@wordpress/e2e-tests 5.0.0 → 5.1.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 (30) hide show
  1. package/assets/large-post.html +1478 -96
  2. package/package.json +5 -5
  3. package/specs/editor/blocks/navigation.test.js +4 -6
  4. package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +3 -1
  5. package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
  6. package/specs/editor/plugins/cpt-locking.test.js +15 -15
  7. package/specs/editor/plugins/iframed-block.test.js +2 -12
  8. package/specs/editor/plugins/iframed-inline-styles.test.js +3 -12
  9. package/specs/editor/plugins/iframed-masonry-block.test.js +2 -12
  10. package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +3 -12
  11. package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +3 -0
  12. package/specs/editor/various/__snapshots__/block-deletion.test.js.snap +3 -1
  13. package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +0 -6
  14. package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +25 -1
  15. package/specs/editor/various/__snapshots__/rich-text.test.js.snap +19 -5
  16. package/specs/editor/various/block-switcher.test.js +11 -3
  17. package/specs/editor/various/font-size-picker.test.js +1 -3
  18. package/specs/editor/various/inserting-blocks.test.js +4 -0
  19. package/specs/editor/various/keep-styles-on-block-transforms.test.js +0 -17
  20. package/specs/editor/various/multi-block-selection.test.js +8 -0
  21. package/specs/editor/various/rich-text.test.js +9 -6
  22. package/specs/editor/various/splitting-merging.test.js +7 -2
  23. package/specs/editor/various/toolbar-roving-tabindex.test.js +2 -1
  24. package/specs/editor/plugins/register-block-type-hooks.test.js +0 -32
  25. package/specs/editor/various/__snapshots__/draggable-block.test.js.snap +0 -41
  26. package/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap +0 -21
  27. package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +0 -305
  28. package/specs/editor/various/draggable-block.test.js +0 -127
  29. package/specs/editor/various/duplicating-blocks.test.js +0 -47
  30. package/specs/editor/various/writing-flow.test.js +0 -829
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -23,11 +23,11 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^8.0.0",
26
+ "@wordpress/e2e-test-utils": "^8.1.0",
27
27
  "@wordpress/jest-console": "^6.0.0",
28
28
  "@wordpress/jest-puppeteer-axe": "^5.0.0",
29
- "@wordpress/scripts": "^24.0.0",
30
- "@wordpress/url": "^3.17.0",
29
+ "@wordpress/scripts": "^24.1.0",
30
+ "@wordpress/url": "^3.18.0",
31
31
  "chalk": "^4.0.0",
32
32
  "expect-puppeteer": "^4.4.0",
33
33
  "filenamify": "^4.2.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "171b87c7465b93e685e081c5f57f153507363c95"
49
+ "gitHead": "0d732d4b184adcb28cc83087603e81b764390d4b"
50
50
  }
@@ -278,8 +278,9 @@ async function waitForBlock( blockName ) {
278
278
  }
279
279
 
280
280
  // Disable reason - these tests are to be re-written.
281
+ // Skipped temporarily due to issues with GH actions: https://wordpress.slack.com/archives/C02QB2JS7/p1661331673166269.
281
282
  // eslint-disable-next-line jest/no-disabled-tests
