Skip to content
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

Add Playwright e2e test suite ready for incremental migration and visual regression testing #7671

Merged
merged 90 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
5bebf8c
Initialise playwright config
Jinksi Nov 9, 2023
f8d428a
Init visual regression testing
Jinksi Nov 9, 2023
c38d672
Add merchant deposits spec
Jinksi Nov 9, 2023
28eb889
Load Payments Overview in basic.spec.ts
Jinksi Nov 9, 2023
c8615d6
Make e2e config a ts file
Jinksi Nov 9, 2023
93fdcf6
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Nov 15, 2023
660296c
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Dec 10, 2023
aa03442
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Dec 15, 2023
123893e
Update authentication setup and use helper functions
Jinksi Dec 15, 2023
b0112b0
Update package-lock.json
Jinksi Dec 15, 2023
80d6f23
Ignore temp auth files
Jinksi Dec 15, 2023
05abe23
Remove basic test visual snapshot
Jinksi Dec 15, 2023
1d98ab0
Update deposits snapshot
Jinksi Dec 15, 2023
1dfbada
Re-use authentication state for local dev
Jinksi Dec 15, 2023
de1ba7b
Fix inconsistent auth file paths
Jinksi Dec 15, 2023
4942b35
Avoid `waitForLoadState( 'networkidle' )`
Jinksi Dec 15, 2023
78b52ef
Remove flaky visual regression snapshot test
Jinksi Dec 15, 2023
b5a8d52
Restore deposits visual regression snapshot test
ismaeldcom Jan 5, 2024
961edc8
Initial shopper-checkout-purchase.spec.ts migration
ismaeldcom Jan 5, 2024
6897f72
Share snapshots across darwin/linux
Jinksi Jan 11, 2024
ad5fe1e
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Jan 11, 2024
97606bf
Rename deposit snapshot file
Jinksi Jan 11, 2024
8313e50
Exploration: Playwright GH action workflow (#7922)
Jinksi Jan 12, 2024
255be36
Remove temp trigger branch used for testing GH checks
Jinksi Jan 12, 2024
a25a555
Replace state-dependant deposit visual test with limited UI test
Jinksi Jan 12, 2024
889b5b5
Increase pixel ratio diff to 0.025 to allow for cross-platform UI inc…
Jinksi Jan 12, 2024
b9cc207
Reduce pixel ratio diff to 0.0005 in order to catch true UI bugs
Jinksi Jan 12, 2024
47bf423
Revert "Reduce pixel ratio diff to 0.0005 in order to catch true UI b…
Jinksi Jan 12, 2024
1915c98
Migrate merchant payment gateways disable confirmation
ismaeldcom Jan 12, 2024
bb11ad8
Simplify shopper addCartProduct method
ismaeldcom Jan 18, 2024
605ee35
Remove redundant comments from playwright config
Jinksi Jan 19, 2024
fd60c37
Only install chromium browser in PW GH action
Jinksi Jan 19, 2024
99d4f01
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 6, 2024
3f67671
Add changelog entry
Jinksi Feb 6, 2024
8cfc11d
Use `github` reporter when running on GitHub Actions CI
Jinksi Feb 6, 2024
a30a227
Use `github` AND `html` reporter when running on GitHub Actions CI
Jinksi Feb 6, 2024
4d07fbf
Expand the README with more details and FAQs
Jinksi Feb 6, 2024
0700831
Update README command descriptions
Jinksi Feb 6, 2024
896c367
Use `frameLocator` for nested 3DS iframe interaction
Jinksi Feb 6, 2024
da25502
Update instructions for viewing test reports
Jinksi Feb 6, 2024
c18de2f
Invalidate auth state after 3 hrs to avoid local auth errors
Jinksi Feb 6, 2024
c3892f9
Disable local parallelism
Jinksi Feb 6, 2024
1be5b4b
Increase `expect` timeout from 5s → 10s due to flaky local checkout p…
Jinksi Feb 6, 2024
fb37af2
Add merchant utils file
Jinksi Feb 7, 2024
980d943
Add `getShopper` and `getMerchant` functions to allow switching betwe…
Jinksi Feb 7, 2024
5d0d8a2
Add merchant disputes order notice spec
Jinksi Feb 7, 2024
7c18a96
Update README with tip about switching between `shopper`/`merchant`
Jinksi Feb 7, 2024
c2b12e1
Update README with instructions for running tests based on keyword
Jinksi Feb 7, 2024
f24ac3b
Add dispute details notice visual regression test
Jinksi Feb 7, 2024
fcd9bcd
Fix grammar
Jinksi Feb 7, 2024
90ab8d8
Add link to e2e-setup instructions
Jinksi Feb 8, 2024
edcfa35
Update dispute notice visual snapshot to match linux font rendering
Jinksi Feb 8, 2024
77f2e97
Re-enable WooPayments payment gateway if test fails
Jinksi Feb 9, 2024
2ace4fb
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 9, 2024
5cd40f4
Use Docker container for running Playwright e2e tests locally to make…
Jinksi Feb 19, 2024
649fa20
Remove GH workflow temp branch
Jinksi Feb 19, 2024
eb05f0c
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 19, 2024
1f545e2
Remove unused arg `cardType` to fix JS Lint warning
Jinksi Feb 20, 2024
aa754b4
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 20, 2024
f500781
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 20, 2024
69080a7
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 27, 2024
d8940c1
Define `fullyParellel: false` to disable parallel test running
Jinksi Feb 28, 2024
b09866a
Remove redundant group when running Install Playwright CI step
Jinksi Feb 28, 2024
660c077
Use docker-compose file for configuring Playwright docker
Jinksi Feb 28, 2024
3d84636
Upgrade Playwright 1.39.0 → 1.42.0
Jinksi Feb 28, 2024
4ea8bac
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 28, 2024
3c2d1b5
Fix sticky header covering deposit filter visual snapshot
Jinksi Feb 28, 2024
f629f87
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Feb 29, 2024
c723748
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 4, 2024
bba590f
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 5, 2024
5947f23
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 5, 2024
06783ff
Update e2e-pw config card expiry dates
Jinksi Mar 5, 2024
ed87d14
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 6, 2024
e35abab
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 7, 2024
ae48ee2
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 12, 2024
2278472
Increase single test timeout to 60s
vbelolapotkov Mar 15, 2024
5c3751e
Refactor auth as admin test locators
vbelolapotkov Mar 15, 2024
5d1219a
Extract WP admin login sequence into helper function
vbelolapotkov Mar 15, 2024
b843658
Fix password input locator to avoid locating show password button
vbelolapotkov Mar 15, 2024
ff36da0
Improve selector for dashboard title
vbelolapotkov Mar 15, 2024
d4b2102
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Mar 19, 2024
e808ea2
Ensure e2e-pw script run in user env consistent with existing scripts
Jinksi Mar 21, 2024
7b88a7c
Remove unneeded shopper test line
ismaeldcom Mar 22, 2024
07e31b6
Use merchant/shopper project names
Jinksi Apr 8, 2024
30dc642
Merge branch 'develop' into try/playwright-e2e-tests
achyuthajoy Apr 16, 2024
b4aef74
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Apr 17, 2024
87f22e9
Merge branch 'develop' into try/playwright-e2e-tests
Jinksi Apr 18, 2024
0b50a83
Improve wording of useShopper/getShopper difference in README
Jinksi Apr 18, 2024
95b5f5b
Remove deprecated `version` from PW `docker-compose.yml`
Jinksi Apr 19, 2024
9cd9095
Upgrade Playwright to latest stable (v1.42.0 → v1.43.1)
Jinksi Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/e2e-pw/run-log-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Run Tests'
description: 'Runs Playwright E2E tests'

runs:
using: 'composite'
steps:
- name: First Run Playwright E2E Tests
id: first_run_e2e_pw_tests
# Use +e to trap errors when running E2E tests.
shell: /bin/bash +e {0}
run: npm run test:e2e-pw-ci
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7
74 changes: 74 additions & 0 deletions .github/workflows/e2e-pw-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: E2E Playwright Tests - Pull Request

on:
pull_request:
branches:
- develop
- trunk
workflow_dispatch:
workflow_call:
inputs:
wcpay-use-build-artifact:
type: boolean
required: false
default: false
repo-branch:
type: string
required: false
description: 'Branch to be used for running tests'

env:
E2E_GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
WCP_DEV_TOOLS_REPO: ${{ secrets.WCP_DEV_TOOLS_REPO }}
WCP_DEV_TOOLS_BRANCH: 'trunk'
WCP_SERVER_REPO: ${{ secrets.WCP_SERVER_REPO }}
WC_SUBSCRIPTIONS_REPO: ${{ secrets.WC_SUBSCRIPTIONS_REPO }}
E2E_BLOG_ID: ${{ secrets.E2E_BLOG_ID }}
E2E_BLOG_TOKEN: ${{ secrets.E2E_BLOG_TOKEN }}
E2E_USER_TOKEN: ${{ secrets.E2E_USER_TOKEN }}
WC_E2E_SCREENSHOTS: 1
E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }}
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
E2E_USE_LOCAL_SERVER: false
E2E_RESULT_FILEPATH: 'tests/e2e/results.json'
WCPAY_USE_BUILD_ARTIFACT: ${{ inputs.wcpay-use-build-artifact }}
WCPAY_ARTIFACT_DIRECTORY: 'zipfile'
NODE_ENV: 'test'
FORCE_E2E_DEPS_SETUP: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
wcpay-e2e-tests:
runs-on: ubuntu-latest

