@wordpress/e2e-tests 2.5.17 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE.md +1 -1
- package/config/flaky-tests-reporter.js +2 -1
- package/package.json +12 -11
- package/plugins/query-block.php +2 -2
- package/specs/editor/blocks/__snapshots__/heading.test.js.snap +2 -2
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +29 -57
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
- package/specs/editor/blocks/classic.test.js +5 -2
- package/specs/editor/blocks/columns.test.js +1 -1
- package/specs/editor/blocks/cover.test.js +1 -1
- package/specs/editor/blocks/heading.test.js +15 -3
- package/specs/editor/blocks/image.test.js +1 -2
- package/specs/editor/blocks/navigation.test.js +311 -439
- package/specs/editor/blocks/preformatted.test.js +2 -1
- package/specs/editor/blocks/site-title.test.js +2 -31
- package/specs/editor/fixtures/menu-items-request-fixture.json +84 -0
- package/specs/editor/fixtures/menu-items-response-fixture.json +240 -144
- package/specs/editor/plugins/block-variations.test.js +1 -1
- package/specs/editor/plugins/custom-post-types.test.js +4 -3
- package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
- package/specs/editor/various/adding-patterns.test.js +1 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
- package/specs/editor/various/block-grouping.test.js +2 -18
- package/specs/editor/various/block-hierarchy-navigation.test.js +3 -3
- package/specs/editor/various/change-detection.test.js +5 -0
- package/specs/editor/various/editor-modes.test.js +7 -0
- package/specs/editor/various/font-size-picker.test.js +58 -18
- package/specs/editor/various/inserting-blocks.test.js +6 -2
- package/specs/editor/various/keyboard-navigable-blocks.test.js +6 -0
- package/specs/editor/various/list-view.test.js +2 -2
- package/specs/editor/various/navigable-toolbar.test.js +2 -2
- package/specs/editor/various/post-editor-template-mode.test.js +1 -1
- package/specs/editor/various/preview.test.js +67 -2
- package/specs/editor/various/reusable-blocks.test.js +53 -31
- package/specs/editor/various/undo.test.js +21 -0
- package/specs/editor/various/writing-flow.test.js +8 -4
- 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 +2 -2
- package/specs/site-editor/multi-entity-saving.test.js +53 -63
- 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 +95 -79
- package/specs/site-editor/template-revert.test.js +13 -9
- package/specs/widgets/customizing-widgets.test.js +7 -3
@@ -2,9 +2,7 @@
|
|
2
2
|
* WordPress dependencies
|
3
3
|
*/
|
4
4
|
import {
|
5
|
-
createNewPost,
|
6
5
|
insertBlock,
|
7
|
-
disablePrePublishChecks,
|
8
6
|
trashAllPosts,
|
9
7
|
activateTheme,
|
10
8
|
getAllBlocks,
|
@@ -23,7 +21,7 @@ const templatePartNameInput =
|
|
23
21
|
|
24
22
|
describe( 'Template Part', () => {
|
25
23
|
beforeAll( async () => {
|
26
|
-
await activateTheme( '
|
24
|
+
await activateTheme( 'emptytheme' );
|
27
25
|
await trashAllPosts( 'wp_template' );
|
28
26
|
await trashAllPosts( 'wp_template_part' );
|
29
27
|
} );
|
@@ -42,7 +40,7 @@ describe( 'Template Part', () => {
|
|
42
40
|
async function navigateToHeader() {
|
43
41
|
// Switch to editing the header template part.
|
44
42
|
await siteEditor.visit( {
|
45
|
-
postId: '
|
43
|
+
postId: 'emptytheme//header',
|
46
44
|
postType: 'wp_template_part',
|
47
45
|
} );
|
48
46
|
}
|
@@ -63,7 +61,7 @@ describe( 'Template Part', () => {
|
|
63
61
|
|
64
62
|
// Switch back to the Index template.
|
65
63
|
await siteEditor.visit( {
|
66
|
-
postId: '
|
64
|
+
postId: 'emptytheme//index',
|
67
65
|
postType: 'wp_template',
|
68
66
|
} );
|
69
67
|
}
|
@@ -95,12 +93,9 @@ describe( 'Template Part', () => {
|
|
95
93
|
expect( paragraphInTemplatePart ).not.toBeNull();
|
96
94
|
}
|
97
95
|
|
98
|
-
async function
|
96
|
+
async function awaitHeaderLoad() {
|
99
97
|
await canvas().waitForSelector(
|
100
|
-
'.wp-block-template-part.
|
101
|
-
);
|
102
|
-
await canvas().waitForSelector(
|
103
|
-
'.wp-block-template-part.site-footer.block-editor-block-list__layout'
|
98
|
+
'header.wp-block-template-part.block-editor-block-list__layout'
|
104
99
|
);
|
105
100
|
}
|
106
101
|
|
@@ -174,7 +169,7 @@ describe( 'Template Part', () => {
|
|
174
169
|
} );
|
175
170
|
|
176
171
|
it( 'Should convert selected block to template part', async () => {
|
177
|
-
await
|
172
|
+
await awaitHeaderLoad();
|
178
173
|
const initialTemplateParts = await canvas().$$(
|
179
174
|
'.wp-block-template-part'
|
180
175
|
);
|
@@ -212,7 +207,7 @@ describe( 'Template Part', () => {
|
|
212
207
|
} );
|
213
208
|
|
214
209
|
it( 'Should convert multiple selected blocks to template part', async () => {
|
215
|
-
await
|
210
|
+
await awaitHeaderLoad();
|
216
211
|
const initialTemplateParts = await canvas().$$(
|
217
212
|
'.wp-block-template-part'
|
218
213
|
);
|
@@ -260,73 +255,94 @@ describe( 'Template Part', () => {
|
|
260
255
|
finalTemplateParts.length - initialTemplateParts.length
|
261
256
|
).toBe( 1 );
|
262
257
|
} );
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
'
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
258
|
+
describe( 'Template part placeholder', () => {
|
259
|
+
// Test constants for template part.
|
260
|
+
const testContent = 'some words...';
|
261
|
+
|
262
|
+
// Selectors
|
263
|
+
const entitiesSaveSelector =
|
264
|
+
'.editor-entities-saved-states__save-button';
|
265
|
+
const savePostSelector = '.edit-site-save-button__button';
|
266
|
+
const templatePartSelector = '*[data-type="core/template-part"]';
|
267
|
+
const activatedTemplatePartSelector = `${ templatePartSelector }.block-editor-block-list__layout`;
|
268
|
+
const createNewButtonSelector =
|
269
|
+
'//button[contains(text(), "New template part")]';
|
270
|
+
const chooseExistingButtonSelector =
|
271
|
+
'//button[contains(text(), "Choose existing")]';
|
272
|
+
const confirmTitleButtonSelector =
|
273
|
+
'.wp-block-template-part__placeholder-create-new__title-form .components-button.is-primary';
|
274
|
+
|
275
|
+
it( 'Should insert new template part on creation', async () => {
|
276
|
+
let siteEditorCanvas = canvas();
|
277
|
+
await awaitHeaderLoad();
|
278
|
+
|
279
|
+
// Create new template part.
|
280
|
+
await insertBlock( 'Template Part' );
|
281
|
+
await siteEditorCanvas.waitForXPath(
|
282
|
+
chooseExistingButtonSelector
|
283
|
+
);
|
284
|
+
const [ createNewButton ] = await siteEditorCanvas.$x(
|
285
|
+
createNewButtonSelector
|
286
|
+
);
|
287
|
+
await createNewButton.click();
|
288
|
+
const confirmTitleButton = await page.waitForSelector(
|
289
|
+
confirmTitleButtonSelector
|
290
|
+
);
|
291
|
+
await page.keyboard.press( 'Tab' );
|
292
|
+
await page.keyboard.press( 'Tab' );
|
293
|
+
await page.keyboard.type( 'Create New' );
|
294
|
+
await confirmTitleButton.click();
|
295
|
+
|
296
|
+
const newTemplatePart = await siteEditorCanvas.waitForSelector(
|
297
|
+
activatedTemplatePartSelector
|
298
|
+
);
|
299
|
+
expect( newTemplatePart ).toBeTruthy();
|
300
|
+
|
301
|
+
// Finish creating template part, insert some text, and save.
|
302
|
+
await siteEditorCanvas.waitForSelector(
|
303
|
+
'.block-editor-button-block-appender'
|
304
|
+
);
|
305
|
+
await siteEditorCanvas.click(
|
306
|
+
'.block-editor-button-block-appender'
|
307
|
+
);
|
308
|
+
await page.waitForSelector(
|
309
|
+
'.editor-block-list-item-paragraph'
|
310
|
+
);
|
311
|
+
await page.click( '.editor-block-list-item-paragraph' );
|
312
|
+
await page.keyboard.type( testContent );
|
313
|
+
await page.click( savePostSelector );
|
314
|
+
await page.click( entitiesSaveSelector );
|
315
|
+
|
316
|
+
// Reload the page so as the new template part is available in the existing template parts.
|
317
|
+
await siteEditor.visit();
|
318
|
+
siteEditorCanvas = canvas();
|
319
|
+
await awaitHeaderLoad();
|
320
|
+
// Try to insert the template part we created.
|
321
|
+
await insertBlock( 'Template Part' );
|
322
|
+
const chooseExistingButton = await siteEditorCanvas.waitForXPath(
|
323
|
+
chooseExistingButtonSelector
|
324
|
+
);
|
325
|
+
await chooseExistingButton.click();
|
326
|
+
await page.waitForSelector(
|
327
|
+
'.wp-block-template-part__selection-preview-container'
|
328
|
+
);
|
329
|
+
const preview = await page.waitForSelector(
|
330
|
+
'.wp-block-template-part__selection-preview-item[aria-label="Create New"]'
|
331
|
+
);
|
332
|
+
await preview.click();
|
333
|
+
// We now have the same template part two times in the page, so check accordingly.
|
334
|
+
const paragraphs = await siteEditorCanvas.$$eval(
|
335
|
+
'[data-type="core/template-part"] > p:first-child',
|
336
|
+
( options ) =>
|
337
|
+
options.map( ( option ) => option.textContent )
|
338
|
+
);
|
339
|
+
expect( paragraphs ).toHaveLength( 2 );
|
340
|
+
expect(
|
341
|
+
paragraphs.every(
|
342
|
+
( paragraph ) => paragraph === testContent
|
343
|
+
)
|
344
|
+
).toBeTruthy();
|
345
|
+
} );
|
330
346
|
} );
|
331
347
|
} );
|
332
348
|
} );
|
@@ -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
|
|
@@ -89,7 +93,7 @@ const assertTemplatesAreDeleted = async () => {
|
|
89
93
|
|
90
94
|
describe( 'Template Revert', () => {
|
91
95
|
beforeAll( async () => {
|
92
|
-
await activateTheme( '
|
96
|
+
await activateTheme( 'emptytheme' );
|
93
97
|
await trashAllPosts( 'wp_template' );
|
94
98
|
await trashAllPosts( 'wp_template_part' );
|
95
99
|
} );
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
clickBlockToolbarButton,
|
11
11
|
deleteAllWidgets,
|
12
12
|
createURL,
|
13
|
+
openTypographyToolsPanelMenu,
|
13
14
|
} from '@wordpress/e2e-test-utils';
|
14
15
|
|
15
16
|
/**
|
@@ -188,7 +189,7 @@ describe( 'Widgets Customizer', () => {
|
|
188
189
|
|
189
190
|
const backButton = await find( {
|
190
191
|
role: 'button',
|
191
|
-
name:
|
192
|
+
name: /Back/,
|
192
193
|
focused: true,
|
193
194
|
} );
|
194
195
|
await expect( backButton ).toHaveFocus();
|
@@ -340,7 +341,7 @@ describe( 'Widgets Customizer', () => {
|
|
340
341
|
// Back to the widget areas panel.
|
341
342
|
const backButton = await find( {
|
342
343
|
role: 'button',
|
343
|
-
name:
|
344
|
+
name: /Back/,
|
344
345
|
} );
|
345
346
|
await backButton.click();
|
346
347
|
|
@@ -376,7 +377,7 @@ describe( 'Widgets Customizer', () => {
|
|
376
377
|
await page.keyboard.type( 'First Heading' );
|
377
378
|
|
378
379
|
// Navigate back to the parent panel.
|
379
|
-
const backButton = await find( { role: 'button', name:
|
380
|
+
const backButton = await find( { role: 'button', name: /Back/ } );
|
380
381
|
await backButton.click();
|
381
382
|
|
382
383
|
await waitForPreviewIframe();
|
@@ -813,6 +814,9 @@ describe( 'Widgets Customizer', () => {
|
|
813
814
|
await showMoreSettingsButton.click();
|
814
815
|
|
815
816
|
// Change `drop cap` (Any change made in this section is sufficient; not required to be `drop cap`).
|
817
|
+
await openTypographyToolsPanelMenu();
|
818
|
+
await page.click( 'button[aria-label="Show Drop cap"]' );
|
819
|
+
|
816
820
|
const [ dropCapToggle ] = await page.$x(
|
817
821
|
"//label[contains(text(), 'Drop cap')]"
|
818
822
|
);
|