@wordpress/e2e-tests 2.5.17 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE.md +1 -1
  3. package/config/flaky-tests-reporter.js +2 -1
  4. package/package.json +12 -11
  5. package/plugins/query-block.php +2 -2
  6. package/specs/editor/blocks/__snapshots__/heading.test.js.snap +2 -2
  7. package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +29 -57
  8. package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
  9. package/specs/editor/blocks/classic.test.js +5 -2
  10. package/specs/editor/blocks/columns.test.js +1 -1
  11. package/specs/editor/blocks/cover.test.js +1 -1
  12. package/specs/editor/blocks/heading.test.js +15 -3
  13. package/specs/editor/blocks/image.test.js +1 -2
  14. package/specs/editor/blocks/navigation.test.js +311 -439
  15. package/specs/editor/blocks/preformatted.test.js +2 -1
  16. package/specs/editor/blocks/site-title.test.js +2 -31
  17. package/specs/editor/fixtures/menu-items-request-fixture.json +84 -0
  18. package/specs/editor/fixtures/menu-items-response-fixture.json +240 -144
  19. package/specs/editor/plugins/block-variations.test.js +1 -1
  20. package/specs/editor/plugins/custom-post-types.test.js +4 -3
  21. package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
  22. package/specs/editor/various/adding-patterns.test.js +1 -1
  23. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
  24. package/specs/editor/various/block-grouping.test.js +2 -18
  25. package/specs/editor/various/block-hierarchy-navigation.test.js +3 -3
  26. package/specs/editor/various/change-detection.test.js +5 -0
  27. package/specs/editor/various/editor-modes.test.js +7 -0
  28. package/specs/editor/various/font-size-picker.test.js +58 -18
  29. package/specs/editor/various/inserting-blocks.test.js +6 -2
  30. package/specs/editor/various/keyboard-navigable-blocks.test.js +6 -0
  31. package/specs/editor/various/list-view.test.js +2 -2
  32. package/specs/editor/various/navigable-toolbar.test.js +2 -2
  33. package/specs/editor/various/post-editor-template-mode.test.js +1 -1
  34. package/specs/editor/various/preview.test.js +67 -2
  35. package/specs/editor/various/reusable-blocks.test.js +53 -31
  36. package/specs/editor/various/undo.test.js +21 -0
  37. package/specs/editor/various/writing-flow.test.js +8 -4
  38. package/specs/performance/site-editor.test.js +1 -1
  39. package/specs/site-editor/document-settings.test.js +5 -5
  40. package/specs/site-editor/multi-entity-editing.test.js +2 -2
  41. package/specs/site-editor/multi-entity-saving.test.js +53 -63
  42. package/specs/site-editor/settings-sidebar.test.js +4 -4
  43. package/specs/site-editor/site-editor-export.test.js +1 -1
  44. package/specs/site-editor/site-editor-inserter.test.js +1 -1
  45. package/specs/site-editor/template-part.test.js +95 -79
  46. package/specs/site-editor/template-revert.test.js +13 -9
  47. package/specs/widgets/customizing-widgets.test.js +7 -3
@@ -181,7 +181,7 @@ describe( 'Block variations', () => {
181
181
  ).toBeTruthy();
182
182
  const description = await getBlockCardDescription();
183
183
  expect( description ).toEqual(
184
- 'Start with the building block of all narrative.'
184
+ 'Start with the basic building block of all narrative.'
185
185
  );
186
186
  } );
187
187
  } );
@@ -7,6 +7,7 @@ import {
7
7
  deactivatePlugin,
8
8
  publishPost,
9
9
  findSidebarPanelWithTitle,
10
+ clickBlockAppender,
10
11
  } from '@wordpress/e2e-test-utils';
11
12
 
