Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(functional-test): update failing coupon tests #16983

Merged
merged 1 commit into from
May 22, 2024

Conversation

sardesam
Copy link
Contributor

Because

  • We are aiming to make stage and prod deployments all green.

This pull request

Issue that this pull request solves

Closes FXA-9689

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Because:

* We are aiming to make stage and prod deployments all green.

This commit:

* Updates tests to add timeout to page locators.
* Follow up to #16978, which added fixme annotation.

Closes FXA-9689
Copy link

netlify bot commented May 22, 2024

Deploy Preview for mozilla-fxa ready!

Name Link
🔨 Latest commit ce8965b
🔍 Latest deploy log https://app.netlify.com/sites/mozilla-fxa/deploys/664d542355d6ab0008fe9cc2
😎 Deploy Preview https://deploy-preview-16983--mozilla-fxa.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@pdehaan pdehaan left a 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!

@sardesam sardesam merged commit bd49333 into main May 22, 2024
23 checks passed
@sardesam sardesam deleted the FXA-9689__coupon-tests branch May 22, 2024 02:49
Copy link
Contributor

@Trinaa Trinaa left a 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,
Copy link
Contributor

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

Comment on lines 36 to 37
expect(await subscribe.couponErrorMessageText()).toContain(
'The code you entered has expired'
Copy link
Contributor

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();

Comment on lines +14 to +16
async getCouponStatusByDataTestId(dataTestId: string) {
return this.page.locator(`[data-testid="${dataTestId}"]`);
}
Copy link
Contributor

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');
  }

sardesam pushed a commit that referenced this pull request May 22, 2024
Because:

* We are aiming to make stage and prod deployments all green.
* There is still flakiness.

This commit:

* Updates tests to add a longer timeout to page locators.
* Follow up to #16983.

Closes FXA-9689
sardesam pushed a commit that referenced this pull request May 22, 2024
Because:

* We want to reduce our failure rate on tests.

This commit:

* Re-adds fixmes removed in #16983.
chenba pushed a commit that referenced this pull request May 24, 2024
Because:

* We want to reduce our failure rate on tests.

This commit:

* Re-adds fixmes removed in #16983.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants