-
Notifications
You must be signed in to change notification settings - Fork 210
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(functional-test): update failing coupon tests #16983
Conversation
✅ Deploy Preview for mozilla-fxa ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Huzzah! Thanks so much @sardesam!
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.
@sardesam I know this is merged but I added some thoughts for your consideration going forward since you've taken on learning about playwright and making the tests more resilient!
await expect( | ||
await subscribe.getCouponStatusByDataTestId('coupon-error') | ||
).toBeVisible({ | ||
timeout: 5000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this timeout may be redundant?
When timeout is defined here I think it overrides the TestConfig.expect value, which is defaulted to 5000ms
expect(await subscribe.couponErrorMessageText()).toContain( | ||
'The code you entered has expired' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we would get more reliable performance if we made this an auto-awaited assert that is user-facing.
await expect(page.getByText('The code you entered has expired')).toBeVisible();
async getCouponStatusByDataTestId(dataTestId: string) { | ||
return this.page.locator(`[data-testid="${dataTestId}"]`); | ||
} |
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.
Playwright recommends using built-in locators, applying that recommendation + standardizing the use of accessors in page objects would look like:
get couponError() {
return this.page.getByTestId('coupon-error');
}
get removeCouponButton() {
return this.page.getByTestId('coupon-remove-button');
}
Because: * We want to reduce our failure rate on tests. This commit: * Re-adds fixmes removed in #16983.
Because: * We want to reduce our failure rate on tests. This commit: * Re-adds fixmes removed in #16983.
Because
This pull request
fixme
annotation.data-test-id
Issue that this pull request solves
Closes FXA-9689
Checklist
Put an
x
in the boxes that apply