@wordpress/e2e-tests 3.0.5 → 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.
Files changed (25) hide show
  1. package/package.json +4 -4
  2. package/specs/editor/blocks/__snapshots__/heading.test.js.snap +8 -8
  3. package/specs/editor/blocks/__snapshots__/quote.test.js.snap +10 -10
  4. package/specs/editor/blocks/image.test.js +4 -3
  5. package/specs/editor/blocks/navigation.test.js +134 -14
  6. package/specs/editor/plugins/block-directory-add.test.js +15 -1
  7. package/specs/editor/various/__snapshots__/block-grouping.test.js.snap +4 -4
  8. package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +2 -2
  9. package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +3 -3
  10. package/specs/editor/various/list-view.test.js +95 -0
  11. package/specs/editor/various/multi-block-selection.test.js +84 -0
  12. package/specs/editor/various/post-editor-template-mode.test.js +182 -5
  13. package/specs/editor/various/post-visibility.test.js +1 -1
  14. package/specs/editor/various/switch-to-draft.test.js +254 -0
  15. package/specs/editor/various/writing-flow.test.js +65 -0
  16. package/specs/performance/site-editor.test.js +5 -6
  17. package/specs/site-editor/document-settings.test.js +3 -3
  18. package/specs/site-editor/multi-entity-editing.test.js +5 -5
  19. package/specs/site-editor/multi-entity-saving.test.js +4 -3
  20. package/specs/site-editor/settings-sidebar.test.js +5 -5
  21. package/specs/site-editor/site-editor-export.test.js +3 -3
  22. package/specs/site-editor/site-editor-inserter.test.js +3 -3
  23. package/specs/site-editor/template-part.test.js +18 -18
  24. package/specs/site-editor/template-revert.test.js +12 -22
  25. package/specs/widgets/customizing-widgets.test.js +4 -0
