-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
writing-flow.spec.js
73 lines (66 loc) · 2.3 KB
/
writing-flow.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
test.describe( 'Site editor writing flow', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'emptytheme' );
} );
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );
// Check for regressions of https://github.com/WordPress/gutenberg/issues/41811.
test( 'allows shift tabbing to the block toolbar from the first block', async ( {
admin,
editor,
page,
pageUtils,
} ) => {
// Navigate to a template part with only a couple of blocks.
await admin.visitSiteEditor( {
postId: 'emptytheme//header',
postType: 'wp_template_part',
} );
await editor.canvas.click( 'body' );
// Select the first site title block.
const siteTitleBlock = editor.canvas.locator(
'role=document[name="Block: Site Title"i]'
);
await expect( siteTitleBlock ).toBeVisible();
await editor.selectBlocks( siteTitleBlock );
// Shift tab to the toolbar.
await pageUtils.pressKeys( 'shift+Tab' );
const blockToolbarButton = page.locator(
'role=toolbar[name="Block tools"i] >> role=button[name="Site Title"i]'
);
await expect( blockToolbarButton ).toBeFocused();
} );
// Check for regressions of https://github.com/WordPress/gutenberg/issues/41811.
test( 'allows tabbing to the inspector from the last block', async ( {
admin,
editor,
page,
pageUtils,
} ) => {
// Navigate to a template part with only a couple of blocks.
await admin.visitSiteEditor( {
postId: 'emptytheme//header',
postType: 'wp_template_part',
} );
await editor.canvas.click( 'body' );
// Make sure the sidebar is open.
await editor.openDocumentSettingsSidebar();
// Select the last site tagline block.
const siteTaglineBlock = editor.canvas.locator(
'role=document[name="Block: Site Tagline"i]'
);
await expect( siteTaglineBlock ).toBeVisible();
await editor.selectBlocks( siteTaglineBlock );
// Tab to the inspector, tabbing three times to go past the two resize handles.
await pageUtils.pressKeys( 'Tab', { times: 3 } );
const inspectorTemplateTab = page.locator(
'role=region[name="Editor settings"i] >> role=button[name="Template"i]'
);
await expect( inspectorTemplateTab ).toBeFocused();
} );
} );