@wordpress/e2e-tests 2.5.14 → 2.5.18
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/mu-plugins/enable-templates-ui.php +24 -0
- package/package.json +3 -3
- package/specs/editor/blocks/__snapshots__/heading.test.js.snap +9 -9
- package/specs/editor/blocks/__snapshots__/quote.test.js.snap +10 -10
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
- package/specs/editor/blocks/heading.test.js +2 -2
- package/specs/editor/plugins/iframed-inline-styles.test.js +0 -6
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -4
- package/specs/editor/various/__snapshots__/block-grouping.test.js.snap +4 -4
- package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +2 -2
- package/specs/editor/various/undo.test.js +21 -0
- package/specs/site-editor/multi-entity-saving.test.js +57 -9
- package/specs/site-editor/template-revert.test.js +12 -8
- package/specs/widgets/customizing-widgets.test.js +0 -20
- package/specs/widgets/editing-widgets.test.js +36 -12
@@ -0,0 +1,24 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test Plugin, Enable Templates UI
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-enable-templates-ui
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Enable Templates & Template Parts post type UI during e2e testing.
|
12
|
+
*/
|
13
|
+
add_filter(
|
14
|
+
'register_post_type_args',
|
15
|
+
static function( $args, $name ) {
|
16
|
+
if ( in_array( $name, array( 'wp_template', 'wp_template_part' ), true ) ) {
|
17
|
+
$args['show_ui'] = wp_is_block_theme();
|
18
|
+
}
|
19
|
+
|
20
|
+
return $args;
|
21
|
+
},
|
22
|
+
20,
|
23
|
+
2
|
24
|
+
);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.18",
|
4
4
|
"description": "End-To-End (E2E) tests for WordPress.",
|
5
5
|
"author": "The WordPress Contributors",
|
6
6
|
"license": "GPL-2.0-or-later",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"@wordpress/e2e-test-utils": "^5.4.10",
|
27
27
|
"@wordpress/jest-console": "^4.1.1",
|
28
28
|
"@wordpress/jest-puppeteer-axe": "^3.1.1",
|
29
|
-
"@wordpress/scripts": "^19.2.
|
29
|
+
"@wordpress/scripts": "^19.2.4",
|
30
30
|
"@wordpress/url": "^3.3.1",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
@@ -43,5 +43,5 @@
|
|
43
43
|
"publishConfig": {
|
44
44
|
"access": "public"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "1246a52b9fdfecf592a9fa1d33a2804a6cc2d257"
|
47
47
|
}
|
@@ -2,25 +2,25 @@
|
|
2
2
|
|
3
3
|
exports[`Heading can be created by prefixing existing content with number signs and a space 1`] = `
|
4
4
|
"<!-- wp:heading {\\"level\\":4} -->
|
5
|
-
<h4
|
5
|
+
<h4>4</h4>
|
6
6
|
<!-- /wp:heading -->"
|
7
7
|
`;
|
8
8
|
|
9
9
|
exports[`Heading can be created by prefixing number sign and a space 1`] = `
|
10
10
|
"<!-- wp:heading {\\"level\\":3} -->
|
11
|
-
<h3
|
11
|
+
<h3>3</h3>
|
12
12
|
<!-- /wp:heading -->"
|
13
13
|
`;
|
14
14
|
|
15
15
|
exports[`Heading should correctly apply custom colors 1`] = `
|
16
|
-
"<!-- wp:heading {\\"level\\":3,\\"style\\":{\\"color\\":{\\"text\\":\\"#
|
17
|
-
<h3 class=\\"has-text-color\\"
|
16
|
+
"<!-- wp:heading {\\"level\\":3,\\"style\\":{\\"color\\":{\\"text\\":\\"#0782f6\\"}}} -->
|
17
|
+
<h3 class=\\"has-text-color\\" style=\\"color:#0782f6\\">Heading</h3>
|
18
18
|
<!-- /wp:heading -->"
|
19
19
|
`;
|
20
20
|
|
21
21
|
exports[`Heading should correctly apply named colors 1`] = `
|
22
22
|
"<!-- wp:heading {\\"textColor\\":\\"luminous-vivid-orange\\"} -->
|
23
|
-
<h2 class=\\"has-luminous-vivid-orange-color has-text-color\\"
|
23
|
+
<h2 class=\\"has-luminous-vivid-orange-color has-text-color\\">Heading</h2>
|
24
24
|
<!-- /wp:heading -->"
|
25
25
|
`;
|
26
26
|
|
@@ -30,13 +30,13 @@ exports[`Heading should create a paragraph block above when pressing enter at th
|
|
30
30
|
<!-- /wp:paragraph -->
|
31
31
|
|
32
32
|
<!-- wp:heading -->
|
33
|
-
<h2
|
33
|
+
<h2>a</h2>
|
34
34
|
<!-- /wp:heading -->"
|
35
35
|
`;
|
36
36
|
|
37
37
|
exports[`Heading should create a paragraph block below when pressing enter at the end 1`] = `
|
38
38
|
"<!-- wp:heading -->
|
39
|
-
<h2
|
39
|
+
<h2>a</h2>
|
40
40
|
<!-- /wp:heading -->
|
41
41
|
|
42
42
|
<!-- wp:paragraph -->
|
@@ -46,12 +46,12 @@ exports[`Heading should create a paragraph block below when pressing enter at th
|
|
46
46
|
|
47
47
|
exports[`Heading should not work with the list input rule 1`] = `
|
48
48
|
"<!-- wp:heading -->
|
49
|
-
<h2
|
49
|
+
<h2>1. H</h2>
|
50
50
|
<!-- /wp:heading -->"
|
51
51
|
`;
|
52
52
|
|
53
53
|
exports[`Heading should work with the format input rules 1`] = `
|
54
54
|
"<!-- wp:heading -->
|
55
|
-
<h2
|
55
|
+
<h2><code>code</code></h2>
|
56
56
|
<!-- /wp:heading -->"
|
57
57
|
`;
|
@@ -40,7 +40,7 @@ exports[`Quote can be converted to paragraphs and renders only one paragraph for
|
|
40
40
|
|
41
41
|
exports[`Quote can be created by converting a heading 1`] = `
|
42
42
|
"<!-- wp:quote -->
|
43
|
-
<blockquote class=\\"wp-block-quote\\"
|
43
|
+
<blockquote class=\\"wp-block-quote\\"><p>test</p></blockquote>
|
44
44
|
<!-- /wp:quote -->"
|
45
45
|
`;
|
46
46
|
|
@@ -144,7 +144,7 @@ exports[`Quote can be split in the middle and merged back 4`] = `
|
|
144
144
|
|
145
145
|
exports[`Quote is transformed to a heading and a quote if the quote contains a citation 1`] = `
|
146
146
|
"<!-- wp:heading -->
|
147
|
-
<h2
|
147
|
+
<h2>one</h2>
|
148
148
|
<!-- /wp:heading -->
|
149
149
|
|
150
150
|
<!-- wp:quote -->
|
@@ -154,7 +154,7 @@ exports[`Quote is transformed to a heading and a quote if the quote contains a c
|
|
154
154
|
|
155
155
|
exports[`Quote is transformed to a heading and a quote if the quote contains multiple paragraphs 1`] = `
|
156
156
|
"<!-- wp:heading -->
|
157
|
-
<h2
|
157
|
+
<h2>one</h2>
|
158
158
|
<!-- /wp:heading -->
|
159
159
|
|
160
160
|
<!-- wp:quote -->
|
@@ -164,7 +164,7 @@ exports[`Quote is transformed to a heading and a quote if the quote contains mul
|
|
164
164
|
|
165
165
|
exports[`Quote is transformed to a heading if the quote just contains one paragraph 1`] = `
|
166
166
|
"<!-- wp:heading -->
|
167
|
-
<h2
|
167
|
+
<h2>one</h2>
|
168
168
|
<!-- /wp:heading -->"
|
169
169
|
`;
|
170
170
|
|
@@ -176,7 +176,7 @@ exports[`Quote is transformed to an empty heading if the quote is empty 1`] = `
|
|
176
176
|
|
177
177
|
exports[`Quote the resuling quote after transforming to a heading can be transformed again 1`] = `
|
178
178
|
"<!-- wp:heading -->
|
179
|
-
<h2
|
179
|
+
<h2>one</h2>
|
180
180
|
<!-- /wp:heading -->
|
181
181
|
|
182
182
|
<!-- wp:quote -->
|
@@ -186,11 +186,11 @@ exports[`Quote the resuling quote after transforming to a heading can be transfo
|
|
186
186
|
|
187
187
|
exports[`Quote the resuling quote after transforming to a heading can be transformed again 2`] = `
|
188
188
|
"<!-- wp:heading -->
|
189
|
-
<h2
|
189
|
+
<h2>one</h2>
|
190
190
|
<!-- /wp:heading -->
|
191
191
|
|
192
192
|
<!-- wp:heading -->
|
193
|
-
<h2
|
193
|
+
<h2>two</h2>
|
194
194
|
<!-- /wp:heading -->
|
195
195
|
|
196
196
|
<!-- wp:quote -->
|
@@ -200,14 +200,14 @@ exports[`Quote the resuling quote after transforming to a heading can be transfo
|
|
200
200
|
|
201
201
|
exports[`Quote the resuling quote after transforming to a heading can be transformed again 3`] = `
|
202
202
|
"<!-- wp:heading -->
|
203
|
-
<h2
|
203
|
+
<h2>one</h2>
|
204
204
|
<!-- /wp:heading -->
|
205
205
|
|
206
206
|
<!-- wp:heading -->
|
207
|
-
<h2
|
207
|
+
<h2>two</h2>
|
208
208
|
<!-- /wp:heading -->
|
209
209
|
|
210
210
|
<!-- wp:heading -->
|
211
|
-
<h2
|
211
|
+
<h2>cite</h2>
|
212
212
|
<!-- /wp:heading -->"
|
213
213
|
`;
|
@@ -7,7 +7,7 @@ exports[`Spacer can be created by typing "/spacer" 1`] = `
|
|
7
7
|
`;
|
8
8
|
|
9
9
|
exports[`Spacer can be resized using the drag handle and remains selected after being dragged 1`] = `
|
10
|
-
"<!-- wp:spacer {\\"height\\"
|
10
|
+
"<!-- wp:spacer {\\"height\\":\\"150px\\"} -->
|
11
11
|
<div style=\\"height:150px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
12
12
|
<!-- /wp:spacer -->"
|
13
13
|
`;
|
@@ -68,7 +68,7 @@ describe( 'Heading', () => {
|
|
68
68
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
69
69
|
} );
|
70
70
|
|
71
|
-
it( 'should correctly apply custom colors', async () => {
|
71
|
+
it.skip( 'should correctly apply custom colors', async () => {
|
72
72
|
await clickBlockAppender();
|
73
73
|
await page.keyboard.type( '### Heading' );
|
74
74
|
const colorPanelToggle = await page.waitForXPath(
|
@@ -91,7 +91,7 @@ describe( 'Heading', () => {
|
|
91
91
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
92
92
|
} );
|
93
93
|
|
94
|
-
it( 'should correctly apply named colors', async () => {
|
94
|
+
it.skip( 'should correctly apply named colors', async () => {
|
95
95
|
await clickBlockAppender();
|
96
96
|
await page.keyboard.type( '## Heading' );
|
97
97
|
const [ colorPanelToggle ] = await page.$x(
|
@@ -57,11 +57,5 @@ describe( 'iframed inline styles', () => {
|
|
57
57
|
expect( await getComputedStyle( canvas(), 'border-width' ) ).toBe(
|
58
58
|
'2px'
|
59
59
|
);
|
60
|
-
|
61
|
-
expect( console ).toHaveWarned(
|
62
|
-
`Stylesheet iframed-inline-styles-compat-style-css was not properly added.
|
63
|
-
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
|
64
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles). <link rel="stylesheet" id="iframed-inline-styles-compat-style-css" href="http://localhost:8889/wp-content/plugins/gutenberg-test-plugins/iframed-inline-styles/compat-style.css?ver=1626189899" media="all">`
|
65
|
-
);
|
66
60
|
} );
|
67
61
|
} );
|
@@ -63,9 +63,5 @@ describe( 'iframed multiple block stylesheets', () => {
|
|
63
63
|
expect( await getComputedStyle( canvas(), 'background-color' ) ).toBe(
|
64
64
|
'rgb(0, 0, 0)'
|
65
65
|
);
|
66
|
-
|
67
|
-
// Skip warnings related to block-styles enqueing and the use of add_editor_style.
|
68
|
-
// The issue is tracked on https://github.com/WordPress/gutenberg/issues/33212.
|
69
|
-
expect( console ).toHaveWarned();
|
70
66
|
} );
|
71
67
|
} );
|
@@ -3,7 +3,7 @@
|
|
3
3
|
exports[`Block Grouping Group creation creates a group from multiple blocks of different types via block transforms 1`] = `
|
4
4
|
"<!-- wp:group -->
|
5
5
|
<div class=\\"wp-block-group\\"><!-- wp:heading -->
|
6
|
-
<h2
|
6
|
+
<h2>Group Heading</h2>
|
7
7
|
<!-- /wp:heading -->
|
8
8
|
|
9
9
|
<!-- wp:image -->
|
@@ -51,7 +51,7 @@ exports[`Block Grouping Group creation creates a group from multiple blocks of t
|
|
51
51
|
exports[`Block Grouping Group creation groups and ungroups multiple blocks of different types via options toolbar 1`] = `
|
52
52
|
"<!-- wp:group -->
|
53
53
|
<div class=\\"wp-block-group\\"><!-- wp:heading -->
|
54
|
-
<h2
|
54
|
+
<h2>Group Heading</h2>
|
55
55
|
<!-- /wp:heading -->
|
56
56
|
|
57
57
|
<!-- wp:image -->
|
@@ -66,7 +66,7 @@ exports[`Block Grouping Group creation groups and ungroups multiple blocks of di
|
|
66
66
|
|
67
67
|
exports[`Block Grouping Group creation groups and ungroups multiple blocks of different types via options toolbar 2`] = `
|
68
68
|
"<!-- wp:heading -->
|
69
|
-
<h2
|
69
|
+
<h2>Group Heading</h2>
|
70
70
|
<!-- /wp:heading -->
|
71
71
|
|
72
72
|
<!-- wp:image -->
|
@@ -81,7 +81,7 @@ exports[`Block Grouping Group creation groups and ungroups multiple blocks of di
|
|
81
81
|
exports[`Block Grouping Preserving selected blocks attributes preserves width alignment settings of selected blocks 1`] = `
|
82
82
|
"<!-- wp:group {\\"align\\":\\"full\\"} -->
|
83
83
|
<div class=\\"wp-block-group alignfull\\"><!-- wp:heading -->
|
84
|
-
<h2
|
84
|
+
<h2>Group Heading</h2>
|
85
85
|
<!-- /wp:heading -->
|
86
86
|
|
87
87
|
<!-- wp:image {\\"align\\":\\"full\\"} -->
|
@@ -71,7 +71,7 @@ exports[`Inserting blocks inserts a block in proper place after having clicked \
|
|
71
71
|
<!-- /wp:paragraph -->
|
72
72
|
|
73
73
|
<!-- wp:heading -->
|
74
|
-
<h2
|
74
|
+
<h2>Heading</h2>
|
75
75
|
<!-- /wp:heading -->
|
76
76
|
|
77
77
|
<!-- wp:paragraph -->
|
@@ -93,7 +93,7 @@ exports[`Inserting blocks inserts a block in proper place after having clicked \
|
|
93
93
|
<!-- /wp:cover -->
|
94
94
|
|
95
95
|
<!-- wp:heading -->
|
96
|
-
<h2
|
96
|
+
<h2>Heading</h2>
|
97
97
|
<!-- /wp:heading -->
|
98
98
|
|
99
99
|
<!-- wp:paragraph -->
|
@@ -420,4 +420,25 @@ describe( 'undo', () => {
|
|
420
420
|
// Expect "1".
|
421
421
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
422
422
|
} );
|
423
|
+
|
424
|
+
it( 'should be able to undo and redo when transient changes have been made and we update/publish', async () => {
|
425
|
+
// Typing consecutive characters in a `Paragraph` block updates the same
|
426
|
+
// block attribute as in the previous action and results in transient edits
|
427
|
+
// and skipping `undo` history steps.
|
428
|
+
const text = 'tonis';
|
429
|
+
await clickBlockAppender();
|
430
|
+
await page.keyboard.type( text );
|
431
|
+
await publishPost();
|
432
|
+
await pressKeyWithModifier( 'primary', 'z' );
|
433
|
+
expect( await getEditedPostContent() ).toBe( '' );
|
434
|
+
await page.waitForSelector(
|
435
|
+
'.editor-history__redo[aria-disabled="false"]'
|
436
|
+
);
|
437
|
+
await page.click( '.editor-history__redo[aria-disabled="false"]' );
|
438
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
439
|
+
"<!-- wp:paragraph -->
|
440
|
+
<p>tonis</p>
|
441
|
+
<!-- /wp:paragraph -->"
|
442
|
+
` );
|
443
|
+
} );
|
423
444
|
} );
|
@@ -250,6 +250,19 @@ describe( 'Multi-entity save flow', () => {
|
|
250
250
|
const disabledSaveSiteSelector = `${ saveSiteSelector }[aria-disabled=true]`;
|
251
251
|
const saveA11ySelector = '.edit-site-editor__toggle-save-panel-button';
|
252
252
|
|
253
|
+
const saveAllChanges = async () => {
|
254
|
+
// Clicking button should open panel with boxes checked.
|
255
|
+
await page.click( activeSaveSiteSelector );
|
256
|
+
await page.waitForSelector( savePanelSelector );
|
257
|
+
await assertAllBoxesChecked();
|
258
|
+
|
259
|
+
// Save a11y button should not be present with save panel open.
|
260
|
+
await assertExistance( saveA11ySelector, false );
|
261
|
+
|
262
|
+
// Saving should result in items being saved.
|
263
|
+
await page.click( entitiesSaveSelector );
|
264
|
+
};
|
265
|
+
|
253
266
|
it( 'Save flow should work as expected', async () => {
|
254
267
|
// Navigate to site editor.
|
255
268
|
await siteEditor.visit( {
|
@@ -279,20 +292,55 @@ describe( 'Multi-entity save flow', () => {
|
|
279
292
|
// Save a11y button should be present.
|
280
293
|
await assertExistance( saveA11ySelector, true );
|
281
294
|
|
282
|
-
//
|
283
|
-
await
|
284
|
-
await page.waitForSelector( savePanelSelector );
|
285
|
-
await assertAllBoxesChecked();
|
286
|
-
|
287
|
-
// Save a11y button should not be present with save panel open.
|
288
|
-
await assertExistance( saveA11ySelector, false );
|
295
|
+
// Save all changes.
|
296
|
+
await saveAllChanges();
|
289
297
|
|
290
|
-
// Saving should result in items being saved.
|
291
|
-
await page.click( entitiesSaveSelector );
|
292
298
|
const disabledButton = await page.waitForSelector(
|
293
299
|
disabledSaveSiteSelector
|
294
300
|
);
|
295
301
|
expect( disabledButton ).not.toBeNull();
|
296
302
|
} );
|
303
|
+
|
304
|
+
it( 'Save flow should allow re-saving after changing the same block attribute', async () => {
|
305
|
+
// Navigate to site editor.
|
306
|
+
await siteEditor.visit( {
|
307
|
+
postId: 'tt1-blocks//index',
|
308
|
+
postType: 'wp_template',
|
309
|
+
} );
|
310
|
+
await siteEditor.disableWelcomeGuide();
|
311
|
+
|
312
|
+
// Insert a paragraph at the bottom.
|
313
|
+
await insertBlock( 'Paragraph' );
|
314
|
+
|
315
|
+
// Open the block settings.
|
316
|
+
await page.click( 'button[aria-label="Settings"]' );
|
317
|
+
|
318
|
+
// Click on font size selector.
|
319
|
+
await page.click( 'button[aria-label="Font size"]' );
|
320
|
+
|
321
|
+
// Click on a different font size.
|
322
|
+
const extraSmallFontSize = await page.waitForXPath(
|
323
|
+
'//li[contains(text(), "Extra small")]'
|
324
|
+
);
|
325
|
+
await extraSmallFontSize.click();
|
326
|
+
|
327
|
+
// Save all changes.
|
328
|
+
await saveAllChanges();
|
329
|
+
|
330
|
+
// Click on font size selector again.
|
331
|
+
await page.click( 'button[aria-label="Font size"]' );
|
332
|
+
|
333
|
+
// Select another font size.
|
334
|
+
const normalFontSize = await page.waitForXPath(
|
335
|
+
'//li[contains(text(), "Normal")]'
|
336
|
+
);
|
337
|
+
await normalFontSize.click();
|
338
|
+
|
339
|
+
// Assert that the save button has been re-enabled.
|
340
|
+
const saveButton = await page.waitForSelector(
|
341
|
+
activeSaveSiteSelector
|
342
|
+
);
|
343
|
+
expect( saveButton ).not.toBeNull();
|
344
|
+
} );
|
297
345
|
} );
|
298
346
|
} );
|
@@ -22,29 +22,31 @@ const {
|
|
22
22
|
disableWelcomeGuide,
|
23
23
|
} = siteEditor;
|
24
24
|
|
25
|
-
const assertSaveButtonIsDisabled = () =>
|
25
|
+
const assertSaveButtonIsDisabled = async () =>
|
26
26
|
page.waitForSelector(
|
27
27
|
'.edit-site-save-button__button[aria-disabled="true"]'
|
28
28
|
);
|
29
29
|
|
30
|
-
const assertSaveButtonIsEnabled = () =>
|
30
|
+
const assertSaveButtonIsEnabled = async () =>
|
31
31
|
page.waitForSelector(
|
32
32
|
'.edit-site-save-button__button[aria-disabled="false"]'
|
33
33
|
);
|
34
34
|
|
35
|
-
const waitForNotice = () => page.waitForSelector( '.components-snackbar' );
|
36
|
-
|
37
35
|
const clickButtonInNotice = async () => {
|
38
36
|
const selector = '.components-snackbar button';
|
39
37
|
await page.waitForSelector( selector );
|
40
38
|
await page.click( selector );
|
41
39
|
};
|
42
40
|
|
43
|
-
const clickUndoInHeaderToolbar = () =>
|
41
|
+
const clickUndoInHeaderToolbar = async () =>
|
44
42
|
page.click( '.edit-site-header__toolbar button[aria-label="Undo"]' );
|
45
43
|
|
46
|
-
const clickRedoInHeaderToolbar = () =>
|
47
|
-
page.
|
44
|
+
const clickRedoInHeaderToolbar = async () => {
|
45
|
+
await page.waitForSelector(
|
46
|
+
'.edit-site-header__toolbar button[aria-label="Redo"][aria-disabled="false"]'
|
47
|
+
);
|
48
|
+
return page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
|
49
|
+
};
|
48
50
|
|
49
51
|
const undoRevertInHeaderToolbar = async () => {
|
50
52
|
await clickUndoInHeaderToolbar();
|
@@ -72,7 +74,9 @@ const save = async () => {
|
|
72
74
|
const revertTemplate = async () => {
|
73
75
|
await page.click( '.edit-site-document-actions__get-info' );
|
74
76
|
await page.click( '.edit-site-template-details__revert-button' );
|
75
|
-
await
|
77
|
+
await page.waitForXPath(
|
78
|
+
'//*[contains(@class, "components-snackbar") and contains(text(), "Template reverted")]'
|
79
|
+
);
|
76
80
|
await assertSaveButtonIsEnabled();
|
77
81
|
};
|
78
82
|
|
@@ -18,10 +18,6 @@ import {
|
|
18
18
|
// eslint-disable-next-line no-restricted-imports
|
19
19
|
import { find, findAll } from 'puppeteer-testing-library';
|
20
20
|
|
21
|
-
const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
|
22
|
-
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
|
23
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
|
24
|
-
|
25
21
|
describe( 'Widgets Customizer', () => {
|
26
22
|
beforeEach( async () => {
|
27
23
|
await deleteAllWidgets();
|
@@ -162,8 +158,6 @@ describe( 'Widgets Customizer', () => {
|
|
162
158
|
name: 'My Search',
|
163
159
|
selector: '.widget-content *',
|
164
160
|
} ).toBeFound( findOptions );
|
165
|
-
|
166
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
167
161
|
} );
|
168
162
|
|
169
163
|
it( 'should open the inspector panel', async () => {
|
@@ -249,8 +243,6 @@ describe( 'Widgets Customizer', () => {
|
|
249
243
|
} ).toBeFound();
|
250
244
|
|
251
245
|
await expect( inspectorHeading ).not.toBeVisible();
|
252
|
-
|
253
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
254
246
|
} );
|
255
247
|
|
256
248
|
it( 'should handle the inserter outer section', async () => {
|
@@ -358,8 +350,6 @@ describe( 'Widgets Customizer', () => {
|
|
358
350
|
name: 'Add a block',
|
359
351
|
level: 2,
|
360
352
|
} ).not.toBeFound();
|
361
|
-
|
362
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
363
353
|
} );
|
364
354
|
|
365
355
|
it( 'should move focus to the block', async () => {
|
@@ -455,8 +445,6 @@ describe( 'Widgets Customizer', () => {
|
|
455
445
|
text: 'First Heading',
|
456
446
|
} );
|
457
447
|
await expect( headingBlock ).toHaveFocus();
|
458
|
-
|
459
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
460
448
|
} );
|
461
449
|
|
462
450
|
it( 'should clear block selection', async () => {
|
@@ -519,8 +507,6 @@ describe( 'Widgets Customizer', () => {
|
|
519
507
|
role: 'toolbar',
|
520
508
|
name: 'Block tools',
|
521
509
|
} ).not.toBeFound();
|
522
|
-
|
523
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
524
510
|
} );
|
525
511
|
|
526
512
|
it( 'should handle legacy widgets', async () => {
|
@@ -699,8 +685,6 @@ describe( 'Widgets Customizer', () => {
|
|
699
685
|
selector: '*[aria-live="polite"][aria-relevant="additions text"]',
|
700
686
|
} ).toBeFound();
|
701
687
|
await expect( paragraphBlock ).toBeVisible();
|
702
|
-
|
703
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
704
688
|
} );
|
705
689
|
|
706
690
|
it( 'should move (inner) blocks to another sidebar', async () => {
|
@@ -760,8 +744,6 @@ describe( 'Widgets Customizer', () => {
|
|
760
744
|
await expect( movedParagraphBlockQuery ).toBeFound();
|
761
745
|
const movedParagraphBlock = await find( movedParagraphBlockQuery );
|
762
746
|
await expect( movedParagraphBlock ).toHaveFocus();
|
763
|
-
|
764
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
765
747
|
} );
|
766
748
|
|
767
749
|
it( 'should not render Block Settings sections', async () => {
|
@@ -851,8 +833,6 @@ describe( 'Widgets Customizer', () => {
|
|
851
833
|
name: 'Customizing ▸ Widgets ▸ Footer #1 Block Settings',
|
852
834
|
level: 3,
|
853
835
|
} );
|
854
|
-
|
855
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
856
836
|
} );
|
857
837
|
} );
|
858
838
|
|
@@ -16,6 +16,7 @@ import {
|
|
16
16
|
openGlobalBlockInserter,
|
17
17
|
searchForBlock,
|
18
18
|
closeGlobalBlockInserter,
|
19
|
+
setBrowserViewport,
|
19
20
|
} from '@wordpress/e2e-test-utils';
|
20
21
|
|
21
22
|
/**
|
@@ -25,10 +26,6 @@ import {
|
|
25
26
|
import { find, findAll } from 'puppeteer-testing-library';
|
26
27
|
import { groupBy, mapValues } from 'lodash';
|
27
28
|
|
28
|
-
const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
|
29
|
-
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
|
30
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
|
31
|
-
|
32
29
|
describe( 'Widgets screen', () => {
|
33
30
|
beforeEach( async () => {
|
34
31
|
await visitWidgetsScreen();
|
@@ -232,8 +229,6 @@ describe( 'Widgets screen', () => {
|
|
232
229
|
</div></div>",
|
233
230
|
}
|
234
231
|
` );
|
235
|
-
|
236
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
237
232
|
} );
|
238
233
|
|
239
234
|
it.skip( 'Should insert content using the inline inserter', async () => {
|
@@ -601,8 +596,6 @@ describe( 'Widgets screen', () => {
|
|
601
596
|
initialSerializedWidgetAreas[ 'sidebar-1' ],
|
602
597
|
].join( '\n' )
|
603
598
|
);
|
604
|
-
|
605
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
606
599
|
} );
|
607
600
|
|
608
601
|
it.skip( 'Should display legacy widgets', async () => {
|
@@ -777,8 +770,6 @@ describe( 'Widgets screen', () => {
|
|
777
770
|
</div></div>",
|
778
771
|
}
|
779
772
|
` );
|
780
|
-
|
781
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
782
773
|
} );
|
783
774
|
|
784
775
|
it( 'Allows widget deletion to be undone', async () => {
|
@@ -838,8 +829,6 @@ describe( 'Widgets screen', () => {
|
|
838
829
|
</div></div>",
|
839
830
|
}
|
840
831
|
` );
|
841
|
-
|
842
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
843
832
|
} );
|
844
833
|
|
845
834
|
it( 'can toggle sidebar list view', async () => {
|
@@ -854,6 +843,41 @@ describe( 'Widgets screen', () => {
|
|
854
843
|
expect( listItems.length >= widgetAreas.length ).toEqual( true );
|
855
844
|
await closeListView();
|
856
845
|
} );
|
846
|
+
|
847
|
+
// Check for regressions of https://github.com/WordPress/gutenberg/issues/38002.
|
848
|
+
it( 'allows blocks to be added on mobile viewports', async () => {
|
849
|
+
await setBrowserViewport( 'small' );
|
850
|
+
const [ firstWidgetArea ] = await findAll( {
|
851
|
+
role: 'document',
|
852
|
+
name: 'Block: Widget Area',
|
853
|
+
} );
|
854
|
+
|
855
|
+
const addParagraphBlock = await getBlockInGlobalInserter( 'Paragraph' );
|
856
|
+
await addParagraphBlock.click();
|
857
|
+
|
858
|
+
const addedParagraphBlockInFirstWidgetArea = await find(
|
859
|
+
{
|
860
|
+
name: /^Empty block/,
|
861
|
+
selector: '[data-block][data-type="core/paragraph"]',
|
862
|
+
},
|
863
|
+
{
|
864
|
+
root: firstWidgetArea,
|
865
|
+
}
|
866
|
+
);
|
867
|
+
await addedParagraphBlockInFirstWidgetArea.focus();
|
868
|
+
await page.keyboard.type( 'First Paragraph' );
|
869
|
+
const updatedParagraphBlockInFirstWidgetArea = await find(
|
870
|
+
{
|
871
|
+
name: 'Paragraph block',
|
872
|
+
value: 'First Paragraph',
|
873
|
+
},
|
874
|
+
{
|
875
|
+
root: firstWidgetArea,
|
876
|
+
}
|
877
|
+
);
|
878
|
+
|
879
|
+
expect( updatedParagraphBlockInFirstWidgetArea ).toBeTruthy();
|
880
|
+
} );
|
857
881
|
} );
|
858
882
|
|
859
883
|
/**
|