@wordpress/e2e-tests 3.0.9 → 3.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.
- package/config/setup-performance-test.js +1 -1
- package/config/setup-test-framework.js +1 -1
- package/package.json +5 -5
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +16 -16
- package/specs/editor/blocks/classic.test.js +2 -2
- package/specs/editor/blocks/cover.test.js +17 -17
- package/specs/editor/blocks/list.test.js +1 -1
- package/specs/editor/blocks/navigation.test.js +259 -52
- package/specs/editor/blocks/table.test.js +1 -1
- package/specs/editor/plugins/align-hook.test.js +10 -10
- package/specs/editor/plugins/block-context.test.js +1 -1
- package/specs/editor/plugins/block-directory-add.test.js +14 -14
- package/specs/editor/plugins/custom-post-types.test.js +1 -1
- package/specs/editor/plugins/custom-taxonomies.test.js +3 -3
- package/specs/editor/plugins/meta-attribute-block.test.js +1 -1
- package/specs/editor/plugins/meta-boxes.test.js +3 -3
- package/specs/editor/plugins/templates.test.js +1 -1
- package/specs/editor/plugins/wp-editor-meta-box.test.js +1 -1
- package/specs/editor/various/autosave.test.js +19 -19
- package/specs/editor/various/block-deletion.test.js +5 -5
- package/specs/editor/various/block-grouping.test.js +29 -12
- package/specs/editor/various/block-hierarchy-navigation.test.js +5 -5
- package/specs/editor/various/change-detection.test.js +3 -3
- package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
- package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +7 -7
- package/specs/editor/various/datepicker.test.js +1 -1
- package/specs/editor/various/duplicating-blocks.test.js +3 -3
- package/specs/editor/various/editor-modes.test.js +5 -5
- package/specs/editor/various/inserting-blocks.test.js +6 -6
- package/specs/editor/various/invalid-block.test.js +4 -4
- package/specs/editor/various/is-typing.test.js +8 -8
- package/specs/editor/various/keyboard-navigable-blocks.test.js +2 -2
- package/specs/editor/various/links.test.js +90 -90
- package/specs/editor/various/list-view.test.js +47 -1
- package/specs/editor/various/manage-reusable-blocks.test.js +5 -5
- package/specs/editor/various/multi-block-selection.test.js +2 -2
- package/specs/editor/various/navigable-toolbar.test.js +1 -1
- package/specs/editor/various/new-post-default-content.test.js +2 -2
- package/specs/editor/various/new-post.test.js +1 -1
- package/specs/editor/various/nux.test.js +11 -11
- package/specs/editor/various/popovers.test.js +3 -3
- package/specs/editor/various/post-editor-template-mode.test.js +12 -11
- package/specs/editor/various/preferences.test.js +1 -1
- package/specs/editor/various/preview.test.js +8 -4
- package/specs/editor/various/publish-button.test.js +2 -2
- package/specs/editor/various/publishing.test.js +50 -1
- package/specs/editor/various/reusable-blocks.test.js +31 -31
- package/specs/editor/various/rich-text.test.js +1 -1
- package/specs/editor/various/splitting-merging.test.js +6 -6
- package/specs/editor/various/style-variation.test.js +2 -2
- package/specs/editor/various/switch-to-draft.test.js +3 -1
- package/specs/editor/various/taxonomies.test.js +1 -1
- package/specs/editor/various/toolbar-roving-tabindex.test.js +1 -1
- package/specs/editor/various/writing-flow.test.js +20 -20
- package/specs/experiments/navigation-editor.test.js +168 -3
- package/specs/performance/post-editor.test.js +7 -7
- package/specs/performance/site-editor.test.js +1 -1
- package/specs/site-editor/document-settings.test.js +5 -5
- package/specs/site-editor/multi-entity-editing.test.js +1 -1
- package/specs/site-editor/multi-entity-saving.test.js +1 -1
- package/specs/site-editor/template-part.test.js +9 -8
- package/specs/widgets/customizing-widgets.test.js +10 -9
- package/specs/widgets/editing-widgets.test.js +8 -7
@@ -17,17 +17,17 @@ describe( 'isTyping', () => {
|
|
17
17
|
|
18
18
|
await clickBlockAppender();
|
19
19
|
|
20
|
-
// Type in a paragraph
|
20
|
+
// Type in a paragraph.
|
21
21
|
await page.keyboard.type( 'Type' );
|
22
22
|
|
23
23
|
// Toolbar is hidden
|
24
24
|
let blockToolbar = await page.$( blockToolbarSelector );
|
25
25
|
expect( blockToolbar ).toBe( null );
|
26
26
|
|
27
|
-
// Moving the mouse shows the toolbar
|
27
|
+
// Moving the mouse shows the toolbar.
|
28
28
|
await showBlockToolbar();
|
29
29
|
|
30
|
-
// Toolbar is visible
|
30
|
+
// Toolbar is visible.
|
31
31
|
blockToolbar = await page.$( blockToolbarSelector );
|
32
32
|
expect( blockToolbar ).not.toBe( null );
|
33
33
|
|
@@ -40,7 +40,7 @@ describe( 'isTyping', () => {
|
|
40
40
|
} );
|
41
41
|
|
42
42
|
it( 'should not close the dropdown when typing in it', async () => {
|
43
|
-
// Adds a Dropdown with an input to all blocks
|
43
|
+
// Adds a Dropdown with an input to all blocks.
|
44
44
|
await page.evaluate( () => {
|
45
45
|
const { Dropdown, ToolbarButton, Fill } = wp.components;
|
46
46
|
const { createElement: el, Fragment } = wp.element;
|
@@ -82,19 +82,19 @@ describe( 'isTyping', () => {
|
|
82
82
|
|
83
83
|
await clickBlockAppender();
|
84
84
|
|
85
|
-
// Type in a paragraph
|
85
|
+
// Type in a paragraph.
|
86
86
|
await page.keyboard.type( 'Type' );
|
87
87
|
|
88
|
-
// Show Toolbar
|
88
|
+
// Show Toolbar.
|
89
89
|
await showBlockToolbar();
|
90
90
|
|
91
|
-
// Open the dropdown
|
91
|
+
// Open the dropdown.
|
92
92
|
await page.click( '.dropdown-open' );
|
93
93
|
|
94
94
|
// Type inside the dropdown's input
|
95
95
|
await page.type( '.dropdown-input', 'Random' );
|
96
96
|
|
97
|
-
// The input should still be visible
|
97
|
+
// The input should still be visible.
|
98
98
|
const input = await page.$( '.dropdown-input' );
|
99
99
|
expect( input ).not.toBe( null );
|
100
100
|
} );
|
@@ -20,7 +20,7 @@ async function getActiveLabel() {
|
|
20
20
|
}
|
21
21
|
|
22
22
|
const navigateToContentEditorTop = async () => {
|
23
|
-
// Use 'Ctrl+`' to return to the top of the editor
|
23
|
+
// Use 'Ctrl+`' to return to the top of the editor.
|
24
24
|
await pressKeyWithModifier( 'ctrl', '`' );
|
25
25
|
await pressKeyWithModifier( 'ctrl', '`' );
|
26
26
|
};
|
@@ -81,7 +81,7 @@ describe( 'Order of block keyboard navigation', () => {
|
|
81
81
|
it( 'permits tabbing through paragraph blocks in the expected order', async () => {
|
82
82
|
const paragraphBlocks = [ 'Paragraph 0', 'Paragraph 1', 'Paragraph 2' ];
|
83
83
|
|
84
|
-
//
|
84
|
+
// Create 3 paragraphs blocks with some content.
|
85
85
|
for ( const paragraphBlock of paragraphBlocks ) {
|
86
86
|
await insertBlock( 'Paragraph' );
|
87
87
|
await page.keyboard.type( paragraphBlock );
|
@@ -31,10 +31,10 @@ describe( 'Links', () => {
|
|
31
31
|
// Now in a new post and try to create a link from an autocomplete suggestion using the keyboard.
|
32
32
|
await page.keyboard.type( 'Here comes a link: ' );
|
33
33
|
|
34
|
-
// Press Cmd+K to insert a link
|
34
|
+
// Press Cmd+K to insert a link.
|
35
35
|
await pressKeyWithModifier( 'primary', 'K' );
|
36
36
|
|
37
|
-
// Wait for the URL field to auto-focus
|
37
|
+
// Wait for the URL field to auto-focus.
|
38
38
|
await waitForURLFieldAutoFocus();
|
39
39
|
expect(
|
40
40
|
await page.$(
|
@@ -58,41 +58,41 @@ describe( 'Links', () => {
|
|
58
58
|
} );
|
59
59
|
|
60
60
|
it( 'can be created by selecting text and clicking Link', async () => {
|
61
|
-
// Create a block with some text
|
61
|
+
// Create a block with some text.
|
62
62
|
await clickBlockAppender();
|
63
63
|
await page.keyboard.type( 'This is Gutenberg' );
|
64
64
|
|
65
|
-
// Select some text
|
65
|
+
// Select some text.
|
66
66
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
67
67
|
|
68
|
-
// Click on the Link button
|
68
|
+
// Click on the Link button.
|
69
69
|
await page.click( 'button[aria-label="Link"]' );
|
70
70
|
|
71
|
-
// Wait for the URL field to auto-focus
|
71
|
+
// Wait for the URL field to auto-focus.
|
72
72
|
await waitForURLFieldAutoFocus();
|
73
73
|
|
74
|
-
// Type a URL
|
74
|
+
// Type a URL.
|
75
75
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
76
76
|
|
77
|
-
// Submit the link
|
77
|
+
// Submit the link.
|
78
78
|
await page.keyboard.press( 'Enter' );
|
79
79
|
|
80
|
-
// The link should have been inserted
|
80
|
+
// The link should have been inserted.
|
81
81
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
82
82
|
} );
|
83
83
|
|
84
84
|
it( 'will not automatically create a link if selected text is not a valid HTTP based URL', async () => {
|
85
|
-
// Create a block with some text
|
85
|
+
// Create a block with some text.
|
86
86
|
await clickBlockAppender();
|
87
87
|
await page.keyboard.type( 'This: is not a link' );
|
88
88
|
|
89
|
-
// Select some text
|
89
|
+
// Select some text.
|
90
90
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
91
91
|
|
92
|
-
// Click on the Link button
|
92
|
+
// Click on the Link button.
|
93
93
|
await page.click( 'button[aria-label="Link"]' );
|
94
94
|
|
95
|
-
// Wait for the URL field to auto-focus
|
95
|
+
// Wait for the URL field to auto-focus.
|
96
96
|
await waitForURLFieldAutoFocus();
|
97
97
|
|
98
98
|
const urlInputValue = await page.evaluate(
|
@@ -103,20 +103,20 @@ describe( 'Links', () => {
|
|
103
103
|
} );
|
104
104
|
|
105
105
|
it( 'can be created by selecting text and using keyboard shortcuts', async () => {
|
106
|
-
// Create a block with some text
|
106
|
+
// Create a block with some text.
|
107
107
|
await clickBlockAppender();
|
108
108
|
await page.keyboard.type( 'This is Gutenberg' );
|
109
109
|
|
110
|
-
// Select some text
|
110
|
+
// Select some text.
|
111
111
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
112
112
|
|
113
|
-
// Press Cmd+K to insert a link
|
113
|
+
// Press Cmd+K to insert a link.
|
114
114
|
await pressKeyWithModifier( 'primary', 'K' );
|
115
115
|
|
116
|
-
// Wait for the URL field to auto-focus
|
116
|
+
// Wait for the URL field to auto-focus.
|
117
117
|
await waitForURLFieldAutoFocus();
|
118
118
|
|
119
|
-
// Type a URL
|
119
|
+
// Type a URL.
|
120
120
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
121
121
|
|
122
122
|
// Navigate to and toggle the "Open in new tab" checkbox.
|
@@ -133,43 +133,43 @@ describe( 'Links', () => {
|
|
133
133
|
// this point the link is still not inserted.
|
134
134
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
135
135
|
|
136
|
-
// Tab back to the Submit and apply the link
|
136
|
+
// Tab back to the Submit and apply the link.
|
137
137
|
await pressKeyWithModifier( 'shift', 'Tab' );
|
138
138
|
await page.keyboard.press( 'Enter' );
|
139
139
|
|
140
|
-
// The link should have been inserted
|
140
|
+
// The link should have been inserted.
|
141
141
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
142
142
|
} );
|
143
143
|
|
144
144
|
it( 'can be created without any text selected', async () => {
|
145
|
-
// Create a block with some text
|
145
|
+
// Create a block with some text.
|
146
146
|
await clickBlockAppender();
|
147
147
|
await page.keyboard.type( 'This is Gutenberg: ' );
|
148
148
|
|
149
|
-
// Press Cmd+K to insert a link
|
149
|
+
// Press Cmd+K to insert a link.
|
150
150
|
await pressKeyWithModifier( 'primary', 'K' );
|
151
151
|
|
152
|
-
// Wait for the URL field to auto-focus
|
152
|
+
// Wait for the URL field to auto-focus.
|
153
153
|
await waitForURLFieldAutoFocus();
|
154
154
|
|
155
|
-
// Type a URL
|
155
|
+
// Type a URL.
|
156
156
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
157
157
|
|
158
|
-
// Press Enter to apply the link
|
158
|
+
// Press Enter to apply the link.
|
159
159
|
await page.keyboard.press( 'Enter' );
|
160
160
|
|
161
|
-
// A link with the URL as its text should have been inserted
|
161
|
+
// A link with the URL as its text should have been inserted.
|
162
162
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
163
163
|
} );
|
164
164
|
|
165
165
|
it( 'can be created instantly when a URL is selected', async () => {
|
166
|
-
// Create a block with some text
|
166
|
+
// Create a block with some text.
|
167
167
|
await clickBlockAppender();
|
168
168
|
await page.keyboard.type(
|
169
169
|
'This is Gutenberg: https://wordpress.org/gutenberg'
|
170
170
|
);
|
171
171
|
|
172
|
-
// Select the URL
|
172
|
+
// Select the URL.
|
173
173
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
174
174
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
175
175
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
@@ -178,52 +178,52 @@ describe( 'Links', () => {
|
|
178
178
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
179
179
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
180
180
|
|
181
|
-
// Click on the Link button
|
181
|
+
// Click on the Link button.
|
182
182
|
await page.click( 'button[aria-label="Link"]' );
|
183
183
|
|
184
|
-
// A link with the selected URL as its href should have been inserted
|
184
|
+
// A link with the selected URL as its href should have been inserted.
|
185
185
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
186
186
|
} );
|
187
187
|
|
188
188
|
it( 'is not created when we click away from the link input', async () => {
|
189
|
-
// Create a block with some text
|
189
|
+
// Create a block with some text.
|
190
190
|
await clickBlockAppender();
|
191
191
|
await page.keyboard.type( 'This is Gutenberg' );
|
192
192
|
|
193
|
-
// Select some text
|
193
|
+
// Select some text.
|
194
194
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
195
195
|
|
196
|
-
// Click on the Link button
|
196
|
+
// Click on the Link button.
|
197
197
|
await page.click( 'button[aria-label="Link"]' );
|
198
198
|
|
199
|
-
// Wait for the URL field to auto-focus
|
199
|
+
// Wait for the URL field to auto-focus.
|
200
200
|
await waitForURLFieldAutoFocus();
|
201
201
|
|
202
|
-
// Type a URL
|
202
|
+
// Type a URL.
|
203
203
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
204
204
|
|
205
|
-
// Click somewhere else - it doesn't really matter where
|
205
|
+
// Click somewhere else - it doesn't really matter where.
|
206
206
|
await page.click( '.editor-post-title' );
|
207
207
|
} );
|
208
208
|
|
209
209
|
const createAndReselectLink = async () => {
|
210
|
-
// Create a block with some text
|
210
|
+
// Create a block with some text.
|
211
211
|
await clickBlockAppender();
|
212
212
|
await page.keyboard.type( 'This is Gutenberg' );
|
213
213
|
|
214
|
-
// Select some text
|
214
|
+
// Select some text.
|
215
215
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
216
216
|
|
217
|
-
// Click on the Link button
|
217
|
+
// Click on the Link button.
|
218
218
|
await page.click( 'button[aria-label="Link"]' );
|
219
219
|
|
220
|
-
// Wait for the URL field to auto-focus
|
220
|
+
// Wait for the URL field to auto-focus.
|
221
221
|
await waitForURLFieldAutoFocus();
|
222
222
|
|
223
|
-
// Type a URL
|
223
|
+
// Type a URL.
|
224
224
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
225
225
|
|
226
|
-
// Click on the Submit button
|
226
|
+
// Click on the Submit button.
|
227
227
|
await page.keyboard.press( 'Enter' );
|
228
228
|
|
229
229
|
// Reselect the link.
|
@@ -233,22 +233,22 @@ describe( 'Links', () => {
|
|
233
233
|
it( 'can be edited', async () => {
|
234
234
|
await createAndReselectLink();
|
235
235
|
|
236
|
-
// Click on the Edit button
|
236
|
+
// Click on the Edit button.
|
237
237
|
const [ editButton ] = await page.$x(
|
238
238
|
'//button[contains(@aria-label, "Edit")]'
|
239
239
|
);
|
240
240
|
await editButton.click();
|
241
241
|
|
242
|
-
// Wait for the URL field to auto-focus
|
242
|
+
// Wait for the URL field to auto-focus.
|
243
243
|
await waitForURLFieldAutoFocus();
|
244
244
|
|
245
|
-
// Change the URL
|
245
|
+
// Change the URL.
|
246
246
|
await page.keyboard.type( '/handbook' );
|
247
247
|
|
248
|
-
// Submit the link
|
248
|
+
// Submit the link.
|
249
249
|
await page.keyboard.press( 'Enter' );
|
250
250
|
|
251
|
-
// The link should have been updated
|
251
|
+
// The link should have been updated.
|
252
252
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
253
253
|
} );
|
254
254
|
|
@@ -264,7 +264,7 @@ describe( 'Links', () => {
|
|
264
264
|
// under very specific circumstances and screensizes.
|
265
265
|
await pressKeyWithModifier( 'primaryShift', 'K' );
|
266
266
|
|
267
|
-
// The link should have been removed
|
267
|
+
// The link should have been removed.
|
268
268
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
269
269
|
} );
|
270
270
|
|
@@ -287,7 +287,7 @@ describe( 'Links', () => {
|
|
287
287
|
await page.keyboard.type( 'Text' );
|
288
288
|
await page.click( 'button[aria-label="Link"]' );
|
289
289
|
|
290
|
-
// Typing "left" should not close the dialog
|
290
|
+
// Typing "left" should not close the dialog.
|
291
291
|
await page.keyboard.press( 'ArrowLeft' );
|
292
292
|
let popover = await page.$(
|
293
293
|
'.components-popover__content .block-editor-link-control'
|
@@ -310,7 +310,7 @@ describe( 'Links', () => {
|
|
310
310
|
|
311
311
|
await clickBlockToolbarButton( 'Link' );
|
312
312
|
|
313
|
-
// Typing "left" should not close the dialog
|
313
|
+
// Typing "left" should not close the dialog.
|
314
314
|
await page.keyboard.press( 'ArrowLeft' );
|
315
315
|
let popover = await page.$(
|
316
316
|
'.components-popover__content .block-editor-link-control'
|
@@ -351,10 +351,10 @@ describe( 'Links', () => {
|
|
351
351
|
// eslint-disable-next-line no-restricted-syntax
|
352
352
|
await page.waitForTimeout( 100 );
|
353
353
|
|
354
|
-
// Publish the post
|
354
|
+
// Publish the post.
|
355
355
|
await page.click( '.editor-post-publish-button' );
|
356
356
|
|
357
|
-
// Return the URL of the new post
|
357
|
+
// Return the URL of the new post.
|
358
358
|
await page.waitForSelector(
|
359
359
|
'.post-publish-panel__postpublish-post-address input'
|
360
360
|
);
|
@@ -377,10 +377,10 @@ describe( 'Links', () => {
|
|
377
377
|
await page.keyboard.type( 'This is Gutenberg' );
|
378
378
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
379
379
|
|
380
|
-
// Press Cmd+K to insert a link
|
380
|
+
// Press Cmd+K to insert a link.
|
381
381
|
await pressKeyWithModifier( 'primary', 'K' );
|
382
382
|
|
383
|
-
// Wait for the URL field to auto-focus
|
383
|
+
// Wait for the URL field to auto-focus.
|
384
384
|
await waitForURLFieldAutoFocus();
|
385
385
|
expect(
|
386
386
|
await page.$(
|
@@ -407,10 +407,10 @@ describe( 'Links', () => {
|
|
407
407
|
await page.keyboard.type( '.' );
|
408
408
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
409
409
|
|
410
|
-
// Press Cmd+K to insert a link
|
410
|
+
// Press Cmd+K to insert a link.
|
411
411
|
await pressKeyWithModifier( 'primary', 'K' );
|
412
412
|
|
413
|
-
// Wait for the URL field to auto-focus
|
413
|
+
// Wait for the URL field to auto-focus.
|
414
414
|
await waitForURLFieldAutoFocus();
|
415
415
|
expect(
|
416
416
|
await page.$(
|
@@ -426,10 +426,10 @@ describe( 'Links', () => {
|
|
426
426
|
)
|
427
427
|
).toBeNull();
|
428
428
|
|
429
|
-
// Press Cmd+K to insert a link
|
429
|
+
// Press Cmd+K to insert a link.
|
430
430
|
await pressKeyWithModifier( 'primary', 'K' );
|
431
431
|
|
432
|
-
// Wait for the URL field to auto-focus
|
432
|
+
// Wait for the URL field to auto-focus.
|
433
433
|
await waitForURLFieldAutoFocus();
|
434
434
|
expect(
|
435
435
|
await page.$(
|
@@ -564,10 +564,10 @@ describe( 'Links', () => {
|
|
564
564
|
await pressKeyWithModifier( 'primary', 'a' );
|
565
565
|
await page.keyboard.type( 'wordpress.org' );
|
566
566
|
|
567
|
-
// Update the link
|
567
|
+
// Update the link.
|
568
568
|
await page.keyboard.press( 'Enter' );
|
569
569
|
|
570
|
-
// Navigate back to the popover
|
570
|
+
// Navigate back to the popover.
|
571
571
|
await page.keyboard.press( 'ArrowLeft' );
|
572
572
|
await page.keyboard.press( 'ArrowLeft' );
|
573
573
|
|
@@ -591,14 +591,14 @@ describe( 'Links', () => {
|
|
591
591
|
|
592
592
|
describe( 'Editing link text', () => {
|
593
593
|
it( 'should not display text input when initially creating the link', async () => {
|
594
|
-
// Create a block with some text
|
594
|
+
// Create a block with some text.
|
595
595
|
await clickBlockAppender();
|
596
596
|
await page.keyboard.type( 'This is Gutenberg: ' );
|
597
597
|
|
598
|
-
// Press Cmd+K to insert a link
|
598
|
+
// Press Cmd+K to insert a link.
|
599
599
|
await pressKeyWithModifier( 'primary', 'K' );
|
600
600
|
|
601
|
-
// Wait for the URL field to auto-focus
|
601
|
+
// Wait for the URL field to auto-focus.
|
602
602
|
await waitForURLFieldAutoFocus();
|
603
603
|
|
604
604
|
const textInput = await page
|
@@ -652,7 +652,7 @@ describe( 'Links', () => {
|
|
652
652
|
const textToSelect = ` spaces `;
|
653
653
|
const textWithWhitespace = `Text with leading and trailing${ textToSelect }`;
|
654
654
|
|
655
|
-
// Create a block with some text
|
655
|
+
// Create a block with some text.
|
656
656
|
await clickBlockAppender();
|
657
657
|
await page.keyboard.type( textWithWhitespace );
|
658
658
|
|
@@ -662,16 +662,16 @@ describe( 'Links', () => {
|
|
662
662
|
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
663
663
|
}
|
664
664
|
|
665
|
-
// Click on the Link button
|
665
|
+
// Click on the Link button.
|
666
666
|
await page.click( 'button[aria-label="Link"]' );
|
667
667
|
|
668
|
-
// Wait for the URL field to auto-focus
|
668
|
+
// Wait for the URL field to auto-focus.
|
669
669
|
await waitForURLFieldAutoFocus();
|
670
670
|
|
671
|
-
// Type a URL
|
671
|
+
// Type a URL.
|
672
672
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
673
673
|
|
674
|
-
// Click on the Submit button
|
674
|
+
// Click on the Submit button.
|
675
675
|
await page.keyboard.press( 'Enter' );
|
676
676
|
|
677
677
|
// Reselect the link.
|
@@ -728,16 +728,16 @@ describe( 'Links', () => {
|
|
728
728
|
// to reflect the original value with no modifications.
|
729
729
|
expect( textInputValue ).toBe( originalLinkText );
|
730
730
|
|
731
|
-
// Select all the link text in the input
|
731
|
+
// Select all the link text in the input.
|
732
732
|
await pressKeyWithModifier( 'primary', 'a' );
|
733
733
|
|
734
|
-
// Modify the link text value
|
734
|
+
// Modify the link text value.
|
735
735
|
await page.keyboard.type( changedLinkText );
|
736
736
|
|
737
|
-
// Submit the change
|
737
|
+
// Submit the change.
|
738
738
|
await page.keyboard.press( 'Enter' );
|
739
739
|
|
740
|
-
// Check the created link reflects the link text
|
740
|
+
// Check the created link reflects the link text.
|
741
741
|
const actualLinkText = await page.evaluate(
|
742
742
|
() =>
|
743
743
|
document.querySelector(
|
@@ -768,12 +768,12 @@ describe( 'Links', () => {
|
|
768
768
|
await page.keyboard.press( 'Tab' );
|
769
769
|
await page.keyboard.press( 'Tab' );
|
770
770
|
|
771
|
-
// Make a selection within the RichText
|
771
|
+
// Make a selection within the RichText.
|
772
772
|
await pressKeyWithModifier( 'shift', 'ArrowRight' );
|
773
773
|
await pressKeyWithModifier( 'shift', 'ArrowRight' );
|
774
774
|
await pressKeyWithModifier( 'shift', 'ArrowRight' );
|
775
775
|
|
776
|
-
// Move back to the text input
|
776
|
+
// Move back to the text input.
|
777
777
|
await page.keyboard.press( 'Tab' );
|
778
778
|
|
779
779
|
// Tabbing back should land us in the text input.
|
@@ -794,7 +794,7 @@ describe( 'Links', () => {
|
|
794
794
|
const linkedText = `Gutenberg`;
|
795
795
|
const textBeyondLinkedText = ` and more text.`;
|
796
796
|
|
797
|
-
// Create a block with some text
|
797
|
+
// Create a block with some text.
|
798
798
|
await clickBlockAppender();
|
799
799
|
await page.keyboard.type(
|
800
800
|
`This is ${ linkedText }${ textBeyondLinkedText }`
|
@@ -809,19 +809,19 @@ describe( 'Links', () => {
|
|
809
809
|
await page.keyboard.press( 'ArrowLeft' );
|
810
810
|
}
|
811
811
|
|
812
|
-
// Select the linkedText
|
812
|
+
// Select the linkedText.
|
813
813
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
814
814
|
|
815
|
-
// Click on the Link button
|
815
|
+
// Click on the Link button.
|
816
816
|
await page.click( 'button[aria-label="Link"]' );
|
817
817
|
|
818
|
-
// Wait for the URL field to auto-focus
|
818
|
+
// Wait for the URL field to auto-focus.
|
819
819
|
await waitForURLFieldAutoFocus();
|
820
820
|
|
821
|
-
// Type a URL
|
821
|
+
// Type a URL.
|
822
822
|
await page.keyboard.type( 'https://wordpress.org/gutenberg' );
|
823
823
|
|
824
|
-
// Update the link
|
824
|
+
// Update the link.
|
825
825
|
await page.keyboard.press( 'Enter' );
|
826
826
|
|
827
827
|
await page.keyboard.press( 'ArrowLeft' );
|
@@ -874,27 +874,27 @@ describe( 'Links', () => {
|
|
874
874
|
const linkOneURL = 'https://wordpress.org';
|
875
875
|
const linkTwoURL = 'https://wordpress.org/gutenberg';
|
876
876
|
|
877
|
-
// Create a block with some text
|
877
|
+
// Create a block with some text.
|
878
878
|
await clickBlockAppender();
|
879
879
|
await page.keyboard.type(
|
880
880
|
`This is the ${ linkedTextOne }${ linkedTextTwo }`
|
881
881
|
);
|
882
882
|
|
883
|
-
// Select the linkedTextTwo
|
883
|
+
// Select the linkedTextTwo.
|
884
884
|
for ( let index = 0; index < linkedTextTwo.length; index++ ) {
|
885
885
|
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
886
886
|
}
|
887
887
|
|
888
|
-
// Click on the Link button
|
888
|
+
// Click on the Link button.
|
889
889
|
await page.click( 'button[aria-label="Link"]' );
|
890
890
|
|
891
|
-
// Wait for the URL field to auto-focus
|
891
|
+
// Wait for the URL field to auto-focus.
|
892
892
|
await waitForURLFieldAutoFocus();
|
893
893
|
|
894
|
-
// Type a URL
|
894
|
+
// Type a URL.
|
895
895
|
await page.keyboard.type( linkTwoURL );
|
896
896
|
|
897
|
-
// Update the link
|
897
|
+
// Update the link.
|
898
898
|
await page.keyboard.press( 'Enter' );
|
899
899
|
|
900
900
|
// Move cursor next to the **end** of `linkTextOne`
|
@@ -905,16 +905,16 @@ describe( 'Links', () => {
|
|
905
905
|
// Select `linkTextOne`
|
906
906
|
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );
|
907
907
|
|
908
|
-
// Click on the Link button
|
908
|
+
// Click on the Link button.
|
909
909
|
await page.click( 'button[aria-label="Link"]' );
|
910
910
|
|
911
|
-
// Wait for the URL field to auto-focus
|
911
|
+
// Wait for the URL field to auto-focus.
|
912
912
|
await waitForURLFieldAutoFocus();
|
913
913
|
|
914
|
-
// Type a URL
|
914
|
+
// Type a URL.
|
915
915
|
await page.keyboard.type( linkOneURL );
|
916
916
|
|
917
|
-
// Update the link
|
917
|
+
// Update the link.
|
918
918
|
await page.keyboard.press( 'Enter' );
|
919
919
|
|
920
920
|
// Move cursor within `linkTextOne`
|
@@ -51,7 +51,7 @@ describe( 'List view', () => {
|
|
51
51
|
'//a[contains(., "Paragraph")][@draggable="true"]'
|
52
52
|
);
|
53
53
|
|
54
|
-
// Drag above the heading block
|
54
|
+
// Drag above the heading block.
|
55
55
|
const headingBlock = await page.waitForXPath(
|
56
56
|
'//a[contains(., "Heading")][@draggable="true"]'
|
57
57
|
);
|
@@ -149,4 +149,50 @@ describe( 'List view', () => {
|
|
149
149
|
|
150
150
|
expect( selectedElementText ).toContain( 'Paragraph' );
|
151
151
|
} );
|
152
|
+
|
153
|
+
// Test keyboard Home/End keys.
|
154
|
+
it( 'ensures the Home/End keyboard keys move focus to start/end of list', async () => {
|
155
|
+
// Insert some blocks of different types.
|
156
|
+
await insertBlock( 'Image' );
|
157
|
+
await insertBlock( 'Heading' );
|
158
|
+
await insertBlock( 'Paragraph' );
|
159
|
+
await insertBlock( 'Columns' );
|
160
|
+
await insertBlock( 'Group' );
|
161
|
+
|
162
|
+
// Open list view.
|
163
|
+
await pressKeyWithModifier( 'access', 'o' );
|
164
|
+
|
165
|
+
// The last inserted group block should be selected in list view.
|
166
|
+
await page.waitForXPath( '//a[contains(., "Group(selected block)")]' );
|
167
|
+
|
168
|
+
// Press Home to go to the first inserted block (image).
|
169
|
+
await page.keyboard.press( 'Home' );
|
170
|
+
const listViewImageBlock = await page.waitForXPath(
|
171
|
+
'//a[contains(., "Image")]'
|
172
|
+
);
|
173
|
+
await expect( listViewImageBlock ).toHaveFocus();
|
174
|
+
|
175
|
+
// Press End followed by Arrow Up to go to the second to last block (columns).
|
176
|
+
await page.keyboard.press( 'End' );
|
177
|
+
await page.keyboard.press( 'ArrowUp' );
|
178
|
+
const listViewColumnsBlock = await page.waitForXPath(
|
179
|
+
'//a[contains(., "Columns")]'
|
180
|
+
);
|
181
|
+
await expect( listViewColumnsBlock ).toHaveFocus();
|
182
|
+
|
183
|
+
// Try navigating the right column to image block options button via Home key.
|
184
|
+
await page.keyboard.press( 'ArrowRight' );
|
185
|
+
await page.keyboard.press( 'Home' );
|
186
|
+
const listViewImageBlockRight = await page.waitForSelector(
|
187
|
+
'button[aria-label="Options for Image block"]'
|
188
|
+
);
|
189
|
+
await expect( listViewImageBlockRight ).toHaveFocus();
|
190
|
+
|
191
|
+
// Try navigating the right column to group block options button.
|
192
|
+
await page.keyboard.press( 'End' );
|
193
|
+
const listViewGroupBlockRight = await page.waitForSelector(
|
194
|
+
'button[aria-label="Options for Group block"]'
|
195
|
+
);
|
196
|
+
await expect( listViewGroupBlockRight ).toHaveFocus();
|
197
|
+
} );
|
152
198
|
} );
|
@@ -28,14 +28,14 @@ describe( 'Managing reusable blocks', () => {
|
|
28
28
|
it( 'Should import reusable blocks', async () => {
|
29
29
|
const originalEntries = await getNumberOfEntries();
|
30
30
|
|
31
|
-
// Import Reusable block
|
31
|
+
// Import Reusable block.
|
32
32
|
await page.waitForSelector( '.list-reusable-blocks__container' );
|
33
33
|
const importButton = await page.$(
|
34
34
|
'.list-reusable-blocks__container button'
|
35
35
|
);
|
36
36
|
await importButton.click();
|
37
37
|
|
38
|
-
// Select the file to upload
|
38
|
+
// Select the file to upload.
|
39
39
|
const testReusableBlockFile = path.join(
|
40
40
|
__dirname,
|
41
41
|
'..',
|
@@ -47,13 +47,13 @@ describe( 'Managing reusable blocks', () => {
|
|
47
47
|
const input = await page.$( '.list-reusable-blocks-import-form input' );
|
48
48
|
await input.uploadFile( testReusableBlockFile );
|
49
49
|
|
50
|
-
// Submit the form
|
50
|
+
// Submit the form.
|
51
51
|
const button = await page.$(
|
52
52
|
'.list-reusable-blocks-import-form__button'
|
53
53
|
);
|
54
54
|
await button.click();
|
55
55
|
|
56
|
-
// Wait for the success notice
|
56
|
+
// Wait for the success notice.
|
57
57
|
await page.waitForSelector( '.notice-success' );
|
58
58
|
const noticeContent = await page.$eval(
|
59
59
|
'.notice-success',
|
@@ -63,7 +63,7 @@ describe( 'Managing reusable blocks', () => {
|
|
63
63
|
'Reusable block imported successfully!'
|
64
64
|
);
|
65
65
|
|
66
|
-
// Refresh the page
|
66
|
+
// Refresh the page.
|
67
67
|
await visitAdminPage( 'edit.php', 'post_type=wp_block' );
|
68
68
|
|
69
69
|
const expectedEntries = originalEntries + 1;
|