forked from WordPress/gutenberg
/
validate-multiple-use.spec.js
44 lines (37 loc) · 1.09 KB
/
validate-multiple-use.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
async function showBlockMenuItems( { editor, page } ) {
await editor.showBlockToolbar();
await page
.getByRole( 'toolbar', { name: 'Block tools' } )
.getByRole( 'button', { name: 'Options' } )
.click();
}
test.describe( 'Validate multiple use', () => {
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );
test( 'should display correct amount of warning message', async ( {
editor,
page,
} ) => {
// Insert a block with `multiple` feature enabled, such as `core/more`
await editor.insertBlock( {
name: 'core/more',
} );
// Group the block
await showBlockMenuItems( { editor, page } );
await page.getByRole( 'menuitem', { name: 'Group' } ).click();
// Duplicate the block
await showBlockMenuItems( { editor, page } );
await page.getByRole( 'menuitem', { name: 'Duplicate' } ).click();
// Check if warnings is visible
await expect(
editor.canvas.getByRole( 'button', {
name: 'Find original',
} )
).toBeVisible();
} );
} );