@wordpress/e2e-tests 3.0.1-next.33ec3857e2.0 → 3.0.1
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 -1
- package/LICENSE.md +1 -1
- package/package.json +9 -9
- package/plugins/query-block.php +2 -2
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +4 -0
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
- package/specs/editor/blocks/classic.test.js +5 -2
- package/specs/editor/blocks/navigation.test.js +280 -191
- package/specs/editor/plugins/block-variations.test.js +1 -1
- 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-editor-keyboard-shortcuts.test.js.snap +38 -24
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
- package/specs/editor/various/font-size-picker.test.js +57 -11
- package/specs/editor/various/post-editor-template-mode.test.js +1 -1
- package/specs/editor/various/preview.test.js +66 -1
- package/specs/editor/various/reusable-blocks.test.js +52 -5
- package/specs/editor/various/undo.test.js +21 -0
- package/specs/performance/site-editor.test.js +1 -1
- package/specs/site-editor/document-settings.test.js +4 -4
- package/specs/site-editor/multi-entity-editing.test.js +2 -2
- package/specs/site-editor/multi-entity-saving.test.js +15 -18
- package/specs/site-editor/settings-sidebar.test.js +4 -4
- package/specs/site-editor/site-editor-export.test.js +1 -1
- package/specs/site-editor/site-editor-inserter.test.js +1 -1
- package/specs/site-editor/template-part.test.js +9 -12
- package/specs/site-editor/template-revert.test.js +13 -9
- package/specs/widgets/customizing-widgets.test.js +3 -23
- package/specs/widgets/editing-widgets.test.js +36 -12
@@ -2,112 +2,126 @@
|
|
2
2
|
|
3
3
|
exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 1`] = `
|
4
4
|
"<!-- wp:paragraph -->
|
5
|
-
<p>
|
5
|
+
<p>1st</p>
|
6
6
|
<!-- /wp:paragraph -->
|
7
7
|
|
8
8
|
<!-- wp:paragraph -->
|
9
|
-
<p>
|
9
|
+
<p>2nd</p>
|
10
10
|
<!-- /wp:paragraph -->
|
11
11
|
|
12
12
|
<!-- wp:paragraph -->
|
13
|
-
<p>
|
13
|
+
<p>3rd</p>
|
14
14
|
<!-- /wp:paragraph -->"
|
15
15
|
`;
|
16
16
|
|
17
17
|
exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 2`] = `
|
18
18
|
"<!-- wp:paragraph -->
|
19
|
-
<p>
|
19
|
+
<p>3rd</p>
|
20
20
|
<!-- /wp:paragraph -->
|
21
21
|
|
22
22
|
<!-- wp:paragraph -->
|
23
|
-
<p>
|
23
|
+
<p>1st</p>
|
24
24
|
<!-- /wp:paragraph -->
|
25
25
|
|
26
26
|
<!-- wp:paragraph -->
|
27
|
-
<p>
|
27
|
+
<p>2nd</p>
|
28
28
|
<!-- /wp:paragraph -->"
|
29
29
|
`;
|
30
30
|
|
31
31
|
exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 1`] = `
|
32
32
|
"<!-- wp:paragraph -->
|
33
|
-
<p>
|
33
|
+
<p>1st</p>
|
34
34
|
<!-- /wp:paragraph -->
|
35
35
|
|
36
36
|
<!-- wp:paragraph -->
|
37
|
-
<p>
|
37
|
+
<p>2nd</p>
|
38
38
|
<!-- /wp:paragraph -->
|
39
39
|
|
40
40
|
<!-- wp:paragraph -->
|
41
|
-
<p>
|
41
|
+
<p>3rd</p>
|
42
42
|
<!-- /wp:paragraph -->"
|
43
43
|
`;
|
44
44
|
|
45
45
|
exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 2`] = `
|
46
46
|
"<!-- wp:paragraph -->
|
47
|
-
<p>
|
47
|
+
<p>2nd</p>
|
48
48
|
<!-- /wp:paragraph -->
|
49
49
|
|
50
50
|
<!-- wp:paragraph -->
|
51
|
-
<p>
|
51
|
+
<p>3rd</p>
|
52
52
|
<!-- /wp:paragraph -->
|
53
53
|
|
54
54
|
<!-- wp:paragraph -->
|
55
|
-
<p>
|
55
|
+
<p>1st</p>
|
56
56
|
<!-- /wp:paragraph -->"
|
57
57
|
`;
|
58
58
|
|
59
59
|
exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 1`] = `
|
60
60
|
"<!-- wp:paragraph -->
|
61
|
-
<p>
|
61
|
+
<p>1st</p>
|
62
62
|
<!-- /wp:paragraph -->
|
63
63
|
|
64
64
|
<!-- wp:paragraph -->
|
65
|
-
<p>
|
65
|
+
<p>2nd</p>
|
66
66
|
<!-- /wp:paragraph -->
|
67
67
|
|
68
68
|
<!-- wp:paragraph -->
|
69
|
-
<p>
|
69
|
+
<p>3rd</p>
|
70
70
|
<!-- /wp:paragraph -->"
|
71
71
|
`;
|
72
72
|
|
73
73
|
exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 2`] = `
|
74
74
|
"<!-- wp:paragraph -->
|
75
|
-
<p>
|
75
|
+
<p>1st</p>
|
76
76
|
<!-- /wp:paragraph -->
|
77
77
|
|
78
78
|
<!-- wp:paragraph -->
|
79
|
-
<p>
|
79
|
+
<p>3rd</p>
|
80
80
|
<!-- /wp:paragraph -->
|
81
81
|
|
82
82
|
<!-- wp:paragraph -->
|
83
|
-
<p>
|
83
|
+
<p>2nd</p>
|
84
84
|
<!-- /wp:paragraph -->"
|
85
85
|
`;
|
86
86
|
|
87
87
|
exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 1`] = `
|
88
88
|
"<!-- wp:paragraph -->
|
89
|
-
<p>
|
89
|
+
<p>1st</p>
|
90
90
|
<!-- /wp:paragraph -->
|
91
91
|
|
92
92
|
<!-- wp:paragraph -->
|
93
|
-
<p>
|
93
|
+
<p>2nd</p>
|
94
94
|
<!-- /wp:paragraph -->
|
95
95
|
|
96
96
|
<!-- wp:paragraph -->
|
97
|
-
<p>
|
97
|
+
<p>3rd</p>
|
98
98
|
<!-- /wp:paragraph -->"
|
99
99
|
`;
|
100
100
|
|
101
101
|
exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 2`] = `
|
102
102
|
"<!-- wp:paragraph -->
|
103
|
-
<p>
|
103
|
+
<p>3rd</p>
|
104
104
|
<!-- /wp:paragraph -->
|
105
105
|
|
106
106
|
<!-- wp:paragraph -->
|
107
|
-
<p>
|
107
|
+
<p>1st</p>
|
108
108
|
<!-- /wp:paragraph -->
|
109
109
|
|
110
110
|
<!-- wp:paragraph -->
|
111
|
-
<p>
|
111
|
+
<p>2nd</p>
|
112
|
+
<!-- /wp:paragraph -->"
|
113
|
+
`;
|
114
|
+
|
115
|
+
exports[`block editor keyboard shortcuts test shortcuts handling through portals in the same tree should prevent deleting multiple selected blocks from inputs 1`] = `
|
116
|
+
"<!-- wp:paragraph -->
|
117
|
+
<p>1st</p>
|
118
|
+
<!-- /wp:paragraph -->
|
119
|
+
|
120
|
+
<!-- wp:paragraph -->
|
121
|
+
<p>2nd</p>
|
122
|
+
<!-- /wp:paragraph -->
|
123
|
+
|
124
|
+
<!-- wp:paragraph -->
|
125
|
+
<p>3rd</p>
|
112
126
|
<!-- /wp:paragraph -->"
|
113
127
|
`;
|
@@ -6,15 +6,18 @@ import {
|
|
6
6
|
clickBlockAppender,
|
7
7
|
getEditedPostContent,
|
8
8
|
pressKeyWithModifier,
|
9
|
+
clickBlockToolbarButton,
|
10
|
+
clickMenuItem,
|
11
|
+
clickOnCloseModalButton,
|
9
12
|
} from '@wordpress/e2e-test-utils';
|
10
13
|
|
11
14
|
const createTestParagraphBlocks = async () => {
|
12
15
|
await clickBlockAppender();
|
13
|
-
await page.keyboard.type( '
|
16
|
+
await page.keyboard.type( '1st' );
|
14
17
|
await page.keyboard.press( 'Enter' );
|
15
|
-
await page.keyboard.type( '
|
18
|
+
await page.keyboard.type( '2nd' );
|
16
19
|
await page.keyboard.press( 'Enter' );
|
17
|
-
await page.keyboard.type( '
|
20
|
+
await page.keyboard.type( '3rd' );
|
18
21
|
};
|
19
22
|
|
20
23
|
describe( 'block editor keyboard shortcuts', () => {
|
@@ -66,4 +69,41 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
66
69
|
} );
|
67
70
|
} );
|
68
71
|
} );
|
72
|
+
describe( 'test shortcuts handling through portals in the same tree', () => {
|
73
|
+
beforeEach( async () => {
|
74
|
+
await createTestParagraphBlocks();
|
75
|
+
// Multiselect via keyboard.
|
76
|
+
await pressKeyWithModifier( 'primary', 'a' );
|
77
|
+
await pressKeyWithModifier( 'primary', 'a' );
|
78
|
+
} );
|
79
|
+
it( 'should propagate properly and delete selected blocks', async () => {
|
80
|
+
await clickBlockToolbarButton( 'Options' );
|
81
|
+
const label = 'Duplicate';
|
82
|
+
await page.$x(
|
83
|
+
`//div[@role="menu"]//span[contains(concat(" ", @class, " "), " components-menu-item__item ")][contains(text(), "${ label }")]`
|
84
|
+
);
|
85
|
+
await page.keyboard.press( 'Delete' );
|
86
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot(
|
87
|
+
`""`
|
88
|
+
);
|
89
|
+
} );
|
90
|
+
it( 'should prevent deleting multiple selected blocks from inputs', async () => {
|
91
|
+
await clickBlockToolbarButton( 'Options' );
|
92
|
+
await clickMenuItem( 'Add to Reusable blocks' );
|
93
|
+
const reusableBlockNameInputSelector =
|
94
|
+
'.reusable-blocks-menu-items__convert-modal .components-text-control__input';
|
95
|
+
const nameInput = await page.waitForSelector(
|
96
|
+
reusableBlockNameInputSelector
|
97
|
+
);
|
98
|
+
await nameInput.click();
|
99
|
+
await page.keyboard.type( 'hi' );
|
100
|
+
await page.keyboard.press( 'Backspace' );
|
101
|
+
await page.keyboard.press( 'ArrowLeft' );
|
102
|
+
await page.keyboard.press( 'Delete' );
|
103
|
+
await clickOnCloseModalButton(
|
104
|
+
'.reusable-blocks-menu-items__convert-modal'
|
105
|
+
);
|
106
|
+
expect( await getEditedPostContent() ).toMatchSnapshot();
|
107
|
+
} );
|
108
|
+
} );
|
69
109
|
} );
|
@@ -7,7 +7,6 @@ import {
|
|
7
7
|
createNewPost,
|
8
8
|
pressKeyWithModifier,
|
9
9
|
pressKeyTimes,
|
10
|
-
activateTheme,
|
11
10
|
openTypographyToolsPanelMenu,
|
12
11
|
} from '@wordpress/e2e-test-utils';
|
13
12
|
|
@@ -100,21 +99,68 @@ describe( 'Font Size Picker', () => {
|
|
100
99
|
` );
|
101
100
|
} );
|
102
101
|
} );
|
102
|
+
|
103
103
|
// A different control is rendered based on the available font sizes number.
|
104
104
|
describe( 'More font sizes', () => {
|
105
|
-
|
106
|
-
await
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
beforeEach( async () => {
|
106
|
+
await page.evaluate( () => {
|
107
|
+
wp.data.dispatch( 'core/block-editor' ).updateSettings(
|
108
|
+
// eslint-disable-next-line no-undef
|
109
|
+
lodash.merge(
|
110
|
+
wp.data.select( 'core/block-editor' ).getSettings(),
|
111
|
+
{
|
112
|
+
__experimentalFeatures: {
|
113
|
+
typography: {
|
114
|
+
fontSizes: {
|
115
|
+
default: [
|
116
|
+
{
|
117
|
+
name: 'Tiny',
|
118
|
+
slug: 'tiny',
|
119
|
+
size: '11px',
|
120
|
+
},
|
121
|
+
,
|
122
|
+
{
|
123
|
+
name: 'Small',
|
124
|
+
slug: 'small',
|
125
|
+
size: '13px',
|
126
|
+
},
|
127
|
+
{
|
128
|
+
name: 'Medium',
|
129
|
+
slug: 'medium',
|
130
|
+
size: '20px',
|
131
|
+
},
|
132
|
+
{
|
133
|
+
name: 'Large',
|
134
|
+
slug: 'large',
|
135
|
+
size: '36px',
|
136
|
+
},
|
137
|
+
{
|
138
|
+
name: 'Extra Large',
|
139
|
+
slug: 'x-large',
|
140
|
+
size: '42px',
|
141
|
+
},
|
142
|
+
{
|
143
|
+
name: 'Huge',
|
144
|
+
slug: 'huge',
|
145
|
+
size: '48px',
|
146
|
+
},
|
147
|
+
],
|
148
|
+
},
|
149
|
+
},
|
150
|
+
},
|
151
|
+
}
|
152
|
+
)
|
153
|
+
);
|
154
|
+
} );
|
110
155
|
} );
|
156
|
+
|
111
157
|
it( 'should apply a named font size using the font size buttons', async () => {
|
112
158
|
// Create a paragraph block with some content.
|
113
159
|
await clickBlockAppender();
|
114
160
|
await page.keyboard.type( 'Paragraph to be made "large"' );
|
115
161
|
|
116
162
|
await openFontSizeSelectControl();
|
117
|
-
await pressKeyTimes( 'ArrowDown',
|
163
|
+
await pressKeyTimes( 'ArrowDown', 5 );
|
118
164
|
await page.keyboard.press( 'Enter' );
|
119
165
|
|
120
166
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
@@ -131,11 +177,11 @@ describe( 'Font Size Picker', () => {
|
|
131
177
|
);
|
132
178
|
|
133
179
|
await openFontSizeSelectControl();
|
134
|
-
await pressKeyTimes( 'ArrowDown',
|
180
|
+
await pressKeyTimes( 'ArrowDown', 4 );
|
135
181
|
await page.keyboard.press( 'Enter' );
|
136
182
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
137
|
-
"<!-- wp:paragraph {\\"fontSize\\":\\"
|
138
|
-
<p class=\\"has-
|
183
|
+
"<!-- wp:paragraph {\\"fontSize\\":\\"medium\\"} -->
|
184
|
+
<p class=\\"has-medium-font-size\\">Paragraph with font size reset using tools panel menu</p>
|
139
185
|
<!-- /wp:paragraph -->"
|
140
186
|
` );
|
141
187
|
|
@@ -158,7 +204,7 @@ describe( 'Font Size Picker', () => {
|
|
158
204
|
);
|
159
205
|
|
160
206
|
await openFontSizeSelectControl();
|
161
|
-
await pressKeyTimes( 'ArrowDown',
|
207
|
+
await pressKeyTimes( 'ArrowDown', 3 );
|
162
208
|
await page.keyboard.press( 'Enter' );
|
163
209
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
164
210
|
"<!-- wp:paragraph {\\"fontSize\\":\\"small\\"} -->
|
@@ -102,7 +102,7 @@ describe( 'Post Editor Template mode', () => {
|
|
102
102
|
} );
|
103
103
|
|
104
104
|
it( 'Allow to switch to template mode, edit the template and check the result', async () => {
|
105
|
-
await activateTheme( '
|
105
|
+
await activateTheme( 'emptytheme' );
|
106
106
|
await createNewPost();
|
107
107
|
// Create a random post.
|
108
108
|
await page.type( '.editor-post-title__input', 'Just an FSE Post' );
|
@@ -204,7 +204,7 @@ describe( 'Preview', () => {
|
|
204
204
|
it( 'should not revert title during a preview right after a save draft', async () => {
|
205
205
|
const editorPage = page;
|
206
206
|
|
207
|
-
// Type aaaaa in the title
|
207
|
+
// Type aaaaa in the title field.
|
208
208
|
await editorPage.type( '.editor-post-title__input', 'aaaaa' );
|
209
209
|
await editorPage.keyboard.press( 'Tab' );
|
210
210
|
|
@@ -248,6 +248,71 @@ describe( 'Preview', () => {
|
|
248
248
|
|
249
249
|
await previewPage.close();
|
250
250
|
} );
|
251
|
+
|
252
|
+
// Verify correct preview. See: https://github.com/WordPress/gutenberg/issues/33616
|
253
|
+
it( 'should display the correct preview when switching between published and draft statuses', async () => {
|
254
|
+
const editorPage = page;
|
255
|
+
|
256
|
+
// Type Lorem in the title field.
|
257
|
+
await editorPage.type( '[aria-label="Add title"]', 'Lorem' );
|
258
|
+
|
259
|
+
// Open the preview page.
|
260
|
+
const previewPage = await openPreviewPage( editorPage );
|
261
|
+
await previewPage.waitForSelector( '.entry-title' );
|
262
|
+
|
263
|
+
// Title in preview should match input.
|
264
|
+
let previewTitle = await previewPage.$eval(
|
265
|
+
'.entry-title',
|
266
|
+
( node ) => node.textContent
|
267
|
+
);
|
268
|
+
expect( previewTitle ).toBe( 'Lorem' );
|
269
|
+
|
270
|
+
// Return to editor and publish post.
|
271
|
+
await editorPage.bringToFront();
|
272
|
+
await publishPost();
|
273
|
+
|
274
|
+
// Close the panel.
|
275
|
+
await page.waitForSelector( '.editor-post-publish-panel' );
|
276
|
+
await page.click( '.editor-post-publish-panel__header button' );
|
277
|
+
|
278
|
+
// Change the title and preview again.
|
279
|
+
await editorPage.type( '[aria-label="Add title"]', ' Ipsum' );
|
280
|
+
await editorPage.keyboard.press( 'Tab' );
|
281
|
+
await waitForPreviewDropdownOpen( editorPage );
|
282
|
+
await waitForPreviewNavigation( previewPage );
|
283
|
+
|
284
|
+
// Title in preview should match updated input.
|
285
|
+
previewTitle = await previewPage.$eval(
|
286
|
+
'.entry-title',
|
287
|
+
( node ) => node.textContent
|
288
|
+
);
|
289
|
+
|
290
|
+
expect( previewTitle ).toBe( 'Lorem Ipsum' );
|
291
|
+
|
292
|
+
// Return to editor and switch to Draft.
|
293
|
+
await editorPage.bringToFront();
|
294
|
+
await editorPage.waitForSelector( '.editor-post-switch-to-draft' );
|
295
|
+
await editorPage.click( '.editor-post-switch-to-draft' );
|
296
|
+
await page.keyboard.press( 'Enter' );
|
297
|
+
|
298
|
+
// Change the title.
|
299
|
+
await editorPage.type( '[aria-label="Add title"]', 'Draft ' );
|
300
|
+
await editorPage.keyboard.press( 'Tab' );
|
301
|
+
|
302
|
+
// Open the preview page.
|
303
|
+
await waitForPreviewDropdownOpen( editorPage );
|
304
|
+
await waitForPreviewNavigation( previewPage );
|
305
|
+
|
306
|
+
// Title in preview should match updated input.
|
307
|
+
previewTitle = await previewPage.$eval(
|
308
|
+
'.entry-title',
|
309
|
+
( node ) => node.textContent
|
310
|
+
);
|
311
|
+
|
312
|
+
expect( previewTitle ).toBe( 'Draft Lorem Ipsum' );
|
313
|
+
|
314
|
+
await previewPage.close();
|
315
|
+
} );
|
251
316
|
} );
|
252
317
|
|
253
318
|
describe( 'Preview with Custom Fields enabled', () => {
|
@@ -15,6 +15,7 @@ import {
|
|
15
15
|
openDocumentSettingsSidebar,
|
16
16
|
saveDraft,
|
17
17
|
createReusableBlock,
|
18
|
+
publishPost,
|
18
19
|
} from '@wordpress/e2e-test-utils';
|
19
20
|
|
20
21
|
const reusableBlockNameInputSelector =
|
@@ -23,11 +24,22 @@ const reusableBlockInspectorNameInputSelector =
|
|
23
24
|
'.block-editor-block-inspector .components-text-control__input';
|
24
25
|
|
25
26
|
const saveAll = async () => {
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
const publishButtonSelector =
|
28
|
+
'.editor-post-publish-button__button.has-changes-dot';
|
29
|
+
// Wait for the Publish button to become enabled in case the editor is autosaving ATM:
|
30
|
+
const publishButton = await page.waitForSelector(
|
31
|
+
publishButtonSelector + '[aria-disabled="false"]'
|
29
32
|
);
|
30
|
-
await
|
33
|
+
await publishButton.click();
|
34
|
+
|
35
|
+
const saveButtonSelector =
|
36
|
+
'button.editor-entities-saved-states__save-button';
|
37
|
+
const saveButton = await page.waitForSelector( saveButtonSelector );
|
38
|
+
await saveButton.click();
|
39
|
+
};
|
40
|
+
|
41
|
+
const saveAllButDontPublish = async () => {
|
42
|
+
await saveAll();
|
31
43
|
|
32
44
|
// no need to publish the post.
|
33
45
|
const cancelPublish = await page.waitForSelector(
|
@@ -81,7 +93,7 @@ describe( 'Reusable blocks', () => {
|
|
81
93
|
await page.keyboard.type( 'Oh! ' );
|
82
94
|
|
83
95
|
// Save the reusable block
|
84
|
-
await
|
96
|
+
await saveAllButDontPublish();
|
85
97
|
|
86
98
|
// Check that its content is up to date
|
87
99
|
const text = await page.$eval(
|
@@ -112,6 +124,41 @@ describe( 'Reusable blocks', () => {
|
|
112
124
|
expect( paragraphContent ).toMatch( 'Oh! Hello there!' );
|
113
125
|
} );
|
114
126
|
|
127
|
+
// Check for regressions of https://github.com/WordPress/gutenberg/issues/33072.
|
128
|
+
it( 'can be saved when modified inside of a published post', async () => {
|
129
|
+
await createReusableBlock(
|
130
|
+
'Guten Berg!',
|
131
|
+
'Alternative greeting block'
|
132
|
+
);
|
133
|
+
|
134
|
+
// Make sure the reusable block has loaded properly before attempting to publish the post.
|
135
|
+
await page.waitForSelector( 'p[aria-label="Paragraph block"]' );
|
136
|
+
|
137
|
+
await publishPost();
|
138
|
+
|
139
|
+
// Close publish panel.
|
140
|
+
const closePublishPanelSelector =
|
141
|
+
'.editor-post-publish-panel__header button[aria-label="Close panel"]';
|
142
|
+
await page.waitForSelector( closePublishPanelSelector );
|
143
|
+
await page.click( closePublishPanelSelector );
|
144
|
+
|
145
|
+
await page.waitForSelector( 'p[aria-label="Paragraph block"]' );
|
146
|
+
await page.focus( 'p[aria-label="Paragraph block"]' );
|
147
|
+
|
148
|
+
// Change the block's content
|
149
|
+
await page.keyboard.type( 'Einen ' );
|
150
|
+
|
151
|
+
// Save the reusable block and update the post
|
152
|
+
await saveAll();
|
153
|
+
|
154
|
+
// Check that its content is up to date
|
155
|
+
const paragraphContent = await page.$eval(
|
156
|
+
'p[aria-label="Paragraph block"]',
|
157
|
+
( element ) => element.innerText
|
158
|
+
);
|
159
|
+
expect( paragraphContent ).toMatch( 'Einen Guten Berg!' );
|
160
|
+
} );
|
161
|
+
|
115
162
|
it( 'can be inserted after refresh', async () => {
|
116
163
|
await createReusableBlock( 'Awesome Paragraph', 'Awesome block' );
|
117
164
|
|
@@ -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
|
} );
|
@@ -31,7 +31,7 @@ jest.setTimeout( 1000000 );
|
|
31
31
|
|
32
32
|
describe( 'Site Editor Performance', () => {
|
33
33
|
beforeAll( async () => {
|
34
|
-
await activateTheme( '
|
34
|
+
await activateTheme( 'emptytheme' );
|
35
35
|
await trashAllPosts( 'wp_template' );
|
36
36
|
await trashAllPosts( 'wp_template', 'auto-draft' );
|
37
37
|
await trashAllPosts( 'wp_template_part' );
|
@@ -26,7 +26,7 @@ async function getDocumentSettingsSecondaryTitle() {
|
|
26
26
|
|
27
27
|
describe( 'Document Settings', () => {
|
28
28
|
beforeAll( async () => {
|
29
|
-
await activateTheme( '
|
29
|
+
await activateTheme( 'emptytheme' );
|
30
30
|
await trashAllPosts( 'wp_template' );
|
31
31
|
await trashAllPosts( 'wp_template_part' );
|
32
32
|
} );
|
@@ -43,7 +43,7 @@ describe( 'Document Settings', () => {
|
|
43
43
|
it( 'should display the selected templates name in the document header', async () => {
|
44
44
|
// Navigate to a template
|
45
45
|
await siteEditor.visit( {
|
46
|
-
postId: '
|
46
|
+
postId: 'emptytheme//index',
|
47
47
|
postType: 'wp_template',
|
48
48
|
} );
|
49
49
|
|
@@ -64,7 +64,7 @@ describe( 'Document Settings', () => {
|
|
64
64
|
);
|
65
65
|
headerTemplatePartListViewButton.click();
|
66
66
|
await page.click(
|
67
|
-
'button[aria-label="Close
|
67
|
+
'button[aria-label="Close List View Sidebar"]'
|
68
68
|
);
|
69
69
|
|
70
70
|
// Evaluate the document settings secondary title
|
@@ -79,7 +79,7 @@ describe( 'Document Settings', () => {
|
|
79
79
|
it( "should display the selected template part's name in the document header", async () => {
|
80
80
|
// Navigate to a template part
|
81
81
|
await siteEditor.visit( {
|
82
|
-
postId: '
|
82
|
+
postId: 'emptytheme//header',
|
83
83
|
postType: 'wp_template_part',
|
84
84
|
} );
|
85
85
|
|
@@ -134,7 +134,7 @@ const removeErrorMocks = () => {
|
|
134
134
|
|
135
135
|
describe( 'Multi-entity editor states', () => {
|
136
136
|
beforeAll( async () => {
|
137
|
-
await activateTheme( '
|
137
|
+
await activateTheme( 'emptytheme' );
|
138
138
|
await trashAllPosts( 'wp_template' );
|
139
139
|
await trashAllPosts( 'wp_template_part' );
|
140
140
|
} );
|
@@ -152,7 +152,7 @@ describe( 'Multi-entity editor states', () => {
|
|
152
152
|
// Skip reason: This should be rewritten to use other methods to switching to different templates.
|
153
153
|
it.skip( 'should not dirty an entity by switching to it in the template dropdown', async () => {
|
154
154
|
await siteEditor.visit( {
|
155
|
-
postId: '
|
155
|
+
postId: 'emptytheme//header',
|
156
156
|
postType: 'wp_template_part',
|
157
157
|
} );
|
158
158
|
await page.waitForFunction( () =>
|
@@ -46,7 +46,7 @@ describe( 'Multi-entity save flow', () => {
|
|
46
46
|
let originalSiteTitle, originalBlogDescription;
|
47
47
|
|
48
48
|
beforeAll( async () => {
|
49
|
-
await activateTheme( '
|
49
|
+
await activateTheme( 'emptytheme' );
|
50
50
|
await trashAllPosts( 'wp_template' );
|
51
51
|
await trashAllPosts( 'wp_template_part' );
|
52
52
|
await trashAllPosts( 'wp_block' );
|
@@ -165,6 +165,11 @@ describe( 'Multi-entity save flow', () => {
|
|
165
165
|
'//*[@id="a11y-speak-polite"][contains(text(), "Post published")]'
|
166
166
|
);
|
167
167
|
|
168
|
+
// Unselect the blocks to avoid clicking the block toolbar.
|
169
|
+
await page.evaluate( () => {
|
170
|
+
wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock();
|
171
|
+
} );
|
172
|
+
|
168
173
|
// Update the post.
|
169
174
|
await page.click( '.editor-post-title' );
|
170
175
|
await page.keyboard.type( '...more title!' );
|
@@ -259,7 +264,7 @@ describe( 'Multi-entity save flow', () => {
|
|
259
264
|
it( 'Save flow should work as expected', async () => {
|
260
265
|
// Navigate to site editor.
|
261
266
|
await siteEditor.visit( {
|
262
|
-
postId: '
|
267
|
+
postId: 'emptytheme//index',
|
263
268
|
postType: 'wp_template',
|
264
269
|
} );
|
265
270
|
await siteEditor.disableWelcomeGuide();
|
@@ -270,7 +275,7 @@ describe( 'Multi-entity save flow', () => {
|
|
270
275
|
'//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "Header")]'
|
271
276
|
);
|
272
277
|
headerTemplatePartListViewButton.click();
|
273
|
-
await page.click( 'button[aria-label="Close
|
278
|
+
await page.click( 'button[aria-label="Close List View Sidebar"]' );
|
274
279
|
|
275
280
|
// Insert something to dirty the editor.
|
276
281
|
await insertBlock( 'Paragraph' );
|
@@ -297,7 +302,7 @@ describe( 'Multi-entity save flow', () => {
|
|
297
302
|
it( 'Save flow should allow re-saving after changing the same block attribute', async () => {
|
298
303
|
// Navigate to site editor.
|
299
304
|
await siteEditor.visit( {
|
300
|
-
postId: '
|
305
|
+
postId: 'emptytheme//index',
|
301
306
|
postType: 'wp_template',
|
302
307
|
} );
|
303
308
|
await siteEditor.disableWelcomeGuide();
|
@@ -308,26 +313,18 @@ describe( 'Multi-entity save flow', () => {
|
|
308
313
|
// Open the block settings.
|
309
314
|
await page.click( 'button[aria-label="Settings"]' );
|
310
315
|
|
311
|
-
//
|
312
|
-
await page.click(
|
313
|
-
|
314
|
-
// Click on a different font size.
|
315
|
-
const extraSmallFontSize = await page.waitForXPath(
|
316
|
-
'//li[contains(text(), "Extra small")]'
|
316
|
+
// Change the font size
|
317
|
+
await page.click(
|
318
|
+
'.components-font-size-picker__controls button[aria-label="Small"]'
|
317
319
|
);
|
318
|
-
await extraSmallFontSize.click();
|
319
320
|
|
320
321
|
// Save all changes.
|
321
322
|
await saveAllChanges();
|
322
323
|
|
323
|
-
//
|
324
|
-
await page.click(
|
325
|
-
|
326
|
-
// Select another font size.
|
327
|
-
const normalFontSize = await page.waitForXPath(
|
328
|
-
'//li[contains(text(), "Normal")]'
|
324
|
+
// Change the font size
|
325
|
+
await page.click(
|
326
|
+
'.components-font-size-picker__controls button[aria-label="Medium"]'
|
329
327
|
);
|
330
|
-
await normalFontSize.click();
|
331
328
|
|
332
329
|
// Assert that the save button has been re-enabled.
|
333
330
|
const saveButton = await page.waitForSelector(
|