Skip to content

Commit

Permalink
Update e2e tests that use code editor (#52788)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Jul 24, 2023
1 parent 30520b7 commit 81b58d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
14 changes: 8 additions & 6 deletions test/e2e/specs/editor/blocks/list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,17 +1241,19 @@ test.describe( 'List (@firefox)', () => {

test( 'can be created by pasting an empty list (-firefox)', async ( {
editor,
page,
pageUtils,
} ) => {
// Open code editor
await pageUtils.pressKeys( 'secondary+M' ); // Emulates CTRL+Shift+Alt + M => toggle code editor

// Paste empty list block
pageUtils.setClipboardData( {
plainText:
'<!-- wp:list -->\n<ul><li></li></ul>\n<!-- /wp:list -->',
} );
await pageUtils.pressKeys( 'primary+v' );
// Add empty list block
await page.getByPlaceholder( 'Start writing with text or HTML' )
.fill( `<!-- wp:list -->
<ul><!-- wp:list-item -->
<li></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->` );

// Go back to normal editor
await pageUtils.pressKeys( 'secondary+M' ); // Emulates CTRL+Shift+Alt + M => toggle code editor
Expand Down
15 changes: 8 additions & 7 deletions test/e2e/specs/editor/various/content-only-lock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ test.describe( 'Content-only lock', () => {
} ) => {
// Add content only locked block in the code editor
await pageUtils.pressKeys( 'secondary+M' ); // Emulates CTRL+Shift+Alt + M => toggle code editor
await page.click( '.editor-post-text-editor' );
await page.keyboard
.type( `<!-- wp:group {"templateLock":"contentOnly","layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Hello</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->` );

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>Hello</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->` );

await pageUtils.pressKeys( 'secondary+M' );
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
await editor.canvas.click( 'role=document[name="Paragraph block"i]' );
Expand Down

0 comments on commit 81b58d3

Please sign in to comment.