-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Rewrite some tests to reduce flakiness: part 1 #3871
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3871 +/- ##
=======================================
Coverage 97.84% 97.84%
=======================================
Files 42 42
Lines 1253 1253
Branches 348 348
=======================================
Hits 1226 1226
Misses 27 27 🚀 New features to boost your workflow:
|
await toggleSelection(1); | ||
testSelection(1, false); | ||
await testSelection(0, true); | ||
await toggleSelection(1, false, true); // force click even if disabled |
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.
forcing click causes flaky test in FF.
await page.mouse.up(); | ||
}; | ||
|
||
const scrollGrid: BrowserCommand<[{ scrollLeft?: number; scrollTop?: number }]> = async ( |
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.
await userEvent.keyboard('abc'); | ||
|
||
await scrollGrid({ scrollTop: 1500 }); | ||
expect(getCellsAtRowIndex(40)[1]).toHaveTextContent(/^40$/); |
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 some reason current scrolling logic is flaky in FF
https://github.com/Comcast/react-data-grid/actions/runs/17952854675/job/51056628087
Hopefully the new commands.scrollGrid
will help
|
||
await scrollGrid({ scrollTop: 1500 }); | ||
expect(getCellsAtRowIndex(40)[1]).toHaveTextContent(/^40$/); | ||
await userEvent.click(getCellsAtRowIndex(40)[1]); |
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.
This can still fail when the grid is properly scrolled. Using locators fixes it
https://vitest.dev/guide/browser/assertion-api.html#assertion-api
https://vitest.dev/guide/browser/locators.html#nth
I think we should find
cell/headercell/row
using name instead of relying on index when possible