@@ -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"]' );
@@ -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 () => {
@@ -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';
@@ -10,8 +10,8 @@ import {
10
10
  describe( 'Site Editor Inserter', () => {
11
11
  beforeAll( async () => {
12
12
  await activateTheme( 'emptytheme' );
13
- await trashAllPosts( 'wp_template' );
14
- await trashAllPosts( 'wp_template_part' );
13
+ await deleteAllTemplates( 'wp_template' );
14
+ await deleteAllTemplates( 'wp_template_part' );
15
15
  } );
16
16
  afterAll( async () => {
17
17
  await activateTheme( 'twentytwentyone' );
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import {
5
5
  insertBlock,
6
- trashAllPosts,
6
+ deleteAllTemplates,
7
7
  activateTheme,
8
8
  getAllBlocks,
9
9
  selectBlockByClientId,
@@ -18,12 +18,12 @@ const templatePartNameInput =
18
18
  describe( 'Template Part', () => {
19
19
  beforeAll( async () => {
20
20
  await activateTheme( 'emptytheme' );
21
- await trashAllPosts( 'wp_template' );
22
- await trashAllPosts( 'wp_template_part' );
21
+ await deleteAllTemplates( 'wp_template' );
22
+ await deleteAllTemplates( 'wp_template_part' );
23
23
  } );
24
24
  afterAll( async () => {
25
- await trashAllPosts( 'wp_template' );
26
- await trashAllPosts( 'wp_template_part' );
25
+ await deleteAllTemplates( 'wp_template' );
26
+ await deleteAllTemplates( 'wp_template_part' );
27
27
  await activateTheme( 'twentytwentyone' );
28
28
  } );
29
29
 
@@ -260,10 +260,10 @@ describe( 'Template Part', () => {
260
260
  const savePostSelector = '.edit-site-save-button__button';
261
261
  const templatePartSelector = '*[data-type="core/template-part"]';
262
262
  const activatedTemplatePartSelector = `${ templatePartSelector }.block-editor-block-list__layout`;
263
- const createNewButtonSelector =
264
- '//button[contains(text(), "New template part")]';
263
+ const startBlockButtonSelector =
264
+ '//button[contains(text(), "Start blank")]';
265
265
  const chooseExistingButtonSelector =
266
- '//button[contains(text(), "Choose existing")]';
266
+ '//button[contains(text(), "Choose")]';
267
267
  const confirmTitleButtonSelector =
268
268
  '.wp-block-template-part__placeholder-create-new__title-form .components-button.is-primary';
269
269
 
@@ -273,13 +273,10 @@ describe( 'Template Part', () => {
273
273
 
274
274
  // Create new template part.
275
275
  await insertBlock( 'Template Part' );
276
- await siteEditorCanvas.waitForXPath(
277
- chooseExistingButtonSelector
278
- );
279
- const [ createNewButton ] = await siteEditorCanvas.$x(
280
- createNewButtonSelector
276
+ const startBlankButton = await siteEditorCanvas.waitForXPath(
277
+ startBlockButtonSelector
281
278
  );
282
- await createNewButton.click();
279
+ await startBlankButton.click();
283
280
  const confirmTitleButton = await page.waitForSelector(
284
281
  confirmTitleButtonSelector
285
282
  );
@@ -318,13 +315,16 @@ describe( 'Template Part', () => {
318
315
  chooseExistingButtonSelector
319
316
  );
320
317
  await chooseExistingButton.click();
321
- await page.waitForSelector(
322
- '.wp-block-template-part__selection-preview-container'
323
- );
324
318
  const preview = await page.waitForSelector(
325
- '.wp-block-template-part__selection-preview-item[aria-label="Create New"]'
319
+ '.block-editor-block-patterns-list__item'
326
320
  );
327
321
  await preview.click();
322
+
323
+ // Wait for the template parts to load properly.
324
+ await siteEditorCanvas.waitForSelector(
325
+ '[data-type="core/template-part"] > p:first-child'
326
+ );
327
+
328
328
  // We now have the same template part two times in the page, so check accordingly.
329
329
  const paragraphs = await siteEditorCanvas.$$eval(
330
330
  '[data-type="core/template-part"] > p:first-child',
@@ -3,15 +3,11 @@
3
3
  */
4
4
  import {
5
5
  insertBlock,
6
- trashAllPosts,
7
6
  activateTheme,
8
- switchUserToAdmin,
9
- switchUserToTest,
10
- visitAdminPage,
7
+ deleteAllTemplates,
11
8
  visitSiteEditor,
12
9
  getCurrentSiteEditorContent,
13
10
  } from '@wordpress/e2e-test-utils';
14
- import { addQueryArgs } from '@wordpress/url';
15
11
 
16
12
  const assertSaveButtonIsDisabled = async () =>
17
13
  page.waitForSelector(
@@ -71,30 +67,19 @@ const revertTemplate = async () => {
71
67
  await assertSaveButtonIsEnabled();
72
68
  };
73
69
 
74
- const assertTemplatesAreDeleted = async () => {
75
- await switchUserToAdmin();
76
- const query = addQueryArgs( '', {
77
- post_type: 'wp_template',
78
- } ).slice( 1 );
79
- await visitAdminPage( 'edit.php', query );
80
- const element = await page.waitForSelector( '#the-list .no-items' );
81
- expect( element ).toBeTruthy();
82
- await switchUserToTest();
83
- };
84
-
85
70
  describe( 'Template Revert', () => {
86
71
  beforeAll( async () => {
87
72
  await activateTheme( 'emptytheme' );
88
- await trashAllPosts( 'wp_template' );
89
- await trashAllPosts( 'wp_template_part' );
73
+ await deleteAllTemplates( 'wp_template' );
74
+ await deleteAllTemplates( 'wp_template_part' );
90
75
  } );
91
76
  afterAll( async () => {
92
- await trashAllPosts( 'wp_template' );
93
- await trashAllPosts( 'wp_template_part' );
77
+ await deleteAllTemplates( 'wp_template' );
78
+ await deleteAllTemplates( 'wp_template_part' );
94
79
  await activateTheme( 'twentytwentyone' );
95
80
  } );
96
81
  beforeEach( async () => {
97
- await trashAllPosts( 'wp_template' );
82
+ await deleteAllTemplates( 'wp_template' );
98
83
  await visitSiteEditor();
99
84
  } );
100
85
 
@@ -104,7 +89,12 @@ describe( 'Template Revert', () => {
104
89
  await revertTemplate();
105
90
  await save();
106
91
 
107
- await assertTemplatesAreDeleted();
92
+ await page.click( '.edit-site-document-actions__get-info' );
93
+
94
+ // The revert button isn't visible anymore.
95
+ expect(
96
+ await page.$( '.edit-site-template-details__revert-button' )
97
+ ).toBeNull();
108
98
  } );
109
99
 
110
100
  it( 'should show the original content after revert', async () => {
@@ -880,6 +880,10 @@ async function addBlock( blockName ) {
880
880
  }
881
881
  } );
882
882
 
883
+ // Click something so that the block toolbar, which sometimes obscures
884
+ // buttons in the inserter, goes away.
885
+ await searchBox.click();
886
+
883
887
  await searchBox.type( blockName );
884
888
 
885
889
  // TODO - remove this timeout when the test plugin for disabling CSS