@wordpress/e2e-tests 6.3.4 → 6.3.6

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": "6.3.4",
3
+ "version": "6.3.6",
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,7 +23,7 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^9.3.2",
26
+ "@wordpress/e2e-test-utils": "^9.3.3",
27
27
  "@wordpress/jest-console": "^6.9.1",
28
28
  "@wordpress/jest-puppeteer-axe": "^5.9.1",
29
29
  "@wordpress/scripts": "^25.3.4",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "1e2b2f680c6378f789d6660bc04b30e35e3a33a3"
49
+ "gitHead": "8ce158f9e03a25797be5a6f16edd7509d62e90e4"
50
50
  }
@@ -68,6 +68,6 @@ exports[`Links should contain a label when it should open in a new tab 1`] = `
68
68
 
69
69
  exports[`Links should contain a label when it should open in a new tab 2`] = `
70
70
  "<!-- wp:paragraph -->
71
- <p>This is <a href=\\"http://wordpress.org\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\">WordPress</a></p>
71
+ <p>This is <a href=\\"http://wordpress.org\\">WordPress</a></p>
72
72
  <!-- /wp:paragraph -->"
73
73
  `;
@@ -121,6 +121,7 @@ describe( 'Links', () => {
121
121
 
122
122
  // Navigate to and toggle the "Open in new tab" checkbox.
123
123
  await page.keyboard.press( 'Tab' );
124
+ await page.keyboard.press( 'Tab' );
124
125
  await page.keyboard.press( 'Space' );
125
126
 
126
127
  // Toggle should still have focus and be checked.
@@ -133,7 +134,7 @@ describe( 'Links', () => {
133
134
  expect( await getEditedPostContent() ).toMatchSnapshot();
134
135
 
135
136
  // Tab back to the Submit and apply the link.
136
- await page.keyboard.press( 'Tab' );
137
+ await pressKeyWithModifier( 'shift', 'Tab' );
137
138
  await page.keyboard.press( 'Enter' );
138
139
 
139
140
  // The link should have been inserted.
@@ -526,6 +527,7 @@ describe( 'Links', () => {
526
527
 
527
528
  // Navigate to and toggle the "Open in new tab" checkbox.
528
529
  await page.keyboard.press( 'Tab' );
530
+ await page.keyboard.press( 'Tab' );
529
531
  await page.keyboard.press( 'Space' );
530
532
 
531
533
  // Confirm that focus was not prematurely returned to the paragraph on
@@ -534,8 +536,7 @@ describe( 'Links', () => {
534
536
 
535
537
  // Close dialog. Expect that "Open in new tab" would have been applied
536
538
  // immediately.
537
-
538
- await pressKeyWithModifier( 'shift', 'Tab' );
539
+ await page.keyboard.press( 'Tab' );
539
540
  await page.keyboard.press( 'Enter' );
540
541
 
541
542
  // Wait for Gutenberg to finish the job.
@@ -765,7 +766,6 @@ describe( 'Links', () => {
765
766
  await page.keyboard.press( 'Tab' );
766
767
  await page.keyboard.press( 'Tab' );
767
768
  await page.keyboard.press( 'Tab' );
768
- await page.keyboard.press( 'Tab' );
769
769
 
770
770
  // Make a selection within the RichText.
771
771
  await pressKeyWithModifier( 'shift', 'ArrowRight' );
@@ -120,7 +120,7 @@ describe( 'Site Editor Performance', () => {
120
120
  '[data-type="core/post-content"] [data-type="core/paragraph"]'
121
121
  );
122
122
  await enterEditMode();
123
- await canvas().click(
123
+ await canvas().focus(
124
124
  '[data-type="core/post-content"] [data-type="core/paragraph"]'
125
125
  );
126
126
  await insertBlock( 'Paragraph' );
@@ -384,6 +384,11 @@ describe( 'Widgets screen', () => {
384
384
 
385
385
  describe( 'Function widgets', () => {
386
386
  async function addMarquee( nbExpectedMarquees ) {
387
+ const [ firstWidgetArea ] = await findAll( {
388
+ role: 'document',
389
+ name: 'Block: Widget Area',
390
+ } );
391
+ await firstWidgetArea.focus();
387
392
  const marqueeBlock = await getBlockInGlobalInserter(
388
393
  'Marquee Greeting'
389
394
  );
@@ -1,111 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`block deletion - deleting the third and fourth blocks using backspace with multi-block selection results in two remaining blocks and positions the caret at the end of the second block 1`] = `
4
- "<!-- wp:paragraph -->
5
- <p>First paragraph</p>
6
- <!-- /wp:paragraph -->
7
-
8
- <!-- wp:paragraph -->
9
- <p>Second paragraph</p>
10
- <!-- /wp:paragraph -->
11
-
12
- <!-- wp:paragraph -->
13
- <p></p>
14
- <!-- /wp:paragraph -->"
15
- `;
16
-
17
- exports[`block deletion - deleting the third and fourth blocks using backspace with multi-block selection results in two remaining blocks and positions the caret at the end of the second block 2`] = `
18
- "<!-- wp:paragraph -->
19
- <p>First paragraph</p>
20
- <!-- /wp:paragraph -->
21
-
22
- <!-- wp:paragraph -->
23
- <p>Second paragraph</p>
24
- <!-- /wp:paragraph -->
25
-
26
- <!-- wp:list -->
27
- <ul><!-- wp:list-item -->
28
- <li>caret was here</li>
29
- <!-- /wp:list-item --></ul>
30
- <!-- /wp:list -->"
31
- `;
32
-
33
- exports[`block deletion - deleting the third block using backspace in an empty block results in two remaining blocks and positions the caret at the end of the second block 1`] = `
34
- "<!-- wp:paragraph -->
35
- <p>First paragraph</p>
36
- <!-- /wp:paragraph -->
37
-
38
- <!-- wp:paragraph -->
39
- <p>Second paragraph</p>
40
- <!-- /wp:paragraph -->"
41
- `;
42
-
43
- exports[`block deletion - deleting the third block using backspace in an empty block results in two remaining blocks and positions the caret at the end of the second block 2`] = `
44
- "<!-- wp:paragraph -->
45
- <p>First paragraph</p>
46
- <!-- /wp:paragraph -->
47
-
48
- <!-- wp:paragraph -->
49
- <p>Second paragraph - caret was here</p>
50
- <!-- /wp:paragraph -->"
51
- `;
52
-
53
- exports[`block deletion - deleting the third block using backspace with block wrapper selection results in three remaining blocks and positions the caret at the end of the third block 1`] = `
54
- "<!-- wp:paragraph -->
55
- <p>First paragraph</p>
56
- <!-- /wp:paragraph -->
57
-
58
- <!-- wp:paragraph -->
59
- <p>Second paragraph</p>
60
- <!-- /wp:paragraph -->"
61
- `;
62
-
63
- exports[`block deletion - deleting the third block using backspace with block wrapper selection results in three remaining blocks and positions the caret at the end of the third block 2`] = `
64
- "<!-- wp:paragraph -->
65
- <p>First paragraph</p>
66
- <!-- /wp:paragraph -->
67
-
68
- <!-- wp:paragraph -->
69
- <p>Second paragraph - caret was here</p>
70
- <!-- /wp:paragraph -->"
71
- `;
72
-
73
- exports[`block deletion - deleting the third block using the Remove Block menu item results in two remaining blocks and positions the caret at the end of the second block 1`] = `
74
- "<!-- wp:paragraph -->
75
- <p>First paragraph</p>
76
- <!-- /wp:paragraph -->
77
-
78
- <!-- wp:paragraph -->
79
- <p>Second paragraph</p>
80
- <!-- /wp:paragraph -->"
81
- `;
82
-
83
- exports[`block deletion - deleting the third block using the Remove Block menu item results in two remaining blocks and positions the caret at the end of the second block 2`] = `
84
- "<!-- wp:paragraph -->
85
- <p>First paragraph</p>
86
- <!-- /wp:paragraph -->
87
-
88
- <!-- wp:paragraph -->
89
- <p>Second paragraph - caret was here</p>
90
- <!-- /wp:paragraph -->"
91
- `;
92
-
93
- exports[`block deletion - deleting the third block using the Remove Block shortcut results in two remaining blocks and positions the caret at the end of the second block 1`] = `
94
- "<!-- wp:paragraph -->
95
- <p>First paragraph</p>
96
- <!-- /wp:paragraph -->
97
-
98
- <!-- wp:paragraph -->
99
- <p>Second paragraph</p>
100
- <!-- /wp:paragraph -->"
101
- `;
102
-
103
- exports[`block deletion - deleting the third block using the Remove Block shortcut results in two remaining blocks and positions the caret at the end of the second block 2`] = `
104
- "<!-- wp:paragraph -->
105
- <p>First paragraph</p>
106
- <!-- /wp:paragraph -->
107
-
108
- <!-- wp:paragraph -->
109
- <p>Second paragraph - caret was here</p>
110
- <!-- /wp:paragraph -->"
111
- `;
@@ -1,209 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- clickBlockAppender,
6
- clickBlockToolbarButton,
7
- getEditedPostContent,
8
- createNewPost,
9
- isInDefaultBlock,
10
- pressKeyWithModifier,
11
- pressKeyTimes,
12
- insertBlock,
13
- } from '@wordpress/e2e-test-utils';
14
-
15
- const addThreeParagraphsToNewPost = async () => {
16
- await createNewPost();
17
-
18
- // Add demo content.
19
- await clickBlockAppender();
20
- await page.keyboard.type( 'First paragraph' );
21
- await page.keyboard.press( 'Enter' );
22
- await page.keyboard.type( 'Second paragraph' );
23
- await page.keyboard.press( 'Enter' );
24
- };
25
-
26
- /**
27
- * Due to an issue with the Popover component not being scrollable
28
- * under certain conditions, Pupeteer cannot "see" the "Remove Block"
29
- * button. This is a workaround until that issue is resolved.
30
- *
31
- * see: https://github.com/WordPress/gutenberg/pull/14908#discussion_r284725956
32
- */
33
- const clickOnBlockSettingsMenuRemoveBlockButton = async () => {
34
- await clickBlockToolbarButton( 'Options' );
35
-
36
- let isRemoveButton = false;
37
-
38
- let numButtons = await page.$$eval(
39
- '.block-editor-block-settings-menu__content button',
40
- ( btns ) => btns.length
41
- );
42
-
43
- // Limit by the number of buttons available.
44
- while ( --numButtons ) {
45
- await page.keyboard.press( 'Tab' );
46
-
47
- isRemoveButton = await page.evaluate( () => {
48
- return document.activeElement.innerText.includes(
49
- 'Remove Paragraph'
50
- );
51
- } );
52
-
53
- // Stop looping once we find the button.
54
- if ( isRemoveButton ) {
55
- await pressKeyTimes( 'Enter', 1 );
56
- break;
57
- }
58
- }
59
-
60
- // Makes failures more explicit.
61
- await expect( isRemoveButton ).toBe( true );
62
- };
63
-
64
- describe( 'block deletion -', () => {
65
- beforeEach( addThreeParagraphsToNewPost );
66
-
67
- describe( 'deleting the third block using the Remove Block menu item', () => {
68
- it( 'results in two remaining blocks and positions the caret at the end of the second block', async () => {
69
- // The blocks can't be empty to trigger the toolbar.
70
- await page.keyboard.type( 'Paragraph to remove' );
71
- await clickOnBlockSettingsMenuRemoveBlockButton();
72
-
73
- expect( await getEditedPostContent() ).toMatchSnapshot();
74
-
75
- // Type additional text and assert that caret position is correct by comparing to snapshot.
76
- await page.keyboard.type( ' - caret was here' );
77
- expect( await getEditedPostContent() ).toMatchSnapshot();
78
- } );
79
- } );
80
-
81
- describe( 'deleting the third block using the Remove Block shortcut', () => {
82
- it( 'results in two remaining blocks and positions the caret at the end of the second block', async () => {
83
- // Type some text to assert that the shortcut also deletes block content.
84
- await page.keyboard.type( 'this is block 2' );
85
- await pressKeyWithModifier( 'access', 'z' );
86
- expect( await getEditedPostContent() ).toMatchSnapshot();
87
-
88
- // Type additional text and assert that caret position is correct by comparing to snapshot.
89
- await page.keyboard.type( ' - caret was here' );
90
- expect( await getEditedPostContent() ).toMatchSnapshot();
91
- } );
92
- } );
93
-
94
- describe( 'deleting the third block using backspace in an empty block', () => {
95
- it( 'results in two remaining blocks and positions the caret at the end of the second block', async () => {
96
- await page.keyboard.press( 'Backspace' );
97
- expect( await getEditedPostContent() ).toMatchSnapshot();
98
-
99
- // Type additional text and assert that caret position is correct by comparing to snapshot.
100
- await page.keyboard.type( ' - caret was here' );
101
- expect( await getEditedPostContent() ).toMatchSnapshot();
102
- } );
103
- } );
104
-
105
- describe( 'deleting the third block using backspace with block wrapper selection', () => {
106
- it( 'results in three remaining blocks and positions the caret at the end of the third block', async () => {
107
- // Add an image block since it's easier to click the wrapper on non-textual blocks.
108
- await page.keyboard.type( '/image' );
109
- await page.waitForXPath(
110
- `//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Image')]`
111
- );
112
- await page.keyboard.press( 'Enter' );
113
-
114
- // Click on something that's not a block.
115
- await page.click( '.editor-post-title' );
116
-
117
- // Click on the image block so that its wrapper is selected and backspace to delete it.
118
- await page.click(
119
- '.wp-block[data-type="core/image"] .components-placeholder__label'
120
- );
121
- await page.keyboard.press( 'Backspace' );
122
-
123
- expect( await getEditedPostContent() ).toMatchSnapshot();
124
-
125
- // Type additional text and assert that caret position is correct by comparing to snapshot.
126
- await page.keyboard.type( ' - caret was here' );
127
- expect( await getEditedPostContent() ).toMatchSnapshot();
128
- } );
129
- } );
130
-
131
- describe( 'deleting the third and fourth blocks using backspace with multi-block selection', () => {
132
- it( 'results in two remaining blocks and positions the caret at the end of the second block', async () => {
133
- // Add a third paragraph for this test.
134
- await page.keyboard.type( 'Third paragraph' );
135
- await page.keyboard.press( 'Enter' );
136
-
137
- // Press the up arrow once to select the third and fourth blocks.
138
- await pressKeyWithModifier( 'shift', 'ArrowUp' );
139
-
140
- // Now that the block wrapper is selected, press backspace to delete it.
141
- await page.keyboard.press( 'Backspace' );
142
- expect( await getEditedPostContent() ).toMatchSnapshot();
143
-
144
- // Type additional text and assert that caret position is correct by comparing to snapshot.
145
- await page.keyboard.type( ' - caret was here' );
146
- expect( await getEditedPostContent() ).toMatchSnapshot();
147
- } );
148
- } );
149
- } );
150
-
151
- describe( 'deleting all blocks', () => {
152
- beforeEach( async () => {
153
- await createNewPost();
154
- } );
155
-
156
- it( 'results in the default block getting selected', async () => {
157
- await clickBlockAppender();
158
- await page.keyboard.type( 'Paragraph' );
159
- await clickOnBlockSettingsMenuRemoveBlockButton();
160
-
161
- // There is a default block and post title:
162
- expect(
163
- await page.$$( '.block-editor-block-list__block' )
164
- ).toHaveLength( 2 );
165
-
166
- // But the effective saved content is still empty:
167
- expect( await getEditedPostContent() ).toBe( '' );
168
-
169
- // And focus is retained:
170
- expect( await isInDefaultBlock() ).toBe( true );
171
- } );
172
-
173
- it( 'gracefully removes blocks when the default block is not available', async () => {
174
- // Regression Test: Previously, removing a block would not clear
175
- // selection state when there were no other blocks to select.
176
- //
177
- // See: https://github.com/WordPress/gutenberg/issues/15458
178
- // See: https://github.com/WordPress/gutenberg/pull/15543
179
-
180
- // Unregister default block type. This may happen if the editor is
181
- // configured to not allow the default (paragraph) block type, either
182
- // by plugin editor settings filtering or user block preferences.
183
- await page.evaluate( () => {
184
- const defaultBlockName = wp.data
185
- .select( 'core/blocks' )
186
- .getDefaultBlockName();
187
- wp.data
188
- .dispatch( 'core/blocks' )
189
- .removeBlockTypes( defaultBlockName );
190
- } );
191
-
192
- // Add and remove a block.
193
- await insertBlock( 'Image' );
194
- await page.waitForSelector( 'figure[data-type="core/image"]' );
195
- await page.keyboard.press( 'ArrowUp' );
196
- await page.keyboard.press( 'Backspace' );
197
-
198
- // Verify there is no selected block.
199
- // TODO: There should be expectations around where focus is placed in
200
- // this scenario. Currently, a focus loss occurs (not acceptable).
201
- const selectedBlocksCount = await page.evaluate( () => {
202
- return wp.data
203
- .select( 'core/block-editor' )
204
- .getSelectedBlockClientIds().length;
205
- } );
206
-
207
- expect( selectedBlocksCount ).toBe( 0 );
208
- } );
209
- } );