@wordpress/e2e-tests 3.0.7 → 3.0.8

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.
@@ -6,11 +6,12 @@ import {
6
6
  createNewPost,
7
7
  insertBlock,
8
8
  saveDraft,
9
- trashAllPosts,
10
9
  openPreviewPage,
11
10
  openDocumentSettingsSidebar,
12
11
  activatePlugin,
13
12
  deactivatePlugin,
13
+ deleteAllTemplates,
14
+ setBrowserViewport,
14
15
  } from '@wordpress/e2e-test-utils';
15
16
 
16
17
  const openSidebarPanelWithTitle = async ( title ) => {
@@ -56,7 +57,7 @@ const switchToTemplateMode = async () => {
56
57
 
57
58
  // Check that we switched properly to edit mode.
58
59
  await page.waitForXPath(
59
- '//*[contains(@class, "components-snackbar")]/*[text()="Editing template. Changes made here affect all posts and pages that use the template."]'
60
+ '//*[text()="Editing template. Changes made here affect all posts and pages that use the template."]'
60
61
  );
61
62
  const title = await page.$eval(
62
63
  '.edit-post-template-top-area',
@@ -92,8 +93,8 @@ const createNewTemplate = async ( templateName ) => {
92
93
  describe( 'Post Editor Template mode', () => {
93
94
  beforeAll( async () => {
94
95
  await activatePlugin( 'gutenberg-test-block-templates' );
95
- await trashAllPosts( 'wp_template' );
96
- await trashAllPosts( 'wp_template_part' );
96
+ await deleteAllTemplates( 'wp_template' );
97
+ await deleteAllTemplates( 'wp_template_part' );
97
98
  } );
98
99
 
99
100
  afterAll( async () => {
@@ -119,7 +120,6 @@ describe( 'Post Editor Template mode', () => {
119
120
  // there's a template resolution bug forcing us to do so.
120
121
  await saveDraft();
121
122
  await page.reload();
122
-
123
123
  await switchToTemplateMode();
124
124
 
125
125
  // Edit the template
@@ -197,3 +197,180 @@ describe( 'Post Editor Template mode', () => {
197
197
  expect( content ).toMatchSnapshot();
198
198
  } );
199
199
  } );
200
+
201
+ describe( 'Delete Post Template Confirmation Dialog', () => {
202
+ beforeAll( async () => {
203
+ await activatePlugin( 'gutenberg-test-block-templates' );
204
+ await deleteAllTemplates( 'wp_template' );
205
+ await deleteAllTemplates( 'wp_template_part' );
206
+ await activateTheme( 'twentytwentyone' );
207
+ await createNewPost();
208
+ // Create a random post.
209
+ await page.type( '.editor-post-title__input', 'Just an FSE Post' );
210
+ await page.keyboard.press( 'Enter' );
211
+ await page.keyboard.type( 'Hello World' );
212
+
213
+ // Save the post
214
+ // Saving shouldn't be necessary but unfortunately,
215
+ // there's a template resolution bug forcing us to do so.
216
+ await saveDraft();
217
+ await page.reload();
218
+ // Unselect the blocks.
219
+ await page.evaluate( () => {
220
+ wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock();
221
+ } );
222
+ } );
223
+
224
+ afterAll( async () => {
225
+ await activateTheme( 'twentytwentyone' );
226
+ await deactivatePlugin( 'gutenberg-test-block-templates' );
227
+ } );
228
+
229
+ [ 'large', 'small' ].forEach( ( viewport ) => {
230
+ it( `should retain template if deletion is canceled when the viewport is ${ viewport }`, async () => {
231
+ await setBrowserViewport( viewport );
232
+
233
+ const isWelcomeGuideActive = await page.evaluate( () =>
234
+ wp.data
235
+ .select( 'core/edit-post' )
236
+ .isFeatureActive( 'welcomeGuide' )
237
+ );
238
+ if ( isWelcomeGuideActive === true ) {
239
+ await page.evaluate( () =>
240
+ wp.data
241
+ .dispatch( 'core/edit-post' )
242
+ .toggleFeature( 'welcomeGuide' )
243
+ );
244
+ await page.reload();
245
+ await page.waitForSelector( '.edit-post-layout' );
246
+ }
247
+ if ( viewport === 'small' ) {
248
+ await page.waitForXPath( '//button[@aria-label="Settings"]' );
249
+ await openDocumentSettingsSidebar();
250
+ }
251
+ const templateTitle = `${ viewport } Viewport Deletion Test`;
252
+
253
+ await createNewTemplate( templateTitle );
254
+ // Edit the template
255
+ if ( viewport === 'small' ) {
256
+ await page.waitForXPath( `//h2[text()="${ templateTitle }"]` );
257
+ const closeDocumentSettingsButton = await page.waitForXPath(
258
+ '//button[@aria-label="Close settings"]'
259
+ );
260
+ await closeDocumentSettingsButton.click();
261
+ }
262
+ await insertBlock( 'Paragraph' );
263
+ await page.keyboard.type(
264
+ 'Just a random paragraph added to the template'
265
+ );
266
+
267
+ // Save changes
268
+ const publishButton = await page.waitForXPath(
269
+ `//button[contains(text(), 'Publish')]`
270
+ );
271
+ await publishButton.click();
272
+ const saveButton = await page.waitForXPath(
273
+ `//div[contains(@class, "entities-saved-states__panel-header")]/button[contains(text(), 'Save')]`
274
+ );
275
+ await saveButton.click();
276
+ // Avoid publishing the post
277
+ // Select the cancel button via parent div's class, because the text `Cancel` is used on another button as well
278
+ const cancelButton = await page.waitForXPath(
279
+ `//div[contains(@class,"editor-post-publish-panel__header-cancel-button")]/button[not(@disabled)]`
280
+ );
281
+ await cancelButton.click();
282
+
283
+ const templateDropdown = await page.waitForXPath(
284
+ `//button[contains(text(), '${ templateTitle }')]`
285
+ );
286
+ await templateDropdown.click();
287
+ const deleteTemplateButton = await page.waitForXPath(
288
+ '//button[@role="menuitem"][@aria-label="Delete template"]'
289
+ );
290
+ await deleteTemplateButton.click();
291
+
292
+ await page.waitForXPath(
293
+ `//*[text()="Are you sure you want to delete the ${ templateTitle } template? It may be used by other pages or posts."]`
294
+ );
295
+ const dialogCancelButton = await page.waitForXPath(
296
+ '//*[@role="dialog"][not(@id="wp-link-wrap")]//button[text()="Cancel"]'
297
+ );
298
+ await dialogCancelButton.click();
299
+
300
+ const exitTemplateModeButton = await page.waitForXPath(
301
+ '//button[text()="Back"]'
302
+ );
303
+ await exitTemplateModeButton.click();
304
+
305
+ await page.waitForXPath(
306
+ '//button[@aria-label="Settings"][@aria-expanded="false"]'
307
+ );
308
+ await openDocumentSettingsSidebar();
309
+
310
+ const element = await page.waitForXPath(
311
+ '//h2/button[contains(text(), "Template")]/../..//select'
312
+ );
313
+ const value = await element.getProperty( 'value' );
314
+ const currentTemplateSlug = await value.jsonValue();
315
+
316
+ expect( currentTemplateSlug ).toBe(
317
+ `wp-custom-template-${ viewport }-viewport-deletion-test`
318
+ );
319
+ } );
320
+
321
+ it( `should delete template if deletion is confirmed when the viewport is ${ viewport }`, async () => {
322
+ const templateTitle = `${ viewport } Viewport Deletion Test`;
323
+
324
+ await setBrowserViewport( viewport );
325
+
326
+ await switchToTemplateMode();
327
+ if ( viewport === 'small' ) {
328
+ const closeDocumentSettingsButton = await page.waitForXPath(
329
+ '//div[contains(@class,"interface-complementary-area-header__small")]/button[@aria-label="Close settings"]'
330
+ );
331
+ await closeDocumentSettingsButton.click();
332
+ }
333
+
334
+ const templateDropdown = await page.waitForXPath(
335
+ `//button[contains(text(), '${ templateTitle }')]`
336
+ );
337
+ await templateDropdown.click();
338
+
339
+ const deleteTemplateButton = await page.waitForXPath(
340
+ '//button[@role="menuitem"][@aria-label="Delete template"]'
341
+ );
342
+ await deleteTemplateButton.click();
343
+
344
+ await page.waitForXPath(
345
+ `//*[text()="Are you sure you want to delete the ${ templateTitle } template? It may be used by other pages or posts."]`
346
+ );
347
+ const dialogConfirmButton = await page.waitForXPath(
348
+ '//*[@role="dialog"][not(@id="wp-link-wrap")]//button[text()="OK"]'
349
+ );
350
+
351
+ await dialogConfirmButton.click();
352
+
353
+ // Saving isn't technically necessary, but for themes without any specified templates,
354
+ // the removal of the Templates dropdown is delayed. A save and reload allows for this
355
+ // delay and prevents flakiness
356
+ await saveDraft();
357
+ await page.reload();
358
+
359
+ const optionElementHandlers = await page.$x(
360
+ '//h2/button[contains(text(), "Template")]/../..//select/option'
361
+ );
362
+ const availableTemplates = [];
363
+ for ( const elem of optionElementHandlers ) {
364
+ const elemName = await elem.getProperty( 'textContent' );
365
+ const templateName = await elemName.jsonValue();
366
+ availableTemplates.push( templateName );
367
+ }
368
+
369
+ expect(
370
+ availableTemplates.includes(
371
+ `${ viewport } Viewport Deletion Test`
372
+ )
373
+ ).toBe( false );
374
+ } );
375
+ } );
376
+ } );
@@ -96,7 +96,7 @@ describe( 'Post visibility', () => {
96
96
  );
97
97
  await (
98
98
  await page.$x(
99
- '//td[contains(concat(" ", @class, " "), " CalendarDay ")]/div[contains(concat(" ", @class, " "), " components-datetime__date__day ")][text() = "15"]'
99
+ '//*[@role="application"][@aria-label="Calendar"]//td[@role="button"]/*[text() = "15"]'
100
100
  )
101
101
  )[ 0 ].click();
102
102
 
@@ -0,0 +1,254 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ createNewPost,
6
+ openDocumentSettingsSidebar,
7
+ publishPost,
8
+ setBrowserViewport,
9
+ trashAllPosts,
10
+ } from '@wordpress/e2e-test-utils';
11
+
12
+ async function prepTestPost( postType, viewport ) {
13
+ // Create a post
14
+ await createNewPost( { postType } );
15
+
16
+ await page.type(
17
+ '.editor-post-title__input',
18
+ `Switch scheduled ${ postType } to draft`
19
+ );
20
+ await page.keyboard.press( 'Enter' );
21
+ await page.keyboard.type(
22
+ `This will be a scheduled ${ postType } edited in a ${ viewport } viewport`
23
+ );
24
+
25
+ // Unselect the blocks.
26
+ await page.evaluate( () => {
27
+ wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock();
28
+ } );
29
+ }
30
+
31
+ async function publishTestPost( postType, viewport ) {
32
+ // Create a post
33
+ await prepTestPost( postType, viewport );
34
+
35
+ // Publish the post
36
+ await publishPost();
37
+
38
+ const publishedSnackBar = await page.waitForXPath(
39
+ `//*[@aria-label="Dismiss this notice"][@role="button"]/div[contains(text(),"published")]`
40
+ );
41
+
42
+ const snackBarText = await (
43
+ await publishedSnackBar.getProperty( 'textContent' )
44
+ ).jsonValue();
45
+
46
+ expect( snackBarText.toLowerCase() ).toBe(
47
+ `${ postType } published.view ${ postType }`
48
+ );
49
+
50
+ const closePublishingPanel = await page.waitForXPath(
51
+ '//button[@aria-label="Close panel"]'
52
+ );
53
+ await closePublishingPanel.click();
54
+ }
55
+
56
+ async function scheduleTestPost( postType, viewport ) {
57
+ // Create a post
58
+ await prepTestPost( postType, viewport );
59
+
60
+ if ( viewport === 'small' ) {
61
+ await openDocumentSettingsSidebar();
62
+ }
63
+ // Set a publish date for the next month.
64
+ await page.click( '.edit-post-post-schedule__toggle' );
65
+ await page.click(
66
+ 'div[aria-label="Move forward to switch to the next month."]'
67
+ );
68
+
69
+ await (
70
+ await page.$x( '//td[@role="button"]/*[text() = "15"]' )
71
+ )[ 0 ].click();
72
+
73
+ await page.click( '.edit-post-post-schedule__toggle' );
74
+
75
+ if ( viewport === 'small' ) {
76
+ const closeDocumentSettingsButton = await page.waitForXPath(
77
+ '//div[@aria-label="Editor settings"]//button[@aria-label="Close settings"]'
78
+ );
79
+ await closeDocumentSettingsButton.click();
80
+ }
81
+
82
+ // Important: target an ellipsis (…) and not three dots (...)
83
+ const scheduleButton = await page.waitForXPath(
84
+ '//button[text()="Schedule…"]'
85
+ );
86
+ await scheduleButton.click();
87
+ const secondScheduleButton = await page.waitForXPath(
88
+ '//button[text()="Schedule"]'
89
+ );
90
+ await secondScheduleButton.click();
91
+
92
+ const closePublishingPanel = await page.waitForXPath(
93
+ '//button[@aria-label="Close panel"]'
94
+ );
95
+ await closePublishingPanel.click();
96
+ }
97
+
98
+ async function verifyRevertToDraft( postType ) {
99
+ const revertedSnackBar = await page.waitForXPath(
100
+ `//*[@aria-label="Dismiss this notice"][@role="button"]/div[contains(text(),"reverted")]`
101
+ );
102
+
103
+ const revertedSnackBarText = await (
104
+ await revertedSnackBar.getProperty( 'textContent' )
105
+ ).jsonValue();
106
+
107
+ expect( revertedSnackBarText.toLowerCase() ).toBe(
108
+ `${ postType } reverted to draft.`
109
+ );
110
+ }
111
+
112
+ describe( 'Clicking "Switch to draft" on a published post/page', () => {
113
+ beforeAll( async () => {
114
+ await trashAllPosts( 'post' );
115
+ await trashAllPosts( 'page' );
116
+ } );
117
+ afterEach( async () => {
118
+ await setBrowserViewport( 'large' );
119
+ } );
120
+
121
+ [ 'large', 'small' ].forEach( ( viewport ) => {
122
+ describe( `in a ${ viewport } viewport`, () => {
123
+ [ 'post', 'page' ].forEach( ( postType ) => {
124
+ const buttonText =
125
+ viewport === 'large' ? 'Switch to draft' : 'Draft';
126
+ beforeEach( async () => {
127
+ await setBrowserViewport( viewport );
128
+ } );
129
+
130
+ it( `should leave a published ${ postType } published if canceled`, async () => {
131
+ publishTestPost( postType, viewport );
132
+
133
+ const switchToDraftButton = await page.waitForXPath(
134
+ `//button[contains(text(), "${ buttonText }")]`
135
+ );
136
+ await switchToDraftButton.click();
137
+
138
+ // Process the ConfirmDialog
139
+ await page.waitForXPath(
140
+ '//*[text()="Are you sure you want to unpublish this post?"]'
141
+ );
142
+ const [ cancelButton ] = await page.$x(
143
+ '//*[@role="dialog"][not(@id="wp-link-wrap")]//button[text()="Cancel"]'
144
+ );
145
+ await cancelButton.click();
146
+
147
+ const postStatus = await page.evaluate( () => {
148
+ return wp.data
149
+ .select( 'core/editor' )
150
+ .getEditedPostAttribute( 'status' );
151
+ } );
152
+ expect( postStatus ).toBe( 'publish' );
153
+ } );
154
+ it( `should revert a published ${ postType } to a draft if confirmed`, async () => {
155
+ // Switch to draft
156
+ const switchToDraftButton = await page.waitForXPath(
157
+ `//button[contains(text(), "${ buttonText }")]`
158
+ );
159
+ await switchToDraftButton.click();
160
+
161
+ // Process the ConfirmDialog
162
+ await page.waitForXPath(
163
+ '//*[text()="Are you sure you want to unpublish this post?"]'
164
+ );
165
+ const [ confirmButton ] = await page.$x(
166
+ '//*[@role="dialog"]//button[text()="OK"]'
167
+ );
168
+ await confirmButton.click();
169
+
170
+ await verifyRevertToDraft( postType );
171
+
172
+ const postStatus = await page.evaluate( () => {
173
+ return wp.data
174
+ .select( 'core/editor' )
175
+ .getEditedPostAttribute( 'status' );
176
+ } );
177
+ expect( postStatus ).toBe( 'draft' );
178
+ } );
179
+ } );
180
+ } );
181
+ } );
182
+ } );
183
+ describe( 'Clicking "Switch to draft" on a scheduled post/page', () => {
184
+ beforeAll( async () => {
185
+ await trashAllPosts( 'post' );
186
+ await trashAllPosts( 'page' );
187
+ } );
188
+ afterEach( async () => {
189
+ await setBrowserViewport( 'large' );
190
+ } );
191
+
192
+ [ 'large', 'small' ].forEach( ( viewport ) => {
193
+ describe( `in a ${ viewport } viewport`, () => {
194
+ [ 'post', 'page' ].forEach( ( postType ) => {
195
+ const buttonText =
196
+ viewport === 'large' ? 'Switch to draft' : 'Draft';
197
+ beforeEach( async () => {
198
+ await setBrowserViewport( viewport );
199
+ } );
200
+
201
+ it( `should leave a scheduled ${ postType } scheduled if canceled`, async () => {
202
+ scheduleTestPost( postType, viewport );
203
+
204
+ const switchToDraftButton = await page.waitForXPath(
205
+ `//button[contains(text(), "${ buttonText }")]`
206
+ );
207
+ await switchToDraftButton.click();
208
+
209
+ // Process the ConfirmDialog
210
+ await page.waitForXPath(
211
+ '//*[text()="Are you sure you want to unschedule this post?"]'
212
+ );
213
+ const [ cancelButton ] = await page.$x(
214
+ '//*[@role="dialog"][not(@id="wp-link-wrap")]//button[text()="Cancel"]'
215
+ );
216
+ await cancelButton.click();
217
+
218
+ // Confirm post is still scheduled
219
+ const postStatus = await page.evaluate( () => {
220
+ return wp.data
221
+ .select( 'core/editor' )
222
+ .getEditedPostAttribute( 'status' );
223
+ } );
224
+ expect( postStatus ).toBe( 'future' );
225
+ } );
226
+ it( `should revert a scheduled ${ postType } to a draft if confirmed`, async () => {
227
+ // Switch to draft
228
+ const switchToDraftButton = await page.waitForXPath(
229
+ `//button[contains(text(), "${ buttonText }")]`
230
+ );
231
+ await switchToDraftButton.click();
232
+
233
+ // Process the ConfirmDialog
234
+ await page.waitForXPath(
235
+ '//*[text()="Are you sure you want to unschedule this post?"]'
236
+ );
237
+ const [ confirmButton ] = await page.$x(
238
+ '//*[@role="dialog"]//button[text()="OK"]'
239
+ );
240
+ await confirmButton.click();
241
+
242
+ await verifyRevertToDraft( postType );
243
+
244
+ const postStatus = await page.evaluate( () => {
245
+ return wp.data
246
+ .select( 'core/editor' )
247
+ .getEditedPostAttribute( 'status' );
248
+ } );
249
+ expect( postStatus ).toBe( 'draft' );
250
+ } );
251
+ } );
252
+ } );
253
+ } );
254
+ } );
@@ -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' );
@@ -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
 
@@ -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' );
@@ -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,
@@ -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
@@ -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"]' );