@wordpress/e2e-tests 3.0.9 → 3.1.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 (63) hide show
  1. package/config/setup-performance-test.js +1 -1
  2. package/config/setup-test-framework.js +1 -1
  3. package/package.json +5 -5
  4. package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +16 -16
  5. package/specs/editor/blocks/classic.test.js +2 -2
  6. package/specs/editor/blocks/cover.test.js +17 -17
  7. package/specs/editor/blocks/list.test.js +1 -1
  8. package/specs/editor/blocks/navigation.test.js +259 -52
  9. package/specs/editor/blocks/table.test.js +1 -1
  10. package/specs/editor/plugins/align-hook.test.js +10 -10
  11. package/specs/editor/plugins/block-context.test.js +1 -1
  12. package/specs/editor/plugins/block-directory-add.test.js +14 -14
  13. package/specs/editor/plugins/custom-post-types.test.js +1 -1
  14. package/specs/editor/plugins/custom-taxonomies.test.js +3 -3
  15. package/specs/editor/plugins/meta-attribute-block.test.js +1 -1
  16. package/specs/editor/plugins/meta-boxes.test.js +3 -3
  17. package/specs/editor/plugins/templates.test.js +1 -1
  18. package/specs/editor/plugins/wp-editor-meta-box.test.js +1 -1
  19. package/specs/editor/various/autosave.test.js +19 -19
  20. package/specs/editor/various/block-deletion.test.js +5 -5
  21. package/specs/editor/various/block-grouping.test.js +29 -12
  22. package/specs/editor/various/block-hierarchy-navigation.test.js +5 -5
  23. package/specs/editor/various/change-detection.test.js +3 -3
  24. package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
  25. package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +7 -7
  26. package/specs/editor/various/datepicker.test.js +1 -1
  27. package/specs/editor/various/duplicating-blocks.test.js +3 -3
  28. package/specs/editor/various/editor-modes.test.js +5 -5
  29. package/specs/editor/various/inserting-blocks.test.js +6 -6
  30. package/specs/editor/various/invalid-block.test.js +4 -4
  31. package/specs/editor/various/is-typing.test.js +8 -8
  32. package/specs/editor/various/keyboard-navigable-blocks.test.js +2 -2
  33. package/specs/editor/various/links.test.js +90 -90
  34. package/specs/editor/various/list-view.test.js +47 -1
  35. package/specs/editor/various/manage-reusable-blocks.test.js +5 -5
  36. package/specs/editor/various/multi-block-selection.test.js +2 -2
  37. package/specs/editor/various/navigable-toolbar.test.js +1 -1
  38. package/specs/editor/various/new-post-default-content.test.js +2 -2
  39. package/specs/editor/various/new-post.test.js +1 -1
  40. package/specs/editor/various/nux.test.js +11 -11
  41. package/specs/editor/various/popovers.test.js +3 -3
  42. package/specs/editor/various/post-editor-template-mode.test.js +12 -11
  43. package/specs/editor/various/preferences.test.js +1 -1
  44. package/specs/editor/various/preview.test.js +8 -4
  45. package/specs/editor/various/publish-button.test.js +2 -2
  46. package/specs/editor/various/publishing.test.js +50 -1
  47. package/specs/editor/various/reusable-blocks.test.js +31 -31
  48. package/specs/editor/various/rich-text.test.js +1 -1
  49. package/specs/editor/various/splitting-merging.test.js +6 -6
  50. package/specs/editor/various/style-variation.test.js +2 -2
  51. package/specs/editor/various/switch-to-draft.test.js +3 -1
  52. package/specs/editor/various/taxonomies.test.js +1 -1
  53. package/specs/editor/various/toolbar-roving-tabindex.test.js +1 -1
  54. package/specs/editor/various/writing-flow.test.js +20 -20
  55. package/specs/experiments/navigation-editor.test.js +168 -3
  56. package/specs/performance/post-editor.test.js +7 -7
  57. package/specs/performance/site-editor.test.js +1 -1
  58. package/specs/site-editor/document-settings.test.js +5 -5
  59. package/specs/site-editor/multi-entity-editing.test.js +1 -1
  60. package/specs/site-editor/multi-entity-saving.test.js +1 -1
  61. package/specs/site-editor/template-part.test.js +9 -8
  62. package/specs/widgets/customizing-widgets.test.js +10 -9
  63. package/specs/widgets/editing-widgets.test.js +8 -7
