@wordpress/e2e-tests 3.0.7 → 3.0.10-next.a55ed9455a.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 (74) hide show
  1. package/config/setup-performance-test.js +1 -1
  2. package/config/setup-test-framework.js +1 -1
  3. package/package.json +7 -7
  4. package/specs/editor/blocks/__snapshots__/heading.test.js.snap +8 -8
  5. package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +16 -16
  6. package/specs/editor/blocks/__snapshots__/quote.test.js.snap +10 -10
  7. package/specs/editor/blocks/classic.test.js +2 -2
  8. package/specs/editor/blocks/cover.test.js +17 -17
  9. package/specs/editor/blocks/image.test.js +4 -3
  10. package/specs/editor/blocks/list.test.js +1 -1
  11. package/specs/editor/blocks/navigation.test.js +392 -65
  12. package/specs/editor/blocks/table.test.js +1 -1
  13. package/specs/editor/plugins/align-hook.test.js +10 -10
  14. package/specs/editor/plugins/block-context.test.js +1 -1
  15. package/specs/editor/plugins/block-directory-add.test.js +14 -14
  16. package/specs/editor/plugins/custom-post-types.test.js +1 -1
  17. package/specs/editor/plugins/custom-taxonomies.test.js +3 -3
  18. package/specs/editor/plugins/meta-attribute-block.test.js +1 -1
  19. package/specs/editor/plugins/meta-boxes.test.js +3 -3
  20. package/specs/editor/plugins/templates.test.js +1 -1
  21. package/specs/editor/plugins/wp-editor-meta-box.test.js +1 -1
  22. package/specs/editor/various/__snapshots__/block-grouping.test.js.snap +4 -4
  23. package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +2 -2
  24. package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +3 -3
  25. package/specs/editor/various/autosave.test.js +19 -19
  26. package/specs/editor/various/block-deletion.test.js +5 -5
  27. package/specs/editor/various/block-grouping.test.js +29 -12
  28. package/specs/editor/various/block-hierarchy-navigation.test.js +5 -5
  29. package/specs/editor/various/change-detection.test.js +3 -3
  30. package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
  31. package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +7 -7
  32. package/specs/editor/various/datepicker.test.js +1 -1
  33. package/specs/editor/various/duplicating-blocks.test.js +3 -3
  34. package/specs/editor/various/editor-modes.test.js +5 -5
  35. package/specs/editor/various/inserting-blocks.test.js +6 -6
  36. package/specs/editor/various/invalid-block.test.js +4 -4
  37. package/specs/editor/various/is-typing.test.js +8 -8
  38. package/specs/editor/various/keyboard-navigable-blocks.test.js +2 -2
  39. package/specs/editor/various/links.test.js +90 -90
  40. package/specs/editor/various/list-view.test.js +142 -1
  41. package/specs/editor/various/manage-reusable-blocks.test.js +5 -5
  42. package/specs/editor/various/multi-block-selection.test.js +86 -2
  43. package/specs/editor/various/navigable-toolbar.test.js +1 -1
  44. package/specs/editor/various/new-post-default-content.test.js +2 -2
  45. package/specs/editor/various/new-post.test.js +1 -1
  46. package/specs/editor/various/nux.test.js +11 -11
  47. package/specs/editor/various/popovers.test.js +3 -3
  48. package/specs/editor/various/post-editor-template-mode.test.js +189 -11
  49. package/specs/editor/various/post-visibility.test.js +1 -1
  50. package/specs/editor/various/preferences.test.js +1 -1
  51. package/specs/editor/various/preview.test.js +8 -4
  52. package/specs/editor/various/publish-button.test.js +2 -2
  53. package/specs/editor/various/publishing.test.js +50 -1
  54. package/specs/editor/various/reusable-blocks.test.js +31 -31
  55. package/specs/editor/various/rich-text.test.js +1 -1
  56. package/specs/editor/various/splitting-merging.test.js +6 -6
  57. package/specs/editor/various/style-variation.test.js +2 -2
  58. package/specs/editor/various/switch-to-draft.test.js +256 -0
  59. package/specs/editor/various/taxonomies.test.js +1 -1
  60. package/specs/editor/various/toolbar-roving-tabindex.test.js +1 -1
  61. package/specs/editor/various/writing-flow.test.js +85 -20
  62. package/specs/experiments/navigation-editor.test.js +168 -3
  63. package/specs/performance/post-editor.test.js +7 -7
  64. package/specs/performance/site-editor.test.js +6 -7
  65. package/specs/site-editor/document-settings.test.js +8 -8
  66. package/specs/site-editor/multi-entity-editing.test.js +6 -6
  67. package/specs/site-editor/multi-entity-saving.test.js +5 -4
  68. package/specs/site-editor/settings-sidebar.test.js +5 -5
  69. package/specs/site-editor/site-editor-export.test.js +3 -3
  70. package/specs/site-editor/site-editor-inserter.test.js +3 -3
  71. package/specs/site-editor/template-part.test.js +27 -26
  72. package/specs/site-editor/template-revert.test.js +12 -22
  73. package/specs/widgets/customizing-widgets.test.js +14 -9
  74. package/specs/widgets/editing-widgets.test.js +8 -7
