You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'dev/woopmnt-5249-e2e-ensure-version-coverage-for-woocommerce-and-php' into dev/woopmnt-5251-e2e-investigate-and-re-enable-woocommerce-blocks-e2e-tests
"text": "• Created a release branch `release/${{ env.RELEASE_VERSION }}` \n • Raised a <https://github.com/Automattic/woocommerce-payments/pull/${{ env.RELEASE_PR_ID }}|Pull Request> to `trunk`\n • Built a <https://github.com/Automattic/woocommerce-payments/actions/runs/$GITHUB_RUN_ID|zip file and ran smoke tests> against it"
120
+
"text": "• Created a release branch `release/${{ env.RELEASE_VERSION }}` \n • Raised a <https://github.com/Automattic/woocommerce-payments/pull/${{ env.RELEASE_PR_ID }}|Pull Request> to `trunk`\n • Built a <https://github.com/Automattic/woocommerce-payments/actions/runs/${{ env.GITHUB_RUN_ID }}|zip file and ran smoke tests> against it"
Copy file name to clipboardExpand all lines: tests/e2e/README.md
+60-5Lines changed: 60 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,24 @@ WooPayments e2e tests can be found in the `./tests/e2e/specs` directory. These t
4
4
5
5
E2E tests can be run locally or in GitHub Actions. Github Actions are already configured and don't require any changes to run the tests.
6
6
7
+
## Recent Improvements
8
+
9
+
### Retry Mechanism
10
+
The E2E tests now include an intelligent retry mechanism that:
11
+
-**First run**: Executes all tests normally
12
+
-**Automatic retry**: If any tests fail, only the failed tests are retried using Playwright's `--last-failed` flag
13
+
14
+
### Improved Timeout Handling
15
+
-**Increased timeouts**: UI interaction timeouts increased from 100ms to 10 seconds for better reliability
16
+
-**Better error handling**: More robust page loading and element waiting strategies
17
+
-**DevTools reliability**: Improved devtools page navigation and interaction
18
+
19
+
### Dynamic Matrix Generation
20
+
-**L-1 Policy**: Tests automatically run against the latest WooCommerce version and the L-1 (previous major) version
21
+
-**Dynamic version resolution**: Automatically fetches latest WC, RC, and beta versions from WordPress.org API
22
+
-**Optimized PHP strategy**: Reduces job count while maintaining comprehensive coverage
23
+
-**Business continuity**: Maintains support for WC 7.7.0 for significant TPV reasons
24
+
7
25
## Setting up & running E2E tests
8
26
9
27
For running E2E tests locally, create a new file named `local.env` under `tests/e2e/config` folder with the following env variables (replace values as required).
@@ -207,6 +225,19 @@ Currently, the best way to debug tests is to use the Playwright UI mode. This mo
207
225
You can use the locator functionality to help correctly determine the locator syntax to correctly target the HTML element you need. Lastly, you can also use
208
226
`console.log()` to assist with debugging tests in UI mode. To run tests in UI mode, use the `npm run test:e2e-ui path/to/test.spec` command.
209
227
228
+
### Understanding Test Failures and Retries
229
+
230
+
When tests fail in CI, the retry mechanism automatically kicks in:
231
+
232
+
1.**First run**: All tests execute normally
233
+
2.**If failures occur**: The system automatically retries only the failed tests
234
+
3.**Retry logs**: Look for the message "Some tests failed, retrying only failed tests with --last-failed flag" in the logs
235
+
4.**Final results**: The test run will show both the initial results and retry results
236
+
237
+
This approach helps distinguish between:
238
+
-**Flaky tests**: Tests that fail occasionally but pass on retry
239
+
-**Consistent failures**: Tests that fail both initially and on retry (indicating real issues)
240
+
210
241
## Slack integration
211
242
212
243
The Slack reporter is a custom reporter that sends e2e test failures to a public Slack channel (search Slack channel ID `CQ0Q6N62D`). The reporter is configured to only send the first failure of a test to Slack. If the retry also fails it will not be sent to prevent spamming the channel.
In some cases, you may need to wait for the page to reach a certain load state before interacting with it. You can use `await page.waitForLoadState( 'domcontentloaded' );` to wait for the page to finish loading.
256
287
288
+
**What timeout values are used for UI interactions?**
289
+
290
+
The E2E tests use optimized timeout values for better reliability:
291
+
- **Global expect timeout**: 20 seconds (configured in `playwright.config.ts`)
292
+
- **UI interaction timeouts**: 10 seconds for critical UI elements (buttons, forms, etc.)
293
+
- **Page load timeouts**: 120 seconds for test execution
294
+
- **Network idle waits**: Used for dynamic content loading
295
+
296
+
These timeouts have been increased from the previous 100ms values to provide better stability, especially for slower environments or complex UI interactions.
297
+
257
298
**What is the best way to target elements in the page?**
258
299
259
300
Prefer the use of [user-facing attribute or test-id locators](https://playwright.dev/docs/locators#locating-elements) to target elements in the page. This will make the tests more resilient to changes to implementation details, such as class names.
@@ -314,15 +355,29 @@ test.describe( 'Sign in as customer', () => {
314
355
} );
315
356
```
316
357
358
+
**How does the dynamic matrix generation work?**
359
+
360
+
The E2E test matrix is dynamically generated using the `.github/scripts/generate-wc-matrix.sh` script:
361
+
362
+
- **L-1 Policy**: Automatically tests against the latest WooCommerce version and the L-1 (previous major) version
363
+
- **Version Resolution**: Fetches latest WC, RC, and beta versions from WordPress.org API
364
+
- **PHP Strategy**:
365
+
- WC 7.7.0: PHP 7.3 (legacy support)
366
+
- WC L-1 & Latest: PHP 8.3 (stable)
367
+
- WC RC: PHP 8.4 (latest)
368
+
- **Business Continuity**: Maintains WC 7.7.0 support for significant TPV reasons
369
+
370
+
This ensures comprehensive test coverage while optimizing CI execution time and resource usage.
371
+
317
372
**How can I investigate and interact with a test failures?**
- Click on the details link to the right of the failed job to see the summary
327
382
- In the job summary, click on the "Run tests, upload screenshots & logs" section.
328
383
- Click on the artifact download link at the end of the section, then extract and copy the `playwright-report` directory to the root of the WooPayments repository
0 commit comments