-
Notifications
You must be signed in to change notification settings - Fork 13
test(filtered-search): harden e2e test #1334
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
base: main
Are you sure you want to change the base?
Conversation
Sometimes playwright is faster than our app. We need to slow it down by checking for certain state before proceeding.
Summary of ChangesHello @spike-rabbit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability of an end-to-end test for the filtered search component. It introduces a synchronization step to prevent race conditions where the test runner might execute actions before the application's UI has fully updated, thereby making the test more stable and less prone to intermittent failures. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request hardens an end-to-end test for the filtered search component by adding an explicit wait for an element to be focused before proceeding with keyboard interactions. This is a good practice to prevent test flakiness. I've suggested a small improvement to make the Playwright locator even more specific and robust, further improving test stability.
| // remove score criterion | ||
| await page.keyboard.press('Shift+Tab'); | ||
| await page.keyboard.press('Shift+Tab'); | ||
| await expect(page.locator('.criterion-value-text', { hasText: 'Good' })).toBeFocused(); |
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.
For better test robustness, it's good practice to use more specific locators. Chaining locators can help scope the search and prevent potential flakiness if other elements with similar properties are added to the page in the future. You could scope this locator to the 'Score' pill to make it more specific.
| await expect(page.locator('.criterion-value-text', { hasText: 'Good' })).toBeFocused(); | |
| await expect(page.locator('.pill-group', { hasText: 'Score' }).locator('.criterion-value-text', { hasText: 'Good' })).toBeFocused(); |
|
Documentation. Coverage Reports: |
Sometimes playwright is faster than our app.
We need to slow it down by checking for certain
state before proceeding.