name: WC - latest

env:
E2E_WP_VERSION: 'latest'
E2E_WC_VERSION: 'latest'

steps:
- name: Checkout WCPay repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.repo-branch || github.ref }}

- name: 'Download WooCommerce Payments build file'
if: ${{ inputs.wcpay-use-build-artifact }}
uses: actions/download-artifact@v4
with:
name: woocommerce-payments
path: ${{ env.WCPAY_ARTIFACT_DIRECTORY }}

- name: Setup E2E environment
uses: ./.github/actions/e2e/env-setup

- name: Install Playwright
shell: bash
run: npx playwright install chromium

- name: Run tests, upload screenshots & logs
uses: ./.github/actions/e2e-pw/run-log-tests
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,12 @@ tests/e2e/screenshots
# E2E Performance test results
tests/e2e/reports

# E2E Playwright
/playwright-report/
/blob-report/
tests/e2e-pw/.auth/
tests/e2e-pw/test-results/
tests/e2e-pw/playwright/.cache/
tests/e2e-pw/tests/e2e-pw/.auth/*
# Slate docs
docs/rest-api/build/*
4 changes: 4 additions & 0 deletions changelog/try-playwright-e2e-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Add Playwright e2e test suite ready for incremental migration and visual regression testing
130 changes: 110 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"test:e2e": "NODE_CONFIG_DIR='tests/e2e/config' JEST_PUPPETEER_CONFIG='tests/e2e/config/jest-puppeteer-headless.config.js' wp-scripts test-e2e --config tests/e2e/config/jest.config.js",
"test:e2e-dev": "NODE_CONFIG_DIR='tests/e2e/config' JEST_PUPPETEER_CONFIG='tests/e2e/config/jest-puppeteer.config.js' wp-scripts test-e2e --config tests/e2e/config/jest.config.js --puppeteer-interactive",
"test:e2e-performance": "NODE_CONFIG_DIR='tests/e2e/config' wp-scripts test-e2e --config tests/e2e/config/jest.performance.config.js",
"test:e2e-pw": "./tests/e2e-pw/test-e2e-pw.sh",
"test:e2e-pw-ui": "./tests/e2e-pw/test-e2e-pw-ui.sh",
"test:e2e-pw-ci": "npx playwright test --config=tests/e2e-pw/playwright.config.ts",
"test:update-snapshots": "npm run test:js -- --updateSnapshot",
"test:php": "./bin/run-tests.sh",
"test:php-coverage": "./bin/check-test-coverage.sh",
Expand Down Expand Up @@ -85,6 +88,7 @@
"devDependencies": {
"@automattic/color-studio": "2.3.1",
"@jest/test-sequencer": "29.5.0",
"@playwright/test": "1.42.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.7",
"@testing-library/jest-dom": "5.14.1",
"@testing-library/react": "11.2.5",
Expand All @@ -93,6 +97,7 @@
"@types/canvas-confetti": "1.6.4",
"@types/intl-tel-input": "17.0.4",
"@types/lodash": "4.14.170",
"@types/node": "20.9.0",
"@types/react": "17.0.2",
"@types/react-transition-group": "4.4.6",
"@types/wordpress__components": "19.10.5",
Expand Down
Loading
Loading