-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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/zoom out mode hook conflicts controlled #67040
Fix/zoom out mode hook conflicts controlled #67040
Conversation
Size Change: +31 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
Flaky tests detected in 2f77abf. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11859941292
|
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.
On initial testing I wasn't able to replicate the original Issue.
Moreover, this PR adds greater test coverage which will help avoid future regressions and allow us to capture and codify any future expectations about behaviour within the tests.
Great job here @jeryj. When you're ready for a final review let me know 🙇
await expect( patternsTab ).toHaveAttribute( | ||
'data-active-item', | ||
'true' | ||
); |
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.
Should we use aria-selected
? It's a more user perceivable attribute whereas data-*
is purely for developers.
I checked to see if there was an isSelected()
but there isn't.
You can do this I believe but you'd have to modify your helper utils to accept options.
getByRole('button', {
selected: true,
});
'data-active-item', | ||
'true' | ||
); | ||
await expect( await InserterUtils.getZoomCanvas() ).toBeVisible(); |
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.
Nit: this feels a bit cumbersome. Moreover, this is only ever used for asserting on the active state of Zoom Out rather than retrieving a reference to the Zoom Out canvas itself.
Therefore it might be a clearer to have an API something like this (maybe via a dedicated ZoomOut helper?):
await expect( await InserterUtils.getZoomCanvas() ).toBeVisible(); | |
await expect( await ZoomOutUtils.isActive() ); |
Not a deal breaker but I think it would improve the readability of the tests.
// We should still be in Zoom Out | ||
await expect( await InserterUtils.getZoomCanvas() ).toBeVisible(); |
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.
The fact we need this comment is a clue that the API isn't quite right (see other comment).
await expect( await InserterUtils.getZoomCanvas() ).toBeVisible(); | ||
} ); | ||
|
||
test( 'should enter zoom out from patterns tab and exit zoom out when closing the inserter', 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.
test( 'should enter zoom out from patterns tab and exit zoom out when closing the inserter', async ( { | |
test( 'should enter zoom out when activating the patterns tab and exit zoom out when closing the inserter', async ( { |
|
||
await expect( blockLibrary ).toBeHidden(); | ||
|
||
await expect( await InserterUtils.getZoomCanvas() ).toBeHidden(); |
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 expect( await InserterUtils.getZoomCanvas() ).toBeHidden(); | |
await expect( await ZoomOut.isInactive() ); |
Maybe something like this?
// We should stayin zoom out since the inserter was opened with | ||
// zoom out engaged |
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.
// We should stayin zoom out since the inserter was opened with | |
// zoom out engaged | |
// Zoom Out should remain active since the inserter was opened with | |
// Zoom Out already engaged. |
} ); | ||
|
||
// Test for https://github.com/WordPress/gutenberg/issues/66328 | ||
test( 'should not return you to zoom out if manually disengaged', 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.
test( 'should not return you to zoom out if manually disengaged', async ( { | |
test( 'should not re-activate Zoom Out if manually disengaged', async ( { |
|
||
await expect( blockLibrary ).toBeHidden(); | ||
|
||
// We should not return to zoom out since it was manually disengaged |
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.
// We should not return to zoom out since it was manually disengaged | |
// Zoom Out should remain inactive since it was manually disengaged |
await expect( await InserterUtils.getZoomCanvas() ).toBeHidden(); | ||
} ); | ||
|
||
// Similar test to the above but starting from not zoomed in |
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.
// Similar test to the above but starting from not zoomed in | |
// Similar test to the above but starting with Zoom Out inactive |
|
||
await expect( blockLibrary ).toBeHidden(); | ||
|
||
// We should stay in zoomed out state since it was manually engaged |
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.
// We should stay in zoomed out state since it was manually engaged | |
// Zoom Out should remain active since it was manually engaged |
Closing in favor of #67591 |
What?
Some potentially useful commits to use in #67033
Closes #66328
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast