-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
command-center.spec.js
51 lines (46 loc) · 1.47 KB
/
command-center.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
45
46
47
48
49
50
51
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
test.describe( 'Site editor command palette', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'emptytheme' );
} );
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );
test.beforeEach( async ( { admin } ) => {
// Navigate to the site editor.
await admin.visitSiteEditor();
} );
test( 'Open the command palette and navigate to the page create page', async ( {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Open command palette' } )
.focus();
await page.keyboard.press( 'Meta+k' );
await page.keyboard.type( 'new page' );
await page.getByRole( 'option', { name: 'Add new page' } ).click();
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
const frame = page.frame( 'editor-canvas' );
await expect( page ).toHaveURL(
'/wp-admin/post-new.php?post_type=page'
);
await expect(
frame.getByRole( 'textbox', { name: 'Add title' } )
).toBeVisible();
} );
test( 'Open the command palette and navigate to a template', async ( {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Open command palette' } )
.click();
await page.keyboard.type( 'index' );
await page.getByRole( 'option', { name: 'index' } ).click();
await expect( page.getByRole( 'heading', { level: 1 } ) ).toHaveText(
'Index'
);
} );
} );