Skip to content

Commit

Permalink
Consolidate duplicate block tests (#51352)
Browse files Browse the repository at this point in the history
* Remove unnecessary select all text command from duplicate block e2e test

* Consolodate duplicate block tests
  • Loading branch information
jeryj authored Jun 9, 2023
1 parent 444697d commit e41ad64
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions test/e2e/specs/editor/various/duplicating-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ test.describe( 'Duplicating blocks', () => {
await admin.createNewPost();
} );

test( 'should duplicate blocks using the block settings menu', async ( {
test( 'should duplicate blocks using the block settings menu and keyboard shortcut', async ( {
page,
pageUtils,
editor,
} ) => {
await editor.insertBlock( { name: 'core/paragraph' } );
await page.keyboard.type( 'Clone me' );

// Select the test we just typed
// This doesn't do anything but we previously had a duplicationi bug
// When the selection was not collapsed.
await pageUtils.pressKeys( 'primary+a' );

// Test: Duplicate using the block settings menu.
await editor.clickBlockToolbarButton( 'Options' );
await page.click( 'role=menuitem[name=/Duplicate/i]' );

Expand All @@ -33,29 +29,19 @@ test.describe( 'Duplicating blocks', () => {
<p>Clone me</p>
<!-- /wp:paragraph -->`
);
} );

test( 'should duplicate blocks using the keyboard shortcut', async ( {
page,
pageUtils,
editor,
} ) => {
await editor.insertBlock( { name: 'core/paragraph' } );
await page.keyboard.type( 'Clone me' );

// Select the test we just typed
// This doesn't do anything but we previously had a duplicationi bug
// When the selection was not collapsed.
await pageUtils.pressKeys( 'primary+a' );

// Duplicate using the keyboard shortccut.
// Test: Duplicate using the keyboard shortccut.
await pageUtils.pressKeys( 'primaryShift+d' );

expect( await editor.getEditedPostContent() ).toBe(
`<!-- wp:paragraph -->
<p>Clone me</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Clone me</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Clone me</p>
<!-- /wp:paragraph -->`
Expand Down

1 comment on commit e41ad64

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in e41ad64.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5220640086
📝 Reported issues:

Please sign in to comment.