-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add acceptance tests #97
Draft
cyl3x
wants to merge
12
commits into
6.6.x
Choose a base branch
from
feat/add-acceptance-tests
base: 6.6.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
50e1851
feat: add acceptance tests
cyl3x 22bded1
fix: typescript types
cyl3x c88fa67
fix: make it work
sguder 3029332
fix: setup as own project
cyl3x 1521e32
fix: paypal account setup
cyl3x bffd8a1
fix: remove account fixture
cyl3x af9b2c1
fix: client secret as password field
cyl3x aceb514
fix: setup paypal account
cyl3x 7f91ea0
fix: eslint complaints
cyl3x 934e1a6
fix: workflow definition
cyl3x ba11f03
fix: playwright projects
cyl3x 7913bf1
fix: naming and tsconfig
cyl3x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,90 @@ | ||
name: Acceptance | ||
on: | ||
push: | ||
branches: | ||
- 6.6.x | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
tests: | ||
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 | ||
PLUGIN_PATH: './custom/plugins/${{ github.event.repository.name }}' | ||
PAYPAL_CLIENT_ID: ${{ secrets.PAYPAL_CLIENT_ID }} | ||
PAYPAL_CLIENT_SECRET: ${{ secrets.PAYPAL_CLIENT_SECRET }} | ||
PAYPAL_MERCHANT_ID: ${{ secrets.PAYPAL_MERCHANT_ID }} | ||
PAYPAL_SANDBOX: ${{ secrets.PAYPAL_SANDBOX }} | ||
PAYPAL_SETTINGS_TWEAKS: 1 | ||
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" | ||
|
||
- 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 | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout SwagPayPal | ||
uses: actions/checkout@v4 | ||
with: | ||
path: custom/plugins/${{ github.event.repository.name }} | ||
- name: Setup SwagPayPal | ||
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal | ||
with: | ||
install-admin: false | ||
install-storefront: false | ||
install-commercial: false | ||
- name: Install dependencies | ||
working-directory: ./custom/plugins/SwagPayPal/tests/acceptance | ||
run: npm ci | ||
- name: Run ESLint | ||
working-directory: ./custom/plugins/SwagPayPal/tests/acceptance | ||
run: npm run lint |
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
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,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,47 @@ | ||
## 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 PayPal plugin (not the shopware root). | ||
|
||
``` | ||
APP_URL="<shop base url>" | ||
PAYPAL_CLIENT_ID="<...>" | ||
PAYPAL_CLIENT_SECRET="<...>" | ||
PAYPAL_MERCHANT_ID="<...>" | ||
|
||
# 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 `[paypal-repo]/tests/acceptance` and run: | ||
|
||
``` | ||
npx playwright 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,9 @@ | ||
import { mergeTests } from '@shopware-ag/acceptance-test-suite'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
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,16 @@ | ||
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'; | ||
import type { ShopAdminTasks } from '@tasks/ShopAdminTasks'; | ||
import type { ShopCustomerTasks } from '@tasks/ShopCustomerTasks'; | ||
|
||
interface TestFixtureTypes extends AdminPageTypes, StorefrontPageTypes, DataFixtureTypes, ShopAdminTasks, ShopCustomerTasks { | ||
} | ||
|
||
declare global { | ||
type Task<Args extends Array<unknown>> = (...args: Args) => () => Promise<void>; | ||
|
||
interface FixtureTypes extends Omit<BaseTypes, keyof TestFixtureTypes>, TestFixtureTypes { | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes, it's a skeleton and properly needed in the future - at least it does no harm