@wordpress/e2e-tests 3.0.9 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/setup-performance-test.js +1 -1
- package/config/setup-test-framework.js +1 -1
- package/package.json +5 -5
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +16 -16
- package/specs/editor/blocks/classic.test.js +2 -2
- package/specs/editor/blocks/cover.test.js +17 -17
- package/specs/editor/blocks/list.test.js +1 -1
- package/specs/editor/blocks/navigation.test.js +259 -52
- package/specs/editor/blocks/table.test.js +1 -1
- package/specs/editor/plugins/align-hook.test.js +10 -10
- package/specs/editor/plugins/block-context.test.js +1 -1
- package/specs/editor/plugins/block-directory-add.test.js +14 -14
- package/specs/editor/plugins/custom-post-types.test.js +1 -1
- package/specs/editor/plugins/custom-taxonomies.test.js +3 -3
- package/specs/editor/plugins/meta-attribute-block.test.js +1 -1
- package/specs/editor/plugins/meta-boxes.test.js +3 -3
- package/specs/editor/plugins/templates.test.js +1 -1
- package/specs/editor/plugins/wp-editor-meta-box.test.js +1 -1
- package/specs/editor/various/autosave.test.js +19 -19
- package/specs/editor/various/block-deletion.test.js +5 -5
- package/specs/editor/various/block-grouping.test.js +29 -12
- package/specs/editor/various/block-hierarchy-navigation.test.js +5 -5
- package/specs/editor/various/change-detection.test.js +3 -3
- package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
- package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +7 -7
- package/specs/editor/various/datepicker.test.js +1 -1
- package/specs/editor/various/duplicating-blocks.test.js +3 -3
- package/specs/editor/various/editor-modes.test.js +5 -5
- package/specs/editor/various/inserting-blocks.test.js +6 -6
- package/specs/editor/various/invalid-block.test.js +4 -4
- package/specs/editor/various/is-typing.test.js +8 -8
- package/specs/editor/various/keyboard-navigable-blocks.test.js +2 -2
- package/specs/editor/various/links.test.js +90 -90
- package/specs/editor/various/list-view.test.js +47 -1
- package/specs/editor/various/manage-reusable-blocks.test.js +5 -5
- package/specs/editor/various/multi-block-selection.test.js +2 -2
- package/specs/editor/various/navigable-toolbar.test.js +1 -1
- package/specs/editor/various/new-post-default-content.test.js +2 -2
- package/specs/editor/various/new-post.test.js +1 -1
- package/specs/editor/various/nux.test.js +11 -11
- package/specs/editor/various/popovers.test.js +3 -3
- package/specs/editor/various/post-editor-template-mode.test.js +12 -11
- package/specs/editor/various/preferences.test.js +1 -1
- package/specs/editor/various/preview.test.js +8 -4
- package/specs/editor/various/publish-button.test.js +2 -2
- package/specs/editor/various/publishing.test.js +50 -1
- package/specs/editor/various/reusable-blocks.test.js +31 -31
- package/specs/editor/various/rich-text.test.js +1 -1
- package/specs/editor/various/splitting-merging.test.js +6 -6
- package/specs/editor/various/style-variation.test.js +2 -2
- package/specs/editor/various/switch-to-draft.test.js +3 -1
- package/specs/editor/various/taxonomies.test.js +1 -1
- package/specs/editor/various/toolbar-roving-tabindex.test.js +1 -1
- package/specs/editor/various/writing-flow.test.js +20 -20
- package/specs/experiments/navigation-editor.test.js +168 -3
- package/specs/performance/post-editor.test.js +7 -7
- package/specs/performance/site-editor.test.js +1 -1
- package/specs/site-editor/document-settings.test.js +5 -5
- package/specs/site-editor/multi-entity-editing.test.js +1 -1
- package/specs/site-editor/multi-entity-saving.test.js +1 -1
- package/specs/site-editor/template-part.test.js +9 -8
- package/specs/widgets/customizing-widgets.test.js +10 -9
- package/specs/widgets/editing-widgets.test.js +8 -7
@@ -694,12 +694,12 @@ describe( 'Multi-block selection', () => {
|
|
694
694
|
// Select a paragraph.
|
695
695
|
await page.keyboard.type( '1' );
|
696
696
|
await page.keyboard.press( 'Enter' );
|
697
|
-
// Add a list
|
697
|
+
// Add a list.
|
698
698
|
await page.keyboard.type( '/list' );
|
699
699
|
await page.keyboard.press( 'Enter' );
|
700
700
|
await page.keyboard.type( '1' );
|
701
701
|
|
702
|
-
// Confirm correct setup: a paragraph and a list
|
702
|
+
// Confirm correct setup: a paragraph and a list.
|
703
703
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
704
704
|
|
705
705
|
await pressKeyWithModifier( 'primary', 'a' );
|
@@ -24,7 +24,7 @@ describe( 'new editor filtered state', () => {
|
|
24
24
|
} );
|
25
25
|
|
26
26
|
it( 'should respect default content', async () => {
|
27
|
-
//
|
27
|
+
// Get the values that should have their defaults changed.
|
28
28
|
const title = await page.$eval(
|
29
29
|
'.editor-post-title__input',
|
30
30
|
( element ) => element.innerHTML
|
@@ -44,7 +44,7 @@ describe( 'new editor filtered state', () => {
|
|
44
44
|
( element ) => element.innerHTML
|
45
45
|
);
|
46
46
|
|
47
|
-
//
|
47
|
+
// Assert they match what the plugin set.
|
48
48
|
expect( title ).toBe( 'My default title' );
|
49
49
|
expect( content ).toBe( 'My default content' );
|
50
50
|
expect( excerpt ).toBe( 'My default excerpt' );
|
@@ -27,7 +27,7 @@ describe( 'new editor state', () => {
|
|
27
27
|
// Should display the blank title.
|
28
28
|
const title = await page.$( '[aria-label="Add title"]' );
|
29
29
|
expect( title ).not.toBeNull();
|
30
|
-
// Trim padding non-breaking space
|
30
|
+
// Trim padding non-breaking space.
|
31
31
|
expect(
|
32
32
|
await title.evaluate( ( el ) => el.textContent.trim() )
|
33
33
|
).toBeFalsy();
|
@@ -7,7 +7,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
7
7
|
it( 'should show the guide to first-time users', async () => {
|
8
8
|
let welcomeGuideText, welcomeGuide;
|
9
9
|
|
10
|
-
// Create a new post as a first-time user
|
10
|
+
// Create a new post as a first-time user.
|
11
11
|
await createNewPost( { showWelcomeGuide: true } );
|
12
12
|
|
13
13
|
// Guide should be on page 1 of 4
|
@@ -17,7 +17,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
17
17
|
);
|
18
18
|
expect( welcomeGuideText ).toContain( 'Welcome to the block editor' );
|
19
19
|
|
20
|
-
// Click on the 'Next' button
|
20
|
+
// Click on the 'Next' button.
|
21
21
|
const [ nextButton ] = await page.$x(
|
22
22
|
'//button[contains(text(), "Next")]'
|
23
23
|
);
|
@@ -30,7 +30,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
30
30
|
);
|
31
31
|
expect( welcomeGuideText ).toContain( 'Make each block your own' );
|
32
32
|
|
33
|
-
// Click on the 'Previous' button
|
33
|
+
// Click on the 'Previous' button.
|
34
34
|
const [ previousButton ] = await page.$x(
|
35
35
|
'//button[contains(text(), "Previous")]'
|
36
36
|
);
|
@@ -43,7 +43,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
43
43
|
);
|
44
44
|
expect( welcomeGuideText ).toContain( 'Welcome to the block editor' );
|
45
45
|
|
46
|
-
// Press the button for Page 2
|
46
|
+
// Press the button for Page 2.
|
47
47
|
await page.click( 'button[aria-label="Page 2 of 4"]' );
|
48
48
|
await page.waitForXPath(
|
49
49
|
'//h1[contains(text(), "Make each block your own")]'
|
@@ -52,20 +52,20 @@ describe( 'New User Experience (NUX)', () => {
|
|
52
52
|
// eslint-disable-next-line no-restricted-syntax
|
53
53
|
await page.waitForTimeout( 500 );
|
54
54
|
|
55
|
-
// Press the right arrow key for Page 3
|
55
|
+
// Press the right arrow key for Page 3.
|
56
56
|
await page.keyboard.press( 'ArrowRight' );
|
57
57
|
await page.waitForXPath(
|
58
58
|
'//h1[contains(text(), "Get to know the block library")]'
|
59
59
|
);
|
60
60
|
|
61
|
-
// Press the right arrow key for Page 4
|
61
|
+
// Press the right arrow key for Page 4.
|
62
62
|
await page.keyboard.press( 'ArrowRight' );
|
63
63
|
await page.waitForXPath(
|
64
64
|
'//h1[contains(text(), "Learn how to use the block editor")]'
|
65
65
|
);
|
66
66
|
|
67
67
|
// Click on the *visible* 'Get started' button. There are two in the DOM
|
68
|
-
// but only one is shown depending on viewport size
|
68
|
+
// but only one is shown depending on viewport size.
|
69
69
|
let getStartedButton;
|
70
70
|
for ( const buttonHandle of await page.$x(
|
71
71
|
'//button[contains(text(), "Get started")]'
|
@@ -85,7 +85,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
85
85
|
welcomeGuide = await page.$( '.edit-post-welcome-guide' );
|
86
86
|
expect( welcomeGuide ).toBeNull();
|
87
87
|
|
88
|
-
// Reload the editor
|
88
|
+
// Reload the editor.
|
89
89
|
await page.reload();
|
90
90
|
await page.waitForSelector( '.edit-post-layout' );
|
91
91
|
|
@@ -97,7 +97,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
97
97
|
it( 'should not show the welcome guide again if it is dismissed', async () => {
|
98
98
|
let welcomeGuide;
|
99
99
|
|
100
|
-
// Create a new post as a first-time user
|
100
|
+
// Create a new post as a first-time user.
|
101
101
|
await createNewPost( { showWelcomeGuide: true } );
|
102
102
|
|
103
103
|
// Guide should be open
|
@@ -107,7 +107,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
107
107
|
// Close the guide
|
108
108
|
await page.click( 'button[aria-label="Close dialog"]' );
|
109
109
|
|
110
|
-
// Reload the editor
|
110
|
+
// Reload the editor.
|
111
111
|
await page.reload();
|
112
112
|
await page.waitForSelector( '.edit-post-layout' );
|
113
113
|
|
@@ -119,7 +119,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
119
119
|
it( 'should show the welcome guide if it is manually opened', async () => {
|
120
120
|
let welcomeGuide;
|
121
121
|
|
122
|
-
// Create a new post as a returning user
|
122
|
+
// Create a new post as a returning user.
|
123
123
|
await createNewPost();
|
124
124
|
|
125
125
|
// Guide should be closed
|
@@ -11,16 +11,16 @@ describe( 'popovers', () => {
|
|
11
11
|
describe( 'dropdown', () => {
|
12
12
|
it( 'toggles via click', async () => {
|
13
13
|
const isMoreMenuOpen = async () =>
|
14
|
-
!! ( await page.$( '.
|
14
|
+
!! ( await page.$( '.interface-more-menu-dropdown__content' ) );
|
15
15
|
|
16
16
|
expect( await isMoreMenuOpen() ).toBe( false );
|
17
17
|
|
18
18
|
// Toggle opened.
|
19
|
-
await page.click( '.
|
19
|
+
await page.click( '.interface-more-menu-dropdown > button' );
|
20
20
|
expect( await isMoreMenuOpen() ).toBe( true );
|
21
21
|
|
22
22
|
// Toggle closed.
|
23
|
-
await page.click( '.
|
23
|
+
await page.click( '.interface-more-menu-dropdown > button' );
|
24
24
|
expect( await isMoreMenuOpen() ).toBe( false );
|
25
25
|
} );
|
26
26
|
} );
|
@@ -122,13 +122,13 @@ describe( 'Post Editor Template mode', () => {
|
|
122
122
|
await page.reload();
|
123
123
|
await switchToTemplateMode();
|
124
124
|
|
125
|
-
// Edit the template
|
125
|
+
// Edit the template.
|
126
126
|
await insertBlock( 'Paragraph' );
|
127
127
|
await page.keyboard.type(
|
128
128
|
'Just a random paragraph added to the template'
|
129
129
|
);
|
130
130
|
|
131
|
-
// Save changes
|
131
|
+
// Save changes.
|
132
132
|
const publishButton = await page.waitForXPath(
|
133
133
|
`//button[contains(text(), 'Publish')]`
|
134
134
|
);
|
@@ -138,7 +138,7 @@ describe( 'Post Editor Template mode', () => {
|
|
138
138
|
);
|
139
139
|
await saveButton.click();
|
140
140
|
|
141
|
-
// Preview changes
|
141
|
+
// Preview changes.
|
142
142
|
const previewPage = await openPreviewPage();
|
143
143
|
await previewPage.waitForXPath(
|
144
144
|
'//p[contains(text(), "Just a random paragraph added to the template")]'
|
@@ -166,13 +166,13 @@ describe( 'Post Editor Template mode', () => {
|
|
166
166
|
|
167
167
|
await createNewTemplate( 'Blank Template' );
|
168
168
|
|
169
|
-
// Edit the template
|
169
|
+
// Edit the template.
|
170
170
|
await insertBlock( 'Paragraph' );
|
171
171
|
await page.keyboard.type(
|
172
172
|
'Just a random paragraph added to the template'
|
173
173
|
);
|
174
174
|
|
175
|
-
// Save changes
|
175
|
+
// Save changes.
|
176
176
|
const publishButton = await page.waitForXPath(
|
177
177
|
`//button[contains(text(), 'Publish')]`
|
178
178
|
);
|
@@ -187,7 +187,7 @@ describe( 'Post Editor Template mode', () => {
|
|
187
187
|
);
|
188
188
|
await cancelButton.click();
|
189
189
|
|
190
|
-
// Preview changes
|
190
|
+
// Preview changes.
|
191
191
|
const previewPage = await openPreviewPage();
|
192
192
|
await previewPage.waitForSelector( '.wp-site-blocks' );
|
193
193
|
const content = await previewPage.evaluate(
|
@@ -230,16 +230,17 @@ describe( 'Delete Post Template Confirmation Dialog', () => {
|
|
230
230
|
it( `should retain template if deletion is canceled when the viewport is ${ viewport }`, async () => {
|
231
231
|
await setBrowserViewport( viewport );
|
232
232
|
|
233
|
-
const isWelcomeGuideActive = await page.evaluate(
|
234
|
-
|
235
|
-
.
|
236
|
-
|
233
|
+
const isWelcomeGuideActive = await page.evaluate(
|
234
|
+
() =>
|
235
|
+
!! wp.data
|
236
|
+
.select( 'core/preferences' )
|
237
|
+
.get( 'core/edit-post', 'welcomeGuide' )
|
237
238
|
);
|
238
239
|
if ( isWelcomeGuideActive === true ) {
|
239
240
|
await page.evaluate( () =>
|
240
241
|
wp.data
|
241
242
|
.dispatch( 'core/edit-post' )
|
242
|
-
.
|
243
|
+
.toggle( 'core/edit-post', 'welcomeGuide' )
|
243
244
|
);
|
244
245
|
await page.reload();
|
245
246
|
await page.waitForSelector( '.edit-post-layout' );
|
@@ -44,7 +44,7 @@ describe( 'preferences', () => {
|
|
44
44
|
await page.waitForSelector( '.edit-post-layout' );
|
45
45
|
expect( await getActiveSidebarTabText() ).toBe( 'Post' );
|
46
46
|
|
47
|
-
// Dismiss
|
47
|
+
// Dismiss.
|
48
48
|
await page.click(
|
49
49
|
'.edit-post-sidebar__panel-tabs [aria-label="Close settings"]'
|
50
50
|
);
|
@@ -54,7 +54,7 @@ async function waitForPreviewNavigation( previewPage ) {
|
|
54
54
|
* @param {boolean} shouldBeChecked If true, turns the option on. If false, off.
|
55
55
|
*/
|
56
56
|
async function toggleCustomFieldsOption( shouldBeChecked ) {
|
57
|
-
const baseXPath = '//*[contains(@class, "
|
57
|
+
const baseXPath = '//*[contains(@class, "interface-preferences-modal")]';
|
58
58
|
const paneslXPath = `${ baseXPath }//button[contains(text(), "Panels")]`;
|
59
59
|
const checkboxXPath = `${ baseXPath }//label[contains(text(), "Custom fields")]`;
|
60
60
|
await clickOnMoreMenuItem( 'Preferences' );
|
@@ -83,7 +83,7 @@ async function toggleCustomFieldsOption( shouldBeChecked ) {
|
|
83
83
|
return;
|
84
84
|
}
|
85
85
|
|
86
|
-
await clickOnCloseModalButton( '.
|
86
|
+
await clickOnCloseModalButton( '.interface-preferences-modal' );
|
87
87
|
}
|
88
88
|
|
89
89
|
describe( 'Preview', () => {
|
@@ -272,8 +272,12 @@ describe( 'Preview', () => {
|
|
272
272
|
await publishPost();
|
273
273
|
|
274
274
|
// Close the panel.
|
275
|
-
await page.waitForSelector(
|
276
|
-
|
275
|
+
await page.waitForSelector(
|
276
|
+
'.editor-post-publish-panel button[aria-label="Close panel"]'
|
277
|
+
);
|
278
|
+
await page.click(
|
279
|
+
'.editor-post-publish-panel button[aria-label="Close panel"]'
|
280
|
+
);
|
277
281
|
|
278
282
|
// Change the title and preview again.
|
279
283
|
await editorPage.type( '[aria-label="Add title"]', ' Ipsum' );
|
@@ -32,7 +32,7 @@ describe( 'PostPublishButton', () => {
|
|
32
32
|
} );
|
33
33
|
|
34
34
|
it( 'should be disabled when post is being saved', async () => {
|
35
|
-
await page.type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable
|
35
|
+
await page.type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable.
|
36
36
|
expect(
|
37
37
|
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
38
38
|
).toBeNull();
|
@@ -44,7 +44,7 @@ describe( 'PostPublishButton', () => {
|
|
44
44
|
} );
|
45
45
|
|
46
46
|
it( 'should be disabled when metabox is being saved', async () => {
|
47
|
-
await page.type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable
|
47
|
+
await page.type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable.
|
48
48
|
expect(
|
49
49
|
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
50
50
|
).toBeNull();
|
@@ -9,9 +9,58 @@ import {
|
|
9
9
|
disablePrePublishChecks,
|
10
10
|
arePrePublishChecksEnabled,
|
11
11
|
setBrowserViewport,
|
12
|
+
openPublishPanel,
|
13
|
+
pressKeyWithModifier,
|
12
14
|
} from '@wordpress/e2e-test-utils';
|
13
15
|
|
14
16
|
describe( 'Publishing', () => {
|
17
|
+
describe.each( [ 'post', 'page' ] )(
|
18
|
+
'%s locking prevent saving',
|
19
|
+
( postType ) => {
|
20
|
+
beforeEach( async () => {
|
21
|
+
await createNewPost( postType );
|
22
|
+
} );
|
23
|
+
|
24
|
+
it( `disables the publish button when a ${ postType } is locked`, async () => {
|
25
|
+
await page.type(
|
26
|
+
'.editor-post-title__input',
|
27
|
+
'E2E Test Post lock check publish button'
|
28
|
+
);
|
29
|
+
await page.evaluate( () =>
|
30
|
+
wp.data
|
31
|
+
.dispatch( 'core/editor' )
|
32
|
+
.lockPostSaving( 'futurelock' )
|
33
|
+
);
|
34
|
+
|
35
|
+
await openPublishPanel();
|
36
|
+
|
37
|
+
expect(
|
38
|
+
await page.$(
|
39
|
+
'.editor-post-publish-button[aria-disabled="true"]'
|
40
|
+
)
|
41
|
+
).not.toBeNull();
|
42
|
+
} );
|
43
|
+
|
44
|
+
it( `disables the save shortcut when a ${ postType } is locked`, async () => {
|
45
|
+
await page.type(
|
46
|
+
'.editor-post-title__input',
|
47
|
+
'E2E Test Post check save shortcut'
|
48
|
+
);
|
49
|
+
await page.evaluate( () =>
|
50
|
+
wp.data
|
51
|
+
.dispatch( 'core/editor' )
|
52
|
+
.lockPostSaving( 'futurelock' )
|
53
|
+
);
|
54
|
+
await pressKeyWithModifier( 'primary', 'S' );
|
55
|
+
|
56
|
+
expect( await page.$( '.editor-post-saved-state' ) ).toBeNull();
|
57
|
+
expect(
|
58
|
+
await page.$( '.editor-post-save-draft' )
|
59
|
+
).not.toBeNull();
|
60
|
+
} );
|
61
|
+
}
|
62
|
+
);
|
63
|
+
|
15
64
|
describe.each( [ 'post', 'page' ] )( 'a %s', ( postType ) => {
|
16
65
|
let werePrePublishChecksEnabled;
|
17
66
|
|
@@ -69,7 +118,7 @@ describe( 'Publishing', () => {
|
|
69
118
|
it( `should publish the ${ postType } without opening the post-publish sidebar.`, async () => {
|
70
119
|
await page.type( '.editor-post-title__input', 'E2E Test Post' );
|
71
120
|
|
72
|
-
// The "Publish" button should be shown instead of the "Publish..." toggle
|
121
|
+
// The "Publish" button should be shown instead of the "Publish..." toggle.
|
73
122
|
expect(
|
74
123
|
await page.$( '.editor-post-publish-panel__toggle' )
|
75
124
|
).toBeNull();
|
@@ -26,7 +26,7 @@ const reusableBlockInspectorNameInputSelector =
|
|
26
26
|
const saveAll = async () => {
|
27
27
|
const publishButtonSelector =
|
28
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
|
29
|
+
// Wait for the Publish button to become enabled in case the editor is autosaving ATM:.
|
30
30
|
const publishButton = await page.waitForSelector(
|
31
31
|
publishButtonSelector + '[aria-disabled="false"]'
|
32
32
|
);
|
@@ -41,7 +41,7 @@ const saveAll = async () => {
|
|
41
41
|
const saveAllButDontPublish = async () => {
|
42
42
|
await saveAll();
|
43
43
|
|
44
|
-
//
|
44
|
+
// No need to publish the post.
|
45
45
|
const cancelPublish = await page.waitForSelector(
|
46
46
|
'.editor-post-publish-panel__header-cancel-button button'
|
47
47
|
);
|
@@ -49,7 +49,7 @@ const saveAllButDontPublish = async () => {
|
|
49
49
|
};
|
50
50
|
|
51
51
|
const clearAllBlocks = async () => {
|
52
|
-
// Remove all blocks from the post so that we're working with a clean slate
|
52
|
+
// Remove all blocks from the post so that we're working with a clean slate.
|
53
53
|
await page.evaluate( () => {
|
54
54
|
const blocks = wp.data.select( 'core/block-editor' ).getBlocks();
|
55
55
|
const clientIds = blocks.map( ( block ) => block.clientId );
|
@@ -70,10 +70,10 @@ describe( 'Reusable blocks', () => {
|
|
70
70
|
await createReusableBlock( 'Hello there!', 'Greeting block' );
|
71
71
|
await clearAllBlocks();
|
72
72
|
|
73
|
-
// Insert the reusable block we created above
|
73
|
+
// Insert the reusable block we created above.
|
74
74
|
await insertReusableBlock( 'Greeting block' );
|
75
75
|
|
76
|
-
// Change the block's title
|
76
|
+
// Change the block's title.
|
77
77
|
await openDocumentSettingsSidebar();
|
78
78
|
const nameInput = await page.waitForSelector(
|
79
79
|
reusableBlockInspectorNameInputSelector
|
@@ -82,20 +82,20 @@ describe( 'Reusable blocks', () => {
|
|
82
82
|
await pressKeyWithModifier( 'primary', 'a' );
|
83
83
|
await page.keyboard.type( 'Surprised greeting block' );
|
84
84
|
|
85
|
-
// Quickly focus the paragraph block
|
85
|
+
// Quickly focus the paragraph block.
|
86
86
|
await page.click(
|
87
87
|
'.block-editor-block-list__block[data-type="core/block"] p'
|
88
88
|
);
|
89
|
-
await page.keyboard.press( 'Escape' ); // Enter navigation mode
|
90
|
-
await page.keyboard.press( 'Enter' ); // Enter edit mode
|
89
|
+
await page.keyboard.press( 'Escape' ); // Enter navigation mode.
|
90
|
+
await page.keyboard.press( 'Enter' ); // Enter edit mode.
|
91
91
|
|
92
|
-
// Change the block's content
|
92
|
+
// Change the block's content.
|
93
93
|
await page.keyboard.type( 'Oh! ' );
|
94
94
|
|
95
|
-
// Save the reusable block
|
95
|
+
// Save the reusable block.
|
96
96
|
await saveAllButDontPublish();
|
97
97
|
|
98
|
-
// Check that its content is up to date
|
98
|
+
// Check that its content is up to date.
|
99
99
|
const text = await page.$eval(
|
100
100
|
'.block-editor-block-list__block[data-type="core/block"] p',
|
101
101
|
( element ) => element.innerText
|
@@ -104,19 +104,19 @@ describe( 'Reusable blocks', () => {
|
|
104
104
|
|
105
105
|
await clearAllBlocks();
|
106
106
|
|
107
|
-
// Insert the reusable block we edited above
|
107
|
+
// Insert the reusable block we edited above.
|
108
108
|
await insertReusableBlock( 'Surprised greeting block' );
|
109
109
|
|
110
|
-
// Convert block to a regular block
|
110
|
+
// Convert block to a regular block.
|
111
111
|
await clickBlockToolbarButton( 'Convert to regular blocks' );
|
112
112
|
|
113
|
-
// Check that we have a paragraph block on the page
|
113
|
+
// Check that we have a paragraph block on the page.
|
114
114
|
const paragraphBlock = await page.$(
|
115
115
|
'.block-editor-block-list__block[data-type="core/paragraph"]'
|
116
116
|
);
|
117
117
|
expect( paragraphBlock ).not.toBeNull();
|
118
118
|
|
119
|
-
// Check that its content is up to date
|
119
|
+
// Check that its content is up to date.
|
120
120
|
const paragraphContent = await page.$eval(
|
121
121
|
'.block-editor-block-list__block[data-type="core/paragraph"]',
|
122
122
|
( element ) => element.innerText
|
@@ -145,13 +145,13 @@ describe( 'Reusable blocks', () => {
|
|
145
145
|
await page.waitForSelector( 'p[aria-label="Paragraph block"]' );
|
146
146
|
await page.focus( 'p[aria-label="Paragraph block"]' );
|
147
147
|
|
148
|
-
// Change the block's content
|
148
|
+
// Change the block's content.
|
149
149
|
await page.keyboard.type( 'Einen ' );
|
150
150
|
|
151
|
-
// Save the reusable block and update the post
|
151
|
+
// Save the reusable block and update the post.
|
152
152
|
await saveAll();
|
153
153
|
|
154
|
-
// Check that its content is up to date
|
154
|
+
// Check that its content is up to date.
|
155
155
|
const paragraphContent = await page.$eval(
|
156
156
|
'p[aria-label="Paragraph block"]',
|
157
157
|
( element ) => element.innerText
|
@@ -180,21 +180,21 @@ describe( 'Reusable blocks', () => {
|
|
180
180
|
it( 'can be created from multiselection and converted back to regular blocks', async () => {
|
181
181
|
await createNewPost();
|
182
182
|
|
183
|
-
// Insert a Two paragraphs block
|
183
|
+
// Insert a Two paragraphs block.
|
184
184
|
await insertBlock( 'Paragraph' );
|
185
185
|
await page.keyboard.type( 'Hello there!' );
|
186
186
|
await page.keyboard.press( 'Enter' );
|
187
187
|
await page.keyboard.type( 'Second paragraph' );
|
188
188
|
|
189
|
-
// Select all the blocks
|
189
|
+
// Select all the blocks.
|
190
190
|
await pressKeyWithModifier( 'primary', 'a' );
|
191
191
|
await pressKeyWithModifier( 'primary', 'a' );
|
192
192
|
|
193
|
-
// Convert block to a reusable block
|
193
|
+
// Convert block to a reusable block.
|
194
194
|
await clickBlockToolbarButton( 'Options' );
|
195
195
|
await clickMenuItem( 'Add to Reusable blocks' );
|
196
196
|
|
197
|
-
// Set title
|
197
|
+
// Set title.
|
198
198
|
const nameInput = await page.waitForSelector(
|
199
199
|
reusableBlockNameInputSelector
|
200
200
|
);
|
@@ -202,20 +202,20 @@ describe( 'Reusable blocks', () => {
|
|
202
202
|
await page.keyboard.type( 'Multi-selection reusable block' );
|
203
203
|
await page.keyboard.press( 'Enter' );
|
204
204
|
|
205
|
-
// Wait for creation to finish
|
205
|
+
// Wait for creation to finish.
|
206
206
|
await page.waitForXPath(
|
207
207
|
'//*[contains(@class, "components-snackbar")]/*[text()="Reusable block created."]'
|
208
208
|
);
|
209
209
|
|
210
210
|
await clearAllBlocks();
|
211
211
|
|
212
|
-
// Insert the reusable block we edited above
|
212
|
+
// Insert the reusable block we edited above.
|
213
213
|
await insertReusableBlock( 'Multi-selection reusable block' );
|
214
214
|
|
215
|
-
// Convert block to a regular block
|
215
|
+
// Convert block to a regular block.
|
216
216
|
await clickBlockToolbarButton( 'Convert to regular blocks' );
|
217
217
|
|
218
|
-
// Check that we have two paragraph blocks on the page
|
218
|
+
// Check that we have two paragraph blocks on the page.
|
219
219
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
220
220
|
} );
|
221
221
|
|
@@ -236,25 +236,25 @@ describe( 'Reusable blocks', () => {
|
|
236
236
|
|
237
237
|
await page.waitForNavigation();
|
238
238
|
|
239
|
-
// Click the block to give it focus
|
239
|
+
// Click the block to give it focus.
|
240
240
|
const blockSelector = 'p[data-title="Paragraph"]';
|
241
241
|
await page.waitForSelector( blockSelector );
|
242
242
|
await page.click( blockSelector );
|
243
243
|
|
244
|
-
// Delete the block, leaving the reusable block empty
|
244
|
+
// Delete the block, leaving the reusable block empty.
|
245
245
|
await clickBlockToolbarButton( 'Options' );
|
246
246
|
const deleteButton = await page.waitForXPath(
|
247
247
|
'//button/span[text()="Remove Paragraph"]'
|
248
248
|
);
|
249
249
|
deleteButton.click();
|
250
250
|
|
251
|
-
// Wait for the Update button to become enabled
|
251
|
+
// Wait for the Update button to become enabled.
|
252
252
|
const publishButtonSelector = '.editor-post-publish-button__button';
|
253
253
|
await page.waitForSelector(
|
254
254
|
publishButtonSelector + '[aria-disabled="false"]'
|
255
255
|
);
|
256
256
|
|
257
|
-
// Save the reusable block
|
257
|
+
// Save the reusable block.
|
258
258
|
await page.click( publishButtonSelector );
|
259
259
|
await page.waitForXPath(
|
260
260
|
'//*[contains(@class, "components-snackbar")]/*[text()="Reusable block updated."]'
|
@@ -268,7 +268,7 @@ describe( 'Reusable blocks', () => {
|
|
268
268
|
} );
|
269
269
|
|
270
270
|
it( 'Should show a proper message when the reusable block is missing', async () => {
|
271
|
-
// Insert a non-existant reusable block
|
271
|
+
// Insert a non-existant reusable block.
|
272
272
|
await page.evaluate( () => {
|
273
273
|
const { createBlock } = window.wp.blocks;
|
274
274
|
const { dispatch } = window.wp.data;
|
@@ -16,19 +16,19 @@ describe( 'splitting and merging blocks', () => {
|
|
16
16
|
} );
|
17
17
|
|
18
18
|
it( 'should split and merge paragraph blocks using Enter and Backspace', async () => {
|
19
|
-
// Use regular inserter to add paragraph block and text
|
19
|
+
// Use regular inserter to add paragraph block and text.
|
20
20
|
await insertBlock( 'Paragraph' );
|
21
21
|
await page.keyboard.type( 'FirstSecond' );
|
22
22
|
|
23
23
|
// Move caret between 'First' and 'Second' and press Enter to split
|
24
|
-
// paragraph blocks
|
24
|
+
// paragraph blocks.
|
25
25
|
await pressKeyTimes( 'ArrowLeft', 6 );
|
26
26
|
await page.keyboard.press( 'Enter' );
|
27
27
|
|
28
|
-
// Assert that there are now two paragraph blocks with correct content
|
28
|
+
// Assert that there are now two paragraph blocks with correct content.
|
29
29
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
30
30
|
|
31
|
-
// Press Backspace to merge paragraph blocks
|
31
|
+
// Press Backspace to merge paragraph blocks.
|
32
32
|
await page.keyboard.press( 'Backspace' );
|
33
33
|
|
34
34
|
// Ensure that caret position is correctly placed at the between point.
|
@@ -76,12 +76,12 @@ describe( 'splitting and merging blocks', () => {
|
|
76
76
|
//
|
77
77
|
// See: https://github.com/WordPress/gutenberg/issues/8388
|
78
78
|
|
79
|
-
// First paragraph
|
79
|
+
// First paragraph.
|
80
80
|
await insertBlock( 'Paragraph' );
|
81
81
|
await page.keyboard.type( 'First' );
|
82
82
|
await page.keyboard.press( 'Enter' );
|
83
83
|
|
84
|
-
// Second paragraph
|
84
|
+
// Second paragraph.
|
85
85
|
await page.keyboard.down( 'Shift' );
|
86
86
|
await page.keyboard.press( 'Enter' );
|
87
87
|
await page.keyboard.up( 'Shift' );
|
@@ -14,7 +14,7 @@ describe( 'adding blocks', () => {
|
|
14
14
|
} );
|
15
15
|
|
16
16
|
it( 'Should switch to the plain style of the quote block', async () => {
|
17
|
-
// Inserting a quote block
|
17
|
+
// Inserting a quote block.
|
18
18
|
await insertBlock( 'Quote' );
|
19
19
|
await page.keyboard.type( 'Quote content' );
|
20
20
|
|
@@ -25,7 +25,7 @@ describe( 'adding blocks', () => {
|
|
25
25
|
);
|
26
26
|
await plainStyleButton.click();
|
27
27
|
|
28
|
-
// Check the content
|
28
|
+
// Check the content.
|
29
29
|
const content = await getEditedPostContent();
|
30
30
|
expect( content ).toMatchInlineSnapshot( `
|
31
31
|
"<!-- wp:quote {\\"className\\":\\"is-style-plain\\"} -->
|
@@ -67,7 +67,9 @@ async function scheduleTestPost( postType, viewport ) {
|
|
67
67
|
);
|
68
68
|
|
69
69
|
await (
|
70
|
-
await page.$x(
|
70
|
+
await page.$x(
|
71
|
+
'//*[@role="application"][@aria-label="Calendar"]//td[@role="button"]/*[text() = "15"]'
|
72
|
+
)
|
71
73
|
)[ 0 ].click();
|
72
74
|
|
73
75
|
await page.click( '.edit-post-post-schedule__toggle' );
|
@@ -200,7 +200,7 @@ describe( 'Taxonomies', () => {
|
|
200
200
|
return;
|
201
201
|
}
|
202
202
|
|
203
|
-
// At the start there are no tag tokens
|
203
|
+
// At the start there are no tag tokens.
|
204
204
|
expect( await page.$$( TAG_TOKEN_SELECTOR ) ).toHaveLength( 0 );
|
205
205
|
|
206
206
|
const tagsPanel = await findSidebarPanelWithTitle( 'Tags' );
|