@wordpress/e2e-tests 3.0.1-next.33ec3857e2.0 → 3.0.1

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 (29) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/LICENSE.md +1 -1
  3. package/package.json +9 -9
  4. package/plugins/query-block.php +2 -2
  5. package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +4 -0
  6. package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
  7. package/specs/editor/blocks/classic.test.js +5 -2
  8. package/specs/editor/blocks/navigation.test.js +280 -191
  9. package/specs/editor/plugins/block-variations.test.js +1 -1
  10. package/specs/editor/plugins/iframed-inline-styles.test.js +0 -6
  11. package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -4
  12. package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
  13. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
  14. package/specs/editor/various/font-size-picker.test.js +57 -11
  15. package/specs/editor/various/post-editor-template-mode.test.js +1 -1
  16. package/specs/editor/various/preview.test.js +66 -1
  17. package/specs/editor/various/reusable-blocks.test.js +52 -5
  18. package/specs/editor/various/undo.test.js +21 -0
  19. package/specs/performance/site-editor.test.js +1 -1
  20. package/specs/site-editor/document-settings.test.js +4 -4
  21. package/specs/site-editor/multi-entity-editing.test.js +2 -2
  22. package/specs/site-editor/multi-entity-saving.test.js +15 -18
  23. package/specs/site-editor/settings-sidebar.test.js +4 -4
  24. package/specs/site-editor/site-editor-export.test.js +1 -1
  25. package/specs/site-editor/site-editor-inserter.test.js +1 -1
  26. package/specs/site-editor/template-part.test.js +9 -12
  27. package/specs/site-editor/template-revert.test.js +13 -9
  28. package/specs/widgets/customizing-widgets.test.js +3 -23
  29. package/specs/widgets/editing-widgets.test.js +36 -12
