Skip to content
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

Add: End to end test to content locking stop editing as blocks behavior #57812

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions test/e2e/specs/editor/various/content-only-lock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,56 @@
},
] );
} );

test( 'should be able to automatically stop temporarily modify as blocks when an outside block is selected', async ( {
editor,
page,
pageUtils,
} ) => {
// Add content only locked block in the code editor
await pageUtils.pressKeys( 'secondary+M' ); // Emulates CTRL+Shift+Alt + M => toggle code editor

await page.getByPlaceholder( 'Start writing with text or HTML' )
.fill( `<!-- wp:group {"templateLock":"contentOnly","layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Locked block a</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Locked block b</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

<!-- wp:heading -->
<h2 class="wp-block-heading"><strong>outside block</strong></h2>
<!-- /wp:heading -->` );

await pageUtils.pressKeys( 'secondary+M' );
// Select the content locked block.
await editor.canvas
.locator( 'role=document[name="Block: Group"i]' )
.click();
// Press modify to temporarily edit as blocks.
await editor.clickBlockOptionsMenuItem( 'Modify' );
// Selected a nest paragraph verify Block is not content locked
// Styles can be changed and nested blocks can be removed
await editor.canvas
.locator( 'role=document[name="Block: Paragraph"i]' )
.first()
.click();
await expect(
page.locator( '.color-block-support-panel' )
).toBeAttached();
await editor.clickBlockOptionsMenuItem( 'Delete' );
// Select an outside block
await editor.canvas
.locator( 'role=document[name="Block: Heading"i]' )
.click();
// Select a locked nested paragraph block again
await pageUtils.pressKeys( 'ArrowUp' );
// Block is content locked again simple styles like position can not be changed.
await expect(
page.locator( '.color-block-support-panel' )
).not.toBeAttached();

Check failure on line 129 in test/e2e/specs/editor/various/content-only-lock.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 3

[chromium] › editor/various/content-only-lock.spec.js:80:2 › Content-only lock › should be able to automatically stop temporarily modify as blocks when an outside block is selected

1) [chromium] › editor/various/content-only-lock.spec.js:80:2 › Content-only lock › should be able to automatically stop temporarily modify as blocks when an outside block is selected Error: Timed out 5000ms waiting for expect(locator).not.toBeAttached() Locator: locator('.color-block-support-panel') Expected: not attached Received: attached Call log: - expect.not.toBeAttached with timeout 5000ms - waiting for locator('.color-block-support-panel') - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" 127 | await expect( 128 | page.locator( '.color-block-support-panel' ) > 129 | ).not.toBeAttached(); | ^ 130 | } ); 131 | } ); 132 | at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/content-only-lock.spec.js:129:9

Check failure on line 129 in test/e2e/specs/editor/various/content-only-lock.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 3

[chromium] › editor/various/content-only-lock.spec.js:80:2 › Content-only lock › should be able to automatically stop temporarily modify as blocks when an outside block is selected

1) [chromium] › editor/various/content-only-lock.spec.js:80:2 › Content-only lock › should be able to automatically stop temporarily modify as blocks when an outside block is selected Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).not.toBeAttached() Locator: locator('.color-block-support-panel') Expected: not attached Received: attached Call log: - expect.not.toBeAttached with timeout 5000ms - waiting for locator('.color-block-support-panel') - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" 127 | await expect( 128 | page.locator( '.color-block-support-panel' ) > 129 | ).not.toBeAttached(); | ^ 130 | } ); 131 | } ); 132 | at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/content-only-lock.spec.js:129:9

Check failure on line 129 in test/e2e/specs/editor/various/content-only-lock.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 3

[chromium] › editor/various/content-only-lock.spec.js:80:2 › Content-only lock › should be able to automatically stop temporarily modify as blocks when an outside block is selected

1) [chromium] › editor/various/content-only-lock.spec.js:80:2 › Content-only lock › should be able to automatically stop temporarily modify as blocks when an outside block is selected Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).not.toBeAttached() Locator: locator('.color-block-support-panel') Expected: not attached Received: attached Call log: - expect.not.toBeAttached with timeout 5000ms - waiting for locator('.color-block-support-panel') - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" - locator resolved to <div data-wp-c16t="true" data-wp-component="ToolsPane…>…</div> - unexpected value "true" 127 | await expect( 128 | page.locator( '.color-block-support-panel' ) > 129 | ).not.toBeAttached(); | ^ 130 | } ); 131 | } ); 132 | at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/content-only-lock.spec.js:129:9
} );
} );
Loading