12
13
  const openPageAttributesPanel = async () => {
@@ -40,7 +41,7 @@ describe( 'Test Custom Post Types', () => {
40
41
 
41
42
  // Create a parent post.
42
43
  await createNewPost( { postType: 'hierar-no-title' } );
43
- await page.click( '.block-editor-writing-flow' );
44
+ await clickBlockAppender();
44
45
  await page.keyboard.type( 'Parent Post' );
45
46
  await publishPost();
46
47
  // Create a post that is a child of the previously created post.
@@ -55,7 +56,7 @@ describe( 'Test Custom Post Types', () => {
55
56
  ( element ) => element.textContent
56
57
  );
57
58
  await optionToSelect.click();
58
- await page.click( '.block-editor-writing-flow' );
59
+ await clickBlockAppender();
59
60
  await page.keyboard.type( 'Child Post' );
60
61
  await publishPost();
61
62
  // Reload the child post and verify it is still correctly selected as a child post.
@@ -72,7 +73,7 @@ describe( 'Test Custom Post Types', () => {
72
73
  } );
73
74
  it( 'should create a cpt with a legacy block in its template without WSOD', async () => {
74
75
  await createNewPost( { postType: 'leg_block_in_tpl' } );
75
- await page.click( '.block-editor-writing-flow' );
76
+ await clickBlockAppender();
76
77
  await page.keyboard.type( 'Hello there' );
77
78
  await page.waitForSelector( '[data-type="core/embed"]' );
78
79
  await publishPost();
@@ -2,112 +2,126 @@
2
2
 
3
3
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 1`] = `
4
4
  "<!-- wp:paragraph -->
5
- <p>First paragraph</p>
5
+ <p>1st</p>
6
6
  <!-- /wp:paragraph -->
7
7
 
8
8
  <!-- wp:paragraph -->
9
- <p>Second paragraph</p>
9
+ <p>2nd</p>
10
10
  <!-- /wp:paragraph -->
11
11
 
12
12
  <!-- wp:paragraph -->
13
- <p>Third paragraph</p>
13
+ <p>3rd</p>
14
14
  <!-- /wp:paragraph -->"
15
15
  `;
16
16
 
17
17
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 2`] = `
18
18
  "<!-- wp:paragraph -->
19
- <p>Third paragraph</p>
19
+ <p>3rd</p>
20
20
  <!-- /wp:paragraph -->
21
21
 
22
22
  <!-- wp:paragraph -->
23
- <p>First paragraph</p>
23
+ <p>1st</p>
24
24
  <!-- /wp:paragraph -->
25
25
 
26
26
  <!-- wp:paragraph -->
27
- <p>Second paragraph</p>
27
+ <p>2nd</p>
28
28
  <!-- /wp:paragraph -->"
29
29
  `;
30
30
 
31
31
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 1`] = `
32
32
  "<!-- wp:paragraph -->
33
- <p>First paragraph</p>
33
+ <p>1st</p>
34
34
  <!-- /wp:paragraph -->
35
35
 
36
36
  <!-- wp:paragraph -->
37
- <p>Second paragraph</p>
37
+ <p>2nd</p>
38
38
  <!-- /wp:paragraph -->
39
39
 
40
40
  <!-- wp:paragraph -->
41
- <p>Third paragraph</p>
41
+ <p>3rd</p>
42
42
  <!-- /wp:paragraph -->"
43
43
  `;
44
44
 
45
45
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 2`] = `
46
46
  "<!-- wp:paragraph -->
47
- <p>Second paragraph</p>
47
+ <p>2nd</p>
48
48
  <!-- /wp:paragraph -->
49
49
 
50
50
  <!-- wp:paragraph -->
51
- <p>Third paragraph</p>
51
+ <p>3rd</p>
52
52
  <!-- /wp:paragraph -->
53
53
 
54
54
  <!-- wp:paragraph -->
55
- <p>First paragraph</p>
55
+ <p>1st</p>
56
56
  <!-- /wp:paragraph -->"
57
57
  `;
58
58
 
59
59
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 1`] = `
60
60
  "<!-- wp:paragraph -->
61
- <p>First paragraph</p>
61
+ <p>1st</p>
62
62
  <!-- /wp:paragraph -->
63
63
 
64
64
  <!-- wp:paragraph -->
65
- <p>Second paragraph</p>
65
+ <p>2nd</p>
66
66
  <!-- /wp:paragraph -->
67
67
 
68
68
  <!-- wp:paragraph -->
69
- <p>Third paragraph</p>
69
+ <p>3rd</p>
70
70
  <!-- /wp:paragraph -->"
71
71
  `;
72
72
 
73
73
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 2`] = `
74
74
  "<!-- wp:paragraph -->
75
- <p>First paragraph</p>
75
+ <p>1st</p>
76
76
  <!-- /wp:paragraph -->
77
77
 
78
78
  <!-- wp:paragraph -->
79
- <p>Third paragraph</p>
79
+ <p>3rd</p>
80
80
  <!-- /wp:paragraph -->
81
81
 
82
82
  <!-- wp:paragraph -->
83
- <p>Second paragraph</p>
83
+ <p>2nd</p>
84
84
  <!-- /wp:paragraph -->"
85
85
  `;
86
86
 
87
87
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 1`] = `
88
88
  "<!-- wp:paragraph -->
89
- <p>First paragraph</p>
89
+ <p>1st</p>
90
90
  <!-- /wp:paragraph -->
91
91
 
92
92
  <!-- wp:paragraph -->
93
- <p>Second paragraph</p>
93
+ <p>2nd</p>
94
94
  <!-- /wp:paragraph -->
95
95
 
96
96
  <!-- wp:paragraph -->
97
- <p>Third paragraph</p>
97
+ <p>3rd</p>
98
98
  <!-- /wp:paragraph -->"
99
99
  `;
100
100
 
101
101
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 2`] = `
102
102
  "<!-- wp:paragraph -->
103
- <p>Third paragraph</p>
103
+ <p>3rd</p>
104
104
  <!-- /wp:paragraph -->
105
105
 
106
106
  <!-- wp:paragraph -->
107
- <p>First paragraph</p>
107
+ <p>1st</p>
108
108
  <!-- /wp:paragraph -->
109
109
 
110
110
  <!-- wp:paragraph -->
111
- <p>Second paragraph</p>
111
+ <p>2nd</p>
112
+ <!-- /wp:paragraph -->"
113
+ `;
114
+
115
+ exports[`block editor keyboard shortcuts test shortcuts handling through portals in the same tree should prevent deleting multiple selected blocks from inputs 1`] = `
116
+ "<!-- wp:paragraph -->
117
+ <p>1st</p>
118
+ <!-- /wp:paragraph -->
119
+
120
+ <!-- wp:paragraph -->
121
+ <p>2nd</p>
122
+ <!-- /wp:paragraph -->
123
+
124
+ <!-- wp:paragraph -->
125
+ <p>3rd</p>
112
126
  <!-- /wp:paragraph -->"
113
127
  `;
@@ -7,7 +7,7 @@ import {
7
7
  getEditedPostContent,
8
8
  } from '@wordpress/e2e-test-utils';
9
9
 
10
- /** @typedef {import('puppeteer').ElementHandle} ElementHandle */
10
+ /** @typedef {import('puppeteer-core').ElementHandle} ElementHandle */
11
11
 
12
12
  describe( 'adding patterns', () => {
13
13
  beforeEach( async () => {
@@ -6,15 +6,18 @@ import {
6
6
  clickBlockAppender,
7
7
  getEditedPostContent,
8
8
  pressKeyWithModifier,
9
+ clickBlockToolbarButton,
10
+ clickMenuItem,
11
+ clickOnCloseModalButton,
9
12
  } from '@wordpress/e2e-test-utils';
10
13
 
11
14
  const createTestParagraphBlocks = async () => {
12
15
  await clickBlockAppender();
13
- await page.keyboard.type( 'First paragraph' );
16
+ await page.keyboard.type( '1st' );
14
17
  await page.keyboard.press( 'Enter' );
15
- await page.keyboard.type( 'Second paragraph' );
18
+ await page.keyboard.type( '2nd' );
16
19
  await page.keyboard.press( 'Enter' );
17
- await page.keyboard.type( 'Third paragraph' );
20
+ await page.keyboard.type( '3rd' );
18
21
  };
19
22
 
20
23
  describe( 'block editor keyboard shortcuts', () => {
@@ -66,4 +69,41 @@ describe( 'block editor keyboard shortcuts', () => {
66
69
  } );
67
70
  } );
68
71
  } );
72
+ describe( 'test shortcuts handling through portals in the same tree', () => {
73
+ beforeEach( async () => {
74
+ await createTestParagraphBlocks();
75
+ // Multiselect via keyboard.
76
+ await pressKeyWithModifier( 'primary', 'a' );
77
+ await pressKeyWithModifier( 'primary', 'a' );
78
+ } );
79
+ it( 'should propagate properly and delete selected blocks', async () => {
80
+ await clickBlockToolbarButton( 'Options' );
81
+ const label = 'Duplicate';
82
+ await page.$x(
83
+ `//div[@role="menu"]//span[contains(concat(" ", @class, " "), " components-menu-item__item ")][contains(text(), "${ label }")]`
84
+ );
85
+ await page.keyboard.press( 'Delete' );
86
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot(
87
+ `""`
88
+ );
89
+ } );
90
+ it( 'should prevent deleting multiple selected blocks from inputs', async () => {
91
+ await clickBlockToolbarButton( 'Options' );
92
+ await clickMenuItem( 'Add to Reusable blocks' );
93
+ const reusableBlockNameInputSelector =
94
+ '.reusable-blocks-menu-items__convert-modal .components-text-control__input';
95
+ const nameInput = await page.waitForSelector(
96
+ reusableBlockNameInputSelector
97
+ );
98
+ await nameInput.click();
99
+ await page.keyboard.type( 'hi' );
100
+ await page.keyboard.press( 'Backspace' );
101
+ await page.keyboard.press( 'ArrowLeft' );
102
+ await page.keyboard.press( 'Delete' );
103
+ await clickOnCloseModalButton(
104
+ '.reusable-blocks-menu-items__convert-modal'
105
+ );
106
+ expect( await getEditedPostContent() ).toMatchSnapshot();
107
+ } );
108
+ } );
69
109
  } );
@@ -13,6 +13,7 @@ import {
13
13
  getAvailableBlockTransforms,
14
14
  activatePlugin,
15
15
  deactivatePlugin,
16
+ createReusableBlock,
16
17
  } from '@wordpress/e2e-test-utils';
17
18
 
18
19
  async function insertBlocksOfSameType() {
@@ -122,24 +123,7 @@ describe( 'Block Grouping', () => {
122
123
  };
123
124
 
124
125
  const paragraphText = 'hi';
125
- const reusableBlockNameInputSelector =
126
- '.reusable-blocks-menu-items__convert-modal .components-text-control__input';
127
- await insertBlock( 'Paragraph' );
128
- await page.keyboard.type( paragraphText );
129
-
130
- await clickBlockToolbarButton( 'Options' );
131
- await clickMenuItem( 'Add to Reusable blocks' );
132
- const nameInput = await page.waitForSelector(
133
- reusableBlockNameInputSelector
134
- );
135
- await nameInput.click();
136
- await page.keyboard.type( 'Block' );
137
- await page.keyboard.press( 'Enter' );
138
-
139
- // Wait for creation to finish
140
- await page.waitForXPath(
141
- '//*[contains(@class, "components-snackbar")]/*[text()="Reusable block created."]'
142
- );
126
+ await createReusableBlock( paragraphText, 'Block' );
143
127
  // Group
144
128
  await clickBlockToolbarButton( 'Options' );
145
129
  await clickMenuItem( 'Group' );
@@ -51,7 +51,7 @@ describe( 'Navigating the block hierarchy', () => {
51
51
  await page.click( '.edit-post-header-toolbar__list-view-toggle' );
52
52
  const columnsBlockMenuItem = (
53
53
  await page.$x(
54
- "//button[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Columns')]"
54
+ "//a[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Columns')]"
55
55
  )
56
56
  )[ 0 ];
57
57
  await columnsBlockMenuItem.click();
@@ -75,7 +75,7 @@ describe( 'Navigating the block hierarchy', () => {
75
75
  // Navigate to the last column block.
76
76
  const lastColumnsBlockMenuItem = (
77
77
  await page.$x(
78
- "//button[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Column')]"
78
+ "//a[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Column')]"
79
79
  )
80
80
  )[ 3 ];
81
81
  await lastColumnsBlockMenuItem.click();
@@ -188,7 +188,7 @@ describe( 'Navigating the block hierarchy', () => {
188
188
  await page.click( '.edit-post-header-toolbar__list-view-toggle' );
189
189
  const groupMenuItem = (
190
190
  await page.$x(
191
- "//button[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Group')]"
191
+ "//a[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Group')]"
192
192
  )
193
193
  )[ 0 ];
194
194
  await groupMenuItem.click();
@@ -10,6 +10,7 @@ import {
10
10
  saveDraft,
11
11
  openDocumentSettingsSidebar,
12
12
  isCurrentURL,
13
+ openTypographyToolsPanelMenu,
13
14
  } from '@wordpress/e2e-test-utils';
14
15
 
15
16
  describe( 'Change detection', () => {
@@ -381,6 +382,10 @@ describe( 'Change detection', () => {
381
382
 
382
383
  // Change the paragraph's `drop cap`.
383
384
  await page.click( '[data-type="core/paragraph"]' );
385
+
386
+ await openTypographyToolsPanelMenu();
387
+ await page.click( 'button[aria-label="Show Drop cap"]' );
388
+
384
389
  const [ dropCapToggle ] = await page.$x(
385
390
  "//label[contains(text(), 'Drop cap')]"
386
391
  );
@@ -10,6 +10,7 @@ import {
10
10
  switchEditorModeTo,
11
11
  pressKeyTimes,
12
12
  pressKeyWithModifier,
13
+ openTypographyToolsPanelMenu,
13
14
  } from '@wordpress/e2e-test-utils';
14
15
 
15
16
  describe( 'Editing modes (visual/HTML)', () => {
@@ -54,6 +55,9 @@ describe( 'Editing modes (visual/HTML)', () => {
54
55
 
55
56
  // The `drop cap` toggle for the paragraph block should appear, even in
56
57
  // HTML editing mode.
58
+ await openTypographyToolsPanelMenu();
59
+ await page.click( 'button[aria-label="Show Drop cap"]' );
60
+
57
61
  const dropCapToggle = await page.$x(
58
62
  "//label[contains(text(), 'Drop cap')]"
59
63
  );
@@ -74,6 +78,9 @@ describe( 'Editing modes (visual/HTML)', () => {
74
78
  expect( htmlBlockContent ).toEqual( '<p>Hello world!</p>' );
75
79
 
76
80
  // Change the `drop cap` using the sidebar.
81
+ await openTypographyToolsPanelMenu();
82
+ await page.click( 'button[aria-label="Show Drop cap"]' );
83
+
77
84
  const [ dropCapToggle ] = await page.$x(
78
85
  "//label[contains(text(), 'Drop cap')]"
79
86
  );
@@ -7,7 +7,7 @@ import {
7
7
  createNewPost,
8
8
  pressKeyWithModifier,
9
9
  pressKeyTimes,
10
- activateTheme,
10
+ openTypographyToolsPanelMenu,
11
11
  } from '@wordpress/e2e-test-utils';
12
12
 
13
13
  const openFontSizeSelectControl = async () => {
@@ -17,13 +17,6 @@ const openFontSizeSelectControl = async () => {
17
17
  return selectControl.click();
18
18
  };
19
19
 
20
- const openTypographyToolsPanelMenu = async () => {
21
- const toggleSelector =
22
- "//div[contains(@class, 'typography-block-support-panel')]//button[contains(@class, 'components-dropdown-menu__toggle')]";
23
- const toggle = await page.waitForXPath( toggleSelector );
24
- return toggle.click();
25
- };
26
-
27
20
  const FONT_SIZE_TOGGLE_GROUP_SELECTOR =
28
21
  "//div[contains(@class, 'components-font-size-picker__controls')]//div[contains(@class, 'components-toggle-group-control')]";
29
22
 
@@ -106,21 +99,68 @@ describe( 'Font Size Picker', () => {
106
99
  ` );
107
100
  } );
108
101
  } );
102
+
109
103
  // A different control is rendered based on the available font sizes number.
110
104
  describe( 'More font sizes', () => {
111
- beforeAll( async () => {
112
- await activateTheme( 'tt1-blocks' );
113
- } );
114
- afterAll( async () => {
115
- await activateTheme( 'twentytwentyone' );
105
+ beforeEach( async () => {
106
+ await page.evaluate( () => {
107
+ wp.data.dispatch( 'core/block-editor' ).updateSettings(
108
+ // eslint-disable-next-line no-undef
109
+ lodash.merge(
110
+ wp.data.select( 'core/block-editor' ).getSettings(),
111
+ {
112
+ __experimentalFeatures: {
113
+ typography: {
114
+ fontSizes: {
115
+ default: [
116
+ {
117
+ name: 'Tiny',
118
+ slug: 'tiny',
119
+ size: '11px',
120
+ },
121
+ ,
122
+ {
123
+ name: 'Small',
124
+ slug: 'small',
125
+ size: '13px',
126
+ },
127
+ {
128
+ name: 'Medium',
129
+ slug: 'medium',
130
+ size: '20px',
131
+ },
132
+ {
133
+ name: 'Large',
134
+ slug: 'large',
135
+ size: '36px',
136
+ },
137
+ {
138
+ name: 'Extra Large',
139
+ slug: 'x-large',
140
+ size: '42px',
141
+ },
142
+ {
143
+ name: 'Huge',
144
+ slug: 'huge',
145
+ size: '48px',
146
+ },
147
+ ],
148
+ },
149
+ },
150
+ },
151
+ }
152
+ )
153
+ );
154
+ } );
116
155
  } );
156
+
117
157
  it( 'should apply a named font size using the font size buttons', async () => {
118
158
  // Create a paragraph block with some content.
119
159
  await clickBlockAppender();
120
160
  await page.keyboard.type( 'Paragraph to be made "large"' );
121
161
 
122
162
  await openFontSizeSelectControl();
123
- await pressKeyTimes( 'ArrowDown', 4 );
163
+ await pressKeyTimes( 'ArrowDown', 5 );
124
164
  await page.keyboard.press( 'Enter' );
125
165
 
126
166
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
@@ -137,11 +177,11 @@ describe( 'Font Size Picker', () => {
137
177
  );
138
178
 
139
179
  await openFontSizeSelectControl();
140
- await pressKeyTimes( 'ArrowDown', 3 );
180
+ await pressKeyTimes( 'ArrowDown', 4 );
141
181
  await page.keyboard.press( 'Enter' );
142
182
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
143
- "<!-- wp:paragraph {\\"fontSize\\":\\"normal\\"} -->
144
- <p class=\\"has-normal-font-size\\">Paragraph with font size reset using tools panel menu</p>
183
+ "<!-- wp:paragraph {\\"fontSize\\":\\"medium\\"} -->
184
+ <p class=\\"has-medium-font-size\\">Paragraph with font size reset using tools panel menu</p>
145
185
  <!-- /wp:paragraph -->"
146
186
  ` );
147
187
 
@@ -164,7 +204,7 @@ describe( 'Font Size Picker', () => {
164
204
  );
165
205
 
166
206
  await openFontSizeSelectControl();
167
- await pressKeyTimes( 'ArrowDown', 2 );
207
+ await pressKeyTimes( 'ArrowDown', 3 );
168
208
  await page.keyboard.press( 'Enter' );
169
209
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
170
210
  "<!-- wp:paragraph {\\"fontSize\\":\\"small\\"} -->
@@ -14,7 +14,7 @@ import {
14
14
  pressKeyWithModifier,
15
15
  } from '@wordpress/e2e-test-utils';
16
16
 
17
- /** @typedef {import('puppeteer').ElementHandle} ElementHandle */
17
+ /** @typedef {import('puppeteer-core').ElementHandle} ElementHandle */
18
18
 
19
19
  /**
20
20
  * Waits for all patterns in the inserter to have a height, which should
@@ -173,7 +173,7 @@ describe( 'Inserting blocks', () => {
173
173
  // Check for regression of https://github.com/WordPress/gutenberg/issues/9583
174
174
  it( 'should not allow transfer of focus outside of the block-insertion menu once open', async () => {
175
175
  // Enter the default block and click the inserter toggle button to the left of it.
176
- await page.keyboard.press( 'ArrowDown' );
176
+ await page.keyboard.press( 'Enter' );
177
177
  await showBlockToolbar();
178
178
  await page.click(
179
179
  '.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle'
@@ -243,6 +243,10 @@ describe( 'Inserting blocks', () => {
243
243
  );
244
244
  expect( selectedButtonBlocks.length ).toBe( 1 );
245
245
 
246
+ // The block appender is only visible when there's no selection.
247
+ await page.evaluate( () =>
248
+ window.wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock()
249
+ );
246
250
  // Specifically click the root container appender.
247
251
  await page.click(
248
252
  '.block-editor-block-list__layout.is-root-container > .block-list-appender .block-editor-inserter__toggle'
@@ -155,6 +155,12 @@ describe( 'Order of block keyboard navigation', () => {
155
155
  .focus();
156
156
  } );
157
157
 
158
+ await pressKeyWithModifier( 'shift', 'Tab' );
159
+ await expect( await getActiveLabel() ).toBe( 'Add block' );
160
+
161
+ await pressKeyWithModifier( 'shift', 'Tab' );
162
+ await expect( await getActiveLabel() ).toBe( 'Add default block' );
163
+
158
164
  await pressKeyWithModifier( 'shift', 'Tab' );
159
165
  await expect( await getActiveLabel() ).toBe(
160
166
  'Paragraph Block. Row 2. 1'
@@ -42,12 +42,12 @@ describe( 'List view', () => {
42
42
  await pressKeyWithModifier( 'access', 'o' );
43
43
 
44
44
  const paragraphBlock = await page.waitForXPath(
45
- '//button[contains(., "Paragraph")][@draggable="true"]'
45
+ '//a[contains(., "Paragraph")][@draggable="true"]'
46
46
  );
47
47
 
48
48
  // Drag above the heading block
49
49
  const headingBlock = await page.waitForXPath(
50
- '//button[contains(., "Heading")][@draggable="true"]'
50
+ '//a[contains(., "Heading")][@draggable="true"]'
51
51
  );
52
52
 
53
53
  await dragAndDrop( paragraphBlock, headingBlock, -5 );
@@ -31,8 +31,8 @@ describe.each( [
31
31
 
32
32
  it( 'navigates in and out of toolbar by keyboard (Alt+F10, Escape)', async () => {
33
33
  // Assumes new post focus starts in title. Create first new
34
- // block by ArrowDown.
35
- await page.keyboard.press( 'ArrowDown' );
34
+ // block by Enter.
35
+ await page.keyboard.press( 'Enter' );
36
36
 
37
37
  // [TEMPORARY]: A new paragraph is not technically a block yet
38
38
  // until starting to type within it.
@@ -102,7 +102,7 @@ describe( 'Post Editor Template mode', () => {
102
102
  } );
103
103
 
104
104
  it( 'Allow to switch to template mode, edit the template and check the result', async () => {
105
- await activateTheme( 'tt1-blocks' );
105
+ await activateTheme( 'emptytheme' );
106
106
  await createNewPost();
107
107
  // Create a random post.
108
108
  await page.type( '.editor-post-title__input', 'Just an FSE Post' );
@@ -14,7 +14,7 @@ import {
14
14
  pressKeyWithModifier,
15
15
  } from '@wordpress/e2e-test-utils';
16
16
 
17
- /** @typedef {import('puppeteer').Page} Page */
17
+ /** @typedef {import('puppeteer-core').Page} Page */
18
18
 
19
19
  /**
20
20
  * Given the Page instance for the editor, opens preview drodpdown, and
@@ -204,7 +204,7 @@ describe( 'Preview', () => {
204
204
  it( 'should not revert title during a preview right after a save draft', async () => {
205
205
  const editorPage = page;
206
206
 
207
- // Type aaaaa in the title filed.
207
+ // Type aaaaa in the title field.
208
208
  await editorPage.type( '.editor-post-title__input', 'aaaaa' );
209
209
  await editorPage.keyboard.press( 'Tab' );
210
210
 
@@ -248,6 +248,71 @@ describe( 'Preview', () => {
248
248
 
249
249
  await previewPage.close();
250
250
  } );
251
+
252
+ // Verify correct preview. See: https://github.com/WordPress/gutenberg/issues/33616
253
+ it( 'should display the correct preview when switching between published and draft statuses', async () => {
254
+ const editorPage = page;
255
+
256
+ // Type Lorem in the title field.
257
+ await editorPage.type( '[aria-label="Add title"]', 'Lorem' );
258
+
259
+ // Open the preview page.
260
+ const previewPage = await openPreviewPage( editorPage );
261
+ await previewPage.waitForSelector( '.entry-title' );
262
+
263
+ // Title in preview should match input.
264
+ let previewTitle = await previewPage.$eval(
265
+ '.entry-title',
266
+ ( node ) => node.textContent
267
+ );
268
+ expect( previewTitle ).toBe( 'Lorem' );
269
+
270
+ // Return to editor and publish post.
271
+ await editorPage.bringToFront();
272
+ await publishPost();
273
+
274
+ // Close the panel.
275
+ await page.waitForSelector( '.editor-post-publish-panel' );
276
+ await page.click( '.editor-post-publish-panel__header button' );
277
+
278
+ // Change the title and preview again.
279
+ await editorPage.type( '[aria-label="Add title"]', ' Ipsum' );
280
+ await editorPage.keyboard.press( 'Tab' );
281
+ await waitForPreviewDropdownOpen( editorPage );
282
+ await waitForPreviewNavigation( previewPage );
283
+
284
+ // Title in preview should match updated input.
285
+ previewTitle = await previewPage.$eval(
286
+ '.entry-title',
287
+ ( node ) => node.textContent
288
+ );
289
+
290
+ expect( previewTitle ).toBe( 'Lorem Ipsum' );
291
+
292
+ // Return to editor and switch to Draft.
293
+ await editorPage.bringToFront();
294
+ await editorPage.waitForSelector( '.editor-post-switch-to-draft' );
295
+ await editorPage.click( '.editor-post-switch-to-draft' );
296
+ await page.keyboard.press( 'Enter' );
297
+
298
+ // Change the title.
299
+ await editorPage.type( '[aria-label="Add title"]', 'Draft ' );
300
+ await editorPage.keyboard.press( 'Tab' );
301
+
302
+ // Open the preview page.
303
+ await waitForPreviewDropdownOpen( editorPage );
304
+ await waitForPreviewNavigation( previewPage );
305
+
306
+ // Title in preview should match updated input.
307
+ previewTitle = await previewPage.$eval(
308
+ '.entry-title',
309
+ ( node ) => node.textContent
310
+ );
311
+
312
+ expect( previewTitle ).toBe( 'Draft Lorem Ipsum' );
313
+
314
+ await previewPage.close();
315
+ } );
251
316
  } );
252
317
 
253
318
  describe( 'Preview with Custom Fields enabled', () => {