@@ -42,7 +42,7 @@ async function getTemplateCard() {
42
42
 
43
43
  describe( 'Settings sidebar', () => {
44
44
  beforeAll( async () => {
45
- await activateTheme( 'tt1-blocks' );
45
+ await activateTheme( 'emptytheme' );
46
46
  await trashAllPosts( 'wp_template' );
47
47
  await trashAllPosts( 'wp_template_part' );
48
48
  } );
@@ -70,7 +70,7 @@ describe( 'Settings sidebar', () => {
70
70
 
71
71
  const templateCardBeforeNavigation = await getTemplateCard();
72
72
  await siteEditor.visit( {
73
- postId: 'tt1-blocks//404',
73
+ postId: 'emptytheme//singular',
74
74
  postType: 'wp_template',
75
75
  } );
76
76
  const templateCardAfterNavigation = await getTemplateCard();
@@ -80,8 +80,8 @@ describe( 'Settings sidebar', () => {
80
80
  description: 'Displays posts.',
81
81
  } );
82
82
  expect( templateCardAfterNavigation ).toMatchObject( {
83
- title: '404',
84
- description: 'Displays when no content is found.',
83
+ title: 'Singular',
84
+ description: 'Displays a single post or page.',
85
85
  } );
86
86
  } );
87
87
  } );
@@ -30,7 +30,7 @@ async function waitForFileExists( filePath, timeout = 10000 ) {
30
30
 
31
31
  describe( 'Site Editor Templates Export', () => {
32
32
  beforeAll( async () => {
33
- await activateTheme( 'tt1-blocks' );
33
+ await activateTheme( 'emptytheme' );
34
34
  await trashAllPosts( 'wp_template' );
35
35
  await trashAllPosts( 'wp_template_part' );
36
36
  } );
@@ -10,7 +10,7 @@ import { siteEditor } from './utils';
10
10
 
11
11
  describe( 'Site Editor Inserter', () => {
12
12
  beforeAll( async () => {
13
- await activateTheme( 'tt1-blocks' );
13
+ await activateTheme( 'emptytheme' );
14
14
  await trashAllPosts( 'wp_template' );
15
15
  await trashAllPosts( 'wp_template_part' );
16
16
  } );
@@ -21,7 +21,7 @@ const templatePartNameInput =
21
21
 
22
22
  describe( 'Template Part', () => {
23
23
  beforeAll( async () => {
24
- await activateTheme( 'tt1-blocks' );
24
+ await activateTheme( 'emptytheme' );
25
25
  await trashAllPosts( 'wp_template' );
26
26
  await trashAllPosts( 'wp_template_part' );
27
27
  } );
@@ -40,7 +40,7 @@ describe( 'Template Part', () => {
40
40
  async function navigateToHeader() {
41
41
  // Switch to editing the header template part.
42
42
  await siteEditor.visit( {
43
- postId: 'tt1-blocks//header',
43
+ postId: 'emptytheme//header',
44
44
  postType: 'wp_template_part',
45
45
  } );
46
46
  }
@@ -61,7 +61,7 @@ describe( 'Template Part', () => {
61
61
 
62
62
  // Switch back to the Index template.
63
63
  await siteEditor.visit( {
64
- postId: 'tt1-blocks//index',
64
+ postId: 'emptytheme//index',
65
65
  postType: 'wp_template',
66
66
  } );
67
67
  }
@@ -93,12 +93,9 @@ describe( 'Template Part', () => {
93
93
  expect( paragraphInTemplatePart ).not.toBeNull();
94
94
  }
95
95
 
96
- async function awaitHeaderAndFooterLoad() {
96
+ async function awaitHeaderLoad() {
97
97
  await canvas().waitForSelector(
98
- '.wp-block-template-part.site-header.block-editor-block-list__layout'
99
- );
100
- await canvas().waitForSelector(
101
- '.wp-block-template-part.site-footer.block-editor-block-list__layout'
98
+ 'header.wp-block-template-part.block-editor-block-list__layout'
102
99
  );
103
100
  }
104
101
 
@@ -172,7 +169,7 @@ describe( 'Template Part', () => {
172
169
  } );
173
170
 
174
171
  it( 'Should convert selected block to template part', async () => {
175
- await awaitHeaderAndFooterLoad();
172
+ await awaitHeaderLoad();
176
173
  const initialTemplateParts = await canvas().$$(
177
174
  '.wp-block-template-part'
178
175
  );
@@ -210,7 +207,7 @@ describe( 'Template Part', () => {
210
207
  } );
211
208
 
212
209
  it( 'Should convert multiple selected blocks to template part', async () => {
213
- await awaitHeaderAndFooterLoad();
210
+ await awaitHeaderLoad();
214
211
  const initialTemplateParts = await canvas().$$(
215
212
  '.wp-block-template-part'
216
213
  );
@@ -277,7 +274,7 @@ describe( 'Template Part', () => {
277
274
 
278
275
  it( 'Should insert new template part on creation', async () => {
279
276
  let siteEditorCanvas = canvas();
280
- await awaitHeaderAndFooterLoad();
277
+ await awaitHeaderLoad();
281
278
 
282
279
  // Create new template part.
283
280
  await insertBlock( 'Template Part' );
@@ -319,7 +316,7 @@ describe( 'Template Part', () => {
319
316
  // Reload the page so as the new template part is available in the existing template parts.
320
317
  await siteEditor.visit();
321
318
  siteEditorCanvas = canvas();
322
- await awaitHeaderAndFooterLoad();
319
+ await awaitHeaderLoad();
323
320
  // Try to insert the template part we created.
324
321
  await insertBlock( 'Template Part' );
325
322
  const chooseExistingButton = await siteEditorCanvas.waitForXPath(
@@ -22,29 +22,31 @@ const {
22
22
  disableWelcomeGuide,
23
23
  } = siteEditor;
24
24
 
25
- const assertSaveButtonIsDisabled = () =>
25
+ const assertSaveButtonIsDisabled = async () =>
26
26
  page.waitForSelector(
27
27
  '.edit-site-save-button__button[aria-disabled="true"]'
28
28
  );
29
29
 
30
- const assertSaveButtonIsEnabled = () =>
30
+ const assertSaveButtonIsEnabled = async () =>
31
31
  page.waitForSelector(
32
32
  '.edit-site-save-button__button[aria-disabled="false"]'
33
33
  );
34
34
 
35
- const waitForNotice = () => page.waitForSelector( '.components-snackbar' );
36
-
37
35
  const clickButtonInNotice = async () => {
38
36
  const selector = '.components-snackbar button';
39
37
  await page.waitForSelector( selector );
40
38
  await page.click( selector );
41
39
  };
42
40
 
43
- const clickUndoInHeaderToolbar = () =>
41
+ const clickUndoInHeaderToolbar = async () =>
44
42
  page.click( '.edit-site-header__toolbar button[aria-label="Undo"]' );
45
43
 
46
- const clickRedoInHeaderToolbar = () =>
47
- page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
44
+ const clickRedoInHeaderToolbar = async () => {
45
+ await page.waitForSelector(
46
+ '.edit-site-header__toolbar button[aria-label="Redo"][aria-disabled="false"]'
47
+ );
48
+ return page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
49
+ };
48
50
 
49
51
  const undoRevertInHeaderToolbar = async () => {
50
52
  await clickUndoInHeaderToolbar();
@@ -72,7 +74,9 @@ const save = async () => {
72
74
  const revertTemplate = async () => {
73
75
  await page.click( '.edit-site-document-actions__get-info' );
74
76
  await page.click( '.edit-site-template-details__revert-button' );
75
- await waitForNotice();
77
+ await page.waitForXPath(
78
+ '//*[contains(@class, "components-snackbar") and contains(text(), "Template reverted")]'
79
+ );
76
80
  await assertSaveButtonIsEnabled();
77
81
  };
78
82
 
@@ -89,7 +93,7 @@ const assertTemplatesAreDeleted = async () => {
89
93
 
90
94
  describe( 'Template Revert', () => {
91
95
  beforeAll( async () => {
92
- await activateTheme( 'tt1-blocks' );
96
+ await activateTheme( 'emptytheme' );
93
97
  await trashAllPosts( 'wp_template' );
94
98
  await trashAllPosts( 'wp_template_part' );
95
99
  } );
@@ -19,10 +19,6 @@ import {
19
19
  // eslint-disable-next-line no-restricted-imports
20
20
  import { find, findAll } from 'puppeteer-testing-library';
21
21
 
22
- const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
23
- For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
24
- For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
25
-
26
22
  describe( 'Widgets Customizer', () => {
27
23
  beforeEach( async () => {
28
24
  await deleteAllWidgets();
@@ -163,8 +159,6 @@ describe( 'Widgets Customizer', () => {
163
159
  name: 'My Search',
164
160
  selector: '.widget-content *',
165
161
  } ).toBeFound( findOptions );
166
-
167
- expect( console ).toHaveWarned( twentyTwentyError );
168
162
  } );
169
163
 
170
164
  it( 'should open the inspector panel', async () => {
@@ -195,7 +189,7 @@ describe( 'Widgets Customizer', () => {
195
189
 
196
190
  const backButton = await find( {
197
191
  role: 'button',
198
- name: 'Back',
192
+ name: /Back/,
199
193
  focused: true,
200
194
  } );
201
195
  await expect( backButton ).toHaveFocus();
@@ -250,8 +244,6 @@ describe( 'Widgets Customizer', () => {
250
244
  } ).toBeFound();
251
245
 
252
246
  await expect( inspectorHeading ).not.toBeVisible();
253
-
254
- expect( console ).toHaveWarned( twentyTwentyError );
255
247
  } );
256
248
 
257
249
  it( 'should handle the inserter outer section', async () => {
@@ -349,7 +341,7 @@ describe( 'Widgets Customizer', () => {
349
341
  // Back to the widget areas panel.
350
342
  const backButton = await find( {
351
343
  role: 'button',
352
- name: 'Back',
344
+ name: /Back/,
353
345
  } );
354
346
  await backButton.click();
355
347
 
@@ -359,8 +351,6 @@ describe( 'Widgets Customizer', () => {
359
351
  name: 'Add a block',
360
352
  level: 2,
361
353
  } ).not.toBeFound();
362
-
363
- expect( console ).toHaveWarned( twentyTwentyError );
364
354
  } );
365
355
 
366
356
  it( 'should move focus to the block', async () => {
@@ -387,7 +377,7 @@ describe( 'Widgets Customizer', () => {
387
377
  await page.keyboard.type( 'First Heading' );
388
378
 
389
379
  // Navigate back to the parent panel.
390
- const backButton = await find( { role: 'button', name: 'Back' } );
380
+ const backButton = await find( { role: 'button', name: /Back/ } );
391
381
  await backButton.click();
392
382
 
393
383
  await waitForPreviewIframe();
@@ -456,8 +446,6 @@ describe( 'Widgets Customizer', () => {
456
446
  text: 'First Heading',
457
447
  } );
458
448
  await expect( headingBlock ).toHaveFocus();
459
-
460
- expect( console ).toHaveWarned( twentyTwentyError );
461
449
  } );
462
450
 
463
451
  it( 'should clear block selection', async () => {
@@ -520,8 +508,6 @@ describe( 'Widgets Customizer', () => {
520
508
  role: 'toolbar',
521
509
  name: 'Block tools',
522
510
  } ).not.toBeFound();
523
-
524
- expect( console ).toHaveWarned( twentyTwentyError );
525
511
  } );
526
512
 
527
513
  it( 'should handle legacy widgets', async () => {
@@ -700,8 +686,6 @@ describe( 'Widgets Customizer', () => {
700
686
  selector: '*[aria-live="polite"][aria-relevant="additions text"]',
701
687
  } ).toBeFound();
702
688
  await expect( paragraphBlock ).toBeVisible();
703
-
704
- expect( console ).toHaveWarned( twentyTwentyError );
705
689
  } );
706
690
 
707
691
  it( 'should move (inner) blocks to another sidebar', async () => {
@@ -761,8 +745,6 @@ describe( 'Widgets Customizer', () => {
761
745
  await expect( movedParagraphBlockQuery ).toBeFound();
762
746
  const movedParagraphBlock = await find( movedParagraphBlockQuery );
763
747
  await expect( movedParagraphBlock ).toHaveFocus();
764
-
765
- expect( console ).toHaveWarned( twentyTwentyError );
766
748
  } );
767
749
 
768
750
  it( 'should not render Block Settings sections', async () => {
@@ -855,8 +837,6 @@ describe( 'Widgets Customizer', () => {
855
837
  name: 'Customizing ▸ Widgets ▸ Footer #1 Block Settings',
856
838
  level: 3,
857
839
  } );
858
-
859
- expect( console ).toHaveWarned( twentyTwentyError );
860
840
  } );
861
841
  } );
862
842
 
@@ -16,6 +16,7 @@ import {
16
16
  openGlobalBlockInserter,
17
17
  searchForBlock,
18
18
  closeGlobalBlockInserter,
19
+ setBrowserViewport,
19
20
  } from '@wordpress/e2e-test-utils';
20
21
 
21
22
  /**
@@ -25,10 +26,6 @@ import {
25
26
  import { find, findAll } from 'puppeteer-testing-library';
26
27
  import { groupBy, mapValues } from 'lodash';
27
28
 
28
- const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
29
- For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
30
- For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
31
-
32
29
  describe( 'Widgets screen', () => {
33
30
  beforeEach( async () => {
34
31
  await visitWidgetsScreen();
@@ -232,8 +229,6 @@ describe( 'Widgets screen', () => {
232
229
  </div></div>",
233
230
  }
234
231
  ` );
235
-
236
- expect( console ).toHaveWarned( twentyTwentyError );
237
232
  } );
238
233
 
239
234
  it.skip( 'Should insert content using the inline inserter', async () => {
@@ -601,8 +596,6 @@ describe( 'Widgets screen', () => {
601
596
  initialSerializedWidgetAreas[ 'sidebar-1' ],
602
597
  ].join( '\n' )
603
598
  );
604
-
605
- expect( console ).toHaveWarned( twentyTwentyError );
606
599
  } );
607
600
 
608
601
  it.skip( 'Should display legacy widgets', async () => {
@@ -777,8 +770,6 @@ describe( 'Widgets screen', () => {
777
770
  </div></div>",
778
771
  }
779
772
  ` );
780
-
781
- expect( console ).toHaveWarned( twentyTwentyError );
782
773
  } );
783
774
 
784
775
  it( 'Allows widget deletion to be undone', async () => {
@@ -838,8 +829,6 @@ describe( 'Widgets screen', () => {
838
829
  </div></div>",
839
830
  }
840
831
  ` );
841
-
842
- expect( console ).toHaveWarned( twentyTwentyError );
843
832
  } );
844
833
 
845
834
  it( 'can toggle sidebar list view', async () => {
@@ -854,6 +843,41 @@ describe( 'Widgets screen', () => {
854
843
  expect( listItems.length >= widgetAreas.length ).toEqual( true );
855
844
  await closeListView();
856
845
  } );
846
+
847
+ // Check for regressions of https://github.com/WordPress/gutenberg/issues/38002.
848
+ it( 'allows blocks to be added on mobile viewports', async () => {
849
+ await setBrowserViewport( 'small' );
850
+ const [ firstWidgetArea ] = await findAll( {
851
+ role: 'document',
852
+ name: 'Block: Widget Area',
853
+ } );
854
+
855
+ const addParagraphBlock = await getBlockInGlobalInserter( 'Paragraph' );
856
+ await addParagraphBlock.click();
857
+
858
+ const addedParagraphBlockInFirstWidgetArea = await find(
859
+ {
860
+ name: /^Empty block/,
861
+ selector: '[data-block][data-type="core/paragraph"]',
862
+ },
863
+ {
864
+ root: firstWidgetArea,
865
+ }
866
+ );
867
+ await addedParagraphBlockInFirstWidgetArea.focus();
868
+ await page.keyboard.type( 'First Paragraph' );
869
+ const updatedParagraphBlockInFirstWidgetArea = await find(
870
+ {
871
+ name: 'Paragraph block',
872
+ value: 'First Paragraph',
873
+ },
874
+ {
875
+ root: firstWidgetArea,
876
+ }
877
+ );
878
+
879
+ expect( updatedParagraphBlockInFirstWidgetArea ).toBeTruthy();
880
+ } );
857
881
  } );
858
882
 
859
883
  /**