-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: Remove unnecessary act()
from Popover
tests
#47690
Conversation
Flaky tests detected in a9bd72b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4082937127
|
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.
Neat!
const popover = screen.getByTestId( 'popover-element' ); | ||
|
||
await waitFor( () => expect( popover ).toBeVisible() ); | ||
await waitFor( () => expect( popover ).toHaveFocus() ); |
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.
Why is the double await
necessary? Should we add an inline comment with the explanation?
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.
It's not necessary actually. I've cleaned the second one up.
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.
🚀
What?
This PR cleans up a few unnecessary
act()
calls and improves some of thePopover
tests.Why?
When preparing our tests to work with React 18 we did a bunch of those
act()
calls. It's time to clean them up where possible.How?
act
call.renderAsync()
helper and inlining the rendering for clarity and simplicity. IMO it wasn't adding value to the tests, but rather was creating indirection when reading the tests.Testing Instructions
Verify tests still pass:
npm run test:unit packages/components/src/popover/test/index.tsx
Testing Instructions for Keyboard
None
Screenshots or screencast
None