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

improve playwright tests #934

Merged
merged 3 commits into from
Feb 25, 2025
Merged

Conversation

nichtsam
Copy link
Contributor

@nichtsam nichtsam commented Feb 18, 2025

Related: #931

Flakiness reasons:

  • Some tests check for pending states, but states might resolve before they get verified.
  • faker.internet.username() can generate usernames that exceed the length limit defined in SignupFormSchema.
  • Some tests interact with components that require JS before it's fully loaded (e.g., Radix Checkbox).

Test Plan

Checklist

  • Tests updated
  • Docs updated

Screenshots

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good to me! Thanks!

@nichtsam
Copy link
Contributor Author

nichtsam commented Feb 18, 2025

That looks good to me! Thanks!

Hey! I’ve been working on this partly to showcase the issues, which is why I added the reliableAction logic. I’m not sure if it’s the best solution, but if you think it works well, I can mark it as ready for review.

I don’t think I’ve fixed all the flakiness yet, but I believe these changes have reduced it quite a bit—at least on my device 😅.

@kentcdodds
Copy link
Member

I don't really want to go with the reliable action approach. I would like to dig a little deeper.

@nichtsam nichtsam marked this pull request as ready for review February 25, 2025 12:54
@nichtsam
Copy link
Contributor Author

I don't really want to go with the reliable action approach. I would like to dig a little deeper.

I dug a bit deeper and found that one issue was JavaScript not being loaded. Since the page is SSR-ed, the visibility check always passes, and Playwright proceeds with the click. However, the Radix checkbox requires JavaScript to function, so the checked state isn’t updated, resulting in ineffective clicks.

@nichtsam nichtsam requested a review from kentcdodds February 25, 2025 13:01
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are good improvements. Thank you a lot!

@kentcdodds kentcdodds merged commit dfbc31c into epicweb-dev:main Feb 25, 2025
5 checks passed
@nichtsam nichtsam deleted the pr/playwright-test branch March 2, 2025 16:12
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.

2 participants