282
- describe( 'Navigation', () => {
283
+ describe.skip( 'Navigation', () => {
283
284
  const contributorUsername = `contributoruser_${ ++uniqueId }`;
284
285
  let contributorPassword;
285
286
 
@@ -1681,10 +1682,7 @@ Expected mock function not to be called but it was called with: ["POST", "http:/
1681
1682
  );
1682
1683
  } );
1683
1684
 
1684
- // Skip reason: running it in interactive works but selecting and
1685
- // checking for focus consistently fails in the test.
1686
- // eslint-disable-next-line jest/no-disabled-tests
1687
- it.skip( 'should always focus select menu button after item selection', async () => {
1685
+ it( 'should always focus select menu button after item selection', async () => {
1688
1686
  // Create some navigation menus to work with.
1689
1687
  await createNavigationMenu( {
1690
1688
  title: 'First navigation',
@@ -1712,7 +1710,7 @@ Expected mock function not to be called but it was called with: ["POST", "http:/
1712
1710
  const theOption = await page.waitForXPath(
1713
1711
  "//button[@aria-checked='false'][contains(., 'First navigation')]"
1714
1712
  );
1715
- theOption.click();
1713
+ await theOption.click();
1716
1714
 
1717
1715
  // Once the options are closed, does select menu button receive focus?
1718
1716
  const selectMenuDropdown2 = await page.$(
@@ -84,7 +84,9 @@ exports[`cpt locking template_lock false should allow blocks to be inserted 1`]
84
84
  <!-- /wp:columns -->
85
85
 
86
86
  <!-- wp:list -->
87
- <ul><li>List content</li></ul>
87
+ <ul><!-- wp:list-item -->
88
+ <li>List content</li>
89
+ <!-- /wp:list-item --></ul>
88
90
  <!-- /wp:list -->"
89
91
  `;
90
92
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  exports[`Using Plugins API Document Setting Custom Panel Should render a custom panel inside Document Setting sidebar 1`] = `"My Custom Panel"`;
4
4
 
5
- exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
5
+ exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
6
6
 
7
- exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
7
+ exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"24\\" height=\\"24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
@@ -119,22 +119,22 @@ describe( 'cpt locking', () => {
119
119
  );
120
120
  } );
121
121
 
122
- it( 'can use the global inserter in inner blocks', async () => {
122
+ it( 'should not allow blocks to be inserted in inner blocks', async () => {
123
123
  await page.click( 'button[aria-label="Two columns; equal split"]' );
124
- await page.click(
125
- '.wp-block-column .block-editor-button-block-appender'
126
- );
127
- await page.type( '.block-editor-inserter__search input', 'image' );
128
- await pressKeyTimes( 'Tab', 2 );
129
- await page.keyboard.press( 'Enter' );
130
- await page.click( '.edit-post-header-toolbar__inserter-toggle' );
131
- await page.type(
132
- '.block-editor-inserter__search input',
133
- 'gallery'
134
- );
135
- await pressKeyTimes( 'Tab', 2 );
136
- await page.keyboard.press( 'Enter' );
137
- expect( await page.$( '.wp-block-gallery' ) ).not.toBeNull();
124
+ expect(
125
+ await page.$(
126
+ '.wp-block-column .block-editor-button-block-appender'
127
+ )
128
+ ).toBeNull();
129
+
130
+ expect(
131
+ await page.evaluate( () => {
132
+ const inserter = document.querySelector(
133
+ '.edit-post-header [aria-label="Add block"], .edit-post-header [aria-label="Toggle block inserter"]'
134
+ );
135
+ return inserter.getAttribute( 'disabled' );
136
+ } )
137
+ ).not.toBeNull();
138
138
  } );
139
139
  } );
140
140
 
@@ -7,9 +7,8 @@ import {
7
7
  deactivatePlugin,
8
8
  insertBlock,
9
9
  getEditedPostContent,
10
- openDocumentSettingsSidebar,
11
- clickButton,
12
10
  canvas,
11
+ createNewTemplate,
13
12
  } from '@wordpress/e2e-test-utils';
14
13
 
15
14
  describe( 'changing image size', () => {
@@ -34,16 +33,7 @@ describe( 'changing image size', () => {
34
33
 
35
34
  expect( text ).toBe( 'Iframed Block (set with jQuery)' );
36
35
 
37
- await openDocumentSettingsSidebar();
38
- await clickButton( 'Page' );
39
- await page.click( 'button[aria-label^="Select template"]' );
40
- await page.waitForSelector( 'button[aria-label="Add template"]' );
41
- await page.click( 'button[aria-label="Add template"]' );
42
- await page.keyboard.press( 'Tab' );
43
- await page.keyboard.press( 'Tab' );
44
- await page.keyboard.type( 'Iframed Test' );
45
- await clickButton( 'Create' );
46
- await page.waitForSelector( 'iframe[name="editor-canvas"]' );
36
+ await createNewTemplate( 'Iframed Test' );
47
37
 
48
38
  const iframeElement = await canvas().waitForSelector(
49
39
  '.wp-block-test-iframed-block'
@@ -7,9 +7,8 @@ import {
7
7
  deactivatePlugin,
8
8
  insertBlock,
9
9
  getEditedPostContent,
10
- openDocumentSettingsSidebar,
11
- clickButton,
12
10
  canvas,
11
+ createNewTemplate,
13
12
  } from '@wordpress/e2e-test-utils';
14
13
 
15
14
  async function getComputedStyle( context, property ) {
@@ -33,22 +32,14 @@ describe( 'iframed inline styles', () => {
33
32
  } );
34
33
 
35
34
  // Skip flaky test. See https://github.com/WordPress/gutenberg/issues/35172
36
- it.skip( 'should load inline styles in iframe', async () => {
35
+ it( 'should load inline styles in iframe', async () => {
37
36
  await insertBlock( 'Iframed Inline Styles' );
38
37
 
39
38
  expect( await getEditedPostContent() ).toMatchSnapshot();
40
39
  expect( await getComputedStyle( page, 'padding' ) ).toBe( '20px' );
41
40
  expect( await getComputedStyle( page, 'border-width' ) ).toBe( '2px' );
42
41
 
43
- await openDocumentSettingsSidebar();
44
- await clickButton( 'Page' );
45
- await clickButton( 'Template' );
46
- await clickButton( 'New' );
47
- await page.keyboard.press( 'Tab' );
48
- await page.keyboard.press( 'Tab' );
49
- await page.keyboard.type( 'Iframed Test' );
50
- await clickButton( 'Create' );
51
- await page.waitForSelector( 'iframe[name="editor-canvas"]' );
42
+ await createNewTemplate( 'Iframed Test' );
52
43
 
53
44
  // Inline styles of properly enqueued stylesheet should load.
54
45
  expect( await getComputedStyle( canvas(), 'padding' ) ).toBe( '20px' );
@@ -7,9 +7,8 @@ import {
7
7
  deactivatePlugin,
8
8
  insertBlock,
9
9
  getEditedPostContent,
10
- openDocumentSettingsSidebar,
11
- clickButton,
12
10
  canvas,
11
+ createNewTemplate,
13
12
  } from '@wordpress/e2e-test-utils';
14
13
 
15
14
  async function didMasonryLoadCorrectly( context ) {
@@ -42,16 +41,7 @@ describe( 'iframed masonry block', () => {
42
41
  expect( await getEditedPostContent() ).toMatchSnapshot();
43
42
  expect( await didMasonryLoadCorrectly( page ) ).toBe( true );
44
43
 
45
- await openDocumentSettingsSidebar();
46
- await clickButton( 'Page' );
47
- await page.click( 'button[aria-label^="Select template"]' );
48
- await page.waitForSelector( 'button[aria-label="Add template"]' );
49
- await page.click( 'button[aria-label="Add template"]' );
50
- await page.keyboard.press( 'Tab' );
51
- await page.keyboard.press( 'Tab' );
52
- await page.keyboard.type( 'Iframed Test' );
53
- await clickButton( 'Create' );
54
- await page.waitForSelector( 'iframe[name="editor-canvas"]' );
44
+ await createNewTemplate( 'Iframed Test' );
55
45
  await canvas().waitForSelector( '.grid-item[style]' );
56
46
 
57
47
  expect( await didMasonryLoadCorrectly( canvas() ) ).toBe( true );
@@ -6,9 +6,8 @@ import {
6
6
  createNewPost,
7
7
  deactivatePlugin,
8
8
  insertBlock,
9
- openDocumentSettingsSidebar,
10
- clickButton,
11
9
  canvas,
10
+ createNewTemplate,
12
11
  } from '@wordpress/e2e-test-utils';
13
12
 
14
13
  async function getComputedStyle( context, property ) {
@@ -33,21 +32,13 @@ describe( 'iframed multiple block stylesheets', () => {
33
32
  await deactivatePlugin( 'gutenberg-test-iframed-multiple-stylesheets' );
34
33
  } );
35
34
 
36
- it.skip( 'should load multiple block stylesheets in iframe', async () => {
35
+ it( 'should load multiple block stylesheets in iframe', async () => {
37
36
  await insertBlock( 'Iframed Multiple Stylesheets' );
38
37
 
39
38
  await page.waitForSelector(
40
39
  '.wp-block-test-iframed-multiple-stylesheets'
41
40
  );
42
- await openDocumentSettingsSidebar();
43
- await clickButton( 'Page' );
44
- await clickButton( 'Template' );
45
- await clickButton( 'New' );
46
- await page.keyboard.press( 'Tab' );
47
- await page.keyboard.press( 'Tab' );
48
- await page.keyboard.type( 'Iframed Test' );
49
- await clickButton( 'Create' );
50
- await page.waitForSelector( 'iframe[name="editor-canvas"]' );
41
+ await createNewTemplate( 'Iframed Test' );
51
42
 
52
43
  // Style loaded from the main stylesheet.
53
44
  expect( await getComputedStyle( canvas(), 'border-style' ) ).toBe(
@@ -75,6 +75,9 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
75
75
  await page.$x( `//button//span[contains(text(), 'List')]` )
76
76
  )[ 0 ];
77
77
  await insertButton.click();
78
+ // Select the list wrapper so the image is inserable.
79
+ await page.keyboard.press( 'ArrowUp' );
80
+ await page.keyboard.press( 'ArrowUp' );
78
81
  await insertBlock( 'Image' );
79
82
  await closeGlobalBlockInserter();
80
83
  await page.waitForSelector( '.product[data-number-of-children="2"]' );
@@ -24,7 +24,9 @@ exports[`block deletion - deleting the third and fourth blocks using backspace w
24
24
  <!-- /wp:paragraph -->
25
25
 
26
26
  <!-- wp:list -->
27
- <ul><li>caret was here</li></ul>
27
+ <ul><!-- wp:list-item -->
28
+ <li>caret was here</li>
29
+ <!-- /wp:list-item --></ul>
28
30
  <!-- /wp:list -->"
29
31
  `;
30
32
 
@@ -6,12 +6,6 @@ exports[`Keep styles on block transforms Should keep colors during a transform 1
6
6
  <!-- /wp:paragraph -->"
7
7
  `;
8
8
 
9
- exports[`Keep styles on block transforms Should keep the font size during a transform from multiple blocks into a single one 1`] = `
10
- "<!-- wp:list {\\"fontSize\\":\\"large\\"} -->
11
- <ul class=\\"has-large-font-size\\"><li>Line 1 to be made large</li><li>Line 2 to be made large</li><li>Line 3 to be made large</li></ul>
12
- <!-- /wp:list -->"
13
- `;
14
-
15
9
  exports[`Keep styles on block transforms Should keep the font size during a transform from multiple blocks into multiple blocks 1`] = `
16
10
  "<!-- wp:heading {\\"fontSize\\":\\"large\\"} -->
17
11
  <h2 class=\\"has-large-font-size\\">Line 1 to be made large</h2>
@@ -152,7 +152,9 @@ exports[`Multi-block selection should multi-select from within the list block 1`
152
152
  <!-- /wp:paragraph -->
153
153
 
154
154
  <!-- wp:list -->
155
- <ul><li>1</li></ul>
155
+ <ul><!-- wp:list-item -->
156
+ <li>1</li>
157
+ <!-- /wp:list-item --></ul>
156
158
  <!-- /wp:list -->"
157
159
  `;
158
160
 
@@ -248,6 +250,28 @@ exports[`Multi-block selection should preserve dragged selection on move 1`] = `
248
250
  <!-- /wp:paragraph -->"
249
251
  `;
250
252
 
253
+ exports[`Multi-block selection should properly select multiple blocks if selected nested blocks belong to different parent 1`] = `
254
+ "<!-- wp:group {\\"layout\\":{\\"type\\":\\"constrained\\"}} -->
255
+ <div class=\\"wp-block-group\\"><!-- wp:paragraph -->
256
+ <p>first</p>
257
+ <!-- /wp:paragraph -->
258
+
259
+ <!-- wp:paragraph -->
260
+ <p>group</p>
261
+ <!-- /wp:paragraph --></div>
262
+ <!-- /wp:group -->
263
+
264
+ <!-- wp:group {\\"layout\\":{\\"type\\":\\"constrained\\"}} -->
265
+ <div class=\\"wp-block-group\\"><!-- wp:paragraph -->
266
+ <p>second</p>
267
+ <!-- /wp:paragraph -->
268
+
269
+ <!-- wp:paragraph -->
270
+ <p>group</p>
271
+ <!-- /wp:paragraph --></div>
272
+ <!-- /wp:group -->"
273
+ `;
274
+
251
275
  exports[`Multi-block selection should return original focus after failed multi selection attempt 1`] = `
252
276
  "<!-- wp:paragraph -->
253
277
  <p>2</p>
@@ -102,12 +102,24 @@ exports[`RichText should only mutate text data on input 1`] = `
102
102
 
103
103
  exports[`RichText should paste list contents into paragraph 1`] = `
104
104
  "<!-- wp:list -->
105
- <ul><li>1<ul><li>2</li></ul></li></ul>
105
+ <ul><!-- wp:list-item -->
106
+ <li>1<!-- wp:list -->
107
+ <ul><!-- wp:list-item -->
108
+ <li>2</li>
109
+ <!-- /wp:list-item --></ul>
110
+ <!-- /wp:list --></li>
111
+ <!-- /wp:list-item --></ul>
106
112
  <!-- /wp:list -->
107
113
 
108
- <!-- wp:paragraph -->
109
- <p>1<br>2</p>
110
- <!-- /wp:paragraph -->"
114
+ <!-- wp:list -->
115
+ <ul><!-- wp:list-item -->
116
+ <li>1<!-- wp:list -->
117
+ <ul><!-- wp:list-item -->
118
+ <li>2</li>
119
+ <!-- /wp:list-item --></ul>
120
+ <!-- /wp:list --></li>
121
+ <!-- /wp:list-item --></ul>
122
+ <!-- /wp:list -->"
111
123
  `;
112
124
 
113
125
  exports[`RichText should paste paragraph contents into list 1`] = `
@@ -116,7 +128,9 @@ exports[`RichText should paste paragraph contents into list 1`] = `
116
128
  <!-- /wp:paragraph -->
117
129
 
118
130
  <!-- wp:list -->
119
- <ul><li>1</li><li>2</li></ul>
131
+ <ul><!-- wp:list-item -->
132
+ <li>1<br>2</li>
133
+ <!-- /wp:list-item --></ul>
120
134
  <!-- /wp:list -->"
121
135
  `;
122
136
 
@@ -18,6 +18,8 @@ describe( 'Block Switcher', () => {
18
18
  // Insert a list block.
19
19
  await insertBlock( 'List' );
20
20
  await page.keyboard.type( 'List content' );
21
+ await page.keyboard.press( 'ArrowUp' );
22
+ await page.keyboard.press( 'ArrowUp' );
21
23
  await pressKeyWithModifier( 'alt', 'F10' );
22
24
 
23
25
  // Verify the block switcher exists.
@@ -31,7 +33,6 @@ describe( 'Block Switcher', () => {
31
33
  'Heading',
32
34
  'Quote',
33
35
  'Columns',
34
- 'Table of Contents',
35
36
  ] )
36
37
  );
37
38
  } );
@@ -45,6 +46,8 @@ describe( 'Block Switcher', () => {
45
46
  // Insert a list block.
46
47
  await insertBlock( 'List' );
47
48
  await page.keyboard.type( 'List content' );
49
+ await page.keyboard.press( 'ArrowUp' );
50
+ await page.keyboard.press( 'ArrowUp' );
48
51
  await pressKeyWithModifier( 'alt', 'F10' );
49
52
 
50
53
  // Verify the block switcher exists.
@@ -56,7 +59,7 @@ describe( 'Block Switcher', () => {
56
59
  'Group',
57
60
  'Paragraph',
58
61
  'Heading',
59
- 'Table of Contents',
62
+ 'Columns',
60
63
  ] )
61
64
  );
62
65
  } );
@@ -71,13 +74,14 @@ describe( 'Block Switcher', () => {
71
74
  'core/group',
72
75
  'core/heading',
73
76
  'core/columns',
74
- 'core/table-of-contents',
75
77
  ].map( ( block ) => wp.blocks.unregisterBlockType( block ) );
76
78
  } );
77
79
 
78
80
  // Insert a list block.
79
81
  await insertBlock( 'List' );
80
82
  await page.keyboard.type( 'List content' );
83
+ await page.keyboard.press( 'ArrowUp' );
84
+ await page.keyboard.press( 'ArrowUp' );
81
85
  await pressKeyWithModifier( 'alt', 'F10' );
82
86
 
83
87
  // Verify the block switcher exists.
@@ -91,6 +95,8 @@ describe( 'Block Switcher', () => {
91
95
  it( 'Should show Columns block only if selected blocks are between limits (1-6)', async () => {
92
96
  await insertBlock( 'List' );
93
97
  await page.keyboard.type( 'List content' );
98
+ await page.keyboard.press( 'ArrowUp' );
99
+ await page.keyboard.press( 'ArrowUp' );
94
100
  await insertBlock( 'Heading' );
95
101
  await page.keyboard.type( 'I am a header' );
96
102
  await page.keyboard.down( 'Shift' );
@@ -103,6 +109,8 @@ describe( 'Block Switcher', () => {
103
109
  it( 'Should NOT show Columns transform only if selected blocks are more than max limit(6)', async () => {
104
110
  await insertBlock( 'List' );
105
111
  await page.keyboard.type( 'List content' );
112
+ await page.keyboard.press( 'ArrowUp' );
113
+ await page.keyboard.press( 'ArrowUp' );
106
114
  await insertBlock( 'Heading' );
107
115
  await page.keyboard.type( 'I am a header' );
108
116
  await page.keyboard.press( 'Enter' );
@@ -37,9 +37,7 @@ const toggleCustomInput = async ( showCustomInput ) => {
37
37
  };
38
38
 
39
39
  const clickCustomInput = async () => {
40
- const customInput = await page.waitForXPath(
41
- "//input[@aria-label='Custom']"
42
- );
40
+ const customInput = await page.waitForXPath( "//input[@type='number']" );
43
41
  return customInput.click();
44
42
  };
45
43
 
@@ -279,6 +279,8 @@ describe( 'Inserting blocks', () => {
279
279
  await insertBlock( 'Group' );
280
280
  await insertBlock( 'Paragraph' );
281
281
  await page.keyboard.type( 'Paragraph after group' );
282
+ // Click the Group first to make the appender inside it clickable.
283
+ await page.click( '[data-type="core/group"]' );
282
284
  await page.click( '[data-type="core/group"] [aria-label="Add block"]' );
283
285
  const browseAll = await page.waitForXPath(
284
286
  '//button[text()="Browse all"]'
@@ -295,6 +297,8 @@ describe( 'Inserting blocks', () => {
295
297
  await insertBlock( 'Group' );
296
298
  await insertBlock( 'Paragraph' );
297
299
  await page.keyboard.type( 'Text' );
300
+ // Click the Group first to make the appender inside it clickable.
301
+ await page.click( '[data-type="core/group"]' );
298
302
  await page.click( '[data-type="core/group"] [aria-label="Add block"]' );
299
303
  await page.waitForSelector( INSERTER_SEARCH_SELECTOR );
300
304
  await page.focus( INSERTER_SEARCH_SELECTOR );
@@ -34,23 +34,6 @@ describe( 'Keep styles on block transforms', () => {
34
34
  expect( await getEditedPostContent() ).toMatchSnapshot();
35
35
  } );
36
36
 
37
- it( 'Should keep the font size during a transform from multiple blocks into a single one', async () => {
38
- // Create a paragraph block with some content.
39
- await clickBlockAppender();
40
- await page.keyboard.type( 'Line 1 to be made large' );
41
- await page.keyboard.press( 'Enter' );
42
- await page.keyboard.type( 'Line 2 to be made large' );
43
- await page.keyboard.press( 'Enter' );
44
- await page.keyboard.type( 'Line 3 to be made large' );
45
- await pressKeyWithModifier( 'shift', 'ArrowUp' );
46
- await pressKeyWithModifier( 'shift', 'ArrowUp' );
47
- await page.click(
48
- '[role="radiogroup"][aria-label="Font size"] [aria-label="Large"]'
49
- );
50
- await transformBlockTo( 'List' );
51
- expect( await getEditedPostContent() ).toMatchSnapshot();
52
- } );
53
-
54
37
  it( 'Should keep the font size during a transform from multiple blocks into multiple blocks', async () => {
55
38
  // Create a paragraph block with some content.
56
39
  await clickBlockAppender();
@@ -331,6 +331,9 @@ describe( 'Multi-block selection', () => {
331
331
  await page.keyboard.up( 'Shift' );
332
332
  await transformBlockTo( 'Group' );
333
333
 
334
+ // Confirm setup.
335
+ expect( await getEditedPostContent() ).toMatchSnapshot();
336
+
334
337
  // Click the first paragraph in the first Group block while pressing `shift` key.
335
338
  const firstParagraph = await page.waitForXPath( "//p[text()='first']" );
336
339
  await page.keyboard.down( 'Shift' );
@@ -676,6 +679,10 @@ describe( 'Multi-block selection', () => {
676
679
 
677
680
  await pressKeyWithModifier( 'primary', 'a' );
678
681
 
682
+ await page.waitForSelector( '[data-type="core/column"].is-selected' );
683
+
684
+ await pressKeyWithModifier( 'primary', 'a' );
685
+
679
686
  await page.waitForSelector(
680
687
  '[data-type="core/column"].is-multi-selected'
681
688
  );
@@ -699,6 +706,7 @@ describe( 'Multi-block selection', () => {
699
706
  // Confirm correct setup: a paragraph and a list.
700
707
  expect( await getEditedPostContent() ).toMatchSnapshot();
701
708
 
709
+ await pressKeyWithModifier( 'primary', 'a' );
702
710
  await pressKeyWithModifier( 'primary', 'a' );
703
711
  await pressKeyWithModifier( 'primary', 'a' );
704
712
 
@@ -473,15 +473,18 @@ describe( 'RichText', () => {
473
473
  await page.keyboard.press( 'Enter' );
474
474
  await page.keyboard.type( ' 2' );
475
475
 
476
- // Select all and copy.
476
+ // Select all text.
477
+ await pressKeyWithModifier( 'primary', 'a' );
478
+ // Select the nested list.
479
+ await pressKeyWithModifier( 'primary', 'a' );
480
+ // Select the parent list item.
481
+ await pressKeyWithModifier( 'primary', 'a' );
482
+ // Select all the parent list item text.
483
+ await pressKeyWithModifier( 'primary', 'a' );
484
+ // Select the entire list.
477
485
  await pressKeyWithModifier( 'primary', 'a' );
478
486
  await pressKeyWithModifier( 'primary', 'c' );
479
487
 
480
- // Collapse the selection to the end.
481
- await page.keyboard.press( 'ArrowRight' );
482
-
483
- // Create a paragraph.
484
- await page.keyboard.press( 'Enter' );
485
488
  await page.keyboard.press( 'Enter' );
486
489
 
487
490
  // Paste paragraph contents.
@@ -235,7 +235,7 @@ describe( 'splitting and merging blocks', () => {
235
235
  await page.keyboard.type( 'item 1' );
236
236
  await page.keyboard.press( 'Enter' );
237
237
  await page.keyboard.type( 'item 2' );
238
- await pressKeyTimes( 'ArrowUp', 2 );
238
+ await pressKeyTimes( 'ArrowUp', 5 );
239
239
  await page.keyboard.press( 'Delete' );
240
240
  // Carret should be in the first block and at the proper position.
241
241
  await page.keyboard.type( '-' );
@@ -257,13 +257,18 @@ describe( 'splitting and merging blocks', () => {
257
257
  await page.keyboard.press( 'Enter' );
258
258
  await page.keyboard.type( 'item 2' );
259
259
  await page.keyboard.press( 'ArrowUp' );
260
+ await page.keyboard.press( 'ArrowUp' );
260
261
  await pressKeyTimes( 'ArrowLeft', 6 );
261
262
  await page.keyboard.press( 'Backspace' );
262
263
  // Carret should be in the first block and at the proper position.
263
264
  await page.keyboard.type( '-' );
264
265
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
265
266
  "<!-- wp:paragraph -->
266
- <p>hi-item 1</p>
267
+ <p>hi</p>
268
+ <!-- /wp:paragraph -->
269
+
270
+ <!-- wp:paragraph -->
271
+ <p>-item 1</p>
267
272
  <!-- /wp:paragraph -->
268
273
 
269
274
  <!-- wp:paragraph -->
@@ -86,7 +86,8 @@ describe( 'Toolbar roving tabindex', () => {
86
86
  it( 'ensures list block toolbar uses roving tabindex', async () => {
87
87
  await insertBlock( 'List' );
88
88
  await page.keyboard.type( 'List' );
89
- await testBlockToolbarKeyboardNavigation( 'Block: List', 'List' );
89
+ await testBlockToolbarKeyboardNavigation( 'List text', 'Select List' );
90
+ await page.click( `[aria-label="Select List"]` );
90
91
  await wrapCurrentBlockWithGroup( 'List' );
91
92
  await testGroupKeyboardNavigation( 'Block: List', 'List' );
92
93
  } );
@@ -1,32 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- activatePlugin,
6
- createNewPost,
7
- deactivatePlugin,
8
- openGlobalBlockInserter,
9
- } from '@wordpress/e2e-test-utils';
10
-
11
- describe( 'Register block type hooks', () => {
12
- beforeEach( async () => {
13
- await activatePlugin( 'gutenberg-test-register-block-type-hooks' );
14
- await createNewPost();
15
- } );
16
-
17
- afterEach( async () => {
18
- await deactivatePlugin( 'gutenberg-test-register-block-type-hooks' );
19
- } );
20
-
21
- it( 'has a custom category for Paragraph block', async () => {
22
- await openGlobalBlockInserter();
23
-
24
- const widgetsCategory = await page.waitForSelector(
25
- '.block-editor-block-types-list[aria-label="Widgets"]'
26
- );
27
-
28
- expect(
29
- await widgetsCategory.$( '.editor-block-list-item-paragraph' )
30
- ).toBeDefined();
31
- } );
32
- } );