@@ -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
 
@@ -437,6 +437,44 @@ describe( 'Writing Flow', () => {
437
437
  expect( await getEditedPostContent() ).toMatchSnapshot();
438
438
  } );
439
439
 
440
+ it( 'should merge and then split paragraphs', async () => {
441
+ await page.keyboard.press( 'Enter' );
442
+ await page.keyboard.type( 'abc' );
443
+ await page.keyboard.press( 'Enter' );
444
+ await page.keyboard.type( '123' );
445
+ await page.keyboard.press( 'ArrowUp' );
446
+ await page.keyboard.press( 'Delete' );
447
+ await page.keyboard.press( 'Enter' );
448
+
449
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
450
+ "<!-- wp:paragraph -->
451
+ <p>abc</p>
452
+ <!-- /wp:paragraph -->
453
+
454
+ <!-- wp:paragraph -->
455
+ <p>123</p>
456
+ <!-- /wp:paragraph -->"
457
+ ` );
458
+ } );
459
+
460
+ it( 'should merge and then soft line break', async () => {
461
+ await page.keyboard.press( 'Enter' );
462
+ await page.keyboard.type( '1' );
463
+ await page.keyboard.press( 'Enter' );
464
+ await page.keyboard.type( '2' );
465
+ await page.keyboard.press( 'ArrowUp' );
466
+ await page.keyboard.press( 'Delete' );
467
+ await page.keyboard.down( 'Shift' );
468
+ await page.keyboard.press( 'Enter' );
469
+ await page.keyboard.up( 'Shift' );
470
+
471
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
472
+ "<!-- wp:paragraph -->
473
+ <p>1<br>2</p>
474
+ <!-- /wp:paragraph -->"
475
+ ` );
476
+ } );
477
+
440
478
  it( 'should merge forwards', async () => {
441
479
  await page.keyboard.press( 'Enter' );
442
480
  await page.keyboard.type( '1' );
@@ -449,6 +487,33 @@ describe( 'Writing Flow', () => {
449
487
  expect( await getEditedPostContent() ).toMatchSnapshot();
450
488
  } );
451
489
 
490
+ it( 'should merge forwards properly on multiple triggers', async () => {
491
+ await page.keyboard.press( 'Enter' );
492
+ await page.keyboard.type( '1' );
493
+ await page.keyboard.press( 'Enter' );
494
+ await page.keyboard.type( '2' );
495
+ await page.keyboard.press( 'Enter' );
496
+ await page.keyboard.type( '3' );
497
+ await pressKeyTimes( 'ArrowUp', 2 );
498
+ await pressKeyTimes( 'Delete', 2 );
499
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
500
+ "<!-- wp:paragraph -->
501
+ <p>1</p>
502
+ <!-- /wp:paragraph -->
503
+
504
+ <!-- wp:paragraph -->
505
+ <p>3</p>
506
+ <!-- /wp:paragraph -->"
507
+ ` );
508
+ await page.keyboard.press( 'Delete' );
509
+
510
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
511
+ "<!-- wp:paragraph -->
512
+ <p>13</p>
513
+ <!-- /wp:paragraph -->"
514
+ ` );
515
+ } );
516
+
452
517
  it( 'should preserve horizontal position when navigating vertically between blocks', async () => {
453
518
  await page.keyboard.press( 'Enter' );
454
519
  await page.keyboard.type( 'abc' );
@@ -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 =
@@ -8,13 +8,13 @@ import { writeFileSync } from 'fs';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import {
11
- trashAllPosts,
12
11
  activateTheme,
13
12
  canvas,
14
13
  createNewPost,
15
14
  visitSiteEditor,
16
15
  saveDraft,
17
16
  insertBlock,
17
+ deleteAllTemplates,
18
18
  } from '@wordpress/e2e-test-utils';
19
19
 
20
20
  /**
@@ -32,13 +32,12 @@ jest.setTimeout( 1000000 );
32
32
  describe( 'Site Editor Performance', () => {
33
33
  beforeAll( async () => {
34
34
  await activateTheme( 'emptytheme' );
35
- await trashAllPosts( 'wp_template' );
36
- await trashAllPosts( 'wp_template', 'auto-draft' );
37
- await trashAllPosts( 'wp_template_part' );
35
+ await deleteAllTemplates( 'wp_template' );
36
+ await deleteAllTemplates( 'wp_template_part' );
38
37
  } );
39
38
  afterAll( async () => {
40
- await trashAllPosts( 'wp_template' );
41
- await trashAllPosts( 'wp_template_part' );
39
+ await deleteAllTemplates( 'wp_template' );
40
+ await deleteAllTemplates( 'wp_template_part' );
42
41
  await activateTheme( 'twentytwentyone' );
43
42
  } );
44
43
 
@@ -87,7 +86,7 @@ describe( 'Site Editor Performance', () => {
87
86
 
88
87
  let i = 3;
89
88
 
90
- // Measuring loading time
89
+ // Measuring loading time.
91
90
  while ( i-- ) {
92
91
  await page.reload();
93
92
  await page.waitForSelector( '.edit-site-visual-editor', {
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- trashAllPosts,
5
+ deleteAllTemplates,
6
6
  activateTheme,
7
7
  visitSiteEditor,
8
8
  } from '@wordpress/e2e-test-utils';
@@ -26,8 +26,8 @@ async function getDocumentSettingsSecondaryTitle() {
26
26
  describe( 'Document Settings', () => {
27
27
  beforeAll( async () => {
28
28
  await activateTheme( 'emptytheme' );
29
- await trashAllPosts( 'wp_template' );
30
- await trashAllPosts( 'wp_template_part' );
29
+ await deleteAllTemplates( 'wp_template' );
30
+ await deleteAllTemplates( 'wp_template_part' );
31
31
  } );
32
32
  afterAll( async () => {
33
33
  await activateTheme( 'twentytwentyone' );
@@ -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' );
@@ -5,7 +5,7 @@ import {
5
5
  insertBlock,
6
6
  createNewPost,
7
7
  publishPost,
8
- trashAllPosts,
8
+ deleteAllTemplates,
9
9
  activateTheme,
10
10
  canvas,
11
11
  openDocumentSettingsSidebar,
@@ -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
 
@@ -135,8 +135,8 @@ const removeErrorMocks = () => {
135
135
  describe( 'Multi-entity editor states', () => {
136
136
  beforeAll( async () => {
137
137
  await activateTheme( 'emptytheme' );
138
- await trashAllPosts( 'wp_template' );
139
- await trashAllPosts( 'wp_template_part' );
138
+ await deleteAllTemplates( 'wp_template' );
139
+ await deleteAllTemplates( 'wp_template_part' );
140
140
  } );
141
141
 
142
142
  afterAll( async () => {
@@ -185,8 +185,8 @@ describe( 'Multi-entity editor states', () => {
185
185
  const templateName = 'Custom Template';
186
186
 
187
187
  beforeAll( async () => {
188
- await trashAllPosts( 'wp_template' );
189
- await trashAllPosts( 'wp_template_part' );
188
+ await deleteAllTemplates( 'wp_template' );
189
+ await deleteAllTemplates( 'wp_template_part' );
190
190
  await createNewPost( {
191
191
  postType: 'wp_template',
192
192
  title: templateName,
@@ -13,6 +13,7 @@ import {
13
13
  clickButton,
14
14
  createReusableBlock,
15
15
  visitSiteEditor,
16
+ deleteAllTemplates,
16
17
  } from '@wordpress/e2e-test-utils';
17
18
 
18
19
  describe( 'Multi-entity save flow', () => {
@@ -43,8 +44,8 @@ describe( 'Multi-entity save flow', () => {
43
44
 
44
45
  beforeAll( async () => {
45
46
  await activateTheme( 'emptytheme' );
46
- await trashAllPosts( 'wp_template' );
47
- await trashAllPosts( 'wp_template_part' );
47
+ await deleteAllTemplates( 'wp_template' );
48
+ await deleteAllTemplates( 'wp_template_part' );
48
49
  await trashAllPosts( 'wp_block' );
49
50
 
50
51
  // Get the current Site Title and Site Tagline, so that we can reset
@@ -97,7 +98,7 @@ describe( 'Multi-entity save flow', () => {
97
98
  await page.keyboard.type( 'Test Post...' );
98
99
  await page.keyboard.press( 'Enter' );
99
100
 
100
- // Should not trigger multi-entity save button with only post edited
101
+ // Should not trigger multi-entity save button with only post edited.
101
102
  await assertMultiSaveDisabled();
102
103
 
103
104
  // Should only have publish panel a11y button active with only post edited.
@@ -267,7 +268,7 @@ describe( 'Multi-entity save flow', () => {
267
268
  // Select the header template part via list view.
268
269
  await page.click( '.edit-site-header-toolbar__list-view-toggle' );
269
270
  const headerTemplatePartListViewButton = await page.waitForXPath(
270
- '//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "Header")]'
271
+ '//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "header")]'
271
272
  );
272
273
  headerTemplatePartListViewButton.click();
273
274
  await page.click( 'button[aria-label="Close List View Sidebar"]' );
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- trashAllPosts,
5
+ deleteAllTemplates,
6
6
  activateTheme,
7
7
  getAllBlocks,
8
8
  selectBlockByClientId,
@@ -39,12 +39,12 @@ async function getTemplateCard() {
39
39
  describe( 'Settings sidebar', () => {
40
40
  beforeAll( async () => {
41
41
  await activateTheme( 'emptytheme' );
42
- await trashAllPosts( 'wp_template' );
43
- await trashAllPosts( 'wp_template_part' );
42
+ await deleteAllTemplates( 'wp_template' );
43
+ await deleteAllTemplates( 'wp_template_part' );
44
44
  } );
45
45
  afterAll( async () => {
46
- await trashAllPosts( 'wp_template' );
47
- await trashAllPosts( 'wp_template_part' );
46
+ await deleteAllTemplates( 'wp_template' );
47
+ await deleteAllTemplates( 'wp_template_part' );
48
48
  await activateTheme( 'twentytwentyone' );
49
49
  } );
50
50
  beforeEach( async () => {
@@ -9,7 +9,7 @@ import os from 'os';
9
9
  * WordPress dependencies
10
10
  */
11
11
  import {
12
- trashAllPosts,
12
+ deleteAllTemplates,
13
13
  activateTheme,
14
14
  visitSiteEditor,
15
15
  clickOnMoreMenuItem,
@@ -31,8 +31,8 @@ async function waitForFileExists( filePath, timeout = 10000 ) {
31
31
  describe( 'Site Editor Templates Export', () => {
32
32
  beforeAll( async () => {
33
33
  await activateTheme( 'emptytheme' );
34
- await trashAllPosts( 'wp_template' );
35
- await trashAllPosts( 'wp_template_part' );
34
+ await deleteAllTemplates( 'wp_template' );
35
+ await deleteAllTemplates( 'wp_template_part' );
36
36
  } );
37
37
 
38
38
  afterAll( async () => {