-
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
Zoom out: e2e test - zoomed out mode zooms the canvas #65943
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: 0 B Total Size: 1.77 MB ℹ️ View Unchanged
|
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.
Thanks for starting on the tests! 🎉
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.
Looks good still, couple of small comments, but should be good to merge once addressed
//We use border to separate the content from the frame so we need | ||
//to check that that is present too, since boundingBox() | ||
//includes the border to calculate the position | ||
const borderWidths = await html.evaluate( ( el ) => { | ||
const styles = window.getComputedStyle( el ); | ||
return { | ||
top: parseFloat( styles.borderTopWidth ), | ||
right: parseFloat( styles.borderRightWidth ), | ||
bottom: parseFloat( styles.borderBottomWidth ), | ||
left: parseFloat( styles.borderLeftWidth ), | ||
}; | ||
} ); | ||
expect( htmlRect.y + borderWidths.top ).toBeGreaterThan( iframeRect.y ); |
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.
I saw that a change was just merged to switch this to padding - https://github.com/WordPress/gutenberg/pull/66012/files
If only top
is used, maybe the other sides don't need to be returned from the evaluate
callback.
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 are actually changing that right now, so yeah, I'll update once we have a final solution for that
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.
I updated this to use padding. It seems a bit brittle that the e2e test is dependent on implementation, but I can't think of a better way to test this
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.
I am merging this now and we can revisit if we found a better way to check for the spacing
Co-authored-by: Daniel Richards <[email protected]>
39b3470
to
79aacfb
Compare
* removed outdated e2 tests and added a new one * Update test/e2e/specs/site-editor/zoom-out.spec.js Co-authored-by: Daniel Richards <[email protected]> * fixed canvas selector * check the size of the iframe after scaling * check if the canvas is separated * reformat comments * updated test after rebasing trunk with latest changes * recalculate the position using padding instead of border --------- Co-authored-by: Daniel Richards <[email protected]> Co-authored-by: MaggieCabrera <[email protected]> Co-authored-by: talldan <[email protected]>
What?
Part of #65797
Why?
We didn't have any e2e tests for zoom out mode
How?
This one removes the skip for zoom out mode tests and replaces the outdated test with a new one. I will follow up with more PRs from the list in Part of #65797
Testing Instructions
Run
npm run test:e2e -- site-editor/zoom-out.spec.js
and the tests should pass