@@ -98,7 +98,7 @@ describe( 'Toolbar roving tabindex', () => {
98
98
  it( 'ensures table block toolbar uses roving tabindex', async () => {
99
99
  await insertBlock( 'Table' );
100
100
  await testBlockToolbarKeyboardNavigation( 'Block: Table', 'Table' );
101
- // Move focus to the first toolbar item
101
+ // Move focus to the first toolbar item.
102
102
  await page.keyboard.press( 'Home' );
103
103
  await expectLabelToHaveFocus( 'Table' );
104
104
  await page.click( '.blocks-table__placeholder-button' );
@@ -17,7 +17,7 @@ const getActiveBlockName = async () =>
17
17
  );
18
18
 
19
19
  const addParagraphsAndColumnsDemo = async () => {
20
- // Add demo content
20
+ // Add demo content.
21
21
  await clickBlockAppender();
22
22
  await page.keyboard.type( 'First paragraph' );
23
23
  await page.keyboard.press( 'Enter' );
@@ -45,10 +45,10 @@ const addParagraphsAndColumnsDemo = async () => {
45
45
  await page.keyboard.press( 'Enter' ); // Insert paragraph.
46
46
  await page.keyboard.type( '2nd col' ); // If this text is too long, it may wrap to a new line and cause test failure. That's why we're using "2nd" instead of "Second" here.
47
47
 
48
- await page.keyboard.press( 'Escape' ); // Enter navigation mode
49
- await page.keyboard.press( 'ArrowLeft' ); // move to the column block
50
- await page.keyboard.press( 'ArrowLeft' ); // move to the columns block
51
- await page.keyboard.press( 'Enter' ); // Enter edit mode with the columns block selected
48
+ await page.keyboard.press( 'Escape' ); // Enter navigation mode.
49
+ await page.keyboard.press( 'ArrowLeft' ); // Move to the column block.
50
+ await page.keyboard.press( 'ArrowLeft' ); // Move to the columns block.
51
+ await page.keyboard.press( 'Enter' ); // Enter edit mode with the columns block selected.
52
52
  await page.keyboard.press( 'Enter' ); // Creates a paragraph after the columns block.
53
53
  await page.keyboard.type( 'Second paragraph' );
54
54
  };
@@ -69,10 +69,10 @@ describe( 'Writing Flow', () => {
69
69
  // See: https://github.com/WordPress/gutenberg/issues/18928
70
70
  let activeElementText, activeBlockName;
71
71
 
72
- // Add demo content
72
+ // Add demo content.
73
73
  await addParagraphsAndColumnsDemo();
74
74
 
75
- // Arrow up into nested context focuses last text input
75
+ // Arrow up into nested context focuses last text input.
76
76
  await page.keyboard.press( 'ArrowUp' );
77
77
  activeBlockName = await getActiveBlockName();
78
78
  expect( activeBlockName ).toBe( 'core/paragraph' );
@@ -111,41 +111,41 @@ describe( 'Writing Flow', () => {
111
111
  // In navigation mode the active element is the block name button, so we can't easily check the block content.
112
112
  let activeBlockName;
113
113
 
114
- // Add demo content
114
+ // Add demo content.
115
115
  await addParagraphsAndColumnsDemo();
116
116
 
117
- // Switch to navigation mode
117
+ // Switch to navigation mode.
118
118
  await page.keyboard.press( 'Escape' );
119
- // Arrow up to Columns block
119
+ // Arrow up to Columns block.
120
120
  await page.keyboard.press( 'ArrowUp' );
121
121
  activeBlockName = await getActiveBlockName();
122
122
  expect( activeBlockName ).toBe( 'core/columns' );
123
- // Arrow right into Column block
123
+ // Arrow right into Column block.
124
124
  await page.keyboard.press( 'ArrowRight' );
125
125
  activeBlockName = await getActiveBlockName();
126
126
  expect( activeBlockName ).toBe( 'core/column' );
127
- // Arrow down to reach second Column block
127
+ // Arrow down to reach second Column block.
128
128
  await page.keyboard.press( 'ArrowDown' );
129
- // Arrow right again into Paragraph block
129
+ // Arrow right again into Paragraph block.
130
130
  await page.keyboard.press( 'ArrowRight' );
131
131
  activeBlockName = await getActiveBlockName();
132
132
  expect( activeBlockName ).toBe( 'core/paragraph' );
133
- // Arrow left back to Column block
133
+ // Arrow left back to Column block.
134
134
  await page.keyboard.press( 'ArrowLeft' );
135
135
  activeBlockName = await getActiveBlockName();
136
136
  expect( activeBlockName ).toBe( 'core/column' );
137
- // Arrow left back to Columns block
137
+ // Arrow left back to Columns block.
138
138
  await page.keyboard.press( 'ArrowLeft' );
139
139
  activeBlockName = await getActiveBlockName();
140
140
  expect( activeBlockName ).toBe( 'core/columns' );
141
- // Arrow up to first paragraph
141
+ // Arrow up to first paragraph.
142
142
  await page.keyboard.press( 'ArrowUp' );
143
143
  activeBlockName = await getActiveBlockName();
144
144
  expect( activeBlockName ).toBe( 'core/paragraph' );
145
145
  } );
146
146
 
147
147
  it( 'should navigate around inline boundaries', async () => {
148
- // Add demo content
148
+ // Add demo content.
149
149
  await clickBlockAppender();
150
150
  await page.keyboard.type( 'First' );
151
151
  await page.keyboard.press( 'Enter' );
@@ -153,10 +153,10 @@ describe( 'Writing Flow', () => {
153
153
  await page.keyboard.press( 'Enter' );
154
154
  await page.keyboard.type( 'Third' );
155
155
 
156
- // Navigate to second paragraph
156
+ // Navigate to second paragraph.
157
157
  await pressKeyTimes( 'ArrowLeft', 6 );
158
158
 
159
- // Bold second paragraph text
159
+ // Bold second paragraph text.
160
160
  await page.keyboard.down( 'Shift' );
161
161
  await pressKeyTimes( 'ArrowLeft', 6 );
162
162
  await page.keyboard.up( 'Shift' );
@@ -195,7 +195,7 @@ describe( 'Writing Flow', () => {
195
195
  await page.keyboard.type( 'After' );
196
196
 
197
197
  // Finally, ensure that ArrowRight from end of unbolded text moves to
198
- // the last paragraph
198
+ // the last paragraph.
199
199
  await page.keyboard.press( 'ArrowRight' );
200
200
  await page.keyboard.type( 'Before' );
201
201
 
@@ -13,6 +13,7 @@ import {
13
13
  deleteAllMenus,
14
14
  pressKeyTimes,
15
15
  pressKeyWithModifier,
16
+ setBrowserViewport,
16
17
  setUpResponseMocking,
17
18
  visitAdminPage,
18
19
  __experimentalRest as rest,
@@ -177,6 +178,27 @@ async function deleteAllLinkedResources() {
177
178
  } );
178
179
  }
179
180
 
181
+ async function openMenuActionsDropdown() {
182
+ const menuActionsDropdown = await page.waitForXPath(
183
+ '//*[@role="region"][@aria-label="Navigation top bar"]//*[@class="edit-navigation-menu-actions"]//button[@aria-expanded="false"]'
184
+ );
185
+ await menuActionsDropdown.click();
186
+ }
187
+
188
+ async function getMenuItem( menuItemName ) {
189
+ return await page
190
+ .waitForXPath(
191
+ `//*[@role="group"]//*[@role="menuitemradio"]/span[text()="${ menuItemName }"]`
192
+ )
193
+ .catch( ( error ) => {
194
+ if ( error.name !== 'TimeoutError' ) {
195
+ throw error;
196
+ } else {
197
+ return null;
198
+ }
199
+ } );
200
+ }
201
+
180
202
  describe.skip( 'Navigation editor', () => {
181
203
  useExperimentalFeatures( [ '#gutenberg-navigation' ] );
182
204
 
@@ -345,7 +367,7 @@ describe.skip( 'Navigation editor', () => {
345
367
  } );
346
368
  expect( submenuLinkVisible ).toBeDefined();
347
369
 
348
- // click in the top left corner of the canvas.
370
+ // Click in the top left corner of the canvas.
349
371
  const canvas = await page.$( '.edit-navigation-layout__content-area' );
350
372
  const boundingBox = await canvas.boundingBox();
351
373
  await page.mouse.click( boundingBox.x + 5, boundingBox.y + 5 );
@@ -523,7 +545,7 @@ describe.skip( 'Navigation editor', () => {
523
545
  name: 'Block: Navigation',
524
546
  } ).toBeFound();
525
547
 
526
- // Check for the placeholder state
548
+ // Check for the placeholder state.
527
549
  await expect( {
528
550
  role: 'button',
529
551
  name: 'Start blank',
@@ -674,9 +696,152 @@ describe.skip( 'Navigation editor', () => {
674
696
  return attributes;
675
697
  } );
676
698
 
677
- // Check the last item is the one we just inserted
699
+ // Check the last item is the one we just inserted.
678
700
  expect( lastItemAttributes.label ).toEqual( itemToSelect.title );
679
701
  expect( lastItemAttributes.isTopLevelLink ).toBeTruthy();
680
702
  } );
681
703
  } );
682
704
  } );
705
+
706
+ describe( 'Delete menu button', () => {
707
+ useExperimentalFeatures( [ '#gutenberg-navigation' ] );
708
+
709
+ beforeAll( async () => {
710
+ await deleteAllMenus();
711
+ await deleteAllLinkedResources();
712
+ } );
713
+
714
+ afterEach( async () => {
715
+ await deleteAllMenus();
716
+ await deleteAllLinkedResources();
717
+ } );
718
+
719
+ afterEach( async () => {
720
+ await setBrowserViewport( 'large' );
721
+ } );
722
+ it.each( [ 'large', 'small' ] )(
723
+ `should retain menu when confirmation is canceled and the viewport is %s`,
724
+ async ( viewport ) => {
725
+ const menuName = 'Menu delete test';
726
+ await createMenu( { name: menuName }, menuItemsFixture );
727
+ await visitNavigationEditor();
728
+ await setBrowserViewport( viewport );
729
+ // Wait for the header to show the menu name.
730
+ await page.waitForXPath(
731
+ `//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
732
+ );
733
+
734
+ if ( viewport === 'small' ) {
735
+ const openSettingsSidebar = await page.waitForXPath(
736
+ '//button[@aria-label="Settings"][@aria-expanded="false"]'
737
+ );
738
+ await openSettingsSidebar.click();
739
+ }
740
+
741
+ const deleteMenuButton = await page.waitForXPath(
742
+ '//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
743
+ );
744
+ await deleteMenuButton.click();
745
+
746
+ const cancelButton = await page.waitForXPath(
747
+ '//*[@role="dialog"]//button[text()="Cancel"]'
748
+ );
749
+ await cancelButton.click();
750
+
751
+ const menuActionsDropdown = await page.waitForXPath(
752
+ `//*[contains(@class,"edit-navigation-menu-actions")]//h2[text()="${ menuName }"]`
753
+ );
754
+ const currentSelectedMenu = await page.evaluate(
755
+ ( el ) => el.textContent,
756
+ menuActionsDropdown
757
+ );
758
+
759
+ expect( currentSelectedMenu ).toBe( menuName );
760
+ }
761
+ );
762
+ it.each( [ 'large', 'small' ] )(
763
+ `should delete menu when confirmation is confirmed and there are no other menus and the viewport is %s`,
764
+ async ( viewport ) => {
765
+ const menuName = 'Menu delete test';
766
+ await createMenu( { name: menuName }, menuItemsFixture );
767
+ await visitNavigationEditor();
768
+ await setBrowserViewport( viewport );
769
+ // Wait for the header to show the menu name.
770
+ await page.waitForXPath(
771
+ `//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
772
+ );
773
+ if ( viewport === 'small' ) {
774
+ const openSettingsSidebar = await page.waitForXPath(
775
+ '//button[@aria-label="Settings"][@aria-expanded="false"]'
776
+ );
777
+ await openSettingsSidebar.click();
778
+ }
779
+
780
+ const deleteMenuButton = await page.waitForXPath(
781
+ '//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
782
+ );
783
+ await deleteMenuButton.click();
784
+
785
+ const confirmButton = await page.waitForXPath(
786
+ '//*[@role="dialog"]//button[text()="OK"]'
787
+ );
788
+ await confirmButton.click();
789
+
790
+ await page.waitForXPath(
791
+ `//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
792
+ );
793
+
794
+ // If the "Create your first menu" prompt appears, we know there are no remaining menus,
795
+ // so our test menu must have been deleted successfully.
796
+ const createFirstMenuPrompt = await page.waitForXPath(
797
+ '//h3[.="Create your first menu"]',
798
+ {
799
+ visible: true,
800
+ }
801
+ );
802
+ const noMenusRemaining = createFirstMenuPrompt ? true : false;
803
+ expect( noMenusRemaining ).toBe( true );
804
+ }
805
+ );
806
+
807
+ it.each( [ 'large', 'small' ] )(
808
+ `should delete menu when confirmation is confirmed and there are other existing menus and the viewport is %s`,
809
+ async () => {
810
+ const menuName = 'Menu delete test';
811
+ await createMenu( { name: menuName }, menuItemsFixture );
812
+ await createMenu( { name: `${ menuName } 2` }, menuItemsFixture );
813
+ await visitNavigationEditor();
814
+ // Wait for the header to show the menu name
815
+ await page.waitForXPath(
816
+ `//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
817
+ );
818
+
819
+ // Confirm both test menus are present
820
+ openMenuActionsDropdown();
821
+ const firstTestMenuItem = await getMenuItem( menuName );
822
+ const secondTestMenuItem = await getMenuItem( `${ menuName } 2` );
823
+
824
+ expect( firstTestMenuItem ).not.toBeNull();
825
+ expect( secondTestMenuItem ).not.toBeNull();
826
+
827
+ // Delete the first test menu
828
+ const deleteMenuButton = await page.waitForXPath(
829
+ '//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
830
+ );
831
+ await deleteMenuButton.click();
832
+
833
+ const confirmButton = await page.waitForXPath(
834
+ '//*[@role="dialog"]//button[text()="OK"]'
835
+ );
836
+ await confirmButton.click();
837
+
838
+ await page.waitForXPath(
839
+ `//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
840
+ );
841
+
842
+ openMenuActionsDropdown();
843
+ const deletedTestMenuItem = await getMenuItem( menuName );
844
+ expect( deletedTestMenuItem ).toBeNull();
845
+ }
846
+ );
847
+ } );
@@ -96,7 +96,7 @@ describe( 'Post Editor Performance', () => {
96
96
  } );
97
97
 
98
98
  it( 'Loading', async () => {
99
- // Measuring loading time
99
+ // Measuring loading time.
100
100
  let i = 5;
101
101
  while ( i-- ) {
102
102
  await page.reload();
@@ -120,7 +120,7 @@ describe( 'Post Editor Performance', () => {
120
120
  } );
121
121
 
122
122
  it( 'Typing', async () => {
123
- // Measuring typing performance
123
+ // Measuring typing performance.
124
124
  await insertBlock( 'Paragraph' );
125
125
  let i = 20;
126
126
  await page.tracing.start( {
@@ -158,7 +158,7 @@ describe( 'Post Editor Performance', () => {
158
158
  } );
159
159
 
160
160
  it( 'Selecting blocks', async () => {
161
- // Measuring block selection performance
161
+ // Measuring block selection performance.
162
162
  await createNewPost();
163
163
  await page.evaluate( () => {
164
164
  const { createBlock } = window.wp.blocks;
@@ -188,7 +188,7 @@ describe( 'Post Editor Performance', () => {
188
188
  } );
189
189
 
190
190
  it( 'Opening persistent list view', async () => {
191
- // Measure time to open inserter
191
+ // Measure time to open inserter.
192
192
  await page.waitForSelector( '.edit-post-layout' );
193
193
  for ( let j = 0; j < 10; j++ ) {
194
194
  await page.tracing.start( {
@@ -208,7 +208,7 @@ describe( 'Post Editor Performance', () => {
208
208
  } );
209
209
 
210
210
  it( 'Opening the inserter', async () => {
211
- // Measure time to open inserter
211
+ // Measure time to open inserter.
212
212
  await page.waitForSelector( '.edit-post-layout' );
213
213
  for ( let j = 0; j < 10; j++ ) {
214
214
  await page.tracing.start( {
@@ -228,7 +228,7 @@ describe( 'Post Editor Performance', () => {
228
228
  } );
229
229
 
230
230
  it( 'Searching the inserter', async () => {
231
- // Measure time to search the inserter and get results
231
+ // Measure time to search the inserter and get results.
232
232
  await openGlobalBlockInserter();
233
233
  for ( let j = 0; j < 10; j++ ) {
234
234
  // Wait for the browser to be idle before starting the monitoring.
@@ -263,7 +263,7 @@ describe( 'Post Editor Performance', () => {
263
263
  } );
264
264
 
265
265
  it( 'Hovering Inserter Items', async () => {
266
- // Measure inserter hover performance
266
+ // Measure inserter hover performance.
267
267
  const paragraphBlockItem =
268
268
  '.block-editor-inserter__menu .editor-block-list-item-paragraph';
269
269
  const headingBlockItem =
@@ -86,7 +86,7 @@ describe( 'Site Editor Performance', () => {
86
86
 
87
87
  let i = 3;
88
88
 
89
- // Measuring loading time
89
+ // Measuring loading time.
90
90
  while ( i-- ) {
91
91
  await page.reload();
92
92
  await page.waitForSelector( '.edit-site-visual-editor', {
@@ -39,13 +39,13 @@ describe( 'Document Settings', () => {
39
39
 
40
40
  describe( 'when a template is selected from the navigation sidebar', () => {
41
41
  it( 'should display the selected templates name in the document header', async () => {
42
- // Navigate to a template
42
+ // Navigate to a template.
43
43
  await visitSiteEditor( {
44
44
  postId: 'emptytheme//index',
45
45
  postType: 'wp_template',
46
46
  } );
47
47
 
48
- // Evaluate the document settings title
48
+ // Evaluate the document settings title.
49
49
  const actual = await getDocumentSettingsTitle();
50
50
 
51
51
  expect( actual ).toEqual( 'Editing template: Index' );
@@ -65,7 +65,7 @@ describe( 'Document Settings', () => {
65
65
  'button[aria-label="Close List View Sidebar"]'
66
66
  );
67
67
 
68
- // Evaluate the document settings secondary title
68
+ // Evaluate the document settings secondary title.
69
69
  const actual = await getDocumentSettingsSecondaryTitle();
70
70
 
71
71
  expect( actual ).toEqual( 'Editing template part: header' );
@@ -75,13 +75,13 @@ describe( 'Document Settings', () => {
75
75
 
76
76
  describe( 'when a template part is selected from the navigation sidebar', () => {
77
77
  it( "should display the selected template part's name in the document header", async () => {
78
- // Navigate to a template part
78
+ // Navigate to a template part.
79
79
  await visitSiteEditor( {
80
80
  postId: 'emptytheme//header',
81
81
  postType: 'wp_template_part',
82
82
  } );
83
83
 
84
- // Evaluate the document settings title
84
+ // Evaluate the document settings title.
85
85
  const actual = await getDocumentSettingsTitle();
86
86
 
87
87
  expect( actual ).toEqual( 'Editing template part: header' );
@@ -53,7 +53,7 @@ const createTemplatePart = async (
53
53
  // Select all of the text in the title field.
54
54
  await pressKeyWithModifier( 'primary', 'a' );
55
55
 
56
- // Give the reusable block a title
56
+ // Give the reusable block a title.
57
57
  await page.keyboard.type( templatePartName );
58
58
  };
59
59
 
@@ -98,7 +98,7 @@ describe( 'Multi-entity save flow', () => {
98
98
  await page.keyboard.type( 'Test Post...' );
99
99
  await page.keyboard.press( 'Enter' );
100
100
 
101
- // Should not trigger multi-entity save button with only post edited
101
+ // Should not trigger multi-entity save button with only post edited.
102
102
  await assertMultiSaveDisabled();
103
103
 
104
104
  // Should only have publish panel a11y button active with only post edited.
@@ -138,23 +138,23 @@ describe( 'Template Part', () => {
138
138
  await insertBlock( 'Paragraph' );
139
139
  await page.keyboard.type( 'Header Template Part 789' );
140
140
 
141
- // Select the paragraph block
141
+ // Select the paragraph block.
142
142
  const text = await canvas().waitForXPath(
143
143
  '//p[contains(text(), "Header Template Part 789")]'
144
144
  );
145
145
 
146
- // Highlight all the text in the paragraph block
146
+ // Highlight all the text in the paragraph block.
147
147
  await text.click( { clickCount: 3 } );
148
148
 
149
- // Click the convert to link toolbar button
149
+ // Click the convert to link toolbar button.
150
150
  await page.waitForSelector( 'button[aria-label="Link"]' );
151
151
  await page.click( 'button[aria-label="Link"]' );
152
152
 
153
- // Enter url for link
153
+ // Enter url for link.
154
154
  await page.keyboard.type( 'https://google.com' );
155
155
  await page.keyboard.press( 'Enter' );
156
156
 
157
- // Verify that there is no error
157
+ // Verify that there is no error.
158
158
  await canvas().click( 'p[data-type="core/paragraph"] a' );
159
159
  const expectedContent = await canvas().$x(
160
160
  '//p[contains(text(), "Header Template Part 789")]'
@@ -184,7 +184,7 @@ describe( 'Template Part', () => {
184
184
  await page.keyboard.type( 'My template part' );
185
185
  await page.keyboard.press( 'Enter' );
186
186
 
187
- // Wait for creation to finish
187
+ // Wait for creation to finish.
188
188
  await page.waitForXPath(
189
189
  '//*[contains(@class, "components-snackbar")]/*[text()="Template part created."]'
190
190
  );
@@ -233,7 +233,7 @@ describe( 'Template Part', () => {
233
233
  await page.keyboard.type( 'My multi template part' );
234
234
  await page.keyboard.press( 'Enter' );
235
235
 
236
- // Wait for creation to finish
236
+ // Wait for creation to finish.
237
237
  await page.waitForXPath(
238
238
  '//*[contains(@class, "components-snackbar")]/*[text()="Template part created."]'
239
239
  );
@@ -250,11 +250,12 @@ describe( 'Template Part', () => {
250
250
  finalTemplateParts.length - initialTemplateParts.length
251
251
  ).toBe( 1 );
252
252
  } );
253
+
253
254
  describe( 'Template part placeholder', () => {
254
255
  // Test constants for template part.
255
256
  const testContent = 'some words...';
256
257
 
257
- // Selectors
258
+ // Selectors.
258
259
  const entitiesSaveSelector =
259
260
  '.editor-entities-saved-states__save-button';
260
261
  const savePostSelector = '.edit-site-save-button__button';
@@ -25,16 +25,17 @@ describe( 'Widgets Customizer', () => {
25
25
  await visitAdminPage( 'customize.php' );
26
26
 
27
27
  // Disable welcome guide if it is enabled.
28
- const isWelcomeGuideActive = await page.evaluate( () =>
29
- wp.data
30
- .select( 'core/interface' )
31
- .isFeatureActive( 'core/customize-widgets', 'welcomeGuide' )
28
+ const isWelcomeGuideActive = await page.evaluate(
29
+ () =>
30
+ !! wp.data
31
+ .select( 'core/preferences' )
32
+ .get( 'core/customize-widgets', 'welcomeGuide' )
32
33
  );
33
34
  if ( isWelcomeGuideActive ) {
34
35
  await page.evaluate( () =>
35
36
  wp.data
36
- .dispatch( 'core/interface' )
37
- .toggleFeature( 'core/customize-widgets', 'welcomeGuide' )
37
+ .dispatch( 'core/preferences' )
38
+ .toggle( 'core/customize-widgets', 'welcomeGuide' )
38
39
  );
39
40
  }
40
41
  } );
@@ -784,7 +785,7 @@ describe( 'Widgets Customizer', () => {
784
785
 
785
786
  await waitForPreviewIframe();
786
787
 
787
- // Click Publish
788
+ // Click Publish.
788
789
  const publishButton = await find( {
789
790
  role: 'button',
790
791
  name: 'Publish',
@@ -797,7 +798,7 @@ describe( 'Widgets Customizer', () => {
797
798
  disabled: true,
798
799
  } );
799
800
 
800
- // Select the paragraph block
801
+ // Select the paragraph block.
801
802
  const paragraphBlock = await find( {
802
803
  role: 'document',
803
804
  name: 'Paragraph block',
@@ -824,7 +825,7 @@ describe( 'Widgets Customizer', () => {
824
825
 
825
826
  // Now that we've made a change:
826
827
  // (1) Publish button should be active
827
- // (2) We should still be in the "Block Settings" area
828
+ // (2) We should still be in the "Block Settings" area.
828
829
  await find( {
829
830
  role: 'button',
830
831
  name: 'Publish',
@@ -31,16 +31,17 @@ describe( 'Widgets screen', () => {
31
31
  await visitWidgetsScreen();
32
32
 
33
33
  // Disable welcome guide if it is enabled.
34
- const isWelcomeGuideActive = await page.evaluate( () =>
35
- wp.data
36
- .select( 'core/interface' )
37
- .isFeatureActive( 'core/edit-widgets', 'welcomeGuide' )
34
+ const isWelcomeGuideActive = await page.evaluate(
35
+ () =>
36
+ !! wp.data
37
+ .select( 'core/preferences' )
38
+ .get( 'core/edit-widgets', 'welcomeGuide' )
38
39
  );
39
40
  if ( isWelcomeGuideActive ) {
40
41
  await page.evaluate( () =>
41
42
  wp.data
42
- .dispatch( 'core/interface' )
43
- .toggleFeature( 'core/edit-widgets', 'welcomeGuide' )
43
+ .dispatch( 'core/preferences' )
44
+ .toggle( 'core/edit-widgets', 'welcomeGuide' )
44
45
  );
45
46
  }
46
47
 
@@ -811,7 +812,7 @@ describe( 'Widgets screen', () => {
811
812
  // To do: clicking on the Snackbar causes focus loss.
812
813
  await page.focus( '.block-editor-writing-flow' );
813
814
 
814
- // Undo block deletion and save again
815
+ // Undo block deletion and save again.
815
816
  await pressKeyWithModifier( 'primary', 'z' );
816
817
  await saveWidgets();
817
818