-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
4,742 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Acceptance | ||
on: | ||
push: | ||
branches: | ||
- trunk | ||
- feat/add-acceptance-tests | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
acceptance: | ||
name: Acceptance Test Suite | ||
runs-on: ubuntu-latest | ||
services: | ||
redis: | ||
image: redis:7.0 | ||
ports: | ||
- '9200:9200' | ||
mailpit: | ||
image: axllent/mailpit:latest | ||
ports: | ||
- '1025:1025' | ||
- '8025:8025' | ||
env: | ||
APP_ENV: prod | ||
APP_DEBUG: '1' | ||
MAILER_DSN: smtp://localhost:1025 | ||
MAILPIT_BASE_URL: http://localhost:8025 | ||
PLUGIN_PATH: './custom/plugins/${{ github.event.repository.name }}' | ||
steps: | ||
- name: Checkout SwagPayPal | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.PLUGIN_PATH }} | ||
|
||
- name: Setup SwagPayPal | ||
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal | ||
with: | ||
install-admin: true | ||
install-storefront: true | ||
env: prod | ||
|
||
- name: Prepare environment variables | ||
run: | | ||
symfony console cache:clear --env="${APP_ENV}" || true | ||
echo "APP_URL=${APP_URL}" >> "${PLUGIN_PATH}/tests/acceptance/.env" | ||
symfony console integration:create AcceptanceTest --admin >> "${PLUGIN_PATH}/tests/acceptance/.env" | ||
cat "${PLUGIN_PATH}/tests/acceptance/.env" | ||
- name: Install playwright | ||
working-directory: ${{ env.PLUGIN_PATH }}/tests/acceptance | ||
run: | | ||
npm ci | ||
npx playwright install --with-deps | ||
- name: Run Playwright | ||
working-directory: ${{ env.PLUGIN_PATH }}/tests/acceptance | ||
run: npx playwright test --reporter=${{ github.event.act && 'line' || 'github' }} --trace=on-first-retry | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: acceptance-${{ github.event.repository.name }}-${{ github.sha }} | ||
path: ${{ env.PLUGIN_PATH }}/tests/acceptance/test-results/ | ||
retention-days: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules/ | ||
.vscode | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ | ||
/playwright/.auth/ | ||
.env | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## Setup | ||
|
||
Navigate to this directory if you haven't yet. | ||
|
||
``` | ||
cd tests/acceptance | ||
``` | ||
|
||
Install the project dependencies. | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
Install Playwright. | ||
|
||
``` | ||
npx playwright install | ||
npx playwright install-deps | ||
``` | ||
|
||
Make sure to add the required environment variables to your `.env` file in the acceptance test directory of the Commercial plugin (not the shopware root). | ||
|
||
``` | ||
APP_URL="<shop base url>" | ||
# optional with default dev setup | ||
SHOPWARE_ACCESS_KEY_ID="<your-api-client-id>" | ||
SHOPWARE_SECRET_ACCESS_KEY="<your-api-secret>" | ||
``` | ||
|
||
To generate the access key you can use the following Symfony command: | ||
|
||
``` | ||
bin/console integration:create AcceptanceTest --admin | ||
``` | ||
|
||
## Running Tests | ||
|
||
Navigate to `[commercial-repo]/tests/acceptance` and run: | ||
|
||
``` | ||
npx playwright test | ||
``` | ||
|
||
## Running Tests (Nix) | ||
|
||
``` | ||
nix run nixpkgs#playwright-test -- test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { mergeTests } from '@shopware-ag/acceptance-test-suite'; | ||
|
||
export interface DataFixtureTypes { | ||
} | ||
|
||
export const test = mergeTests( | ||
|
||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import tseslint from 'typescript-eslint'; | ||
import eslint from '@eslint/js'; | ||
import playwright from 'eslint-plugin-playwright'; | ||
import stylistic from '@stylistic/eslint-plugin'; | ||
import globals from 'globals'; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
tseslint.configs.recommendedTypeChecked, | ||
playwright.configs['flat/recommended'], | ||
stylistic.configs['recommended-flat'], | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
globals: globals.node, | ||
}, | ||
|
||
plugins: { '@stylistic': stylistic }, | ||
|
||
rules: { | ||
/* stylistic rules */ | ||
'@stylistic/semi': ['error', 'always'], | ||
'@stylistic/indent': ['error', 4, { SwitchCase: 1 }], | ||
'@stylistic/member-delimiter-style': ['error'], | ||
'@stylistic/no-multi-spaces': ['error'], | ||
'@stylistic/object-curly-spacing': ['error', 'always'], | ||
'@stylistic/space-before-function-paren': ['error', { | ||
anonymous: 'always', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}], | ||
'@stylistic/spaced-comment': ['error', 'always'], | ||
'@stylistic/no-tabs': ['error'], | ||
'@stylistic/no-mixed-spaces-and-tabs': ['error'], | ||
'@stylistic/max-len': 'off', | ||
'@stylistic/quote-props': ['error', 'as-needed'], | ||
'@stylistic/no-extra-semi': ['error'], | ||
'@stylistic/comma-dangle': ['error', 'always-multiline'], | ||
/* stylistic rules */ | ||
|
||
/* typescript rules */ | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
/* typescript rules */ | ||
|
||
/* playwright rules */ | ||
'playwright/expect-expect': 'off', | ||
/* playwright rules */ | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { test as ShopwareTestSuite, mergeTests } from '@shopware-ag/acceptance-test-suite'; | ||
import { test as shopCustomerTasks } from '@tasks/ShopCustomerTasks'; | ||
import { test as shopAdminTasks } from '@tasks/ShopAdminTasks'; | ||
import { test as adminPages } from '@page-objects/AdministrationPages'; | ||
import { test as storefrontPages } from '@page-objects/StorefrontPages'; | ||
|
||
export const test = mergeTests( | ||
ShopwareTestSuite, | ||
shopCustomerTasks, | ||
shopAdminTasks, | ||
adminPages, | ||
storefrontPages, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { FixtureTypes as BaseTypes } from '@shopware-ag/acceptance-test-suite'; | ||
import type { AdminPageTypes } from '@page-objects/AdministrationPages'; | ||
import type { StorefrontPageTypes } from '@page-objects/StorefrontPages'; | ||
import type { DataFixtureTypes } from './data-fixtures/DataFixtures'; | ||
|
||
declare global { | ||
type FixtureTypes = BaseTypes & AdminPageTypes & StorefrontPageTypes & DataFixtureTypes; | ||
}; |
Oops, something went wrong.