-
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
E2E: Add regression test for spacer block in themes without spacing units #68913
E2E: Add regression test for spacer block in themes without spacing units #68913
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. |
Hey @Mamaduka, Please let me know if this PR looks good to you whenever you have time 😃 |
editor, | ||
requestUtils, | ||
} ) => { | ||
await requestUtils.activateTheme( 'twentytwenty' ); |
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.
Switching themes can be expensive, usually done in test.beforeAll
hooks. Can we find a different way to test this without switching themes?
} ); | ||
} ); | ||
|
||
await admin.createNewPost(); |
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 can remove this. It's already handled in the test.beforeEach
hook.
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.
Oh, I might have missed the line in the beforeEach
hook. Correcting this.
await page.evaluate( () => { | ||
if ( window.__originalSettings ) { | ||
window.wp.data | ||
.dispatch( 'core/block-editor' ) | ||
.updateSettings( window.__originalSettings ); | ||
delete window.__originalSettings; | ||
} | ||
} ); |
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 think there's no need to restore old settings in this case. Reloading the subsequent tests will re-open the editor, and store data will be refetched..
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 did this since in the future if we decide to add steps to this, I must clean up the changes in the configs I made. But I see how this is a far-fetched thought, so removing it.
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, @himanshupathak95!
This looks good ✅
Closes #37922
What?
Add an E2E test to ensure the Spacer block works correctly in themes without spacing unit support. This regression test switches to the Twenty Twenty theme (which doesn't support spacing units) and verifies the Spacer block can be inserted without errors.
Why?
Previously, the Spacer block would break in themes where
useSetting( 'spacing.units' )
returnedfalse
. This regression test ensures this issue doesn't recur by testing the block's functionality in a theme without spacing unit support.Reference: #37774 where the original issue was fixed. This PR adds test coverage to prevent future regressions.
Testing Instructions
Run the E2E test suite: