-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix two flaky e2e tests #47562
Fix two flaky e2e tests #47562
Conversation
Hi @adimoldovan, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block.spec.js
Outdated
Show resolved
Hide resolved
@@ -1,7 +1,8 @@ | |||
const { expect } = require( '../fixtures/fixtures' ); | |||
const logIn = async ( page, username, password, assertSuccess = true ) => { | |||
await page.waitForSelector( 'form' ); | |||
await page.getByLabel( 'Username or Email Address' ).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meant to add a comment on this:
I know this is a goofy thing, and a .fill()
shouldn't need a .click()
preceding it. It looks like in about 10% of executions, Playwright starts to fill in the login form before the page has finished loading and that there is a focus()
on the username field that fires right before we start filling out the password -- so the password ends up overwriting the username (and that causes the flakiness/failure). Explicitly clicking on each field before filling it out seems to have fixed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lanej0 for working on this. It looks much better.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Fixes two flaky tests: basic.spec.js (which was identified by Buildkite as being flaky) and Closes: #46666
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
pnpm env:restart && pnpm test:e2e-pw basic.spec.js --repeat-each 5
pnpm test:e2e-pw checkout-block.spec.js --repeat-each 5
Changelog entry
Significance
Type
Message
Comment