From ec0c743750e7ea13bcf7726a97bac8175b63b58b Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Thu, 30 Jan 2025 10:53:08 -0500 Subject: [PATCH 01/43] Update run-log-tests action command --- .github/actions/e2e/run-log-tests/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 8707bc46394..5b77078552e 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - npm run test:e2e -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" + npm run test:e2e-ci -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') @@ -30,7 +30,7 @@ runs: shell: bash # Filter failed E2E files from the result JSON file, and re-run them. run: | - cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e -- --NODE_ENV="$NODE_ENV" + cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e-ci -- --NODE_ENV="$NODE_ENV" # Archive screenshots if any - name: Archive e2e test screenshots & logs From 350e864ee9dc57e1059a99329a6aeb91c24135cc Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Thu, 30 Jan 2025 11:07:28 -0500 Subject: [PATCH 02/43] Revert 'ci' command change --- .github/actions/e2e/run-log-tests/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 5b77078552e..8707bc46394 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - npm run test:e2e-ci -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" + npm run test:e2e -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') @@ -30,7 +30,7 @@ runs: shell: bash # Filter failed E2E files from the result JSON file, and re-run them. run: | - cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e-ci -- --NODE_ENV="$NODE_ENV" + cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e -- --NODE_ENV="$NODE_ENV" # Archive screenshots if any - name: Archive e2e test screenshots & logs From 9c4c5908062dfabb7f6d33873a37d8d3377c3567 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Thu, 30 Jan 2025 11:10:14 -0500 Subject: [PATCH 03/43] Re-add 'ci' to command. --- .github/actions/e2e/run-log-tests/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 8707bc46394..5b77078552e 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - npm run test:e2e -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" + npm run test:e2e-ci -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') @@ -30,7 +30,7 @@ runs: shell: bash # Filter failed E2E files from the result JSON file, and re-run them. run: | - cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e -- --NODE_ENV="$NODE_ENV" + cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e-ci -- --NODE_ENV="$NODE_ENV" # Archive screenshots if any - name: Archive e2e test screenshots & logs From b089cc3f9f6087e91a4a2deba87d3c231c3a02c6 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Thu, 30 Jan 2025 11:10:35 -0500 Subject: [PATCH 04/43] Temporarily add feature branch to action for testing --- .github/workflows/e2e-pull-request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index 4ed61a3882b..741266c0609 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -5,6 +5,7 @@ on: branches: - develop - trunk + - dev/10240-update-npm-scripts # [TODO] Remove this line after the branch is merged. workflow_dispatch: workflow_call: inputs: From 06d25db7da21a2436d0e19307626bab10395f57c Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 08:43:53 -0500 Subject: [PATCH 05/43] Revert change to pull request workflow file --- .github/workflows/e2e-pull-request.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index 741266c0609..4ed61a3882b 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -5,7 +5,6 @@ on: branches: - develop - trunk - - dev/10240-update-npm-scripts # [TODO] Remove this line after the branch is merged. workflow_dispatch: workflow_call: inputs: From 34a2469091eb5e7e353b5baea7c549e31ac39bf3 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 09:15:22 -0500 Subject: [PATCH 06/43] Update run-log-tests action Update Playwright CI reporters config --- .github/actions/e2e/run-log-tests/action.yml | 2 +- tests/e2e-pw/playwright.config.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 5b77078552e..b002bead04d 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - npm run test:e2e-ci -- --json --outputFile="$E2E_RESULT_FILEPATH" --NODE_ENV="$NODE_ENV" + PLAYWRIGHT_JSON_OUTPUT_FILE="$E2E_RESULT_FILEPATH" npm run test:e2e-ci -- --NODE_ENV="$NODE_ENV" if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index f5911d09ede..a920f36468b 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -29,6 +29,7 @@ export default defineConfig( { ? [ // If running on CI, also use the GitHub Actions reporter [ 'github' ], + [ 'json' ], [ 'html' ], ] : [ [ 'html', { open: 'never' } ] ], From 595071fb63eae8883b6cf207b00841b3ced2fbcd Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 09:23:59 -0500 Subject: [PATCH 07/43] Remove NODE_ENV flag --- .github/actions/e2e/run-log-tests/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index b002bead04d..b9e1e137cc2 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - PLAYWRIGHT_JSON_OUTPUT_FILE="$E2E_RESULT_FILEPATH" npm run test:e2e-ci -- --NODE_ENV="$NODE_ENV" + PLAYWRIGHT_JSON_OUTPUT_FILE="$E2E_RESULT_FILEPATH" npm run test:e2e-ci if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') @@ -30,7 +30,7 @@ runs: shell: bash # Filter failed E2E files from the result JSON file, and re-run them. run: | - cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e-ci -- --NODE_ENV="$NODE_ENV" + cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e-ci # Archive screenshots if any - name: Archive e2e test screenshots & logs From 43c2d02772663fea132047419d3167cf2f8f6b76 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 09:43:01 -0500 Subject: [PATCH 08/43] Add Playwright browser install step --- .github/workflows/e2e-pull-request.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index 4ed61a3882b..e8f5e526bef 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -74,5 +74,9 @@ jobs: - 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/run-log-tests From 657a7be956739bce70a8aa354e15d34b7aa5274b Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 10:47:12 -0500 Subject: [PATCH 09/43] Update Playwright config --- tests/e2e-pw/playwright.config.ts | 36 +++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index a920f36468b..124b85c80f6 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -9,7 +9,30 @@ import path from 'path'; config( { path: path.resolve( __dirname, '../e2e/config', '.env' ) } ); config( { path: path.resolve( __dirname, '../e2e/config', 'local.env' ) } ); -const { BASE_URL } = process.env; +const { BASE_URL, E2E_GROUP, E2E_BRANCH } = process.env; + +const validGroups = [ 'wcpay', 'subscriptions' ]; +const validBranches = [ 'merchant', 'shopper' ]; + +const buildTestDir = ( group: string, branch: string ) => { + const baseDir = `\/specs`; + + if ( ! group || ! validGroups.includes( group ) ) { + return baseDir; + } + + if ( ! branch || ! validBranches.includes( branch ) ) { + return `${ baseDir }\/${ group }`; + } + + return `${ baseDir }\/${ group }\/${ branch }`; +}; + +const getTestMatch = ( group: string, branch: string ) => { + const testDir = buildTestDir( group, branch ); + + return new RegExp( `${ testDir }\/.*\.spec\.ts` ); +}; /** * See https://playwright.dev/docs/test-configuration. @@ -50,6 +73,8 @@ export default defineConfig( { }, snapshotPathTemplate: '{testDir}/__snapshots__/{testFilePath}/{arg}{ext}', + testMatch: getTestMatch( E2E_GROUP, E2E_BRANCH ), + /* Configure projects for major browsers */ projects: [ { @@ -59,15 +84,8 @@ export default defineConfig( { dependencies: [ 'setup' ], }, { - name: 'merchant', - use: { ...devices[ 'Desktop Chrome' ] }, - testDir: './specs/merchant', - dependencies: [ 'setup' ], - }, - { - name: 'shopper', + name: 'chromium', use: { ...devices[ 'Desktop Chrome' ] }, - testDir: './specs/shopper', dependencies: [ 'setup' ], }, // Setup project From 7e8ec5016230b057310033a2ed49a9d2f0a524b1 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 11:26:56 -0500 Subject: [PATCH 10/43] Update run-log-tests action --- .github/actions/e2e/run-log-tests/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index b9e1e137cc2..e7077bca9ed 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - PLAYWRIGHT_JSON_OUTPUT_FILE="$E2E_RESULT_FILEPATH" npm run test:e2e-ci + PLAYWRIGHT_JSON_OUTPUT_FILE=results.json npm run test:e2e-ci if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') From 5f628c20c2a2d5ac145c430887a2528f05b16c18 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 11:37:10 -0500 Subject: [PATCH 11/43] Update E2E_RESULT_FILEPATH Update run-log-tests action --- .github/actions/e2e/run-log-tests/action.yml | 2 +- .github/workflows/e2e-pull-request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index e7077bca9ed..b9e1e137cc2 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - PLAYWRIGHT_JSON_OUTPUT_FILE=results.json npm run test:e2e-ci + PLAYWRIGHT_JSON_OUTPUT_FILE="$E2E_RESULT_FILEPATH" npm run test:e2e-ci if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index e8f5e526bef..a20263fc82c 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -30,7 +30,7 @@ env: 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' + E2E_RESULT_FILEPATH: 'results.json' WCPAY_USE_BUILD_ARTIFACT: ${{ inputs.wcpay-use-build-artifact }} WCPAY_ARTIFACT_DIRECTORY: 'zipfile' NODE_ENV: 'test' From 78c241092d89f6d7fa1c71199aa82b6828cb2705 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 11:44:41 -0500 Subject: [PATCH 12/43] Update pull request workflow --- .github/workflows/e2e-pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index a20263fc82c..0812c29ce5e 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -30,7 +30,7 @@ env: E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }} E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }} E2E_USE_LOCAL_SERVER: false - E2E_RESULT_FILEPATH: 'results.json' + E2E_RESULT_FILEPATH: 'tests/e2e-pw/test-results/results.json' WCPAY_USE_BUILD_ARTIFACT: ${{ inputs.wcpay-use-build-artifact }} WCPAY_ARTIFACT_DIRECTORY: 'zipfile' NODE_ENV: 'test' From 8760dce251a16daa303f2c50a977fb91ef926436 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 11:57:11 -0500 Subject: [PATCH 13/43] Update Playwright config --- tests/e2e-pw/playwright.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index 124b85c80f6..72e4e8d7a5c 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -9,7 +9,7 @@ import path from 'path'; config( { path: path.resolve( __dirname, '../e2e/config', '.env' ) } ); config( { path: path.resolve( __dirname, '../e2e/config', 'local.env' ) } ); -const { BASE_URL, E2E_GROUP, E2E_BRANCH } = process.env; +const { BASE_URL, E2E_GROUP, E2E_BRANCH, E2E_RESULT_FILEPATH } = process.env; const validGroups = [ 'wcpay', 'subscriptions' ]; const validBranches = [ 'merchant', 'shopper' ]; @@ -52,7 +52,7 @@ export default defineConfig( { ? [ // If running on CI, also use the GitHub Actions reporter [ 'github' ], - [ 'json' ], + [ 'json', { outputFile: E2E_RESULT_FILEPATH } ], [ 'html' ], ] : [ [ 'html', { open: 'never' } ] ], From 01dcc5d300a098ffe614a547ab9dd362d847d63d Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 12:04:47 -0500 Subject: [PATCH 14/43] Update results file config --- .github/actions/e2e/run-log-tests/action.yml | 2 +- .github/workflows/e2e-pull-request.yml | 2 +- tests/e2e-pw/playwright.config.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index b9e1e137cc2..4e33113bdee 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -9,7 +9,7 @@ runs: # Use +e to trap errors when running E2E tests. shell: /bin/bash +e {0} run: | - PLAYWRIGHT_JSON_OUTPUT_FILE="$E2E_RESULT_FILEPATH" npm run test:e2e-ci + npm run test:e2e-ci if [[ -f "$E2E_RESULT_FILEPATH" ]]; then E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index 0812c29ce5e..afb5dfecdfb 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -30,7 +30,7 @@ env: E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }} E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }} E2E_USE_LOCAL_SERVER: false - E2E_RESULT_FILEPATH: 'tests/e2e-pw/test-results/results.json' + E2E_RESULT_FILEPATH: 'tests/e2e-pw/results.json' WCPAY_USE_BUILD_ARTIFACT: ${{ inputs.wcpay-use-build-artifact }} WCPAY_ARTIFACT_DIRECTORY: 'zipfile' NODE_ENV: 'test' diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index 72e4e8d7a5c..2f16c6f10ba 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -9,7 +9,7 @@ import path from 'path'; config( { path: path.resolve( __dirname, '../e2e/config', '.env' ) } ); config( { path: path.resolve( __dirname, '../e2e/config', 'local.env' ) } ); -const { BASE_URL, E2E_GROUP, E2E_BRANCH, E2E_RESULT_FILEPATH } = process.env; +const { BASE_URL, E2E_GROUP, E2E_BRANCH } = process.env; const validGroups = [ 'wcpay', 'subscriptions' ]; const validBranches = [ 'merchant', 'shopper' ]; @@ -52,7 +52,7 @@ export default defineConfig( { ? [ // If running on CI, also use the GitHub Actions reporter [ 'github' ], - [ 'json', { outputFile: E2E_RESULT_FILEPATH } ], + [ 'json', { outputFile: 'results.json' } ], [ 'html' ], ] : [ [ 'html', { open: 'never' } ] ], From 67db11484766eaa6c7d178e9673800605b1af8fc Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 14:40:22 -0500 Subject: [PATCH 15/43] Update failed test cound and retry failed tests command --- .github/actions/e2e/run-log-tests/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 4e33113bdee..7c1a9dffe25 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -12,7 +12,7 @@ runs: npm run test:e2e-ci if [[ -f "$E2E_RESULT_FILEPATH" ]]; then - E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.numFailedTestSuites') + E2E_NUM_FAILED_TEST_SUITES=$(cat "$E2E_RESULT_FILEPATH" | jq '.stats["unexpected"]') echo "FIRST_RUN_FAILED_TEST_SUITES=$(echo $E2E_NUM_FAILED_TEST_SUITES)" >> $GITHUB_OUTPUT if [[ ${E2E_NUM_FAILED_TEST_SUITES} -gt 0 ]]; then echo "::notice::${E2E_NUM_FAILED_TEST_SUITES} test suite(s) failed in the first run but we will try (it) them again in the second run." @@ -30,7 +30,7 @@ runs: shell: bash # Filter failed E2E files from the result JSON file, and re-run them. run: | - cat "$E2E_RESULT_FILEPATH" | jq '.testResults[] | select(.status == "failed") | .name' | xargs npm run test:e2e-ci + npm run test:e2e-ci $(cat $E2E_RESULT_FILEPATH | jq -r '[.suites[] | (if has("suites") then .suites[] | .specs[] else .specs[] end) | select(.tests[].status == "unexpected") | .file] | unique | .[]') # Archive screenshots if any - name: Archive e2e test screenshots & logs From aa2eb6b2fc32390cfc60d233da693458b1ad70be Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 14:51:43 -0500 Subject: [PATCH 16/43] Update Playwright config --- tests/e2e-pw/playwright.config.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index 2f16c6f10ba..cb2c031224d 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -84,8 +84,27 @@ export default defineConfig( { dependencies: [ 'setup' ], }, { - name: 'chromium', + name: 'wcpay - merchant', use: { ...devices[ 'Desktop Chrome' ] }, + testMatch: getTestMatch( 'wcpay', 'merchant' ), + dependencies: [ 'setup' ], + }, + { + name: 'wcpay - shopper', + use: { ...devices[ 'Desktop Chrome' ] }, + testMatch: getTestMatch( 'wcpay', 'shopper' ), + dependencies: [ 'setup' ], + }, + { + name: 'subscriptions - merchant', + use: { ...devices[ 'Desktop Chrome' ] }, + testMatch: getTestMatch( 'subscriptions', 'merchant' ), + dependencies: [ 'setup' ], + }, + { + name: 'subscriptions - shopper', + use: { ...devices[ 'Desktop Chrome' ] }, + testMatch: getTestMatch( 'subscriptions', 'shopper' ), dependencies: [ 'setup' ], }, // Setup project From afe1564ecf1a6de343cf63087cae9effbeaf4498 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 15:26:35 -0500 Subject: [PATCH 17/43] Update Playwright e2e tests directory structure --- ...ubscriptions-renew-action-scheduler.spec.ts | 10 +++++----- .../merchant-subscriptions-renew.spec.ts | 14 +++++++------- .../merchant-subscriptions-settings.spec.ts | 6 +++--- ...opper-subscriptions-manage-payments.spec.ts | 13 ++++++++----- ...r-subscriptions-purchase-free-trial.spec.ts | 17 ++++++++++------- ...ons-purchase-multiple-subscriptions.spec.ts | 12 ++++++------ ...ubscriptions-purchase-no-signup-fee.spec.ts | 15 +++++++++------ ...-subscriptions-purchase-sign-up-fee.spec.ts | 13 ++++++++----- ...lytics-should-load-without-any-errors-1.png | Bin ...Select-deposits-list-advanced-filters-1.png | Bin ...tions-page-should-load-without-errors-1.png | Bin ...-disputed-order-notice-button-clicked-1.png | Bin ...utton-when-no-currencies-are-selected-1.png | Bin ...eolocation-correctly-with-USD-and-GBP-1.png | Bin ...eolocation-correctly-with-USD-and-GBP-2.png | Bin ...currency-page-load-without-any-errors-1.png | Bin .../merchant-admin-account-balance.spec.ts | 2 +- .../merchant/merchant-admin-analytics.spec.ts | 8 ++++---- .../merchant/merchant-admin-deposits.spec.ts | 2 +- .../merchant/merchant-admin-disputes.spec.ts | 2 +- .../merchant-admin-transactions.spec.ts | 6 +++--- .../merchant/merchant-disputes-respond.spec.ts | 11 +++++++---- ...putes-view-details-via-order-notice.spec.ts | 8 ++++---- .../merchant-multi-currency-widget.spec.ts | 6 +++--- .../merchant-orders-full-refund.spec.ts | 11 +++++++---- .../merchant-orders-manual-capture.spec.ts | 8 ++++---- .../merchant-orders-partial-refund.spec.ts | 12 ++++++------ .../merchant-orders-refund-failures.spec.ts | 8 ++++---- .../merchant-orders-status-change.spec.ts | 6 +++--- ...chant-payment-gateways-confirmation.spec.ts | 2 +- ...ant-payment-settings-manual-capture.spec.ts | 4 ++-- .../merchant-progressive-onboarding.spec.ts | 6 +++--- .../multi-currency-on-boarding.spec.ts | 6 +++--- .../merchant/multi-currency-setup.spec.ts | 8 ++++---- .../merchant/multi-currency.spec.ts | 6 +++--- .../{ => wcpay}/merchant/woopay-setup.spec.ts | 4 ++-- .../shopper/klarna-checkout-purchase.spec.ts | 10 +++++----- .../shopper/multi-currency-checkout.spec.ts | 8 ++++---- .../shopper/shopper-bnpls-checkout.spec.ts | 8 ++++---- .../shopper-checkout-cart-coupon.spec.ts | 8 ++++---- .../shopper/shopper-checkout-failures.spec.ts | 4 ++-- ...opper-checkout-purchase-site-editor.spec.ts | 12 ++++++------ ...-checkout-purchase-with-upe-methods.spec.ts | 12 ++++++------ .../shopper/shopper-checkout-purchase.spec.ts | 8 ++++---- ...per-checkout-save-card-and-purchase.spec.ts | 8 ++++---- .../shopper-multi-currency-widget.spec.ts | 12 ++++++------ ...-myaccount-payment-methods-add-fail.spec.ts | 11 +++++++---- ...hopper-myaccount-renew-subscription.spec.ts | 13 ++++++++----- .../shopper-myaccount-saved-cards.spec.ts | 8 ++++---- .../shopper/shopper-pay-for-order.spec.ts | 10 +++++----- ...shopper-wc-blocks-checkout-failures.spec.ts | 12 ++++++------ ...shopper-wc-blocks-checkout-purchase.spec.ts | 12 ++++++------ ...locks-saved-card-checkout-and-usage.spec.ts | 12 ++++++------ 53 files changed, 209 insertions(+), 185 deletions(-) rename tests/e2e-pw/specs/{ => subscriptions}/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts (90%) rename tests/e2e-pw/specs/{ => subscriptions}/merchant/merchant-subscriptions-renew.spec.ts (85%) rename tests/e2e-pw/specs/{ => subscriptions}/merchant/merchant-subscriptions-settings.spec.ts (78%) rename tests/e2e-pw/specs/{ => subscriptions}/shopper/shopper-subscriptions-manage-payments.spec.ts (87%) rename tests/e2e-pw/specs/{ => subscriptions}/shopper/shopper-subscriptions-purchase-free-trial.spec.ts (92%) rename tests/e2e-pw/specs/{ => subscriptions}/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts (91%) rename tests/e2e-pw/specs/{ => subscriptions}/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts (87%) rename tests/e2e-pw/specs/{ => subscriptions}/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts (82%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png (100%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-admin-account-balance.spec.ts (98%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-admin-analytics.spec.ts (90%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-admin-deposits.spec.ts (96%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-admin-disputes.spec.ts (92%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-admin-transactions.spec.ts (78%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-disputes-respond.spec.ts (97%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-disputes-view-details-via-order-notice.spec.ts (90%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-multi-currency-widget.spec.ts (97%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-orders-full-refund.spec.ts (93%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-orders-manual-capture.spec.ts (89%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-orders-partial-refund.spec.ts (94%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-orders-refund-failures.spec.ts (93%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-orders-status-change.spec.ts (96%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-payment-gateways-confirmation.spec.ts (98%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-payment-settings-manual-capture.spec.ts (92%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/merchant-progressive-onboarding.spec.ts (91%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/multi-currency-on-boarding.spec.ts (97%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/multi-currency-setup.spec.ts (95%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/multi-currency.spec.ts (92%) rename tests/e2e-pw/specs/{ => wcpay}/merchant/woopay-setup.spec.ts (84%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/klarna-checkout-purchase.spec.ts (89%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/multi-currency-checkout.spec.ts (91%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-bnpls-checkout.spec.ts (90%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-checkout-cart-coupon.spec.ts (90%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-checkout-failures.spec.ts (97%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-checkout-purchase-site-editor.spec.ts (89%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts (90%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-checkout-purchase.spec.ts (88%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-checkout-save-card-and-purchase.spec.ts (92%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-multi-currency-widget.spec.ts (90%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts (92%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-myaccount-renew-subscription.spec.ts (85%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-myaccount-saved-cards.spec.ts (97%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-pay-for-order.spec.ts (89%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-wc-blocks-checkout-failures.spec.ts (87%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-wc-blocks-checkout-purchase.spec.ts (85%) rename tests/e2e-pw/specs/{ => wcpay}/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts (90%) diff --git a/tests/e2e-pw/specs/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts similarity index 90% rename from tests/e2e-pw/specs/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts rename to tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts index 09f91cde677..37c9c4f2ef5 100644 --- a/tests/e2e-pw/specs/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts @@ -6,18 +6,18 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { describeif, getMerchant, getShopper } from '../../utils/helpers'; -import * as shopper from '../../utils/shopper'; -import { config } from '../../config/default'; +import { describeif, getMerchant, getShopper } from '../../../utils/helpers'; +import * as shopper from '../../../utils/shopper'; +import { config } from '../../../config/default'; import { products, shouldRunActionSchedulerTests, shouldRunSubscriptionsTests, -} from '../../utils/constants'; +} from '../../../utils/constants'; import { goToActionScheduler, goToSubscriptions, -} from '../../utils/merchant-navigation'; +} from '../../../utils/merchant-navigation'; // Run the tests if the two 'skip' environment variables are not set. describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( diff --git a/tests/e2e-pw/specs/merchant/merchant-subscriptions-renew.spec.ts b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew.spec.ts similarity index 85% rename from tests/e2e-pw/specs/merchant/merchant-subscriptions-renew.spec.ts rename to tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew.spec.ts index dc8c8e0f89d..8661d460b03 100644 --- a/tests/e2e-pw/specs/merchant/merchant-subscriptions-renew.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew.spec.ts @@ -6,19 +6,19 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import RestAPI from '../../utils/rest-api'; -import { config } from '../../config/default'; -import { describeif, getMerchant, getShopper } from '../../utils/helpers'; +import RestAPI from '../../../utils/rest-api'; +import { config } from '../../../config/default'; +import { describeif, getMerchant, getShopper } from '../../../utils/helpers'; import { emptyCart, fillCardDetails, focusPlaceOrderButton, placeOrder, setupProductCheckout, -} from '../../utils/shopper'; -import { goToShop } from '../../utils/shopper-navigation'; -import { goToSubscriptionPage } from '../../utils/merchant-navigation'; -import { shouldRunSubscriptionsTests } from '../../utils/constants'; +} from '../../../utils/shopper'; +import { goToShop } from '../../../utils/shopper-navigation'; +import { goToSubscriptionPage } from '../../../utils/merchant-navigation'; +import { shouldRunSubscriptionsTests } from '../../../utils/constants'; const productName = 'Subscription signup fee product'; const customerBillingConfig = diff --git a/tests/e2e-pw/specs/merchant/merchant-subscriptions-settings.spec.ts b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts similarity index 78% rename from tests/e2e-pw/specs/merchant/merchant-subscriptions-settings.spec.ts rename to tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts index a2cfe8fcfcf..0f0b3ef8b40 100644 --- a/tests/e2e-pw/specs/merchant/merchant-subscriptions-settings.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts @@ -2,9 +2,9 @@ * External dependencies */ import test, { expect } from 'playwright/test'; -import { describeif, useMerchant } from '../../utils/helpers'; -import { shouldRunSubscriptionsTests } from '../../utils/constants'; -import { goToWooCommerceSettings } from '../../utils/merchant-navigation'; +import { describeif, useMerchant } from '../../../utils/helpers'; +import { shouldRunSubscriptionsTests } from '../../../utils/constants'; +import { goToWooCommerceSettings } from '../../../utils/merchant-navigation'; describeif( shouldRunSubscriptionsTests )( 'WooCommerce > Settings > Subscriptions', diff --git a/tests/e2e-pw/specs/shopper/shopper-subscriptions-manage-payments.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-manage-payments.spec.ts similarity index 87% rename from tests/e2e-pw/specs/shopper/shopper-subscriptions-manage-payments.spec.ts rename to tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-manage-payments.spec.ts index 53bffb11da0..4da007cb456 100644 --- a/tests/e2e-pw/specs/shopper/shopper-subscriptions-manage-payments.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-manage-payments.spec.ts @@ -6,11 +6,14 @@ import test, { expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { products, shouldRunSubscriptionsTests } from '../../utils/constants'; -import { describeif, getShopper } from '../../utils/helpers'; -import * as shopper from '../../utils/shopper'; -import * as navigation from '../../utils/shopper-navigation'; +import { config } from '../../../config/default'; +import { + products, + shouldRunSubscriptionsTests, +} from '../../../utils/constants'; +import { describeif, getShopper } from '../../../utils/helpers'; +import * as shopper from '../../../utils/shopper'; +import * as navigation from '../../../utils/shopper-navigation'; const navigateToSubscriptionDetails = async ( page: Page, diff --git a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-free-trial.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-free-trial.spec.ts similarity index 92% rename from tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-free-trial.spec.ts rename to tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-free-trial.spec.ts index 275a99752cc..a9e22e79a70 100644 --- a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-free-trial.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-free-trial.spec.ts @@ -6,25 +6,28 @@ import test, { Page, expect } from '@playwright/test'; /** * Internal dependencies */ -import { shouldRunSubscriptionsTests } from '../../utils/constants'; -import { describeif, getMerchant, getShopper } from '../../utils/helpers'; -import { config } from '../../config/default'; +import { shouldRunSubscriptionsTests } from '../../../utils/constants'; +import { describeif, getMerchant, getShopper } from '../../../utils/helpers'; +import { config } from '../../../config/default'; import { confirmCardAuthentication, emptyCart, fillCardDetails, setupCheckout, -} from '../../utils/shopper'; +} from '../../../utils/shopper'; import { goToCart, goToProductPageBySlug, -} from '../../utils/shopper-navigation'; -import { goToOrder, goToSubscriptions } from '../../utils/merchant-navigation'; +} from '../../../utils/shopper-navigation'; +import { + goToOrder, + goToSubscriptions, +} from '../../../utils/merchant-navigation'; import { activateMulticurrency, deactivateMulticurrency, isMulticurrencyEnabled, -} from '../../utils/merchant'; +} from '../../../utils/merchant'; const nowLocal = new Date(); const nowUTC = new Date( diff --git a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts similarity index 91% rename from tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts rename to tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts index 04fe7227f86..b4b2fd015a1 100644 --- a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-multiple-subscriptions.spec.ts @@ -6,25 +6,25 @@ import test, { Page, expect } from '@playwright/test'; /** * Internal dependencies */ -import { shouldRunSubscriptionsTests } from '../../utils/constants'; -import { describeif, getMerchant, getShopper } from '../../utils/helpers'; -import { config } from '../../config/default'; +import { shouldRunSubscriptionsTests } from '../../../utils/constants'; +import { describeif, getMerchant, getShopper } from '../../../utils/helpers'; +import { config } from '../../../config/default'; import { emptyCart, fillCardDetails, placeOrder, setupProductCheckout, -} from '../../utils/shopper'; +} from '../../../utils/shopper'; import { goToShop, goToShopWithCurrency, goToSubscriptions, -} from '../../utils/shopper-navigation'; +} from '../../../utils/shopper-navigation'; import { activateMulticurrency, deactivateMulticurrency, restoreCurrencies, -} from '../../utils/merchant'; +} from '../../../utils/merchant'; const products = { 'Subscription no signup fee product': 'subscription-no-signup-fee-product', diff --git a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts similarity index 87% rename from tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts rename to tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts index 626c42771d5..bbde3248bdf 100644 --- a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts @@ -6,16 +6,19 @@ import test, { expect } from '@playwright/test'; /** * Internal dependencies */ -import { shouldRunSubscriptionsTests } from '../../utils/constants'; -import { describeif, getMerchant, getShopper } from '../../utils/helpers'; -import { config } from '../../config/default'; -import { goToSubscriptions, goToOrder } from '../../utils/merchant-navigation'; +import { shouldRunSubscriptionsTests } from '../../../utils/constants'; +import { describeif, getMerchant, getShopper } from '../../../utils/helpers'; +import { config } from '../../../config/default'; +import { + goToSubscriptions, + goToOrder, +} from '../../../utils/merchant-navigation'; import { fillCardDetails, placeOrder, setupCheckout, -} from '../../utils/shopper'; -import { goToProductPageBySlug } from '../../utils/shopper-navigation'; +} from '../../../utils/shopper'; +import { goToProductPageBySlug } from '../../../utils/shopper-navigation'; const productName = 'Subscription no signup fee product'; const productSlug = 'subscription-no-signup-fee-product'; diff --git a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts similarity index 82% rename from tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts rename to tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts index 2728a404530..24445e63d17 100644 --- a/tests/e2e-pw/specs/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-sign-up-fee.spec.ts @@ -6,11 +6,14 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { describeif, getMerchant, getShopper } from '../../utils/helpers'; -import * as shopper from '../../utils/shopper'; -import * as navigation from '../../utils/merchant-navigation'; -import { shouldRunSubscriptionsTests, products } from '../../utils/constants'; +import { config } from '../../../config/default'; +import { describeif, getMerchant, getShopper } from '../../../utils/helpers'; +import * as shopper from '../../../utils/shopper'; +import * as navigation from '../../../utils/merchant-navigation'; +import { + shouldRunSubscriptionsTests, + products, +} from '../../../utils/constants'; describeif( shouldRunSubscriptionsTests )( 'Subscriptions > Purchase subscription with signup fee', diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png diff --git a/tests/e2e-pw/specs/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png b/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png similarity index 100% rename from tests/e2e-pw/specs/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png rename to tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png diff --git a/tests/e2e-pw/specs/merchant/merchant-admin-account-balance.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-account-balance.spec.ts similarity index 98% rename from tests/e2e-pw/specs/merchant/merchant-admin-account-balance.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-admin-account-balance.spec.ts index bed2efcb90d..2b60efe22d6 100644 --- a/tests/e2e-pw/specs/merchant/merchant-admin-account-balance.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-account-balance.spec.ts @@ -6,7 +6,7 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; +import { useMerchant } from '../../../utils/helpers'; // Optional currency symbol, followed by one or more digits, decimal separator, or comma. const formattedCurrencyRegex = /[^\d.,]*[\d.,]+/; diff --git a/tests/e2e-pw/specs/merchant/merchant-admin-analytics.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-analytics.spec.ts similarity index 90% rename from tests/e2e-pw/specs/merchant/merchant-admin-analytics.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-admin-analytics.spec.ts index c8a1847297d..c9e4333e642 100644 --- a/tests/e2e-pw/specs/merchant/merchant-admin-analytics.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-analytics.spec.ts @@ -6,16 +6,16 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import * as shopper from '../../utils/shopper'; -import { getMerchant, getShopper, useMerchant } from '../../utils/helpers'; +import * as shopper from '../../../utils/shopper'; +import { getMerchant, getShopper, useMerchant } from '../../../utils/helpers'; import { activateMulticurrency, ensureOrderIsProcessed, isMulticurrencyEnabled, tableDataHasLoaded, waitAndSkipTourComponent, -} from '../../utils/merchant'; -import { goToOrderAnalytics } from '../../utils/merchant-navigation'; +} from '../../../utils/merchant'; +import { goToOrderAnalytics } from '../../../utils/merchant-navigation'; test.describe( 'Admin order analytics', () => { let orderId: string; diff --git a/tests/e2e-pw/specs/merchant/merchant-admin-deposits.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-deposits.spec.ts similarity index 96% rename from tests/e2e-pw/specs/merchant/merchant-admin-deposits.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-admin-deposits.spec.ts index 96008887630..1363dc7b175 100644 --- a/tests/e2e-pw/specs/merchant/merchant-admin-deposits.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-deposits.spec.ts @@ -2,7 +2,7 @@ * External dependencies */ import { test, expect } from '@playwright/test'; -import { useMerchant } from '../../utils/helpers'; +import { useMerchant } from '../../../utils/helpers'; test.describe( 'Merchant deposits', () => { // Use the merchant user for this test suite. diff --git a/tests/e2e-pw/specs/merchant/merchant-admin-disputes.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-disputes.spec.ts similarity index 92% rename from tests/e2e-pw/specs/merchant/merchant-admin-disputes.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-admin-disputes.spec.ts index d2fed057b5d..f6a3d52d893 100644 --- a/tests/e2e-pw/specs/merchant/merchant-admin-disputes.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-disputes.spec.ts @@ -6,7 +6,7 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; +import { useMerchant } from '../../../utils/helpers'; test.describe( 'Merchant disputes', () => { // Use the merchant user for this test suite. diff --git a/tests/e2e-pw/specs/merchant/merchant-admin-transactions.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-transactions.spec.ts similarity index 78% rename from tests/e2e-pw/specs/merchant/merchant-admin-transactions.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-admin-transactions.spec.ts index 59547ed98a6..8709909934c 100644 --- a/tests/e2e-pw/specs/merchant/merchant-admin-transactions.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-admin-transactions.spec.ts @@ -6,9 +6,9 @@ import test, { expect } from '@playwright/test'; /** * Internal dependencies */ -import { shouldRunSubscriptionsTests } from '../../utils/constants'; -import { getMerchant } from '../../utils/helpers'; -import { goToTransactions } from '../../utils/merchant-navigation'; +import { shouldRunSubscriptionsTests } from '../../../utils/constants'; +import { getMerchant } from '../../../utils/helpers'; +import { goToTransactions } from '../../../utils/merchant-navigation'; test.describe( 'Admin transactions', () => { test( 'page should load without errors', async ( { browser } ) => { diff --git a/tests/e2e-pw/specs/merchant/merchant-disputes-respond.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-disputes-respond.spec.ts similarity index 97% rename from tests/e2e-pw/specs/merchant/merchant-disputes-respond.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-disputes-respond.spec.ts index e80bd0bb372..ed43e9411a7 100644 --- a/tests/e2e-pw/specs/merchant/merchant-disputes-respond.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-disputes-respond.spec.ts @@ -6,10 +6,13 @@ import { test, expect, Page, Browser } from '@playwright/test'; /** * Internal dependencies */ -import * as shopper from '../../utils/shopper'; -import { config } from '../../config/default'; -import { getAnonymousShopper, getMerchant } from '../../utils/helpers'; -import { goToOrder, goToPaymentDetails } from '../../utils/merchant-navigation'; +import * as shopper from '../../../utils/shopper'; +import { config } from '../../../config/default'; +import { getAnonymousShopper, getMerchant } from '../../../utils/helpers'; +import { + goToOrder, + goToPaymentDetails, +} from '../../../utils/merchant-navigation'; /** * Navigates to the payment details page for a given disputed order. diff --git a/tests/e2e-pw/specs/merchant/merchant-disputes-view-details-via-order-notice.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-disputes-view-details-via-order-notice.spec.ts similarity index 90% rename from tests/e2e-pw/specs/merchant/merchant-disputes-view-details-via-order-notice.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-disputes-view-details-via-order-notice.spec.ts index b7da795ce06..510d79b26b8 100644 --- a/tests/e2e-pw/specs/merchant/merchant-disputes-view-details-via-order-notice.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-disputes-view-details-via-order-notice.spec.ts @@ -6,10 +6,10 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import * as shopper from '../../utils/shopper'; -import { config } from '../../config/default'; -import { getMerchant, getShopper } from '../../utils/helpers'; -import { goToOrder } from '../../utils/merchant-navigation'; +import * as shopper from '../../../utils/shopper'; +import { config } from '../../../config/default'; +import { getMerchant, getShopper } from '../../../utils/helpers'; +import { goToOrder } from '../../../utils/merchant-navigation'; test.describe( 'Disputes > View dispute details via disputed order notice', diff --git a/tests/e2e-pw/specs/merchant/merchant-multi-currency-widget.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-multi-currency-widget.spec.ts similarity index 97% rename from tests/e2e-pw/specs/merchant/merchant-multi-currency-widget.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-multi-currency-widget.spec.ts index f326812ca24..770cc7e10a3 100644 --- a/tests/e2e-pw/specs/merchant/merchant-multi-currency-widget.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-multi-currency-widget.spec.ts @@ -6,15 +6,15 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { getMerchant, getShopper } from '../../utils/helpers'; +import { getMerchant, getShopper } from '../../../utils/helpers'; import { activateMulticurrency, addMulticurrencyWidget, deactivateMulticurrency, removeMultiCurrencyWidgets, restoreCurrencies, -} from '../../utils/merchant'; -import * as navigation from '../../utils/shopper-navigation'; +} from '../../../utils/merchant'; +import * as navigation from '../../../utils/shopper-navigation'; test.describe( 'Multi-currency widget setup', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/merchant/merchant-orders-full-refund.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-full-refund.spec.ts similarity index 93% rename from tests/e2e-pw/specs/merchant/merchant-orders-full-refund.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-orders-full-refund.spec.ts index 8ea26d1dd3f..be69815098f 100644 --- a/tests/e2e-pw/specs/merchant/merchant-orders-full-refund.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-full-refund.spec.ts @@ -6,13 +6,16 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { getMerchant, getShopper } from '../../utils/helpers'; +import { getMerchant, getShopper } from '../../../utils/helpers'; import { deactivateMulticurrency, isMulticurrencyEnabled, -} from '../../utils/merchant'; -import * as shopper from '../../utils/shopper'; -import { goToOrder, goToPaymentDetails } from '../../utils/merchant-navigation'; +} from '../../../utils/merchant'; +import * as shopper from '../../../utils/shopper'; +import { + goToOrder, + goToPaymentDetails, +} from '../../../utils/merchant-navigation'; test.describe( 'WooCommerce Payments - Full Refund', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/merchant/merchant-orders-manual-capture.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts similarity index 89% rename from tests/e2e-pw/specs/merchant/merchant-orders-manual-capture.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts index a23d9a35c09..85489bfc488 100644 --- a/tests/e2e-pw/specs/merchant/merchant-orders-manual-capture.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts @@ -6,13 +6,13 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { getShopper, getMerchant } from '../../utils/helpers'; -import { goToOrder } from '../../utils/merchant-navigation'; +import { getShopper, getMerchant } from '../../../utils/helpers'; +import { goToOrder } from '../../../utils/merchant-navigation'; import { activateCaptureLater, deactivateCaptureLater, -} from '../../utils/merchant'; -import { placeOrderWithOptions } from '../../utils/shopper'; +} from '../../../utils/merchant'; +import { placeOrderWithOptions } from '../../../utils/shopper'; /** * Local variables. diff --git a/tests/e2e-pw/specs/merchant/merchant-orders-partial-refund.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-partial-refund.spec.ts similarity index 94% rename from tests/e2e-pw/specs/merchant/merchant-orders-partial-refund.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-orders-partial-refund.spec.ts index 4bc0c0cec9c..2454f74d474 100644 --- a/tests/e2e-pw/specs/merchant/merchant-orders-partial-refund.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-partial-refund.spec.ts @@ -6,20 +6,20 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { getMerchant, getShopper } from '../../utils/helpers'; +import { config } from '../../../config/default'; +import { getMerchant, getShopper } from '../../../utils/helpers'; import { fillCardDetails, placeOrder, setupProductCheckout, -} from '../../utils/shopper'; -import { goToShop } from '../../utils/shopper-navigation'; -import { goToOrder } from '../../utils/merchant-navigation'; +} from '../../../utils/shopper'; +import { goToShop } from '../../../utils/shopper-navigation'; +import { goToOrder } from '../../../utils/merchant-navigation'; import { activateMulticurrency, deactivateMulticurrency, restoreCurrencies, -} from '../../utils/merchant'; +} from '../../../utils/merchant'; // Needs to be finished. test.describe( 'Order > Partial refund', () => { diff --git a/tests/e2e-pw/specs/merchant/merchant-orders-refund-failures.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-refund-failures.spec.ts similarity index 93% rename from tests/e2e-pw/specs/merchant/merchant-orders-refund-failures.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-orders-refund-failures.spec.ts index 6f5dce44ac8..47e88a7a4c7 100644 --- a/tests/e2e-pw/specs/merchant/merchant-orders-refund-failures.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-refund-failures.spec.ts @@ -6,10 +6,10 @@ import test, { Dialog, Page, expect } from '@playwright/test'; /** * Internal dependencies */ -import { emptyCart, placeOrderWithCurrency } from '../../utils/shopper'; -import { getMerchant, getShopper } from '../../utils/helpers'; -import { goToOrder } from '../../utils/merchant-navigation'; -import { ensureOrderIsProcessed } from '../../utils/merchant'; +import { emptyCart, placeOrderWithCurrency } from '../../../utils/shopper'; +import { getMerchant, getShopper } from '../../../utils/helpers'; +import { goToOrder } from '../../../utils/merchant-navigation'; +import { ensureOrderIsProcessed } from '../../../utils/merchant'; const selectorQty = '.refund_order_item_qty'; const selectorLineAmount = '.refund_line_total'; diff --git a/tests/e2e-pw/specs/merchant/merchant-orders-status-change.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-status-change.spec.ts similarity index 96% rename from tests/e2e-pw/specs/merchant/merchant-orders-status-change.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-orders-status-change.spec.ts index a1f2da82ccb..b62c72bc1c7 100644 --- a/tests/e2e-pw/specs/merchant/merchant-orders-status-change.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-status-change.spec.ts @@ -6,9 +6,9 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { getMerchant, getShopper, isUIUnblocked } from '../../utils/helpers'; -import { placeOrderWithOptions } from '../../utils/shopper'; -import * as navigation from '../../utils/merchant-navigation'; +import { getMerchant, getShopper, isUIUnblocked } from '../../../utils/helpers'; +import { placeOrderWithOptions } from '../../../utils/shopper'; +import * as navigation from '../../../utils/merchant-navigation'; const orderStatusDropdownSelector = 'select[name="order_status"]'; const cancelModalSelector = 'div.wcpay-confirmation-modal'; diff --git a/tests/e2e-pw/specs/merchant/merchant-payment-gateways-confirmation.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-payment-gateways-confirmation.spec.ts similarity index 98% rename from tests/e2e-pw/specs/merchant/merchant-payment-gateways-confirmation.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-payment-gateways-confirmation.spec.ts index 7e089ba858a..dda3adfc63e 100644 --- a/tests/e2e-pw/specs/merchant/merchant-payment-gateways-confirmation.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-payment-gateways-confirmation.spec.ts @@ -6,7 +6,7 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; +import { useMerchant } from '../../../utils/helpers'; test.describe( 'payment gateways disable confirmation', () => { useMerchant(); diff --git a/tests/e2e-pw/specs/merchant/merchant-payment-settings-manual-capture.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.ts similarity index 92% rename from tests/e2e-pw/specs/merchant/merchant-payment-settings-manual-capture.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.ts index 54456e23e34..ab6c5c39928 100644 --- a/tests/e2e-pw/specs/merchant/merchant-payment-settings-manual-capture.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.ts @@ -5,8 +5,8 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; -import { goToWooPaymentsSettings } from '../../utils/merchant-navigation'; +import { useMerchant } from '../../../utils/helpers'; +import { goToWooPaymentsSettings } from '../../../utils/merchant-navigation'; test.describe( 'As a merchant, I should be prompted a confirmation modal when I try to activate the manual capture', diff --git a/tests/e2e-pw/specs/merchant/merchant-progressive-onboarding.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-progressive-onboarding.spec.ts similarity index 91% rename from tests/e2e-pw/specs/merchant/merchant-progressive-onboarding.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/merchant-progressive-onboarding.spec.ts index 10c1e22e64b..4b294b2fbd3 100644 --- a/tests/e2e-pw/specs/merchant/merchant-progressive-onboarding.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-progressive-onboarding.spec.ts @@ -6,9 +6,9 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; -import * as devtools from '../../utils/devtools'; -import { goToConnect } from '../../utils/merchant-navigation'; +import { useMerchant } from '../../../utils/helpers'; +import * as devtools from '../../../utils/devtools'; +import { goToConnect } from '../../../utils/merchant-navigation'; test.describe( 'Admin merchant progressive onboarding', () => { useMerchant(); diff --git a/tests/e2e-pw/specs/merchant/multi-currency-on-boarding.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/multi-currency-on-boarding.spec.ts similarity index 97% rename from tests/e2e-pw/specs/merchant/multi-currency-on-boarding.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/multi-currency-on-boarding.spec.ts index 59e81183582..ec8d6e3cfd7 100644 --- a/tests/e2e-pw/specs/merchant/multi-currency-on-boarding.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/multi-currency-on-boarding.spec.ts @@ -5,7 +5,7 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; +import { useMerchant } from '../../../utils/helpers'; import { activateMulticurrency, activateTheme, @@ -15,8 +15,8 @@ import { getActiveThemeSlug, removeCurrency, restoreCurrencies, -} from '../../utils/merchant'; -import * as navigation from '../../utils/merchant-navigation'; +} from '../../../utils/merchant'; +import * as navigation from '../../../utils/merchant-navigation'; test.describe( 'Multi-currency on-boarding', () => { let page: Page; diff --git a/tests/e2e-pw/specs/merchant/multi-currency-setup.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/multi-currency-setup.spec.ts similarity index 95% rename from tests/e2e-pw/specs/merchant/multi-currency-setup.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/multi-currency-setup.spec.ts index ad66065b39f..c347b29a8f8 100644 --- a/tests/e2e-pw/specs/merchant/multi-currency-setup.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/multi-currency-setup.spec.ts @@ -5,7 +5,7 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { getMerchant, getShopper } from '../../utils/helpers'; +import { getMerchant, getShopper } from '../../../utils/helpers'; import { activateMulticurrency, addCurrency, @@ -16,9 +16,9 @@ import { setCurrencyCharmPricing, setCurrencyPriceRounding, setCurrencyRate, -} from '../../utils/merchant'; -import * as navigation from '../../utils/shopper-navigation'; -import { getPriceFromProduct } from '../../utils/shopper'; +} from '../../../utils/merchant'; +import * as navigation from '../../../utils/shopper-navigation'; +import { getPriceFromProduct } from '../../../utils/shopper'; test.describe( 'Multi-currency setup', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/merchant/multi-currency.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/multi-currency.spec.ts similarity index 92% rename from tests/e2e-pw/specs/merchant/multi-currency.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/multi-currency.spec.ts index 92f42c3b97b..885410df350 100644 --- a/tests/e2e-pw/specs/merchant/multi-currency.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/multi-currency.spec.ts @@ -5,7 +5,7 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { useMerchant } from '../../utils/helpers'; +import { useMerchant } from '../../../utils/helpers'; import { activateMulticurrency, addMulticurrencyWidget, @@ -13,8 +13,8 @@ import { disableAllEnabledCurrencies, removeMultiCurrencyWidgets, restoreCurrencies, -} from '../../utils/merchant'; -import * as navigation from '../../utils/merchant-navigation'; +} from '../../../utils/merchant'; +import * as navigation from '../../../utils/merchant-navigation'; test.describe( 'Multi-currency', () => { let wasMulticurrencyEnabled: boolean; diff --git a/tests/e2e-pw/specs/merchant/woopay-setup.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/woopay-setup.spec.ts similarity index 84% rename from tests/e2e-pw/specs/merchant/woopay-setup.spec.ts rename to tests/e2e-pw/specs/wcpay/merchant/woopay-setup.spec.ts index c36cdb135d0..4d26d56bed9 100644 --- a/tests/e2e-pw/specs/merchant/woopay-setup.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/woopay-setup.spec.ts @@ -5,8 +5,8 @@ import { test, Page } from '@playwright/test'; /** * Internal dependencies */ -import { getMerchant } from '../../utils/helpers'; -import { activateWooPay, deactivateWooPay } from '../../utils/merchant'; +import { getMerchant } from '../../../utils/helpers'; +import { activateWooPay, deactivateWooPay } from '../../../utils/merchant'; test.describe( 'WooPay setup', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/shopper/klarna-checkout-purchase.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/klarna-checkout-purchase.spec.ts similarity index 89% rename from tests/e2e-pw/specs/shopper/klarna-checkout-purchase.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/klarna-checkout-purchase.spec.ts index b810f32ecb0..165c41b73fd 100644 --- a/tests/e2e-pw/specs/shopper/klarna-checkout-purchase.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/klarna-checkout-purchase.spec.ts @@ -6,14 +6,14 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import * as shopper from '../../utils/shopper'; -import { getMerchant, getShopper } from '../../utils/helpers'; -import * as merchant from '../../utils/merchant'; -import { config } from '../../config/default'; +import * as shopper from '../../../utils/shopper'; +import { getMerchant, getShopper } from '../../../utils/helpers'; +import * as merchant from '../../../utils/merchant'; +import { config } from '../../../config/default'; import { goToProductPageBySlug, goToShop, -} from '../../utils/shopper-navigation'; +} from '../../../utils/shopper-navigation'; test.describe( 'Klarna Checkout', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/shopper/multi-currency-checkout.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/multi-currency-checkout.spec.ts similarity index 91% rename from tests/e2e-pw/specs/shopper/multi-currency-checkout.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/multi-currency-checkout.spec.ts index a174ab1bcf7..8c832b03eb1 100644 --- a/tests/e2e-pw/specs/shopper/multi-currency-checkout.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/multi-currency-checkout.spec.ts @@ -5,15 +5,15 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { getMerchant, getShopper } from '../../utils/helpers'; +import { getMerchant, getShopper } from '../../../utils/helpers'; import { activateMulticurrency, addCurrency, deactivateMulticurrency, restoreCurrencies, -} from '../../utils/merchant'; -import { emptyCart, placeOrderWithCurrency } from '../../utils/shopper'; -import * as navigation from '../../utils/shopper-navigation'; +} from '../../../utils/merchant'; +import { emptyCart, placeOrderWithCurrency } from '../../../utils/shopper'; +import * as navigation from '../../../utils/shopper-navigation'; test.describe( 'Multi-currency checkout', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/shopper/shopper-bnpls-checkout.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-bnpls-checkout.spec.ts similarity index 90% rename from tests/e2e-pw/specs/shopper/shopper-bnpls-checkout.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-bnpls-checkout.spec.ts index 569093b959a..dfb2c8ffaab 100644 --- a/tests/e2e-pw/specs/shopper/shopper-bnpls-checkout.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-bnpls-checkout.spec.ts @@ -7,10 +7,10 @@ import { test, expect, Page } from '@playwright/test'; * Internal dependencies */ -import { getMerchant, getShopper } from '../../utils/helpers'; -import * as merchant from '../../utils/merchant'; -import * as shopper from '../../utils/shopper'; -import * as devtools from '../../utils/devtools'; +import { getMerchant, getShopper } from '../../../utils/helpers'; +import * as merchant from '../../../utils/merchant'; +import * as shopper from '../../../utils/shopper'; +import * as devtools from '../../../utils/devtools'; const cardTestingProtectionStates = [ false, true ]; const bnplProviders = [ 'Affirm', 'Afterpay' ]; diff --git a/tests/e2e-pw/specs/shopper/shopper-checkout-cart-coupon.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-cart-coupon.spec.ts similarity index 90% rename from tests/e2e-pw/specs/shopper/shopper-checkout-cart-coupon.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-cart-coupon.spec.ts index 2b0a94c33dd..353f997d996 100644 --- a/tests/e2e-pw/specs/shopper/shopper-checkout-cart-coupon.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-cart-coupon.spec.ts @@ -6,13 +6,13 @@ import test, { expect } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; +import { config } from '../../../config/default'; import { goToCart, goToCheckout, goToShop, -} from '../../utils/shopper-navigation'; -import { useShopper } from '../../utils/helpers'; +} from '../../../utils/shopper-navigation'; +import { useShopper } from '../../../utils/helpers'; import { addToCartFromShopPage, emptyCart, @@ -20,7 +20,7 @@ import { fillCardDetails, placeOrder, setupCheckout, -} from '../../utils/shopper'; +} from '../../../utils/shopper'; const productName = config.products.simple.name; diff --git a/tests/e2e-pw/specs/shopper/shopper-checkout-failures.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-failures.spec.ts similarity index 97% rename from tests/e2e-pw/specs/shopper/shopper-checkout-failures.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-failures.spec.ts index 5b21fc1570d..dbdebc71d73 100644 --- a/tests/e2e-pw/specs/shopper/shopper-checkout-failures.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-failures.spec.ts @@ -7,8 +7,8 @@ import { test, expect, Page } from '@playwright/test'; * Internal dependencies */ -import { config } from '../../config/default'; -import * as shopper from '../../utils/shopper'; +import { config } from '../../../config/default'; +import * as shopper from '../../../utils/shopper'; test.describe( 'Shopper > Checkout > Failures with various cards', () => { const waitForBanner = async ( page: Page, errorText: string ) => { diff --git a/tests/e2e-pw/specs/shopper/shopper-checkout-purchase-site-editor.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase-site-editor.spec.ts similarity index 89% rename from tests/e2e-pw/specs/shopper/shopper-checkout-purchase-site-editor.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase-site-editor.spec.ts index 23a55fbd7b8..63635773496 100644 --- a/tests/e2e-pw/specs/shopper/shopper-checkout-purchase-site-editor.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase-site-editor.spec.ts @@ -9,10 +9,10 @@ import test, { Page, expect } from '@playwright/test'; import { disableCardTestingProtection, enableCardTestingProtection, -} from '../../utils/devtools'; -import { getMerchant, getShopper } from '../../utils/helpers'; -import { activateTheme } from '../../utils/merchant'; -import { config } from '../../config/default'; +} from '../../../utils/devtools'; +import { getMerchant, getShopper } from '../../../utils/helpers'; +import { activateTheme } from '../../../utils/merchant'; +import { config } from '../../../config/default'; import { addCartProduct, confirmCardAuthentication, @@ -21,8 +21,8 @@ import { fillCardDetails, placeOrder, setupCheckout, -} from '../../utils/shopper'; -import { goToShop } from '../../utils/shopper-navigation'; +} from '../../../utils/shopper'; +import { goToShop } from '../../../utils/shopper-navigation'; /** * Tests for successful purchases with both card testing prevention enabled diff --git a/tests/e2e-pw/specs/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts similarity index 90% rename from tests/e2e-pw/specs/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts index 6fdd21bf1fb..9c7427adc89 100644 --- a/tests/e2e-pw/specs/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase-with-upe-methods.spec.ts @@ -13,12 +13,12 @@ import { disablePaymentMethods, enablePaymentMethods, restoreCurrencies, -} from '../../utils/merchant'; -import { getShopper, getMerchant } from '../../utils/helpers'; +} from '../../../utils/merchant'; +import { getShopper, getMerchant } from '../../../utils/helpers'; import { disableCardTestingProtection, enableCardTestingProtection, -} from '../../utils/devtools'; +} from '../../../utils/devtools'; import { addToCartFromShopPage, changeAccountCurrency, @@ -27,9 +27,9 @@ import { fillBillingAddress, focusPlaceOrderButton, placeOrder, -} from '../../utils/shopper'; -import { config } from '../../config/default'; -import { goToCheckout, goToShop } from '../../utils/shopper-navigation'; +} from '../../../utils/shopper'; +import { config } from '../../../config/default'; +import { goToCheckout, goToShop } from '../../../utils/shopper-navigation'; test.describe( 'Enable UPE with deferred intent creation', () => { let wasMultiCurrencyEnabled = false; diff --git a/tests/e2e-pw/specs/shopper/shopper-checkout-purchase.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase.spec.ts similarity index 88% rename from tests/e2e-pw/specs/shopper/shopper-checkout-purchase.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase.spec.ts index b2a0246d438..592591a379a 100644 --- a/tests/e2e-pw/specs/shopper/shopper-checkout-purchase.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-purchase.spec.ts @@ -7,10 +7,10 @@ import { test, expect, Page } from '@playwright/test'; * Internal dependencies */ -import { config } from '../../config/default'; -import * as shopper from '../../utils/shopper'; -import * as devtools from '../../utils/devtools'; -import { getMerchant, getShopper } from '../../utils/helpers'; +import { config } from '../../../config/default'; +import * as shopper from '../../../utils/shopper'; +import * as devtools from '../../../utils/devtools'; +import { getMerchant, getShopper } from '../../../utils/helpers'; test.describe( 'Successful purchase', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/shopper/shopper-checkout-save-card-and-purchase.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-save-card-and-purchase.spec.ts similarity index 92% rename from tests/e2e-pw/specs/shopper/shopper-checkout-save-card-and-purchase.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-save-card-and-purchase.spec.ts index 4b2ca024df7..a4375c2c3f0 100644 --- a/tests/e2e-pw/specs/shopper/shopper-checkout-save-card-and-purchase.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-checkout-save-card-and-purchase.spec.ts @@ -6,8 +6,8 @@ import test, { Page, expect } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { getAnonymousShopper, getShopper } from '../../utils/helpers'; +import { config } from '../../../config/default'; +import { getAnonymousShopper, getShopper } from '../../../utils/helpers'; import { confirmCardAuthentication, deleteSavedCard, @@ -16,8 +16,8 @@ import { selectSavedCardOnCheckout, setSavePaymentMethod, setupProductCheckout, -} from '../../utils/shopper'; -import { goToMyAccount, goToShop } from '../../utils/shopper-navigation'; +} from '../../../utils/shopper'; +import { goToMyAccount, goToShop } from '../../../utils/shopper-navigation'; type CardType = [ string, typeof config.cards.basic ]; diff --git a/tests/e2e-pw/specs/shopper/shopper-multi-currency-widget.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts similarity index 90% rename from tests/e2e-pw/specs/shopper/shopper-multi-currency-widget.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts index cd2495bd6f0..7925f01c8ca 100644 --- a/tests/e2e-pw/specs/shopper/shopper-multi-currency-widget.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts @@ -5,12 +5,12 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import * as merchant from '../../utils/merchant'; -import * as shopper from '../../utils/shopper'; -import * as navigation from '../../utils/shopper-navigation'; -import { goToOrder } from '../../utils/merchant-navigation'; -import RestAPI from '../../utils/rest-api'; -import { getMerchant, getShopper } from '../../utils/helpers'; +import * as merchant from '../../../utils/merchant'; +import * as shopper from '../../../utils/shopper'; +import * as navigation from '../../../utils/shopper-navigation'; +import { goToOrder } from '../../../utils/merchant-navigation'; +import RestAPI from '../../../utils/rest-api'; +import { getMerchant, getShopper } from '../../../utils/helpers'; test.describe( 'Shopper Multi-Currency widget', () => { let merchantPage: Page; diff --git a/tests/e2e-pw/specs/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts similarity index 92% rename from tests/e2e-pw/specs/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts index d20e2cdc34f..de14ce9564c 100644 --- a/tests/e2e-pw/specs/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts @@ -6,10 +6,13 @@ import test, { Page, expect } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { goToMyAccount } from '../../utils/shopper-navigation'; -import { getShopper } from '../../utils/helpers'; -import { addSavedCard, confirmCardAuthentication } from '../../utils/shopper'; +import { config } from '../../../config/default'; +import { goToMyAccount } from '../../../utils/shopper-navigation'; +import { getShopper } from '../../../utils/helpers'; +import { + addSavedCard, + confirmCardAuthentication, +} from '../../../utils/shopper'; type CardType = [ string, typeof config.cards.declined, string ]; diff --git a/tests/e2e-pw/specs/shopper/shopper-myaccount-renew-subscription.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-renew-subscription.spec.ts similarity index 85% rename from tests/e2e-pw/specs/shopper/shopper-myaccount-renew-subscription.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-renew-subscription.spec.ts index 565c54e5863..c1d2197a977 100644 --- a/tests/e2e-pw/specs/shopper/shopper-myaccount-renew-subscription.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-renew-subscription.spec.ts @@ -6,11 +6,14 @@ import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { describeif, getShopper } from '../../utils/helpers'; -import * as shopper from '../../utils/shopper'; -import * as navigation from '../../utils/shopper-navigation'; -import { products, shouldRunSubscriptionsTests } from '../../utils/constants'; +import { config } from '../../../config/default'; +import { describeif, getShopper } from '../../../utils/helpers'; +import * as shopper from '../../../utils/shopper'; +import * as navigation from '../../../utils/shopper-navigation'; +import { + products, + shouldRunSubscriptionsTests, +} from '../../../utils/constants'; describeif( shouldRunSubscriptionsTests )( 'Subscriptions > Renew a subscription in my account', diff --git a/tests/e2e-pw/specs/shopper/shopper-myaccount-saved-cards.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-saved-cards.spec.ts similarity index 97% rename from tests/e2e-pw/specs/shopper/shopper-myaccount-saved-cards.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-saved-cards.spec.ts index cdb4546afaf..0ab57aa8a7c 100644 --- a/tests/e2e-pw/specs/shopper/shopper-myaccount-saved-cards.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-saved-cards.spec.ts @@ -6,9 +6,9 @@ import test, { Page, expect } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import { goToMyAccount, goToShop } from '../../utils/shopper-navigation'; -import { getShopper } from '../../utils/helpers'; +import { config } from '../../../config/default'; +import { goToMyAccount, goToShop } from '../../../utils/shopper-navigation'; +import { getShopper } from '../../../utils/helpers'; import { addSavedCard, confirmCardAuthentication, @@ -17,7 +17,7 @@ import { selectSavedCardOnCheckout, setDefaultPaymentMethod, setupProductCheckout, -} from '../../utils/shopper'; +} from '../../../utils/shopper'; type TestVariablesType = { [ key: string ]: { diff --git a/tests/e2e-pw/specs/shopper/shopper-pay-for-order.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-pay-for-order.spec.ts similarity index 89% rename from tests/e2e-pw/specs/shopper/shopper-pay-for-order.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-pay-for-order.spec.ts index ae5713568e7..576686bbb88 100644 --- a/tests/e2e-pw/specs/shopper/shopper-pay-for-order.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-pay-for-order.spec.ts @@ -6,11 +6,11 @@ import { test, expect } from '@playwright/test'; /** * Internal dependencies */ -import { config } from '../../config/default'; -import * as shopper from '../../utils/shopper'; -import * as shopperNavigation from '../../utils/shopper-navigation'; -import * as devtools from '../../utils/devtools'; -import { getMerchant, getShopper } from '../../utils/helpers'; +import { config } from '../../../config/default'; +import * as shopper from '../../../utils/shopper'; +import * as shopperNavigation from '../../../utils/shopper-navigation'; +import * as devtools from '../../../utils/devtools'; +import { getMerchant, getShopper } from '../../../utils/helpers'; const cardTestingPreventionStates = [ { cardTestingPreventionEnabled: false }, diff --git a/tests/e2e-pw/specs/shopper/shopper-wc-blocks-checkout-failures.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts similarity index 87% rename from tests/e2e-pw/specs/shopper/shopper-wc-blocks-checkout-failures.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts index ec8a15b3622..3aa1c79a1c9 100644 --- a/tests/e2e-pw/specs/shopper/shopper-wc-blocks-checkout-failures.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts @@ -11,12 +11,12 @@ import { describeif, getMerchant, getShopper, -} from '../../utils/helpers'; -import * as navigation from '../../utils/shopper-navigation'; -import * as shopper from '../../utils/shopper'; -import { addWCBCheckoutPage } from '../../utils/merchant'; -import { shouldRunWCBlocksTests } from '../../utils/constants'; -import { config } from '../../config/default'; +} from '../../../utils/helpers'; +import * as navigation from '../../../utils/shopper-navigation'; +import * as shopper from '../../../utils/shopper'; +import { addWCBCheckoutPage } from '../../../utils/merchant'; +import { shouldRunWCBlocksTests } from '../../../utils/constants'; +import { config } from '../../../config/default'; const failures = [ { diff --git a/tests/e2e-pw/specs/shopper/shopper-wc-blocks-checkout-purchase.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-purchase.spec.ts similarity index 85% rename from tests/e2e-pw/specs/shopper/shopper-wc-blocks-checkout-purchase.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-purchase.spec.ts index ef28ccc098e..7051366465d 100644 --- a/tests/e2e-pw/specs/shopper/shopper-wc-blocks-checkout-purchase.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-purchase.spec.ts @@ -11,17 +11,17 @@ import { describeif, getMerchant, getShopper, -} from '../../utils/helpers'; -import { shouldRunWCBlocksTests } from '../../utils/constants'; -import { addWCBCheckoutPage } from '../../utils/merchant'; -import { goToCheckoutWCB } from '../../utils/shopper-navigation'; +} from '../../../utils/helpers'; +import { shouldRunWCBlocksTests } from '../../../utils/constants'; +import { addWCBCheckoutPage } from '../../../utils/merchant'; +import { goToCheckoutWCB } from '../../../utils/shopper-navigation'; import { addCartProduct, confirmCardAuthentication, fillBillingAddressWCB, fillCardDetailsWCB, -} from '../../utils/shopper'; -import { config } from '../../config/default'; +} from '../../../utils/shopper'; +import { config } from '../../../config/default'; describeif( shouldRunWCBlocksTests )( 'WooCommerce Blocks > Successful purchase', diff --git a/tests/e2e-pw/specs/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts similarity index 90% rename from tests/e2e-pw/specs/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts rename to tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts index b212b94aea9..c82b7cb5b9a 100644 --- a/tests/e2e-pw/specs/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-saved-card-checkout-and-usage.spec.ts @@ -11,13 +11,13 @@ import { describeif, getMerchant, getShopper, -} from '../../utils/helpers'; -import { shouldRunWCBlocksTests } from '../../utils/constants'; +} from '../../../utils/helpers'; +import { shouldRunWCBlocksTests } from '../../../utils/constants'; import { goToMyAccount, goToShop, goToCheckoutWCB, -} from '../../utils/shopper-navigation'; +} from '../../../utils/shopper-navigation'; import { addCartProduct, deleteSavedCard, @@ -25,9 +25,9 @@ import { fillBillingAddressWCB, fillCardDetailsWCB, selectSavedCardOnCheckout, -} from '../../utils/shopper'; -import { addWCBCheckoutPage } from '../../utils/merchant'; -import { config } from '../../config/default'; +} from '../../../utils/shopper'; +import { addWCBCheckoutPage } from '../../../utils/merchant'; +import { config } from '../../../config/default'; describeif( shouldRunWCBlocksTests )( 'WooCommerce Blocks > Saved cards', From 6df668c52043761e860e7ad066dd2649ddc5ded1 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Fri, 31 Jan 2025 16:01:34 -0500 Subject: [PATCH 18/43] Update e2e-test workflow to install Playwright chromium --- .github/workflows/e2e-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 1d1f0b1bd71..2e32c45c39f 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -116,5 +116,9 @@ jobs: - 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/run-log-tests From ebd662f4a1c70a1b0a88d872d2edce7836c4893c Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Fri, 31 Jan 2025 18:38:48 -0300 Subject: [PATCH 19/43] Update projects to be a simple chromium setup --- tests/e2e-pw/playwright.config.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index cb2c031224d..2f16c6f10ba 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -84,27 +84,8 @@ export default defineConfig( { dependencies: [ 'setup' ], }, { - name: 'wcpay - merchant', + name: 'chromium', use: { ...devices[ 'Desktop Chrome' ] }, - testMatch: getTestMatch( 'wcpay', 'merchant' ), - dependencies: [ 'setup' ], - }, - { - name: 'wcpay - shopper', - use: { ...devices[ 'Desktop Chrome' ] }, - testMatch: getTestMatch( 'wcpay', 'shopper' ), - dependencies: [ 'setup' ], - }, - { - name: 'subscriptions - merchant', - use: { ...devices[ 'Desktop Chrome' ] }, - testMatch: getTestMatch( 'subscriptions', 'merchant' ), - dependencies: [ 'setup' ], - }, - { - name: 'subscriptions - shopper', - use: { ...devices[ 'Desktop Chrome' ] }, - testMatch: getTestMatch( 'subscriptions', 'shopper' ), dependencies: [ 'setup' ], }, // Setup project From 58a9fb98be5cab4bec84e7380b95aded71ede3d9 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Fri, 31 Jan 2025 22:41:13 -0300 Subject: [PATCH 20/43] Add Playwright test results to artifacts --- .github/actions/e2e/run-log-tests/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 7c1a9dffe25..5b091b80471 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -42,6 +42,7 @@ runs: screenshots tests/e2e/screenshots tests/e2e/docker/wordpress/wp-content/debug.log + tests/e2e-pw/test-results ${{ env.E2E_RESULT_FILEPATH }} if-no-files-found: ignore retention-days: 14 From a7b3650d443545f2527bcb5ccee872b0f5e005af Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Fri, 31 Jan 2025 22:56:58 -0300 Subject: [PATCH 21/43] Disable multi-currency before running price checks --- ...bscriptions-purchase-no-signup-fee.spec.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts index bbde3248bdf..71c505dfa6b 100644 --- a/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts @@ -19,6 +19,11 @@ import { setupCheckout, } from '../../../utils/shopper'; import { goToProductPageBySlug } from '../../../utils/shopper-navigation'; +import { + activateMulticurrency, + deactivateMulticurrency, + isMulticurrencyEnabled, +} from '../../../utils/merchant'; const productName = 'Subscription no signup fee product'; const productSlug = 'subscription-no-signup-fee-product'; @@ -58,10 +63,21 @@ describeif( shouldRunSubscriptionsTests )( ); orderId = await orderIdField.textContent(); } ); + test( 'It should have a charge for subscription cost without fee & an active subscription', async ( { browser, } ) => { const { merchantPage } = await getMerchant( browser ); + + // Disable multi-currency in the merchant settings. + // This step is important because local environment setups might have multi-currency enabled. + const wasMultiCurrencyEnabled = await isMulticurrencyEnabled( + merchantPage + ); + if ( wasMultiCurrencyEnabled ) { + await deactivateMulticurrency( merchantPage ); + } + await goToOrder( merchantPage, orderId ); // Verify we have an active subscription @@ -105,6 +121,11 @@ describeif( shouldRunSubscriptionsTests )( await expect( subscriptionsRow.locator( '.recurring_total' ) ).toHaveText( /\$9\.99 \/ month/i ); + + // Enable multicurrency if it was enabled before. + if ( wasMultiCurrencyEnabled ) { + await activateMulticurrency( merchantPage ); + } } ); } ); From 2494c5f82d1aa8775dfd8c4dc170eae00af46ece Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Fri, 31 Jan 2025 23:06:47 -0300 Subject: [PATCH 22/43] Remove custom timeouts --- tests/e2e-pw/utils/helpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e-pw/utils/helpers.ts b/tests/e2e-pw/utils/helpers.ts index 7f01beeb007..e470a9cfc53 100644 --- a/tests/e2e-pw/utils/helpers.ts +++ b/tests/e2e-pw/utils/helpers.ts @@ -96,12 +96,12 @@ export const getShopper = async ( shopperPage.locator( '.woocommerce-MyAccount-navigation-link--customer-logout' ) - ).toBeVisible( { timeout: 1000 } ); + ).toBeVisible(); await expect( shopperPage.locator( 'div.woocommerce-MyAccount-content > p >> nth=0' ) - ).toContainText( 'Hello', { timeout: 1000 } ); + ).toContainText( 'Hello' ); await shopperPage .context() .storageState( { path: customerStorageFile } ); From f6bdc3cb0841ddb019f9f9ff7e28c69753cdca53 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Fri, 31 Jan 2025 23:08:50 -0300 Subject: [PATCH 23/43] Wait for UI to be unblocked to continue test --- .../shopper/shopper-myaccount-payment-methods-add-fail.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts index de14ce9564c..ce80f2497ee 100644 --- a/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-myaccount-payment-methods-add-fail.spec.ts @@ -8,7 +8,7 @@ import test, { Page, expect } from '@playwright/test'; */ import { config } from '../../../config/default'; import { goToMyAccount } from '../../../utils/shopper-navigation'; -import { getShopper } from '../../../utils/helpers'; +import { getShopper, isUIUnblocked } from '../../../utils/helpers'; import { addSavedCard, confirmCardAuthentication, @@ -65,6 +65,7 @@ test.describe( 'Payment Methods', () => { if ( 'declined-3ds' === cardType ) { await confirmCardAuthentication( shopperPage, false ); + await isUIUnblocked( shopperPage ); } // Verify that we get the expected error message. From f129a1e7e31fc9932110dc35387400db636c5129 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Fri, 31 Jan 2025 23:12:20 -0300 Subject: [PATCH 24/43] Fix snapshots folder location --- ...r-analytics-should-load-without-any-errors-1.png | Bin ...sits-Select-deposits-list-advanced-filters-1.png | Bin ...ansactions-page-should-load-without-errors-1.png | Bin ...-when-disputed-order-notice-button-clicked-1.png | Bin ...mit-button-when-no-currencies-are-selected-1.png | Bin ...-by-geolocation-correctly-with-USD-and-GBP-1.png | Bin ...-by-geolocation-correctly-with-USD-and-GBP-2.png | Bin ...ulti-currency-page-load-without-any-errors-1.png | Bin 8 files changed, 0 insertions(+), 0 deletions(-) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png (100%) rename tests/e2e-pw/specs/{wcpay/merchant/__snapshots__ => __snapshots__/wcpay/merchant}/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png (100%) diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-admin-analytics.spec.ts/Admin-order-analytics-should-load-without-any-errors-1.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-admin-deposits.spec.ts/Merchant-deposits-Select-deposits-list-advanced-filters-1.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-admin-transactions.spec.ts/Admin-transactions-page-should-load-without-errors-1.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/merchant-disputes-view-details-via-order-notice.spec.ts/Disputes-View-dispute-details-via-disputed-o-f9e9d-ils-when-disputed-order-notice-button-clicked-1.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Currency-selection--7b0d9-submit-button-when-no-currencies-are-selected-1.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-83665-tch-by-geolocation-correctly-with-USD-and-GBP-1.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency-on-boarding.spec.ts/Multi-currency-on-boarding-Geolocation-feature-d8568-tch-by-geolocation-correctly-with-USD-and-GBP-2.png diff --git a/tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png b/tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png similarity index 100% rename from tests/e2e-pw/specs/wcpay/merchant/__snapshots__/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png rename to tests/e2e-pw/specs/__snapshots__/wcpay/merchant/multi-currency.spec.ts/Multi-currency-page-load-without-any-errors-1.png From b46ed4f4814715af0c92d027405bb9d4f4546bae Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Sat, 1 Feb 2025 07:02:05 -0300 Subject: [PATCH 25/43] Ensure test report is always uploaded after execution --- .github/actions/e2e/run-log-tests/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/e2e/run-log-tests/action.yml b/.github/actions/e2e/run-log-tests/action.yml index 5b091b80471..7265d598b40 100644 --- a/.github/actions/e2e/run-log-tests/action.yml +++ b/.github/actions/e2e/run-log-tests/action.yml @@ -34,7 +34,7 @@ runs: # Archive screenshots if any - name: Archive e2e test screenshots & logs - if: ${{ failure() }} + if: ${{ always() }} uses: actions/upload-artifact@v4 with: name: wp(${{ env.E2E_WP_VERSION }})-wc(${{ env.E2E_WC_VERSION }})-${{ env.E2E_GROUP }}-${{ env.E2E_BRANCH }} From f3002da33eeeccc4d78bbe78af2d01b7e2964d01 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Sat, 1 Feb 2025 07:34:15 -0300 Subject: [PATCH 26/43] Update E2E results file path for tests all workflow --- .github/workflows/e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 2e32c45c39f..ad081e1bd8e 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -22,7 +22,7 @@ env: 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' + E2E_RESULT_FILEPATH: 'tests/e2e-pw/results.json' WC_MIN_SUPPORTED_VERSION: '7.6.0' NODE_ENV: 'test' FORCE_E2E_DEPS_SETUP: true From b5028d6b8be487cdef26f8ec8f9495062da2a7e4 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Sat, 1 Feb 2025 07:43:07 -0300 Subject: [PATCH 27/43] Add step for installing Playwright --- .github/workflows/e2e-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index ad081e1bd8e..c68a4d61a81 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -64,6 +64,10 @@ jobs: - 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/run-log-tests From 82996545f54322fe73e03af5a873b623a9e4ea49 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Sat, 1 Feb 2025 08:03:18 -0300 Subject: [PATCH 28/43] Remove wait for load state --- tests/e2e-pw/utils/shopper.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e-pw/utils/shopper.ts b/tests/e2e-pw/utils/shopper.ts index d3105d83a11..1a4299609bc 100644 --- a/tests/e2e-pw/utils/shopper.ts +++ b/tests/e2e-pw/utils/shopper.ts @@ -206,7 +206,6 @@ export const fillCardDetailsWCB = async ( ); const stripeFrame = await frameHandle.contentFrame(); if ( ! stripeFrame ) return; - await stripeFrame.waitForLoadState( 'networkidle' ); await stripeFrame.getByPlaceholder( '1234 1234 1234' ).fill( card.number ); await stripeFrame .getByPlaceholder( 'MM / YY' ) From db6633f7cfdc9de798fc897c0b390480660b084e Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Sat, 1 Feb 2025 08:33:17 -0300 Subject: [PATCH 29/43] Check for HPOS availability before running the sync It should fallback to COT when HPOS is not available. --- tests/e2e/env/setup.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/e2e/env/setup.sh b/tests/e2e/env/setup.sh index d9e1bc5d7db..364d906f29e 100755 --- a/tests/e2e/env/setup.sh +++ b/tests/e2e/env/setup.sh @@ -219,9 +219,10 @@ cli wp option set woocommerce_checkout_company_field "optional" echo "Importing WooCommerce shop pages..." cli wp wc --user=admin tool run install_pages +INSTALLED_WC_VERSION=$(cli_debug wp plugin get woocommerce --field=version) + # Start - Workaround for > WC 8.3 compatibility by updating cart & checkout pages to use shortcode. # To be removed when WooPayments L-2 support is >= WC 8.3 -INSTALLED_WC_VERSION=$(cli_debug wp plugin get woocommerce --field=version) IS_WORKAROUND_REQUIRED=$(cli_debug wp eval "echo version_compare(\"$INSTALLED_WC_VERSION\", \"8.3\", \">=\");") if [[ "$IS_WORKAROUND_REQUIRED" = "1" ]]; then @@ -345,8 +346,16 @@ cli wp db query "DELETE p, m FROM wp_posts p LEFT JOIN wp_postmeta m ON p.ID = m echo "Setting up a coupon for E2E tests" cli wp wc --user=admin shop_coupon create --code=free --amount=100 --discount_type=percent --individual_use=true --free_shipping=true -echo "Syncing HPOS data" -cli wp wc hpos sync +# HPOS was officially released in WooCommerce 8.2.0, so we need to check if we should sync COT or HPOS data. +IS_HPOS_AVAILABLE=$(cli_debug wp eval "echo version_compare(\"$INSTALLED_WC_VERSION\", \"8.2\", \">=\");") + +if [[ ${IS_HPOS_AVAILABLE} ]]; then + echo "Syncing HPOS data" + cli wp wc hpos sync +else + echo "Syncing COT data" + cli wp wc cot sync +fi # Log test configuration for visibility echo From 270d80dd53b039c725ebbf6bcdd5d88e2532fdd3 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 09:25:38 -0500 Subject: [PATCH 30/43] Fix strict mode violation for WC 7.7.0 test run --- .../merchant/merchant-subscriptions-settings.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts index 0f0b3ef8b40..a685727c0cb 100644 --- a/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.ts @@ -21,9 +21,11 @@ describeif( shouldRunSubscriptionsTests )( await expect( menuItem ).toBeVisible(); // An alternative way to verify the subscriptions menu page is active, avoiding the active tab classname. - const heading = await page.getByRole( 'heading', { - name: 'Subscriptions', - } ); + const heading = await page + .getByRole( 'heading', { + name: 'Subscriptions', + } ) + .first(); await expect( heading ).toBeVisible(); } ); } From da2cd16b824838fd1f553f26b0d036074860bdb1 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 12:04:29 -0300 Subject: [PATCH 31/43] Enable the optional company field --- tests/e2e-pw/utils/merchant.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/e2e-pw/utils/merchant.ts b/tests/e2e-pw/utils/merchant.ts index 9f18c1887e2..a98ae7eedaf 100644 --- a/tests/e2e-pw/utils/merchant.ts +++ b/tests/e2e-pw/utils/merchant.ts @@ -420,6 +420,17 @@ export const addWCBCheckoutPage = async ( page: Page ) => { await page.waitForTimeout( 500 ); await page.keyboard.press( 'Escape' ); // to dismiss a dialog if present + // Enable the "Company" field if it's not already enabled. + await page.getByLabel( 'Block: Shipping Address' ).click(); + + const companyCheckbox = page + .locator( '.components-toggle-control' ) + .getByLabel( 'Company' ); + + if ( ! ( await companyCheckbox.isChecked() ) ) { + await companyCheckbox.check(); + } + // Publish the page await page.locator( 'button.editor-post-publish-panel__toggle' ).click(); await page.waitForTimeout( 500 ); From 4d78af5c45f94063d6520190658be92eb1ceaaa3 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 12:05:01 -0300 Subject: [PATCH 32/43] Add fallback to WC 7.7.0 --- tests/e2e-pw/utils/shopper.ts | 36 ++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/tests/e2e-pw/utils/shopper.ts b/tests/e2e-pw/utils/shopper.ts index 1a4299609bc..17d5d07bb6f 100644 --- a/tests/e2e-pw/utils/shopper.ts +++ b/tests/e2e-pw/utils/shopper.ts @@ -68,9 +68,22 @@ export const fillBillingAddressWCB = async ( const billingAddressForm = page.getByRole( 'group', { name: 'Billing address', } ); - await billingAddressForm - .getByLabel( 'Country/Region' ) - .selectOption( billingAddress.country ); + + const countryField = billingAddressForm.getByLabel( 'Country/Region' ); + + try { + await countryField.selectOption( billingAddress.country ); + } catch ( error ) { + // Fallback for WC 7.7.0. + await countryField.focus(); + await countryField.fill( billingAddress.country ); + + await page + .locator( '.components-form-token-field__suggestion' ) + .first() + .click(); + } + await billingAddressForm .getByLabel( 'First Name' ) .fill( billingAddress.firstname ); @@ -93,10 +106,17 @@ export const fillBillingAddressWCB = async ( .getByLabel( 'Apartment, suite, etc. (optional)' ) .fill( billingAddress.addresssecondline ); await billingAddressForm.getByLabel( 'City' ).fill( billingAddress.city ); + + const stateInput = billingAddressForm.getByLabel( 'State', { + exact: true, + } ); if ( billingAddress.state ) { - await billingAddressForm - .getByLabel( 'State' ) - .selectOption( billingAddress.state ); + try { + await stateInput.selectOption( billingAddress.state ); + } catch ( error ) { + // Fallback for WC 7.7.0. + await stateInput.fill( billingAddress.state ); + } } await billingAddressForm .getByLabel( 'ZIP Code' ) @@ -279,9 +299,11 @@ export const addToCartFromShopPage = async ( page.locator( `${ addToCartSelector }.added` ) ).toBeVisible(); } else { + // This generic regex will match the aria-label for the "Add to cart" button for any product. + // It should work for WC 7.7.0 and later. // These unicode characters are the smart (or curly) quotes: “ ”. const addToCartRegex = new RegExp( - `Add to cart: \u201C${ product }\u201D` + `Add\\s+(?:to\\s+cart:\\s*)?\u201C${ product }\u201D(?:\\s+to\\s+your\\s+cart)?` ); await page.getByLabel( addToCartRegex ).click(); From 352aebd06efe5fba3f254a3ca2589adb9c772be6 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 10:37:48 -0500 Subject: [PATCH 33/43] Add wooCoreVersion constant --- tests/e2e-pw/utils/constants.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e-pw/utils/constants.ts b/tests/e2e-pw/utils/constants.ts index f223b1fd078..ec274824acb 100644 --- a/tests/e2e-pw/utils/constants.ts +++ b/tests/e2e-pw/utils/constants.ts @@ -10,3 +10,5 @@ export const products = { SUBSCRIPTION_SIGNUP_FEE: 70, SUBSCRIPTION_NO_SIGNUP_FEE: 88, }; + +export const wooCoreVersion = process.env.E2E_WC_VERSION; From 9ec962f5a199c380f60b24665b3a6267c7ad9ff8 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 10:38:24 -0500 Subject: [PATCH 34/43] Add WC version check to goToSubscriptions --- tests/e2e-pw/utils/merchant-navigation.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/e2e-pw/utils/merchant-navigation.ts b/tests/e2e-pw/utils/merchant-navigation.ts index d258e5d09e4..7b74533016a 100644 --- a/tests/e2e-pw/utils/merchant-navigation.ts +++ b/tests/e2e-pw/utils/merchant-navigation.ts @@ -4,6 +4,11 @@ import { Page } from 'playwright/test'; import { dataHasLoaded } from './merchant'; +/** + * Internal dependencies + */ +import { wooCoreVersion } from './constants'; + export const goToOrder = async ( page: Page, orderId: string ) => { await page.goto( `/wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }`, @@ -114,10 +119,15 @@ export const goToConnect = async ( page: Page ) => { await dataHasLoaded( page ); }; -export const goToSubscriptions = async ( page: Page ) => - await page.goto( '/wp-admin/admin.php?page=wc-orders--shop_subscription', { +export const goToSubscriptions = async ( page: Page ) => { + const subscriptionsUrl = + wooCoreVersion === '7.7.0' + ? '/wp-admin/edit.php?post_type=shop_subscription' + : '/wp-admin/admin.php?page=wc-orders--shop_subscription'; + await page.goto( subscriptionsUrl, { waitUntil: 'load', } ); +}; export const goToSubscriptionPage = async ( page: Page, From 4443a72ffcb6a71e555fdaab815f3d323087c600 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 10:38:53 -0500 Subject: [PATCH 35/43] Update test to work with WC latest & 7.7.0 --- ...hant-subscriptions-renew-action-scheduler.spec.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts index 37c9c4f2ef5..380f8014393 100644 --- a/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts @@ -29,8 +29,6 @@ describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( const customerBillingConfig = config.addresses[ 'subscriptions-customer' ].billing; - let subscriptionId: string; - test.beforeAll( async ( { browser }, { project } ) => { const { shopperPage } = await getShopper( browser, @@ -48,10 +46,6 @@ describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( await expect( shopperPage.getByRole( 'heading', { name: 'Order received' } ) ).toBeVisible(); - - subscriptionId = await shopperPage - .getByLabel( 'View subscription number' ) - .innerText(); } ); test( 'should renew a subscription with action scheduler', async ( { @@ -81,12 +75,8 @@ describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( // Go to Subscriptions and verify the subscription renewal await goToSubscriptions( merchantPage ); - const numericSubscriptionId = subscriptionId.substring( 1 ); - await expect( - merchantPage - .locator( `#order-${ numericSubscriptionId }` ) - .getByRole( 'cell', { name: '2', exact: true } ) + merchantPage.getByRole( 'cell', { name: '2', exact: true } ) ).toBeVisible(); } ); } From 232ca49c10df31955a5341428a12dd39eb46aa5c Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 12:59:32 -0300 Subject: [PATCH 36/43] Update locator selector to work on WC 7.7.0 --- .../wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts index 3aa1c79a1c9..7e0522e70eb 100644 --- a/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-wc-blocks-checkout-failures.spec.ts @@ -99,7 +99,9 @@ describeif( shouldRunWCBlocksTests )( await shopper.confirmCardAuthentication( shopperPage ); } await expect( - shopperPage.getByLabel( 'Checkout' ).getByText( error ) + shopperPage + .locator( '.wc-block-checkout__form' ) + .getByText( error ) ).toBeVisible(); } ); } From 31de6895816cb6225fe778450755bfb1e6250982 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 11:15:55 -0500 Subject: [PATCH 37/43] Update goToSubscriptionPage to work with WC latest and 7.7.0 --- tests/e2e-pw/utils/merchant-navigation.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/e2e-pw/utils/merchant-navigation.ts b/tests/e2e-pw/utils/merchant-navigation.ts index 7b74533016a..b00fc1f2f78 100644 --- a/tests/e2e-pw/utils/merchant-navigation.ts +++ b/tests/e2e-pw/utils/merchant-navigation.ts @@ -134,9 +134,6 @@ export const goToSubscriptionPage = async ( subscriptionId: number ) => { await goToSubscriptions( page ); - const orderRow = page.locator( - 'tr#order-' + subscriptionId + ' .order_title a:nth-child(1)' - ); - orderRow.evaluate( ( el: HTMLLinkElement ) => el.click() ); + await page.getByRole( 'link', { name: `#${ subscriptionId }` } ).click(); await dataHasLoaded( page ); }; From 5caa5c32792f185f0dd1ca7a1533b521c66c1a17 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 12:09:39 -0500 Subject: [PATCH 38/43] Fix test to work with WC latest & 7.7.0 --- .../merchant-orders-manual-capture.spec.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts index 85489bfc488..366b34c5f7e 100644 --- a/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts +++ b/tests/e2e-pw/specs/wcpay/merchant/merchant-orders-manual-capture.spec.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -import { test, expect } from '@playwright/test'; +import { test, expect, Page } from '@playwright/test'; /** * Internal dependencies @@ -17,8 +17,8 @@ import { placeOrderWithOptions } from '../../../utils/shopper'; /** * Local variables. */ -let orderId; -let merchantPage; +let orderId: string; +let merchantPage: Page; test.describe( 'Order > Manual Capture', () => { test.beforeAll( async ( { browser } ) => { @@ -40,11 +40,16 @@ test.describe( 'Order > Manual Capture', () => { // Merchant go to the order. await goToOrder( merchantPage, orderId ); + const orderTotal = await merchantPage + .getByRole( 'row', { name: 'Order Total: $' } ) + .locator( 'bdi' ) + .textContent(); + // Confirm order status is 'On hold', and that there's an 'authorized' note. await expect( merchantPage.getByTitle( 'On hold' ) ).toBeVisible(); await expect( merchantPage.getByText( - 'A payment of $18.00 was authorized using WooPayments' + `A payment of ${ orderTotal } was authorized using WooPayments` ) ).toBeVisible(); @@ -60,7 +65,7 @@ test.describe( 'Order > Manual Capture', () => { await expect( merchantPage.getByTitle( 'Processing' ) ).toBeVisible(); await expect( merchantPage.getByText( - 'A payment of $18.00 was successfully captured using WooPayments' + `A payment of ${ orderTotal } was successfully captured using WooPayments` ) ).toBeVisible(); } ); From 9cb41aa18d54e88165a111376428319f87a870f7 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 14:31:52 -0300 Subject: [PATCH 39/43] Update price assertions --- .../shopper/shopper-multi-currency-widget.spec.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts index 7925f01c8ca..374e2e05146 100644 --- a/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts @@ -68,15 +68,11 @@ test.describe( 'Shopper Multi-Currency widget', () => { test.describe( 'Should not affect prices', () => { let orderId: string; + let orderPrice: string; test.afterEach( async () => { - await shopperPage.selectOption( - '.widget select[name=currency]', - 'EUR' - ); - await expect( - shopperPage.getByText( '$18.00 USD' ).first() + shopperPage.getByText( `${ orderPrice } USD` ).first() ).toBeVisible(); await navigation.goToShopWithCurrency( shopperPage, 'USD' ); @@ -87,12 +83,17 @@ test.describe( 'Shopper Multi-Currency widget', () => { shopperPage, 'USD' ); + orderPrice = await shopperPage + .locator( '.woocommerce-order-overview__total bdi' ) + .textContent(); } ); test( 'at My account > Orders', async () => { await navigation.goToOrders( shopperPage ); await expect( - shopperPage.getByLabel( `View order number ${ orderId }` ) + shopperPage + .locator( '.woocommerce-orders-table__cell-order-number' ) + .getByRole( 'link', { name: `#${ orderId }` } ) ).toBeVisible(); } ); } ); From 9189fa605b2f7264f7044e1cd7bfe69813721488 Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 14:48:50 -0300 Subject: [PATCH 40/43] Add fallback for WC 7.7.0 --- .../shopper-subscriptions-purchase-no-signup-fee.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts index 71c505dfa6b..d6b1948961d 100644 --- a/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/shopper/shopper-subscriptions-purchase-no-signup-fee.spec.ts @@ -106,10 +106,17 @@ describeif( shouldRunSubscriptionsTests )( await goToSubscriptions( merchantPage ); - const subscriptionsRow = merchantPage.locator( + let subscriptionsRow = merchantPage.locator( '#order-' + relatedSubscriptionId ); + // Fallback for WC 7.7.0. + if ( ( await subscriptionsRow.count() ) === 0 ) { + subscriptionsRow = merchantPage.locator( + '#post-' + relatedSubscriptionId + ); + } + await expect( subscriptionsRow.locator( '.subscription-status' ) ).toHaveText( 'Active' ); From e5d366de28f403273098bf282abdd273880ac9eb Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 16:42:56 -0300 Subject: [PATCH 41/43] Update selectors to work with the latest WC version --- .../wcpay/shopper/shopper-multi-currency-widget.spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts b/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts index 374e2e05146..ff278098068 100644 --- a/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts +++ b/tests/e2e-pw/specs/wcpay/shopper/shopper-multi-currency-widget.spec.ts @@ -84,7 +84,9 @@ test.describe( 'Shopper Multi-Currency widget', () => { 'USD' ); orderPrice = await shopperPage - .locator( '.woocommerce-order-overview__total bdi' ) + .getByRole( 'row', { name: 'Total: $' } ) + .locator( '.amount' ) + .nth( 1 ) .textContent(); } ); @@ -93,7 +95,7 @@ test.describe( 'Shopper Multi-Currency widget', () => { await expect( shopperPage .locator( '.woocommerce-orders-table__cell-order-number' ) - .getByRole( 'link', { name: `#${ orderId }` } ) + .getByRole( 'link', { name: orderId } ) ).toBeVisible(); } ); } ); From 6f5afaf9ecf19ab654e708c7c529837a6c1e024d Mon Sep 17 00:00:00 2001 From: Eduardo Umpierre Date: Mon, 3 Feb 2025 16:53:10 -0300 Subject: [PATCH 42/43] Increase maxDiffPixelRatio for WC 7.7.0 --- tests/e2e-pw/playwright.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/e2e-pw/playwright.config.ts b/tests/e2e-pw/playwright.config.ts index 2f16c6f10ba..b44483820da 100644 --- a/tests/e2e-pw/playwright.config.ts +++ b/tests/e2e-pw/playwright.config.ts @@ -67,7 +67,10 @@ export default defineConfig( { }, timeout: 120 * 1000, // Default is 30s, somteimes it is not enough for local tests due to long setup. expect: { - toHaveScreenshot: { maxDiffPixelRatio: 0.025 }, + toHaveScreenshot: { + maxDiffPixelRatio: + process.env.E2E_WC_VERSION === '7.7.0' ? 0.035 : 0.025, + }, //=* Increase expect timeout to 10 seconds. See https://playwright.dev/docs/test-timeouts#set-expect-timeout-in-the-config.*/ timeout: 20 * 1000, }, From a6a9c9693255cccdf96128035b7620eb0935cbc2 Mon Sep 17 00:00:00 2001 From: Allie Mims Date: Mon, 3 Feb 2025 15:33:29 -0500 Subject: [PATCH 43/43] Add changelog --- changelog/dev-10238-update-e2e-tests-all-workflow | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog/dev-10238-update-e2e-tests-all-workflow diff --git a/changelog/dev-10238-update-e2e-tests-all-workflow b/changelog/dev-10238-update-e2e-tests-all-workflow new file mode 100644 index 00000000000..6861f616e0d --- /dev/null +++ b/changelog/dev-10238-update-e2e-tests-all-workflow @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Update Github actions and workflows. Change e2e tests directory structure.