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

Migrate list view E2E tests to Playwright #47919

Merged
merged 24 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5e261e4
Migrate block list drag&drop test
WunderBart Feb 9, 2023
c29c64c
Migrate first block removal regression test
WunderBart Feb 9, 2023
6a37983
Don't use the generated snapshot
WunderBart Feb 9, 2023
8073e6c
Migrate previous block selection test
WunderBart Feb 9, 2023
d6377af
Migrate the next block selection test
WunderBart Feb 9, 2023
3f978f7
Migrate test for removing all blocks
WunderBart Feb 9, 2023
1e054f0
Migrate nested items test
WunderBart Feb 9, 2023
bea0a97
Avoid extra nesting
WunderBart Feb 10, 2023
7ff6c03
Migrate the Home/End keynavigation test
WunderBart Feb 10, 2023
d88bd71
Make test titles consistent
WunderBart Feb 10, 2023
97befc8
Remove old List View tests (complete migration)
WunderBart Feb 10, 2023
889e631
Update a few more comments
WunderBart Feb 10, 2023
1045fe3
Fix the dragging test
WunderBart Feb 10, 2023
6a43855
Move the most repeated part to a helper fn
WunderBart Feb 10, 2023
d3ff02e
Remove obsolete snapshot
WunderBart Feb 10, 2023
8b891b3
Revert "Move the most repeated part to a helper fn"
WunderBart Feb 11, 2023
6d9a7ce
Revert "Avoid extra nesting"
WunderBart Feb 11, 2023
f3223ec
Replace waitFor with expect.toBeVisible
WunderBart Feb 12, 2023
ace5e75
Add some more locator nesting for readability
WunderBart Feb 12, 2023
cdd101c
Use editor.canvas where appropriate
WunderBart Feb 12, 2023
13e794f
Remove unnecessary page error check
WunderBart Feb 12, 2023
594638a
Use getByRole( 'link' ) instead of locator( 'a' )
WunderBart Feb 12, 2023
4b80291
Use testid for the expander element
WunderBart Feb 12, 2023
4dd325f
Migrate test added in #45135
WunderBart Feb 21, 2023
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
Next Next commit
Migrate block list drag&drop test
  • Loading branch information
WunderBart committed Feb 21, 2023
commit 5e261e4b1d958f924e6616b92a44ee21e98a8642
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading"></h2>
<!-- /wp:heading -->

<!-- wp:image -->
<figure class="wp-block-image"><img alt=""/></figure>
<!-- /wp:image -->
36 changes: 36 additions & 0 deletions test/e2e/specs/editor/various/list-view.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'List view', () => {
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'allows a user to drag a block to a new sibling position', async ( {
editor,
page,
} ) => {
// Insert some blocks of different types.
await editor.insertBlock( { name: 'core/heading' } );
await editor.insertBlock( { name: 'core/image' } );
await editor.insertBlock( { name: 'core/paragraph' } );

// Bring up the paragraph block selection menu.
await page.keyboard.press( 'Escape' );

// Define the drag source and target.
const paragraphBlockDragButton = page.locator(
'button[draggable="true"][aria-label="Drag"]'
);
const headingBlock = page.getByRole( 'document', {
name: 'Block: Heading',
} );

// Drag the paragraph above the heading.
await paragraphBlockDragButton.dragTo( headingBlock, { x: 0, y: 0 } );

expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );
} );