@wordpress/e2e-tests 2.5.13 → 2.5.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "2.5.13",
3
+ "version": "2.5.17",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -26,7 +26,7 @@
26
26
  "@wordpress/e2e-test-utils": "^5.4.10",
27
27
  "@wordpress/jest-console": "^4.1.1",
28
28
  "@wordpress/jest-puppeteer-axe": "^3.1.1",
29
- "@wordpress/scripts": "^19.2.2",
29
+ "@wordpress/scripts": "^19.2.4",
30
30
  "@wordpress/url": "^3.3.1",
31
31
  "chalk": "^4.0.0",
32
32
  "expect-puppeteer": "^4.4.0",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "1081a28b2368fcebd9a14554fbd0e25eb33fbcb6"
46
+ "gitHead": "823b3225e81748f8febb808e780e2b71478bc854"
47
47
  }
@@ -57,11 +57,5 @@ describe( 'iframed inline styles', () => {
57
57
  expect( await getComputedStyle( canvas(), 'border-width' ) ).toBe(
58
58
  '2px'
59
59
  );
60
-
61
- expect( console ).toHaveWarned(
62
- `Stylesheet iframed-inline-styles-compat-style-css was not properly added.
63
- 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).
64
- For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles). <link rel="stylesheet" id="iframed-inline-styles-compat-style-css" href="http://localhost:8889/wp-content/plugins/gutenberg-test-plugins/iframed-inline-styles/compat-style.css?ver=1626189899" media="all">`
65
- );
66
60
  } );
67
61
  } );
@@ -63,9 +63,5 @@ describe( 'iframed multiple block stylesheets', () => {
63
63
  expect( await getComputedStyle( canvas(), 'background-color' ) ).toBe(
64
64
  'rgb(0, 0, 0)'
65
65
  );
66
-
67
- // Skip warnings related to block-styles enqueing and the use of add_editor_style.
68
- // The issue is tracked on https://github.com/WordPress/gutenberg/issues/33212.
69
- expect( console ).toHaveWarned();
70
66
  } );
71
67
  } );
