-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Cover Block: Add E2E
Test for FocalPointPicker
#69077
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
Cover Block: Add E2E
Test for FocalPointPicker
#69077
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. |
When you have a moment, could you please review this PR? |
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 the PR!
I think the current test checks the behavior of the FocalPointPicker
component itself, and does not seem to be related to the Cover block at all.
We should check that the values set in the focal point picker are correctly applied to the block.
So I think we need to check at least two things:
toMatchObject
: Whether the focal point values are saved as attributes
toHaveCSS
: Whether inline styles are added to block HTML
7880ab1
to
251631b
Compare
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.
LGTM 👍
* feat: Add e2e test for focal point picker in cover block * fix: Use existing editor API to select blocks * fix: Refactored to use Accessible selectors while selecting focalPointInputs * feat: Expect cover block to have updated focalPoint attributes * feat: Expect the visual DOM to have the CSS applied because of updates in focals * feat: Update the focal inputs to have different values for top and left * feat: Add toMatchObject for the check for attributes in core/cover * feat: Update frontend expect to have 30% in left object-position Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ockham <bernhard-reiter@git.wordpress.org>
What?
Closes: #29002
This PR adds an end-to-end (E2E) test to ensure the Focal Point Picker in the Cover block works correctly.
Why?
We've encountered regressions in the past related to the Cover block's Focal Point Picker (e.g., #28487). Currently, there is no E2E test coverage for this feature, so adding a test will help prevent future regressions.
How?
Testing Instructions
Run the test using the following command:
To run only this test, temporarily modify the test to use
.only()
like this:For debugging, change headless to false in the playwright.config.js file to view the UI while the test runs.
Screencast
Screen.Recording.2025-02-06.at.5.08.46.PM.mov
Screenshot of the test cases for the Cover block. Observe the 8th test case, which has been added in this PR.