-
Notifications
You must be signed in to change notification settings - Fork 4.5k
E2E Tests: Add test suite for columns block template lock #69089
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 Tests: Add test suite for columns block template lock #69089
Conversation
@himanshupathak95, let me know when this is ready for review. |
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. |
@Mamaduka, This PR is finally ready for review. Please take a look at your convenience 🙇🏻 |
Thanks for working on this, @himanshupathak95! The new tests look good to me. One thing to consider: The @t-hamano, what do you think? |
I think it's a good idea. However, the following test might be in the Columns block:
I think we can write these tests like this: Detailstest.describe( 'Columns', () => {
for ( const templateLock of [ 'all', 'insert', 'contentOnly' ] ) {
test( `templateLock="${ templateLock }" should hide column count control`, async ( {
editor,
page,
} ) => {
await editor.insertBlock( {
name: 'core/columns',
attributes: { templateLock },
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{
name: 'core/paragraph',
attributes: { content: 'Col 1' },
},
],
},
{
name: 'core/column',
innerBlocks: [
{
name: 'core/paragraph',
attributes: { content: 'Col 2' },
},
],
},
],
} );
await editor.openDocumentSettingsSidebar();
await expect(
page.getByRole( 'slider', { name: 'Columns' } )
).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.
LGTM! It would be great if we could add new tests for templateLock
in a follow-up PR.
…ntentOnly` in `column.spec.js`
e36d837
to
af8cdbf
Compare
…69089) * E2E: Add test for columns block template lock removal restriction * E2E: Improve test for templateLock - all * E2E: Move the tests from post-type-locking.spec.js to columns.spec.js * E2E: Seperate tests into multiple units * E2E: Add tests for `templateLock=insert` attribute * E2E: Add tests for templateLock=contentOnly attribute * E2E: Add `templateLock=false` test - Ensure columns block deletion prevention * E2E: Add all remaining tests for `templateLock=false` attribute * E2E: Use `selectBlocks` to select blocks * E2E: Remove all `templateLock` tests from `column.spec.js` * E2E: Keep the column count control tests for `all`, `insert`, and `contentOnly` in `column.spec.js` * E2E: Test column count control for `templateLock=false` inside locked parent * E2E: Remove redundant sibling paragraph * E2E: Remove unnecessary second column Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
Closes 49235
Adds end-to-end (E2E) tests for the
templateLock
attribute functionality on thecore/columns
block.Why?
The
templateLock
attribute was added to thecore/columns
block in #49132 to provide granular control over inner block manipulation (adding, moving, deleting columns, and inserting blocks within columns). Currently, there are no automated tests to verify this functionality.This PR adds E2E tests, as suggested in this comment on the original PR, to:
templateLock
values (all
,insert
,contentOnly
) correctly restrict or allow actions on the innercore/column
blocks.templateLock=false
is set on the Columns block itself, but it resides within a parent block (Group) that hastemplateLock="insert"
.How?
core/columns
).templateLock
attribute, verifying the expected outcomes for theall
,insert
,contentOnly
, andfalse
lock types.Testing Instructions
Check out this branch.
Run the E2E tests specifically for the columns block spec file to confirm that the new tests pass:
Verify that all tests within the new 'Template Lock' suite pass successfully.
Screenshots or screencast
N/A - This PR adds automated tests, not visual UI changes.