@wordpress/e2e-tests 7.5.0 → 7.6.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/CHANGELOG.md +2 -0
- package/config/setup-test-framework.js +9 -0
- package/package.json +7 -7
- package/plugins/block-context.php +1 -1
- package/plugins/iframed-block/block.json +1 -1
- package/plugins/iframed-block.php +2 -2
- package/plugins/iframed-enqueue-block-assets.php +1 -1
- package/plugins/iframed-inline-styles/block.json +1 -1
- package/plugins/iframed-inline-styles/editor.js +1 -1
- package/plugins/iframed-inline-styles.php +3 -3
- package/plugins/iframed-masonry-block/block.json +1 -1
- package/plugins/iframed-masonry-block/editor.js +1 -1
- package/plugins/iframed-masonry-block.php +2 -2
- package/plugins/iframed-multiple-stylesheets/block.json +1 -1
- package/plugins/iframed-multiple-stylesheets/editor.js +1 -1
- package/plugins/iframed-multiple-stylesheets.php +2 -2
- package/plugins/marquee-function-widget.php +2 -2
- package/specs/editor/blocks/post-title.test.js +5 -4
- package/specs/editor/blocks/site-title.test.js +3 -2
- package/specs/editor/plugins/annotations.test.js +17 -9
- package/specs/editor/plugins/block-variations.test.js +6 -5
- package/specs/editor/plugins/cpt-locking.test.js +15 -12
- package/specs/editor/plugins/iframed-inline-styles.test.js +6 -2
- package/specs/editor/plugins/iframed-masonry-block.test.js +1 -1
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +1 -1
- package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +7 -6
- package/specs/editor/plugins/inner-blocks-prioritized-inserter-blocks.test.js +2 -1
- package/specs/editor/various/__snapshots__/links.test.js.snap +0 -24
- package/specs/editor/various/adding-inline-tokens.test.js +0 -1
- package/specs/editor/various/autosave.test.js +2 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +3 -2
- package/specs/editor/various/block-grouping.test.js +5 -4
- package/specs/editor/various/block-hierarchy-navigation.test.js +12 -9
- package/specs/editor/various/change-detection.test.js +20 -19
- package/specs/editor/various/editor-modes.test.js +7 -6
- package/specs/editor/various/embedding.test.js +21 -15
- package/specs/editor/various/inserting-blocks.test.js +19 -14
- package/specs/editor/various/invalid-block.test.js +4 -6
- package/specs/editor/various/keyboard-navigable-blocks.test.js +16 -17
- package/specs/editor/various/links.test.js +22 -154
- package/specs/editor/various/navigable-toolbar.test.js +14 -14
- package/specs/editor/various/nux.test.js +6 -2
- package/specs/editor/various/publish-button.test.js +3 -2
- package/specs/editor/various/publish-panel.test.js +4 -3
- package/specs/editor/various/publishing.test.js +9 -5
- package/specs/editor/various/reusable-blocks.test.js +22 -18
- package/specs/editor/various/rich-text.test.js +7 -6
- package/specs/editor/various/sidebar-permalink.test.js +4 -3
- package/specs/editor/various/taxonomies.test.js +4 -3
- package/specs/editor/various/typewriter.test.js +68 -50
- package/specs/performance/site-editor.test.js +2 -1
- package/specs/site-editor/settings-sidebar.test.js +2 -2
@@ -12,18 +12,6 @@ exports[`Links can be created by selecting text and clicking Link 1`] = `
|
|
12
12
|
<!-- /wp:paragraph -->"
|
13
13
|
`;
|
14
14
|
|
15
|
-
exports[`Links can be created by selecting text and using keyboard shortcuts 1`] = `
|
16
|
-
"<!-- wp:paragraph -->
|
17
|
-
<p>This is Gutenberg</p>
|
18
|
-
<!-- /wp:paragraph -->"
|
19
|
-
`;
|
20
|
-
|
21
|
-
exports[`Links can be created by selecting text and using keyboard shortcuts 2`] = `
|
22
|
-
"<!-- wp:paragraph -->
|
23
|
-
<p>This is <a href="https://wordpress.org/gutenberg" target="_blank" rel="noreferrer noopener">Gutenberg</a></p>
|
24
|
-
<!-- /wp:paragraph -->"
|
25
|
-
`;
|
26
|
-
|
27
15
|
exports[`Links can be created instantly when a URL is selected 1`] = `
|
28
16
|
"<!-- wp:paragraph -->
|
29
17
|
<p>This is Gutenberg: <a href="https://wordpress.org/gutenberg">https://wordpress.org/gutenberg</a></p>
|
@@ -59,15 +47,3 @@ exports[`Links can be removed 1`] = `
|
|
59
47
|
<p>This is Gutenberg</p>
|
60
48
|
<!-- /wp:paragraph -->"
|
61
49
|
`;
|
62
|
-
|
63
|
-
exports[`Links should contain a label when it should open in a new tab 1`] = `
|
64
|
-
"<!-- wp:paragraph -->
|
65
|
-
<p>This is <a href="http://w.org" target="_blank" rel="noreferrer noopener">WordPress</a></p>
|
66
|
-
<!-- /wp:paragraph -->"
|
67
|
-
`;
|
68
|
-
|
69
|
-
exports[`Links should contain a label when it should open in a new tab 2`] = `
|
70
|
-
"<!-- wp:paragraph -->
|
71
|
-
<p>This is <a href="http://wordpress.org" target="_blank" rel="noreferrer noopener">WordPress</a></p>
|
72
|
-
<!-- /wp:paragraph -->"
|
73
|
-
`;
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
publishPost,
|
10
10
|
saveDraft,
|
11
11
|
toggleOfflineMode,
|
12
|
+
canvas,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
// Constant to override editor preference
|
@@ -258,7 +259,7 @@ describe( 'autosave', () => {
|
|
258
259
|
await page.keyboard.type( 'before publish' );
|
259
260
|
await publishPost();
|
260
261
|
|
261
|
-
await
|
262
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
262
263
|
await page.keyboard.type( ' after publish' );
|
263
264
|
|
264
265
|
// Trigger remote autosave.
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
clickBlockToolbarButton,
|
10
10
|
clickMenuItem,
|
11
11
|
clickOnCloseModalButton,
|
12
|
+
canvas,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
const createTestParagraphBlocks = async () => {
|
@@ -51,7 +52,7 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
51
52
|
await createTestParagraphBlocks();
|
52
53
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
53
54
|
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
54
|
-
await
|
55
|
+
await canvas().waitForSelector(
|
55
56
|
'[aria-label="Multiple selected blocks"]'
|
56
57
|
);
|
57
58
|
await moveUp();
|
@@ -63,7 +64,7 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
63
64
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
64
65
|
await page.keyboard.press( 'ArrowUp' );
|
65
66
|
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
66
|
-
await
|
67
|
+
await canvas().waitForSelector(
|
67
68
|
'[aria-label="Multiple selected blocks"]'
|
68
69
|
);
|
69
70
|
await moveDown();
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
activatePlugin,
|
15
15
|
deactivatePlugin,
|
16
16
|
createReusableBlock,
|
17
|
+
canvas,
|
17
18
|
} from '@wordpress/e2e-test-utils';
|
18
19
|
|
19
20
|
async function insertBlocksOfSameType() {
|
@@ -115,8 +116,8 @@ describe( 'Block Grouping', () => {
|
|
115
116
|
const getParagraphText = async () => {
|
116
117
|
const paragraphInReusableSelector =
|
117
118
|
'.block-editor-block-list__block[data-type="core/block"] p';
|
118
|
-
await
|
119
|
-
return
|
119
|
+
await canvas().waitForSelector( paragraphInReusableSelector );
|
120
|
+
return canvas().$eval(
|
120
121
|
paragraphInReusableSelector,
|
121
122
|
( element ) => element.innerText
|
122
123
|
);
|
@@ -128,14 +129,14 @@ describe( 'Block Grouping', () => {
|
|
128
129
|
await clickBlockToolbarButton( 'Options' );
|
129
130
|
await clickMenuItem( 'Group' );
|
130
131
|
|
131
|
-
let group = await
|
132
|
+
let group = await canvas().$$( '[data-type="core/group"]' );
|
132
133
|
expect( group ).toHaveLength( 1 );
|
133
134
|
// Make sure the paragraph in reusable block exists.
|
134
135
|
expect( await getParagraphText() ).toMatch( paragraphText );
|
135
136
|
|
136
137
|
await clickBlockToolbarButton( 'Options' );
|
137
138
|
await clickMenuItem( 'Ungroup' );
|
138
|
-
group = await
|
139
|
+
group = await canvas().$$( '[data-type="core/group"]' );
|
139
140
|
expect( group ).toHaveLength( 0 );
|
140
141
|
// Make sure the paragraph in reusable block exists.
|
141
142
|
expect( await getParagraphText() ).toEqual( paragraphText );
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
openDocumentSettingsSidebar,
|
11
11
|
getListViewBlocks,
|
12
12
|
switchBlockInspectorTab,
|
13
|
+
canvas,
|
13
14
|
} from '@wordpress/e2e-test-utils';
|
14
15
|
|
15
16
|
async function openListViewSidebar() {
|
@@ -53,7 +54,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
53
54
|
|
54
55
|
it( 'should navigate using the list view sidebar', async () => {
|
55
56
|
await insertBlock( 'Columns' );
|
56
|
-
await
|
57
|
+
await canvas().click( '[aria-label="Two columns; equal split"]' );
|
57
58
|
|
58
59
|
// Add a paragraph in the first column.
|
59
60
|
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
|
@@ -114,7 +115,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
114
115
|
it( 'should navigate block hierarchy using only the keyboard', async () => {
|
115
116
|
await insertBlock( 'Columns' );
|
116
117
|
await openDocumentSettingsSidebar();
|
117
|
-
await
|
118
|
+
await canvas().click( '[aria-label="Two columns; equal split"]' );
|
118
119
|
|
119
120
|
// Add a paragraph in the first column.
|
120
121
|
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
|
@@ -141,13 +142,15 @@ describe( 'Navigating the block hierarchy', () => {
|
|
141
142
|
// Navigate to the third column in the columns block.
|
142
143
|
await pressKeyWithModifier( 'ctrlShift', '`' );
|
143
144
|
await pressKeyWithModifier( 'ctrlShift', '`' );
|
144
|
-
await pressKeyTimes( 'Tab',
|
145
|
+
await pressKeyTimes( 'Tab', 3 );
|
145
146
|
await pressKeyTimes( 'ArrowDown', 4 );
|
146
|
-
await
|
147
|
+
await canvas().waitForSelector(
|
147
148
|
'.is-highlighted[aria-label="Block: Column (3 of 3)"]'
|
148
149
|
);
|
149
150
|
await page.keyboard.press( 'Enter' );
|
150
|
-
await
|
151
|
+
await canvas().waitForSelector(
|
152
|
+
'.is-selected[data-type="core/column"]'
|
153
|
+
);
|
151
154
|
|
152
155
|
// Insert text in the last column block.
|
153
156
|
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
|
@@ -190,12 +193,12 @@ describe( 'Navigating the block hierarchy', () => {
|
|
190
193
|
// Insert a group block.
|
191
194
|
await insertBlock( 'Group' );
|
192
195
|
// Select the default, selected Group layout from the variation picker.
|
193
|
-
await
|
196
|
+
await canvas().click(
|
194
197
|
'button[aria-label="Group: Gather blocks in a container."]'
|
195
198
|
);
|
196
199
|
// Insert some random blocks.
|
197
200
|
// The last block shouldn't be a textual block.
|
198
|
-
await
|
201
|
+
await canvas().click( '.block-list-appender .block-editor-inserter' );
|
199
202
|
const paragraphMenuItem = (
|
200
203
|
await page.$x( `//button//span[contains(text(), 'Paragraph')]` )
|
201
204
|
)[ 0 ];
|
@@ -207,7 +210,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
207
210
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
208
211
|
|
209
212
|
// Unselect the blocks.
|
210
|
-
await
|
213
|
+
await canvas().click( '.editor-post-title' );
|
211
214
|
|
212
215
|
// Try selecting the group block using the Outline.
|
213
216
|
await page.click(
|
@@ -217,7 +220,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
217
220
|
await groupMenuItem.click();
|
218
221
|
|
219
222
|
// The group block's wrapper should be selected.
|
220
|
-
const isGroupBlockSelected = await
|
223
|
+
const isGroupBlockSelected = await canvas().evaluate(
|
221
224
|
() =>
|
222
225
|
document.activeElement.getAttribute( 'data-type' ) ===
|
223
226
|
'core/group'
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
openDocumentSettingsSidebar,
|
12
12
|
isCurrentURL,
|
13
13
|
openTypographyToolsPanelMenu,
|
14
|
+
canvas,
|
14
15
|
} from '@wordpress/e2e-test-utils';
|
15
16
|
|
16
17
|
describe( 'Change detection', () => {
|
@@ -78,7 +79,7 @@ describe( 'Change detection', () => {
|
|
78
79
|
} );
|
79
80
|
|
80
81
|
it( 'Should autosave post', async () => {
|
81
|
-
await
|
82
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
82
83
|
|
83
84
|
// Force autosave to occur immediately.
|
84
85
|
await Promise.all( [
|
@@ -94,7 +95,7 @@ describe( 'Change detection', () => {
|
|
94
95
|
} );
|
95
96
|
|
96
97
|
it( 'Should prompt to confirm unsaved changes for autosaved draft for non-content fields', async () => {
|
97
|
-
await
|
98
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
98
99
|
|
99
100
|
// Toggle post as needing review (not persisted for autosave).
|
100
101
|
await ensureSidebarOpened();
|
@@ -117,7 +118,7 @@ describe( 'Change detection', () => {
|
|
117
118
|
} );
|
118
119
|
|
119
120
|
it( 'Should prompt to confirm unsaved changes for autosaved published post', async () => {
|
120
|
-
await
|
121
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
121
122
|
|
122
123
|
await publishPost();
|
123
124
|
|
@@ -130,7 +131,7 @@ describe( 'Change detection', () => {
|
|
130
131
|
] );
|
131
132
|
|
132
133
|
// Should be dirty after autosave change of published post.
|
133
|
-
await
|
134
|
+
await canvas().type( '.editor-post-title__input', '!' );
|
134
135
|
|
135
136
|
await Promise.all( [
|
136
137
|
page.waitForSelector(
|
@@ -162,7 +163,7 @@ describe( 'Change detection', () => {
|
|
162
163
|
} );
|
163
164
|
|
164
165
|
it( 'Should prompt if property changed without save', async () => {
|
165
|
-
await
|
166
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
166
167
|
|
167
168
|
await assertIsDirty( true );
|
168
169
|
} );
|
@@ -175,7 +176,7 @@ describe( 'Change detection', () => {
|
|
175
176
|
} );
|
176
177
|
|
177
178
|
it( 'Should not prompt if changes saved', async () => {
|
178
|
-
await
|
179
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
179
180
|
|
180
181
|
await saveDraft();
|
181
182
|
|
@@ -192,7 +193,7 @@ describe( 'Change detection', () => {
|
|
192
193
|
} );
|
193
194
|
|
194
195
|
it( 'Should not save if all changes saved', async () => {
|
195
|
-
await
|
196
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
196
197
|
|
197
198
|
await saveDraft();
|
198
199
|
|
@@ -205,7 +206,7 @@ describe( 'Change detection', () => {
|
|
205
206
|
} );
|
206
207
|
|
207
208
|
it( 'Should prompt if save failed', async () => {
|
208
|
-
await
|
209
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
209
210
|
|
210
211
|
await page.setOfflineMode( true );
|
211
212
|
|
@@ -231,7 +232,7 @@ describe( 'Change detection', () => {
|
|
231
232
|
} );
|
232
233
|
|
233
234
|
it( 'Should prompt if changes and save is in-flight', async () => {
|
234
|
-
await
|
235
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
235
236
|
|
236
237
|
// Hold the posts request so we don't deal with race conditions of the
|
237
238
|
// save completing early. Other requests should be allowed to continue,
|
@@ -247,7 +248,7 @@ describe( 'Change detection', () => {
|
|
247
248
|
} );
|
248
249
|
|
249
250
|
it( 'Should prompt if changes made while save is in-flight', async () => {
|
250
|
-
await
|
251
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
251
252
|
|
252
253
|
// Hold the posts request so we don't deal with race conditions of the
|
253
254
|
// save completing early. Other requests should be allowed to continue,
|
@@ -257,7 +258,7 @@ describe( 'Change detection', () => {
|
|
257
258
|
// Keyboard shortcut Ctrl+S save.
|
258
259
|
await pressKeyWithModifier( 'primary', 'S' );
|
259
260
|
|
260
|
-
await
|
261
|
+
await canvas().type( '.editor-post-title__input', '!' );
|
261
262
|
await page.waitForSelector( '.editor-post-save-draft' );
|
262
263
|
|
263
264
|
await releaseSaveIntercept();
|
@@ -266,7 +267,7 @@ describe( 'Change detection', () => {
|
|
266
267
|
} );
|
267
268
|
|
268
269
|
it( 'Should prompt if property changes made while save is in-flight, and save completes', async () => {
|
269
|
-
await
|
270
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
270
271
|
|
271
272
|
// Hold the posts request so we don't deal with race conditions of the
|
272
273
|
// save completing early.
|
@@ -282,7 +283,7 @@ describe( 'Change detection', () => {
|
|
282
283
|
);
|
283
284
|
|
284
285
|
// Dirty post while save is in-flight.
|
285
|
-
await
|
286
|
+
await canvas().type( '.editor-post-title__input', '!' );
|
286
287
|
|
287
288
|
// Allow save to complete. Disabling interception flushes pending.
|
288
289
|
await Promise.all( [ savedPromise, releaseSaveIntercept() ] );
|
@@ -291,7 +292,7 @@ describe( 'Change detection', () => {
|
|
291
292
|
} );
|
292
293
|
|
293
294
|
it( 'Should prompt if block revision is made while save is in-flight, and save completes', async () => {
|
294
|
-
await
|
295
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
295
296
|
|
296
297
|
// Hold the posts request so we don't deal with race conditions of the
|
297
298
|
// save completing early.
|
@@ -324,7 +325,7 @@ describe( 'Change detection', () => {
|
|
324
325
|
await saveDraft();
|
325
326
|
|
326
327
|
// Verify that the title is empty.
|
327
|
-
const title = await
|
328
|
+
const title = await canvas().$eval(
|
328
329
|
'.editor-post-title__input',
|
329
330
|
// Trim padding non-breaking space.
|
330
331
|
( element ) => element.textContent.trim()
|
@@ -337,7 +338,7 @@ describe( 'Change detection', () => {
|
|
337
338
|
|
338
339
|
it( 'should not prompt to confirm unsaved changes when trashing an existing post', async () => {
|
339
340
|
// Enter title.
|
340
|
-
await
|
341
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
341
342
|
|
342
343
|
// Save.
|
343
344
|
await saveDraft();
|
@@ -381,7 +382,7 @@ describe( 'Change detection', () => {
|
|
381
382
|
] );
|
382
383
|
|
383
384
|
// Change the paragraph's `drop cap`.
|
384
|
-
await
|
385
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
385
386
|
|
386
387
|
await openTypographyToolsPanelMenu();
|
387
388
|
await page.click( 'button[aria-label="Show Drop cap"]' );
|
@@ -390,7 +391,7 @@ describe( 'Change detection', () => {
|
|
390
391
|
"//label[contains(text(), 'Drop cap')]"
|
391
392
|
);
|
392
393
|
await dropCapToggle.click();
|
393
|
-
await
|
394
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
394
395
|
|
395
396
|
// Check that the post is dirty.
|
396
397
|
await page.waitForSelector( '.editor-post-save-draft' );
|
@@ -402,7 +403,7 @@ describe( 'Change detection', () => {
|
|
402
403
|
] );
|
403
404
|
|
404
405
|
// Change the paragraph's `drop cap` again.
|
405
|
-
await
|
406
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
406
407
|
await dropCapToggle.click();
|
407
408
|
|
408
409
|
// Check that the post is dirty.
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
pressKeyTimes,
|
12
12
|
pressKeyWithModifier,
|
13
13
|
openTypographyToolsPanelMenu,
|
14
|
+
canvas,
|
14
15
|
} from '@wordpress/e2e-test-utils';
|
15
16
|
|
16
17
|
describe( 'Editing modes (visual/HTML)', () => {
|
@@ -22,7 +23,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
22
23
|
|
23
24
|
it( 'should switch between visual and HTML modes', async () => {
|
24
25
|
// This block should be in "visual" mode by default.
|
25
|
-
let visualBlock = await
|
26
|
+
let visualBlock = await canvas().$$( '[data-block].rich-text' );
|
26
27
|
expect( visualBlock ).toHaveLength( 1 );
|
27
28
|
|
28
29
|
// Change editing mode from "Visual" to "HTML".
|
@@ -30,7 +31,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
30
31
|
await clickMenuItem( 'Edit as HTML' );
|
31
32
|
|
32
33
|
// Wait for the block to be converted to HTML editing mode.
|
33
|
-
const htmlBlock = await
|
34
|
+
const htmlBlock = await canvas().$$(
|
34
35
|
'[data-block] .block-editor-block-list__block-html-textarea'
|
35
36
|
);
|
36
37
|
expect( htmlBlock ).toHaveLength( 1 );
|
@@ -40,7 +41,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
40
41
|
await clickMenuItem( 'Edit visually' );
|
41
42
|
|
42
43
|
// This block should be in "visual" mode by default.
|
43
|
-
visualBlock = await
|
44
|
+
visualBlock = await canvas().$$( '[data-block].rich-text' );
|
44
45
|
expect( visualBlock ).toHaveLength( 1 );
|
45
46
|
} );
|
46
47
|
|
@@ -67,7 +68,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
67
68
|
await clickMenuItem( 'Edit as HTML' );
|
68
69
|
|
69
70
|
// Make sure the paragraph content is rendered as expected.
|
70
|
-
let htmlBlockContent = await
|
71
|
+
let htmlBlockContent = await canvas().$eval(
|
71
72
|
'.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea',
|
72
73
|
( node ) => node.textContent
|
73
74
|
);
|
@@ -83,7 +84,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
83
84
|
await dropCapToggle.click();
|
84
85
|
|
85
86
|
// Make sure the HTML content updated.
|
86
|
-
htmlBlockContent = await
|
87
|
+
htmlBlockContent = await canvas().$eval(
|
87
88
|
'.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea',
|
88
89
|
( node ) => node.textContent
|
89
90
|
);
|
@@ -138,7 +139,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
138
139
|
const editPosition = textContent.indexOf( 'Hello' );
|
139
140
|
|
140
141
|
// Replace the word 'Hello' with 'Hi'.
|
141
|
-
await
|
142
|
+
await canvas().click( '.editor-post-title__input' );
|
142
143
|
await page.keyboard.press( 'Tab' );
|
143
144
|
await pressKeyTimes( 'ArrowRight', editPosition );
|
144
145
|
await pressKeyTimes( 'Delete', 5 );
|
@@ -3,7 +3,6 @@
|
|
3
3
|
*/
|
4
4
|
import {
|
5
5
|
clickBlockAppender,
|
6
|
-
clickButton,
|
7
6
|
createEmbeddingMatcher,
|
8
7
|
createJSONResponse,
|
9
8
|
createNewPost,
|
@@ -12,6 +11,7 @@ import {
|
|
12
11
|
insertBlock,
|
13
12
|
publishPost,
|
14
13
|
setUpResponseMocking,
|
14
|
+
canvas,
|
15
15
|
} from '@wordpress/e2e-test-utils';
|
16
16
|
|
17
17
|
const MOCK_EMBED_WORDPRESS_SUCCESS_RESPONSE = {
|
@@ -178,24 +178,24 @@ describe( 'Embedding content', () => {
|
|
178
178
|
it( 'should render embeds in the correct state', async () => {
|
179
179
|
// Valid embed. Should render valid figure element.
|
180
180
|
await insertEmbed( 'https://twitter.com/notnownikki' );
|
181
|
-
await
|
181
|
+
await canvas().waitForSelector( 'figure.wp-block-embed' );
|
182
182
|
|
183
183
|
// Valid provider; invalid content. Should render failed, edit state.
|
184
184
|
await insertEmbed( 'https://twitter.com/wooyaygutenberg123454312' );
|
185
|
-
await
|
185
|
+
await canvas().waitForSelector(
|
186
186
|
'input[value="https://twitter.com/wooyaygutenberg123454312"]'
|
187
187
|
);
|
188
188
|
|
189
189
|
// WordPress invalid content. Should render failed, edit state.
|
190
190
|
await insertEmbed( 'https://wordpress.org/gutenberg/handbook/' );
|
191
|
-
await
|
191
|
+
await canvas().waitForSelector(
|
192
192
|
'input[value="https://wordpress.org/gutenberg/handbook/"]'
|
193
193
|
);
|
194
194
|
|
195
195
|
// Provider whose oembed API has gone wrong. Should render failed, edit
|
196
196
|
// state.
|
197
197
|
await insertEmbed( 'https://twitter.com/thatbunty' );
|
198
|
-
await
|
198
|
+
await canvas().waitForSelector(
|
199
199
|
'input[value="https://twitter.com/thatbunty"]'
|
200
200
|
);
|
201
201
|
|
@@ -204,18 +204,18 @@ describe( 'Embedding content', () => {
|
|
204
204
|
await insertEmbed(
|
205
205
|
'https://wordpress.org/gutenberg/handbook/block-api/attributes/'
|
206
206
|
);
|
207
|
-
await
|
207
|
+
await canvas().waitForSelector( 'figure.wp-block-embed' );
|
208
208
|
|
209
209
|
// Video content. Should render valid figure element, and include the
|
210
210
|
// aspect ratio class.
|
211
211
|
await insertEmbed( 'https://www.youtube.com/watch?v=lXMskKTw3Bc' );
|
212
|
-
await
|
212
|
+
await canvas().waitForSelector(
|
213
213
|
'figure.wp-block-embed.is-type-video.wp-embed-aspect-16-9'
|
214
214
|
);
|
215
215
|
|
216
216
|
// Photo content. Should render valid figure element.
|
217
217
|
await insertEmbed( 'https://cloudup.com/cQFlxqtY4ob' );
|
218
|
-
await
|
218
|
+
await canvas().waitForSelector(
|
219
219
|
'iframe[title="Embedded content from cloudup"'
|
220
220
|
);
|
221
221
|
|
@@ -230,18 +230,21 @@ describe( 'Embedding content', () => {
|
|
230
230
|
// has styles applied which depend on resize observer, wait for the
|
231
231
|
// expected size class to settle before clicking, since otherwise a race
|
232
232
|
// condition could occur on the placeholder layout vs. click intent.
|
233
|
-
await
|
233
|
+
await canvas().waitForSelector(
|
234
234
|
'.components-placeholder.is-large .components-placeholder__error'
|
235
235
|
);
|
236
236
|
|
237
|
-
|
237
|
+
const button = await canvas().waitForXPath(
|
238
|
+
`//button[contains(text(), 'Convert to link')]`
|
239
|
+
);
|
240
|
+
await button.click();
|
238
241
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
239
242
|
} );
|
240
243
|
|
241
244
|
it( 'should retry embeds that could not be embedded with trailing slashes, without the trailing slashes', async () => {
|
242
245
|
await insertEmbed( 'https://twitter.com/notnownikki/' );
|
243
246
|
// The twitter block should appear correctly.
|
244
|
-
await
|
247
|
+
await canvas().waitForSelector( 'figure.wp-block-embed' );
|
245
248
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
246
249
|
} );
|
247
250
|
|
@@ -253,7 +256,7 @@ describe( 'Embedding content', () => {
|
|
253
256
|
// has styles applied which depend on resize observer, wait for the
|
254
257
|
// expected size class to settle before clicking, since otherwise a race
|
255
258
|
// condition could occur on the placeholder layout vs. click intent.
|
256
|
-
await
|
259
|
+
await canvas().waitForSelector(
|
257
260
|
'.components-placeholder.is-large .components-placeholder__error'
|
258
261
|
);
|
259
262
|
|
@@ -268,8 +271,11 @@ describe( 'Embedding content', () => {
|
|
268
271
|
),
|
269
272
|
},
|
270
273
|
] );
|
271
|
-
|
272
|
-
|
274
|
+
const button = await canvas().waitForXPath(
|
275
|
+
`//button[contains(text(), 'Try again')]`
|
276
|
+
);
|
277
|
+
await button.click();
|
278
|
+
await canvas().waitForSelector( 'figure.wp-block-embed' );
|
273
279
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
274
280
|
} );
|
275
281
|
|
@@ -292,6 +298,6 @@ describe( 'Embedding content', () => {
|
|
292
298
|
await insertEmbed( postUrl );
|
293
299
|
|
294
300
|
// Check the block has become a WordPress block.
|
295
|
-
await
|
301
|
+
await canvas().waitForSelector( 'figure.wp-block-embed' );
|
296
302
|
} );
|
297
303
|
} );
|