@wordpress/e2e-tests 3.0.1-next.33ec3857e2.0 → 3.0.4
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/README.md +31 -19
- package/config/is-gutenberg-plugin.js +6 -0
- package/jest.config.js +1 -1
- package/jest.performance.config.js +1 -1
- package/mu-plugins/enable-templates-ui.php +24 -0
- package/package.json +9 -9
- package/plugins/plugins-api/error-boundary.js +11 -0
- package/plugins/plugins-error-boundary.php +27 -0
- package/plugins/query-block.php +2 -2
- package/specs/editor/blocks/__snapshots__/image.test.js.snap +6 -6
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +4 -2
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
- package/specs/editor/blocks/classic.test.js +5 -2
- package/specs/editor/blocks/cover.test.js +7 -3
- package/specs/editor/blocks/gallery.test.js +6 -1
- package/specs/editor/blocks/heading.test.js +1 -11
- package/specs/editor/blocks/navigation.test.js +279 -240
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
- package/specs/editor/plugins/block-variations.test.js +3 -3
- 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/plugins/plugins-api.test.js +30 -0
- package/specs/editor/plugins/templates.test.js +1 -7
- package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
- package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +1 -1
- package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +35 -0
- 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/fullscreen-mode.test.js +1 -1
- package/specs/editor/various/keep-styles-on-block-transforms.test.js +81 -0
- package/specs/editor/various/post-editor-template-mode.test.js +1 -1
- package/specs/editor/various/post-visibility.test.js +54 -0
- package/specs/editor/various/preview.test.js +66 -1
- package/specs/editor/various/reusable-blocks.test.js +52 -5
- package/specs/editor/various/style-variation.test.js +9 -5
- package/specs/editor/various/undo.test.js +21 -0
- package/specs/performance/site-editor.test.js +3 -4
- package/specs/site-editor/document-settings.test.js +12 -14
- package/specs/site-editor/multi-entity-editing.test.js +14 -16
- package/specs/site-editor/multi-entity-saving.test.js +18 -27
- package/specs/site-editor/settings-sidebar.test.js +7 -12
- package/specs/site-editor/site-editor-export.test.js +9 -10
- package/specs/site-editor/site-editor-inserter.test.js +7 -9
- package/specs/site-editor/style-variations.test.js +211 -0
- package/specs/site-editor/template-part.test.js +14 -22
- package/specs/site-editor/template-revert.test.js +31 -37
- package/specs/widgets/customizing-widgets.test.js +3 -23
- package/specs/widgets/editing-widgets.test.js +36 -12
- package/themes/style-variations/block-templates/index.html +11 -0
- package/themes/style-variations/index.php +0 -0
- package/themes/style-variations/style.css +15 -0
- package/themes/style-variations/styles/pink.json +33 -0
- package/themes/style-variations/styles/yellow.json +12 -0
- package/themes/style-variations/theme.json +8 -0
- package/config/gutenberg-phase.js +0 -9
- package/specs/editor/various/__snapshots__/style-variation.test.js.snap +0 -7
- package/specs/site-editor/utils.js +0 -153
@@ -26,6 +26,15 @@ describe( 'Post visibility', () => {
|
|
26
26
|
);
|
27
27
|
await privateLabel.click();
|
28
28
|
|
29
|
+
await page.waitForXPath(
|
30
|
+
'//*[text()="Would you like to privately publish this post now?"]'
|
31
|
+
);
|
32
|
+
|
33
|
+
const [ confirmButton ] = await page.$x(
|
34
|
+
'//*[@role="dialog"]//button[text()="OK"]'
|
35
|
+
);
|
36
|
+
await confirmButton.click();
|
37
|
+
|
29
38
|
const currentStatus = await page.evaluate( () => {
|
30
39
|
return wp.data
|
31
40
|
.select( 'core/editor' )
|
@@ -34,6 +43,42 @@ describe( 'Post visibility', () => {
|
|
34
43
|
|
35
44
|
expect( currentStatus ).toBe( 'private' );
|
36
45
|
} );
|
46
|
+
|
47
|
+
it( `can be canceled when the viewport is ${ viewport }`, async () => {
|
48
|
+
await setBrowserViewport( viewport );
|
49
|
+
|
50
|
+
await createNewPost();
|
51
|
+
|
52
|
+
await openDocumentSettingsSidebar();
|
53
|
+
|
54
|
+
const initialStatus = await page.evaluate( () => {
|
55
|
+
return wp.data
|
56
|
+
.select( 'core/editor' )
|
57
|
+
.getEditedPostAttribute( 'status' );
|
58
|
+
} );
|
59
|
+
|
60
|
+
await page.click( '.edit-post-post-visibility__toggle' );
|
61
|
+
|
62
|
+
const [ privateLabel ] = await page.$x(
|
63
|
+
'//label[text()="Private"]'
|
64
|
+
);
|
65
|
+
await privateLabel.click();
|
66
|
+
await page.waitForXPath(
|
67
|
+
'//*[text()="Would you like to privately publish this post now?"]'
|
68
|
+
);
|
69
|
+
const cancelButton = await page.waitForXPath(
|
70
|
+
'//*[@role="dialog"][not(@id="wp-link-wrap")]//button[text()="Cancel"]'
|
71
|
+
);
|
72
|
+
await cancelButton.click();
|
73
|
+
|
74
|
+
const currentStatus = await page.evaluate( () => {
|
75
|
+
return wp.data
|
76
|
+
.select( 'core/editor' )
|
77
|
+
.getEditedPostAttribute( 'status' );
|
78
|
+
} );
|
79
|
+
|
80
|
+
expect( currentStatus ).toBe( initialStatus );
|
81
|
+
} );
|
37
82
|
} );
|
38
83
|
|
39
84
|
it( 'visibility remains private even if the publish date is in the future', async () => {
|
@@ -60,6 +105,15 @@ describe( 'Post visibility', () => {
|
|
60
105
|
const [ privateLabel ] = await page.$x( '//label[text()="Private"]' );
|
61
106
|
await privateLabel.click();
|
62
107
|
|
108
|
+
await page.waitForXPath(
|
109
|
+
'//*[text()="Would you like to privately publish this post now?"]'
|
110
|
+
);
|
111
|
+
|
112
|
+
const [ confirmButton ] = await page.$x(
|
113
|
+
'//*[@role="dialog"]//button[text()="OK"]'
|
114
|
+
);
|
115
|
+
await confirmButton.click();
|
116
|
+
|
63
117
|
// Enter a title for this post.
|
64
118
|
await page.type( '.editor-post-title__input', ' Changed' );
|
65
119
|
|
@@ -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
|
|
@@ -13,20 +13,24 @@ describe( 'adding blocks', () => {
|
|
13
13
|
await createNewPost();
|
14
14
|
} );
|
15
15
|
|
16
|
-
it( 'Should switch to the
|
16
|
+
it( 'Should switch to the plain style of the quote block', async () => {
|
17
17
|
// Inserting a quote block
|
18
18
|
await insertBlock( 'Quote' );
|
19
19
|
await page.keyboard.type( 'Quote content' );
|
20
20
|
|
21
21
|
await clickBlockToolbarButton( 'Quote' );
|
22
22
|
|
23
|
-
const
|
24
|
-
'//*[@role="menuitem"][contains(., "
|
23
|
+
const plainStyleButton = await page.waitForXPath(
|
24
|
+
'//*[@role="menuitem"][contains(., "Plain")]'
|
25
25
|
);
|
26
|
-
await
|
26
|
+
await plainStyleButton.click();
|
27
27
|
|
28
28
|
// Check the content
|
29
29
|
const content = await getEditedPostContent();
|
30
|
-
expect( content ).
|
30
|
+
expect( content ).toMatchInlineSnapshot( `
|
31
|
+
"<!-- wp:quote {\\"className\\":\\"is-style-plain\\"} -->
|
32
|
+
<blockquote class=\\"wp-block-quote is-style-plain\\"><p>Quote content</p></blockquote>
|
33
|
+
<!-- /wp:quote -->"
|
34
|
+
` );
|
31
35
|
} );
|
32
36
|
} );
|
@@ -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
|
} );
|
@@ -12,6 +12,7 @@ import {
|
|
12
12
|
activateTheme,
|
13
13
|
canvas,
|
14
14
|
createNewPost,
|
15
|
+
visitSiteEditor,
|
15
16
|
saveDraft,
|
16
17
|
insertBlock,
|
17
18
|
} from '@wordpress/e2e-test-utils';
|
@@ -19,7 +20,6 @@ import {
|
|
19
20
|
/**
|
20
21
|
* Internal dependencies
|
21
22
|
*/
|
22
|
-
import { siteEditor } from '../site-editor/utils';
|
23
23
|
import {
|
24
24
|
readFile,
|
25
25
|
deleteFile,
|
@@ -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' );
|
@@ -83,8 +83,7 @@ describe( 'Site Editor Performance', () => {
|
|
83
83
|
new URL( document.location ).searchParams.get( 'post' )
|
84
84
|
);
|
85
85
|
|
86
|
-
await
|
87
|
-
await siteEditor.disableWelcomeGuide();
|
86
|
+
await visitSiteEditor( { postId: id, postType: 'page' } );
|
88
87
|
|
89
88
|
let i = 3;
|
90
89
|
|
@@ -1,12 +1,11 @@
|
|
1
1
|
/**
|
2
2
|
* WordPress dependencies
|
3
3
|
*/
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
import { siteEditor } from './utils';
|
4
|
+
import {
|
5
|
+
trashAllPosts,
|
6
|
+
activateTheme,
|
7
|
+
visitSiteEditor,
|
8
|
+
} from '@wordpress/e2e-test-utils';
|
10
9
|
|
11
10
|
async function getDocumentSettingsTitle() {
|
12
11
|
const titleElement = await page.waitForSelector(
|
@@ -26,7 +25,7 @@ async function getDocumentSettingsSecondaryTitle() {
|
|
26
25
|
|
27
26
|
describe( 'Document Settings', () => {
|
28
27
|
beforeAll( async () => {
|
29
|
-
await activateTheme( '
|
28
|
+
await activateTheme( 'emptytheme' );
|
30
29
|
await trashAllPosts( 'wp_template' );
|
31
30
|
await trashAllPosts( 'wp_template_part' );
|
32
31
|
} );
|
@@ -35,15 +34,14 @@ describe( 'Document Settings', () => {
|
|
35
34
|
} );
|
36
35
|
|
37
36
|
beforeEach( async () => {
|
38
|
-
await
|
39
|
-
await siteEditor.disableWelcomeGuide();
|
37
|
+
await visitSiteEditor();
|
40
38
|
} );
|
41
39
|
|
42
40
|
describe( 'when a template is selected from the navigation sidebar', () => {
|
43
41
|
it( 'should display the selected templates name in the document header', async () => {
|
44
42
|
// Navigate to a template
|
45
|
-
await
|
46
|
-
postId: '
|
43
|
+
await visitSiteEditor( {
|
44
|
+
postId: 'emptytheme//index',
|
47
45
|
postType: 'wp_template',
|
48
46
|
} );
|
49
47
|
|
@@ -64,7 +62,7 @@ describe( 'Document Settings', () => {
|
|
64
62
|
);
|
65
63
|
headerTemplatePartListViewButton.click();
|
66
64
|
await page.click(
|
67
|
-
'button[aria-label="Close
|
65
|
+
'button[aria-label="Close List View Sidebar"]'
|
68
66
|
);
|
69
67
|
|
70
68
|
// Evaluate the document settings secondary title
|
@@ -78,8 +76,8 @@ describe( 'Document Settings', () => {
|
|
78
76
|
describe( 'when a template part is selected from the navigation sidebar', () => {
|
79
77
|
it( "should display the selected template part's name in the document header", async () => {
|
80
78
|
// Navigate to a template part
|
81
|
-
await
|
82
|
-
postId: '
|
79
|
+
await visitSiteEditor( {
|
80
|
+
postId: 'emptytheme//header',
|
83
81
|
postType: 'wp_template_part',
|
84
82
|
} );
|
85
83
|
|
@@ -11,18 +11,18 @@ import {
|
|
11
11
|
openDocumentSettingsSidebar,
|
12
12
|
pressKeyWithModifier,
|
13
13
|
selectBlockByClientId,
|
14
|
+
visitSiteEditor,
|
15
|
+
clickSiteEditorMenuItem,
|
16
|
+
navigateSiteEditorBackToRoot,
|
17
|
+
openSiteEditorNavigationPanel,
|
18
|
+
siteEditorNavigateSequence,
|
14
19
|
} from '@wordpress/e2e-test-utils';
|
15
20
|
|
16
|
-
/**
|
17
|
-
* Internal dependencies
|
18
|
-
*/
|
19
|
-
import { navigationPanel, siteEditor } from './utils';
|
20
|
-
|
21
21
|
const clickTemplateItem = async ( menus, itemName ) => {
|
22
|
-
await
|
23
|
-
await
|
24
|
-
await
|
25
|
-
await
|
22
|
+
await openSiteEditorNavigationPanel();
|
23
|
+
await navigateSiteEditorBackToRoot();
|
24
|
+
await siteEditorNavigateSequence( menus );
|
25
|
+
await clickSiteEditorMenuItem( itemName );
|
26
26
|
};
|
27
27
|
|
28
28
|
const createTemplatePart = async (
|
@@ -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
|
} );
|
@@ -144,15 +144,14 @@ describe( 'Multi-entity editor states', () => {
|
|
144
144
|
} );
|
145
145
|
|
146
146
|
it( 'should not display any dirty entities when loading the site editor', async () => {
|
147
|
-
await
|
148
|
-
await siteEditor.disableWelcomeGuide();
|
147
|
+
await visitSiteEditor();
|
149
148
|
expect( await openEntitySavePanel() ).toBe( false );
|
150
149
|
} );
|
151
150
|
|
152
151
|
// Skip reason: This should be rewritten to use other methods to switching to different templates.
|
153
152
|
it.skip( 'should not dirty an entity by switching to it in the template dropdown', async () => {
|
154
|
-
await
|
155
|
-
postId: '
|
153
|
+
await visitSiteEditor( {
|
154
|
+
postId: 'emptytheme//header',
|
156
155
|
postType: 'wp_template_part',
|
157
156
|
} );
|
158
157
|
await page.waitForFunction( () =>
|
@@ -204,8 +203,7 @@ describe( 'Multi-entity editor states', () => {
|
|
204
203
|
true
|
205
204
|
);
|
206
205
|
await saveAllEntities();
|
207
|
-
await
|
208
|
-
await siteEditor.disableWelcomeGuide();
|
206
|
+
await visitSiteEditor();
|
209
207
|
|
210
208
|
// Wait for site editor to load.
|
211
209
|
await canvas().waitForSelector(
|
@@ -12,13 +12,9 @@ import {
|
|
12
12
|
activateTheme,
|
13
13
|
clickButton,
|
14
14
|
createReusableBlock,
|
15
|
+
visitSiteEditor,
|
15
16
|
} from '@wordpress/e2e-test-utils';
|
16
17
|
|
17
|
-
/**
|
18
|
-
* Internal dependencies
|
19
|
-
*/
|
20
|
-
import { siteEditor } from './utils';
|
21
|
-
|
22
18
|
describe( 'Multi-entity save flow', () => {
|
23
19
|
// Selectors - usable between Post/Site editors.
|
24
20
|
const checkedBoxSelector = '.components-checkbox-control__checked';
|
@@ -46,7 +42,7 @@ describe( 'Multi-entity save flow', () => {
|
|
46
42
|
let originalSiteTitle, originalBlogDescription;
|
47
43
|
|
48
44
|
beforeAll( async () => {
|
49
|
-
await activateTheme( '
|
45
|
+
await activateTheme( 'emptytheme' );
|
50
46
|
await trashAllPosts( 'wp_template' );
|
51
47
|
await trashAllPosts( 'wp_template_part' );
|
52
48
|
await trashAllPosts( 'wp_block' );
|
@@ -165,6 +161,11 @@ describe( 'Multi-entity save flow', () => {
|
|
165
161
|
'//*[@id="a11y-speak-polite"][contains(text(), "Post published")]'
|
166
162
|
);
|
167
163
|
|
164
|
+
// Unselect the blocks to avoid clicking the block toolbar.
|
165
|
+
await page.evaluate( () => {
|
166
|
+
wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock();
|
167
|
+
} );
|
168
|
+
|
168
169
|
// Update the post.
|
169
170
|
await page.click( '.editor-post-title' );
|
170
171
|
await page.keyboard.type( '...more title!' );
|
@@ -258,11 +259,10 @@ describe( 'Multi-entity save flow', () => {
|
|
258
259
|
|
259
260
|
it( 'Save flow should work as expected', async () => {
|
260
261
|
// Navigate to site editor.
|
261
|
-
await
|
262
|
-
postId: '
|
262
|
+
await visitSiteEditor( {
|
263
|
+
postId: 'emptytheme//index',
|
263
264
|
postType: 'wp_template',
|
264
265
|
} );
|
265
|
-
await siteEditor.disableWelcomeGuide();
|
266
266
|
|
267
267
|
// Select the header template part via list view.
|
268
268
|
await page.click( '.edit-site-header-toolbar__list-view-toggle' );
|
@@ -270,7 +270,7 @@ describe( 'Multi-entity save flow', () => {
|
|
270
270
|
'//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "Header")]'
|
271
271
|
);
|
272
272
|
headerTemplatePartListViewButton.click();
|
273
|
-
await page.click( 'button[aria-label="Close
|
273
|
+
await page.click( 'button[aria-label="Close List View Sidebar"]' );
|
274
274
|
|
275
275
|
// Insert something to dirty the editor.
|
276
276
|
await insertBlock( 'Paragraph' );
|
@@ -296,11 +296,10 @@ describe( 'Multi-entity save flow', () => {
|
|
296
296
|
|
297
297
|
it( 'Save flow should allow re-saving after changing the same block attribute', async () => {
|
298
298
|
// Navigate to site editor.
|
299
|
-
await
|
300
|
-
postId: '
|
299
|
+
await visitSiteEditor( {
|
300
|
+
postId: 'emptytheme//index',
|
301
301
|
postType: 'wp_template',
|
302
302
|
} );
|
303
|
-
await siteEditor.disableWelcomeGuide();
|
304
303
|
|
305
304
|
// Insert a paragraph at the bottom.
|
306
305
|
await insertBlock( 'Paragraph' );
|
@@ -308,26 +307,18 @@ describe( 'Multi-entity save flow', () => {
|
|
308
307
|
// Open the block settings.
|
309
308
|
await page.click( 'button[aria-label="Settings"]' );
|
310
309
|
|
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")]'
|
310
|
+
// Change the font size
|
311
|
+
await page.click(
|
312
|
+
'.components-font-size-picker__controls button[aria-label="Small"]'
|
317
313
|
);
|
318
|
-
await extraSmallFontSize.click();
|
319
314
|
|
320
315
|
// Save all changes.
|
321
316
|
await saveAllChanges();
|
322
317
|
|
323
|
-
//
|
324
|
-
await page.click(
|
325
|
-
|
326
|
-
// Select another font size.
|
327
|
-
const normalFontSize = await page.waitForXPath(
|
328
|
-
'//li[contains(text(), "Normal")]'
|
318
|
+
// Change the font size
|
319
|
+
await page.click(
|
320
|
+
'.components-font-size-picker__controls button[aria-label="Medium"]'
|
329
321
|
);
|
330
|
-
await normalFontSize.click();
|
331
322
|
|
332
323
|
// Assert that the save button has been re-enabled.
|
333
324
|
const saveButton = await page.waitForSelector(
|
@@ -7,13 +7,9 @@ import {
|
|
7
7
|
getAllBlocks,
|
8
8
|
selectBlockByClientId,
|
9
9
|
insertBlock,
|
10
|
+
visitSiteEditor,
|
10
11
|
} from '@wordpress/e2e-test-utils';
|
11
12
|
|
12
|
-
/**
|
13
|
-
* Internal dependencies
|
14
|
-
*/
|
15
|
-
import { siteEditor } from './utils';
|
16
|
-
|
17
13
|
async function toggleSidebar() {
|
18
14
|
await page.click(
|
19
15
|
'.edit-site-header__actions button[aria-label="Settings"]'
|
@@ -42,7 +38,7 @@ async function getTemplateCard() {
|
|
42
38
|
|
43
39
|
describe( 'Settings sidebar', () => {
|
44
40
|
beforeAll( async () => {
|
45
|
-
await activateTheme( '
|
41
|
+
await activateTheme( 'emptytheme' );
|
46
42
|
await trashAllPosts( 'wp_template' );
|
47
43
|
await trashAllPosts( 'wp_template_part' );
|
48
44
|
} );
|
@@ -52,8 +48,7 @@ describe( 'Settings sidebar', () => {
|
|
52
48
|
await activateTheme( 'twentytwentyone' );
|
53
49
|
} );
|
54
50
|
beforeEach( async () => {
|
55
|
-
await
|
56
|
-
await siteEditor.disableWelcomeGuide();
|
51
|
+
await visitSiteEditor();
|
57
52
|
} );
|
58
53
|
|
59
54
|
describe( 'Template tab', () => {
|
@@ -69,8 +64,8 @@ describe( 'Settings sidebar', () => {
|
|
69
64
|
await toggleSidebar();
|
70
65
|
|
71
66
|
const templateCardBeforeNavigation = await getTemplateCard();
|
72
|
-
await
|
73
|
-
postId: '
|
67
|
+
await visitSiteEditor( {
|
68
|
+
postId: 'emptytheme//singular',
|
74
69
|
postType: 'wp_template',
|
75
70
|
} );
|
76
71
|
const templateCardAfterNavigation = await getTemplateCard();
|
@@ -80,8 +75,8 @@ describe( 'Settings sidebar', () => {
|
|
80
75
|
description: 'Displays posts.',
|
81
76
|
} );
|
82
77
|
expect( templateCardAfterNavigation ).toMatchObject( {
|
83
|
-
title: '
|
84
|
-
description: 'Displays
|
78
|
+
title: 'Singular',
|
79
|
+
description: 'Displays a single post or page.',
|
85
80
|
} );
|
86
81
|
} );
|
87
82
|
} );
|
@@ -8,12 +8,12 @@ import os from 'os';
|
|
8
8
|
/**
|
9
9
|
* WordPress dependencies
|
10
10
|
*/
|
11
|
-
import {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
import {
|
12
|
+
trashAllPosts,
|
13
|
+
activateTheme,
|
14
|
+
visitSiteEditor,
|
15
|
+
clickOnMoreMenuItem,
|
16
|
+
} from '@wordpress/e2e-test-utils';
|
17
17
|
|
18
18
|
async function waitForFileExists( filePath, timeout = 10000 ) {
|
19
19
|
const start = Date.now();
|
@@ -30,7 +30,7 @@ async function waitForFileExists( filePath, timeout = 10000 ) {
|
|
30
30
|
|
31
31
|
describe( 'Site Editor Templates Export', () => {
|
32
32
|
beforeAll( async () => {
|
33
|
-
await activateTheme( '
|
33
|
+
await activateTheme( 'emptytheme' );
|
34
34
|
await trashAllPosts( 'wp_template' );
|
35
35
|
await trashAllPosts( 'wp_template_part' );
|
36
36
|
} );
|
@@ -40,8 +40,7 @@ describe( 'Site Editor Templates Export', () => {
|
|
40
40
|
} );
|
41
41
|
|
42
42
|
beforeEach( async () => {
|
43
|
-
await
|
44
|
-
await siteEditor.disableWelcomeGuide();
|
43
|
+
await visitSiteEditor();
|
45
44
|
} );
|
46
45
|
|
47
46
|
it( 'clicking export should download edit-site-export.zip file', async () => {
|
@@ -53,7 +52,7 @@ describe( 'Site Editor Templates Export', () => {
|
|
53
52
|
downloadPath: directory,
|
54
53
|
} );
|
55
54
|
|
56
|
-
await
|
55
|
+
await clickOnMoreMenuItem( 'Export', 'site-editor' );
|
57
56
|
const filePath = path.join( directory, 'edit-site-export.zip' );
|
58
57
|
await waitForFileExists( filePath );
|
59
58
|
expect( fs.existsSync( filePath ) ).toBe( true );
|