@@ -84,8 +84,8 @@ describe( 'Multi-entity save flow', () => {
84
84
  expect( multiSaveButton ).toBeNull();
85
85
  };
86
86
 
87
- it( 'Save flow should work as expected.', async () => {
88
- await createNewPost();
87
+ // Template parts can't be used in posts, so this test needs to be rebuilt using perhaps reusable blocks.
88
+ it.skip( 'Save flow should work as expected.', async () => {
89
89
  // Edit the page some.
90
90
  await page.click( '.editor-post-title' );
91
91
  await page.keyboard.type( 'Test Post...' );
@@ -250,6 +250,19 @@ describe( 'Multi-entity save flow', () => {
250
250
  const disabledSaveSiteSelector = `${ saveSiteSelector }[aria-disabled=true]`;
251
251
  const saveA11ySelector = '.edit-site-editor__toggle-save-panel-button';
252
252
 
253
+ const saveAllChanges = async () => {
254
+ // Clicking button should open panel with boxes checked.
255
+ await page.click( activeSaveSiteSelector );
256
+ await page.waitForSelector( savePanelSelector );
257
+ await assertAllBoxesChecked();
258
+
259
+ // Save a11y button should not be present with save panel open.
260
+ await assertExistance( saveA11ySelector, false );
261
+
262
+ // Saving should result in items being saved.
263
+ await page.click( entitiesSaveSelector );
264
+ };
265
+
253
266
  it( 'Save flow should work as expected', async () => {
254
267
  // Navigate to site editor.
255
268
  await siteEditor.visit( {
@@ -279,20 +292,55 @@ describe( 'Multi-entity save flow', () => {
279
292
  // Save a11y button should be present.
280
293
  await assertExistance( saveA11ySelector, true );
281
294
 
282
- // Clicking button should open panel with boxes checked.
283
- await page.click( activeSaveSiteSelector );
284
- await page.waitForSelector( savePanelSelector );
285
- await assertAllBoxesChecked();
295
+ // Save all changes.
296
+ await saveAllChanges();
286
297
 
287
- // Save a11y button should not be present with save panel open.
288
- await assertExistance( saveA11ySelector, false );
289
-
290
- // Saving should result in items being saved.
291
- await page.click( entitiesSaveSelector );
292
298
  const disabledButton = await page.waitForSelector(
293
299
  disabledSaveSiteSelector
294
300
  );
295
301
  expect( disabledButton ).not.toBeNull();
296
302
  } );
303
+
304
+ it( 'Save flow should allow re-saving after changing the same block attribute', async () => {
305
+ // Navigate to site editor.
306
+ await siteEditor.visit( {
307
+ postId: 'tt1-blocks//index',
308
+ postType: 'wp_template',
309
+ } );
310
+ await siteEditor.disableWelcomeGuide();
311
+
312
+ // Insert a paragraph at the bottom.
313
+ await insertBlock( 'Paragraph' );
314
+
315
+ // Open the block settings.
316
+ await page.click( 'button[aria-label="Settings"]' );
317
+
318
+ // Click on font size selector.
319
+ await page.click( 'button[aria-label="Font size"]' );
320
+
321
+ // Click on a different font size.
322
+ const extraSmallFontSize = await page.waitForXPath(
323
+ '//li[contains(text(), "Extra small")]'
324
+ );
325
+ await extraSmallFontSize.click();
326
+
327
+ // Save all changes.
328
+ await saveAllChanges();
329
+
330
+ // Click on font size selector again.
331
+ await page.click( 'button[aria-label="Font size"]' );
332
+
333
+ // Select another font size.
334
+ const normalFontSize = await page.waitForXPath(
335
+ '//li[contains(text(), "Normal")]'
336
+ );
337
+ await normalFontSize.click();
338
+
339
+ // Assert that the save button has been re-enabled.
340
+ const saveButton = await page.waitForSelector(
341
+ activeSaveSiteSelector
342
+ );
343
+ expect( saveButton ).not.toBeNull();
344
+ } );
297
345
  } );
298
346
  } );
@@ -280,7 +280,8 @@ describe( 'Template Part', () => {
280
280
  const confirmTitleButtonSelector =
281
281
  '.wp-block-template-part__placeholder-create-new__title-form .components-button.is-primary';
282
282
 
283
- it( 'Should insert new template part on creation', async () => {
283
+ // Template parts can't be used in posts, so this test needs to be rebuilt for the template editor.
284
+ it.skip( 'Should insert new template part on creation', async () => {
284
285
  await createNewPost();
285
286
  await disablePrePublishChecks();
286
287
  // Create new template part.
@@ -18,10 +18,6 @@ import {
18
18
  // eslint-disable-next-line no-restricted-imports
19
19
  import { find, findAll } from 'puppeteer-testing-library';
20
20
 
21
- const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
22
- 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).
23
- For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
24
-
25
21
  describe( 'Widgets Customizer', () => {
26
22
  beforeEach( async () => {
27
23
  await deleteAllWidgets();
@@ -162,8 +158,6 @@ describe( 'Widgets Customizer', () => {
162
158
  name: 'My Search',
163
159
  selector: '.widget-content *',
164
160
  } ).toBeFound( findOptions );
165
-
166
- expect( console ).toHaveWarned( twentyTwentyError );
167
161
  } );
168
162
 
169
163
  it( 'should open the inspector panel', async () => {
@@ -249,8 +243,6 @@ describe( 'Widgets Customizer', () => {
249
243
  } ).toBeFound();
250
244
 
251
245
  await expect( inspectorHeading ).not.toBeVisible();
252
-
253
- expect( console ).toHaveWarned( twentyTwentyError );
254
246
  } );
255
247
 
256
248
  it( 'should handle the inserter outer section', async () => {
@@ -358,8 +350,6 @@ describe( 'Widgets Customizer', () => {
358
350
  name: 'Add a block',
359
351
  level: 2,
360
352
  } ).not.toBeFound();
361
-
362
- expect( console ).toHaveWarned( twentyTwentyError );
363
353
  } );
364
354
 
365
355
  it( 'should move focus to the block', async () => {
@@ -455,8 +445,6 @@ describe( 'Widgets Customizer', () => {
455
445
  text: 'First Heading',
456
446
  } );
457
447
  await expect( headingBlock ).toHaveFocus();
458
-
459
- expect( console ).toHaveWarned( twentyTwentyError );
460
448
  } );
461
449
 
462
450
  it( 'should clear block selection', async () => {
@@ -519,8 +507,6 @@ describe( 'Widgets Customizer', () => {
519
507
  role: 'toolbar',
520
508
  name: 'Block tools',
521
509
  } ).not.toBeFound();
522
-
523
- expect( console ).toHaveWarned( twentyTwentyError );
524
510
  } );
525
511
 
526
512
  it( 'should handle legacy widgets', async () => {
@@ -699,8 +685,6 @@ describe( 'Widgets Customizer', () => {
699
685
  selector: '*[aria-live="polite"][aria-relevant="additions text"]',
700
686
  } ).toBeFound();
701
687
  await expect( paragraphBlock ).toBeVisible();
702
-
703
- expect( console ).toHaveWarned( twentyTwentyError );
704
688
  } );
705
689
 
706
690
  it( 'should move (inner) blocks to another sidebar', async () => {
@@ -760,8 +744,6 @@ describe( 'Widgets Customizer', () => {
760
744
  await expect( movedParagraphBlockQuery ).toBeFound();
761
745
  const movedParagraphBlock = await find( movedParagraphBlockQuery );
762
746
  await expect( movedParagraphBlock ).toHaveFocus();
763
-
764
- expect( console ).toHaveWarned( twentyTwentyError );
765
747
  } );
766
748
 
767
749
  it( 'should not render Block Settings sections', async () => {
@@ -851,8 +833,6 @@ describe( 'Widgets Customizer', () => {
851
833
  name: 'Customizing ▸ Widgets ▸ Footer #1 Block Settings',
852
834
  level: 3,
853
835
  } );
854
-
855
- expect( console ).toHaveWarned( twentyTwentyError );
856
836
  } );
857
837
  } );
858
838
 
@@ -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
  /**