@wordpress/e2e-tests 4.5.0 → 4.6.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/package.json +5 -5
- package/specs/editor/blocks/navigation.test.js +8 -12
- package/specs/editor/plugins/iframed-block.test.js +3 -2
- package/specs/editor/plugins/iframed-masonry-block.test.js +3 -2
- package/specs/editor/various/datepicker.test.js +9 -11
- package/specs/editor/various/sidebar.test.js +4 -6
- package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +0 -33
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +0 -13
- package/specs/editor/blocks/__snapshots__/table.test.js.snap +0 -61
- package/specs/editor/blocks/buttons.test.js +0 -95
- package/specs/editor/blocks/spacer.test.js +0 -48
- package/specs/editor/blocks/table.test.js +0 -295
- package/specs/editor/various/__snapshots__/rtl.test.js.snap +0 -63
- package/specs/editor/various/preview.test.js +0 -425
- package/specs/editor/various/rtl.test.js +0 -129
- package/specs/site-editor/style-variations.test.js +0 -213
- package/themes/style-variations/block-templates/index.html +0 -11
- package/themes/style-variations/index.php +0 -0
- package/themes/style-variations/style.css +0 -15
- package/themes/style-variations/styles/pink.json +0 -33
- package/themes/style-variations/styles/yellow.json +0 -12
- package/themes/style-variations/theme.json +0 -8
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.6.0",
|
4
4
|
"description": "End-To-End (E2E) tests for WordPress.",
|
5
5
|
"author": "The WordPress Contributors",
|
6
6
|
"license": "GPL-2.0-or-later",
|
@@ -23,11 +23,11 @@
|
|
23
23
|
"node": ">=12"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^7.
|
26
|
+
"@wordpress/e2e-test-utils": "^7.8.0",
|
27
27
|
"@wordpress/jest-console": "^5.3.0",
|
28
28
|
"@wordpress/jest-puppeteer-axe": "^4.0.2",
|
29
|
-
"@wordpress/scripts": "^23.
|
30
|
-
"@wordpress/url": "^3.
|
29
|
+
"@wordpress/scripts": "^23.4.0",
|
30
|
+
"@wordpress/url": "^3.13.0",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
33
33
|
"filenamify": "^4.2.0",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "a80eeb62ec7cb1418b9915c277e084a29d6665e3"
|
50
50
|
}
|
@@ -1,8 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* External dependencies
|
3
|
-
*/
|
4
|
-
import { uniqueId } from 'lodash';
|
5
|
-
|
6
1
|
/**
|
7
2
|
* WordPress dependencies
|
8
3
|
*/
|
@@ -48,6 +43,7 @@ const REST_PAGES_ROUTES = [
|
|
48
43
|
'/wp/v2/pages',
|
49
44
|
`rest_route=${ encodeURIComponent( '/wp/v2/pages' ) }`,
|
50
45
|
];
|
46
|
+
let uniqueId = 0;
|
51
47
|
|
52
48
|
/**
|
53
49
|
* Determines if a given URL matches any of a given collection of
|
@@ -312,7 +308,7 @@ async function waitForBlock( blockName ) {
|
|
312
308
|
// Disable reason - these tests are to be re-written.
|
313
309
|
// eslint-disable-next-line jest/no-disabled-tests
|
314
310
|
describe( 'Navigation', () => {
|
315
|
-
const contributorUsername = uniqueId
|
311
|
+
const contributorUsername = `contributoruser_${ ++uniqueId }`;
|
316
312
|
let contributorPassword;
|
317
313
|
|
318
314
|
beforeAll( async () => {
|
@@ -388,7 +384,10 @@ describe( 'Navigation', () => {
|
|
388
384
|
expect( loadingSpinner ).toBeNull();
|
389
385
|
} );
|
390
386
|
|
391
|
-
|
387
|
+
// Skip reason: This test is quite flaky recently.
|
388
|
+
// See https://github.com/WordPress/gutenberg/issues/39231.
|
389
|
+
// eslint-disable-next-line jest/no-disabled-tests
|
390
|
+
it.skip( 'shows a loading indicator whilst ref resolves to Navigation post items', async () => {
|
392
391
|
const testNavId = 1;
|
393
392
|
|
394
393
|
let resolveNavigationRequest;
|
@@ -400,11 +399,8 @@ describe( 'Navigation', () => {
|
|
400
399
|
await setUpResponseMocking( [
|
401
400
|
{
|
402
401
|
match: ( request ) => {
|
403
|
-
return (
|
404
|
-
|
405
|
-
decodeURIComponent( request.url() ).includes(
|
406
|
-
`navigation/${ testNavId }`
|
407
|
-
)
|
402
|
+
return decodeURIComponent( request.url() ).includes(
|
403
|
+
`navigation/`
|
408
404
|
);
|
409
405
|
},
|
410
406
|
onRequestMatch: ( request ) => {
|
@@ -36,8 +36,9 @@ describe( 'changing image size', () => {
|
|
36
36
|
|
37
37
|
await openDocumentSettingsSidebar();
|
38
38
|
await clickButton( 'Page' );
|
39
|
-
await
|
40
|
-
await
|
39
|
+
await page.click( 'button[aria-label^="Select template"]' );
|
40
|
+
await page.waitForSelector( 'button[aria-label="Add template"]' );
|
41
|
+
await page.click( 'button[aria-label="Add template"]' );
|
41
42
|
await page.keyboard.press( 'Tab' );
|
42
43
|
await page.keyboard.press( 'Tab' );
|
43
44
|
await page.keyboard.type( 'Iframed Test' );
|
@@ -44,8 +44,9 @@ describe( 'iframed masonry block', () => {
|
|
44
44
|
|
45
45
|
await openDocumentSettingsSidebar();
|
46
46
|
await clickButton( 'Page' );
|
47
|
-
await
|
48
|
-
await
|
47
|
+
await page.click( 'button[aria-label^="Select template"]' );
|
48
|
+
await page.waitForSelector( 'button[aria-label="Add template"]' );
|
49
|
+
await page.click( 'button[aria-label="Add template"]' );
|
49
50
|
await page.keyboard.press( 'Tab' );
|
50
51
|
await page.keyboard.press( 'Tab' );
|
51
52
|
await page.keyboard.type( 'Iframed Test' );
|
@@ -45,17 +45,13 @@ function trimLeadingZero( str ) {
|
|
45
45
|
return str[ 0 ] === '0' ? str.slice( 1 ) : str;
|
46
46
|
}
|
47
47
|
|
48
|
-
function formatDatePickerValues(
|
49
|
-
year,
|
50
|
-
|
51
|
-
|
52
|
-
hours,
|
53
|
-
minutes,
|
54
|
-
amOrPm,
|
55
|
-
} ) {
|
48
|
+
function formatDatePickerValues(
|
49
|
+
{ year, monthLabel, day, hours, minutes, amOrPm },
|
50
|
+
timezone
|
51
|
+
) {
|
56
52
|
const dayTrimmed = trimLeadingZero( day );
|
57
53
|
const hoursTrimmed = trimLeadingZero( hours );
|
58
|
-
return `${ monthLabel } ${ dayTrimmed }, ${ year } ${ hoursTrimmed }:${ minutes }
|
54
|
+
return `${ monthLabel } ${ dayTrimmed }, ${ year } ${ hoursTrimmed }:${ minutes }\xa0${ amOrPm } ${ timezone }`;
|
59
55
|
}
|
60
56
|
|
61
57
|
async function getPublishingDate() {
|
@@ -70,11 +66,13 @@ describe.each( [ [ 'UTC-10' ], [ 'UTC' ], [ 'UTC+10' ] ] )(
|
|
70
66
|
( timezone ) => {
|
71
67
|
let oldTimezone;
|
72
68
|
beforeEach( async () => {
|
69
|
+
await page.emulateTimezone( 'America/New_York' ); // Set browser to a timezone that's different to `timezone`.
|
73
70
|
oldTimezone = await changeSiteTimezone( timezone );
|
74
71
|
await createNewPost();
|
75
72
|
} );
|
76
73
|
afterEach( async () => {
|
77
74
|
await changeSiteTimezone( oldTimezone );
|
75
|
+
await page.emulateTimezone( null );
|
78
76
|
} );
|
79
77
|
|
80
78
|
it( 'should show the publishing date as "Immediately" if the date is not altered', async () => {
|
@@ -98,7 +96,7 @@ describe.each( [ [ 'UTC-10' ], [ 'UTC' ], [ 'UTC+10' ] ] )(
|
|
98
96
|
const publishingDate = await getPublishingDate();
|
99
97
|
|
100
98
|
expect( publishingDate ).toBe(
|
101
|
-
formatDatePickerValues( datePickerValues )
|
99
|
+
formatDatePickerValues( datePickerValues, timezone )
|
102
100
|
);
|
103
101
|
} );
|
104
102
|
|
@@ -119,7 +117,7 @@ describe.each( [ [ 'UTC-10' ], [ 'UTC' ], [ 'UTC+10' ] ] )(
|
|
119
117
|
expect( publishingDate ).not.toEqual( 'Immediately' );
|
120
118
|
// The expected date format will be "Sep 26, 2018 11:52 pm".
|
121
119
|
expect( publishingDate ).toBe(
|
122
|
-
formatDatePickerValues( datePickerValues )
|
120
|
+
formatDatePickerValues( datePickerValues, timezone )
|
123
121
|
);
|
124
122
|
} );
|
125
123
|
|
@@ -131,9 +131,7 @@ describe( 'Sidebar', () => {
|
|
131
131
|
).toBeDefined();
|
132
132
|
expect( await findSidebarPanelWithTitle( 'Excerpt' ) ).toBeDefined();
|
133
133
|
expect( await findSidebarPanelWithTitle( 'Discussion' ) ).toBeDefined();
|
134
|
-
expect(
|
135
|
-
await findSidebarPanelWithTitle( 'Status & visibility' )
|
136
|
-
).toBeDefined();
|
134
|
+
expect( await findSidebarPanelWithTitle( 'Summary' ) ).toBeDefined();
|
137
135
|
|
138
136
|
await page.evaluate( () => {
|
139
137
|
const { removeEditorPanel } = wp.data.dispatch( 'core/edit-post' );
|
@@ -165,8 +163,8 @@ describe( 'Sidebar', () => {
|
|
165
163
|
expect(
|
166
164
|
await page.$x( getPanelToggleSelector( 'Discussion' ) )
|
167
165
|
).toEqual( [] );
|
168
|
-
expect(
|
169
|
-
|
170
|
-
)
|
166
|
+
expect( await page.$x( getPanelToggleSelector( 'Summary' ) ) ).toEqual(
|
167
|
+
[]
|
168
|
+
);
|
171
169
|
} );
|
172
170
|
} );
|
@@ -1,33 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Buttons can jump to the link editor using the keyboard shortcut 1`] = `
|
4
|
-
"<!-- wp:buttons -->
|
5
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
6
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\" href=\\"https://www.wordpress.org/\\">WordPress</a></div>
|
7
|
-
<!-- /wp:button --></div>
|
8
|
-
<!-- /wp:buttons -->"
|
9
|
-
`;
|
10
|
-
|
11
|
-
exports[`Buttons dismisses link editor when escape is pressed 1`] = `
|
12
|
-
"<!-- wp:buttons -->
|
13
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
14
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">WordPress</a></div>
|
15
|
-
<!-- /wp:button --></div>
|
16
|
-
<!-- /wp:buttons -->"
|
17
|
-
`;
|
18
|
-
|
19
|
-
exports[`Buttons has focus on button content (slash inserter) 1`] = `
|
20
|
-
"<!-- wp:buttons -->
|
21
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
22
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">Content</a></div>
|
23
|
-
<!-- /wp:button --></div>
|
24
|
-
<!-- /wp:buttons -->"
|
25
|
-
`;
|
26
|
-
|
27
|
-
exports[`Buttons has focus on button content 1`] = `
|
28
|
-
"<!-- wp:buttons -->
|
29
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
30
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">Content</a></div>
|
31
|
-
<!-- /wp:button --></div>
|
32
|
-
<!-- /wp:buttons -->"
|
33
|
-
`;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Spacer can be created by typing "/spacer" 1`] = `
|
4
|
-
"<!-- wp:spacer -->
|
5
|
-
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
6
|
-
<!-- /wp:spacer -->"
|
7
|
-
`;
|
8
|
-
|
9
|
-
exports[`Spacer can be resized using the drag handle and remains selected after being dragged 1`] = `
|
10
|
-
"<!-- wp:spacer {\\"height\\":\\"150px\\"} -->
|
11
|
-
<div style=\\"height:150px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
12
|
-
<!-- /wp:spacer -->"
|
13
|
-
`;
|
@@ -1,61 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Table allows a caption to be added 1`] = `
|
4
|
-
"<!-- wp:table -->
|
5
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><figcaption>Caption!</figcaption></figure>
|
6
|
-
<!-- /wp:table -->"
|
7
|
-
`;
|
8
|
-
|
9
|
-
exports[`Table allows adding and deleting columns across the table header, body and footer 1`] = `
|
10
|
-
"<!-- wp:table -->
|
11
|
-
<figure class=\\"wp-block-table\\"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody><tfoot><tr><td></td><td></td><td></td></tr></tfoot></table></figure>
|
12
|
-
<!-- /wp:table -->"
|
13
|
-
`;
|
14
|
-
|
15
|
-
exports[`Table allows adding and deleting columns across the table header, body and footer 2`] = `
|
16
|
-
"<!-- wp:table -->
|
17
|
-
<figure class=\\"wp-block-table\\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td></td><td></td></tr></tfoot></table></figure>
|
18
|
-
<!-- /wp:table -->"
|
19
|
-
`;
|
20
|
-
|
21
|
-
exports[`Table allows cells to be selected when the cell area outside of the RichText is clicked 1`] = `
|
22
|
-
"<!-- wp:table {\\"hasFixedLayout\\":true} -->
|
23
|
-
<figure class=\\"wp-block-table\\"><table class=\\"has-fixed-layout\\"><tbody><tr><td><br><br><br><br></td><td>Second cell.</td></tr><tr><td></td><td></td></tr></tbody></table></figure>
|
24
|
-
<!-- /wp:table -->"
|
25
|
-
`;
|
26
|
-
|
27
|
-
exports[`Table allows columns to be aligned 1`] = `
|
28
|
-
"<!-- wp:table -->
|
29
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td>None</td><td class=\\"has-text-align-left\\" data-align=\\"left\\">To the left</td><td class=\\"has-text-align-center\\" data-align=\\"center\\">Centered</td><td class=\\"has-text-align-right\\" data-align=\\"right\\">Right aligned</td></tr><tr><td></td><td class=\\"has-text-align-left\\" data-align=\\"left\\"></td><td class=\\"has-text-align-center\\" data-align=\\"center\\"></td><td class=\\"has-text-align-right\\" data-align=\\"right\\"></td></tr></tbody></table></figure>
|
30
|
-
<!-- /wp:table -->"
|
31
|
-
`;
|
32
|
-
|
33
|
-
exports[`Table allows header and footer rows to be switched on and off 1`] = `
|
34
|
-
"<!-- wp:table -->
|
35
|
-
<figure class=\\"wp-block-table\\"><table><thead><tr><th>header</th><th></th></tr></thead><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td>footer</td><td></td></tr></tfoot></table></figure>
|
36
|
-
<!-- /wp:table -->"
|
37
|
-
`;
|
38
|
-
|
39
|
-
exports[`Table allows header and footer rows to be switched on and off 2`] = `
|
40
|
-
"<!-- wp:table -->
|
41
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody></table></figure>
|
42
|
-
<!-- /wp:table -->"
|
43
|
-
`;
|
44
|
-
|
45
|
-
exports[`Table allows text to by typed into cells 1`] = `
|
46
|
-
"<!-- wp:table -->
|
47
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td>This</td><td>is</td></tr><tr><td>table</td><td>block</td></tr></tbody></table></figure>
|
48
|
-
<!-- /wp:table -->"
|
49
|
-
`;
|
50
|
-
|
51
|
-
exports[`Table displays a form for choosing the row and column count of the table 1`] = `
|
52
|
-
"<!-- wp:table -->
|
53
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table></figure>
|
54
|
-
<!-- /wp:table -->"
|
55
|
-
`;
|
56
|
-
|
57
|
-
exports[`Table up and down arrow navigation 1`] = `
|
58
|
-
"<!-- wp:table -->
|
59
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td>1</td><td>4</td></tr><tr><td>2</td><td>3</td></tr></tbody></table></figure>
|
60
|
-
<!-- /wp:table -->"
|
61
|
-
`;
|
@@ -1,95 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
insertBlock,
|
6
|
-
getEditedPostContent,
|
7
|
-
createNewPost,
|
8
|
-
pressKeyWithModifier,
|
9
|
-
clickBlockAppender,
|
10
|
-
} from '@wordpress/e2e-test-utils';
|
11
|
-
|
12
|
-
describe( 'Buttons', () => {
|
13
|
-
beforeEach( async () => {
|
14
|
-
await createNewPost();
|
15
|
-
} );
|
16
|
-
|
17
|
-
it( 'has focus on button content', async () => {
|
18
|
-
await insertBlock( 'Buttons' );
|
19
|
-
await page.keyboard.type( 'Content' );
|
20
|
-
|
21
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
22
|
-
} );
|
23
|
-
|
24
|
-
it( 'has focus on button content (slash inserter)', async () => {
|
25
|
-
await clickBlockAppender();
|
26
|
-
await page.keyboard.type( '/buttons' );
|
27
|
-
await page.keyboard.press( 'Enter' );
|
28
|
-
await page.keyboard.type( 'Content' );
|
29
|
-
|
30
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
31
|
-
} );
|
32
|
-
|
33
|
-
it( 'dismisses link editor when escape is pressed', async () => {
|
34
|
-
// Regression: https://github.com/WordPress/gutenberg/pull/19885
|
35
|
-
await insertBlock( 'Buttons' );
|
36
|
-
await pressKeyWithModifier( 'primary', 'k' );
|
37
|
-
await page.waitForFunction(
|
38
|
-
() => !! document.activeElement.closest( '.block-editor-url-input' )
|
39
|
-
);
|
40
|
-
await page.keyboard.press( 'Escape' );
|
41
|
-
await page.waitForFunction(
|
42
|
-
() =>
|
43
|
-
document.activeElement ===
|
44
|
-
document.querySelector( '.block-editor-rich-text__editable' )
|
45
|
-
);
|
46
|
-
await page.keyboard.type( 'WordPress' );
|
47
|
-
|
48
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
49
|
-
} );
|
50
|
-
|
51
|
-
it( 'moves focus from the link editor back to the button when escape is pressed after the URL has been submitted', async () => {
|
52
|
-
// Regression: https://github.com/WordPress/gutenberg/issues/34307
|
53
|
-
await insertBlock( 'Buttons' );
|
54
|
-
await pressKeyWithModifier( 'primary', 'k' );
|
55
|
-
await page.waitForFunction(
|
56
|
-
() => !! document.activeElement.closest( '.block-editor-url-input' )
|
57
|
-
);
|
58
|
-
await page.keyboard.type( 'https://example.com' );
|
59
|
-
await page.keyboard.press( 'Enter' );
|
60
|
-
await page.waitForFunction(
|
61
|
-
() =>
|
62
|
-
document.activeElement ===
|
63
|
-
document.querySelector(
|
64
|
-
'.block-editor-link-control a[href="https://example.com"]'
|
65
|
-
)
|
66
|
-
);
|
67
|
-
await page.keyboard.press( 'Escape' );
|
68
|
-
|
69
|
-
// Focus should move from the link control to the button block's text.
|
70
|
-
await page.waitForFunction(
|
71
|
-
() =>
|
72
|
-
document.activeElement ===
|
73
|
-
document.querySelector( '[aria-label="Button text"]' )
|
74
|
-
);
|
75
|
-
|
76
|
-
// The link control should still be visible when a URL is set.
|
77
|
-
const linkControl = await page.$( '.block-editor-link-control' );
|
78
|
-
expect( linkControl ).toBeTruthy();
|
79
|
-
} );
|
80
|
-
|
81
|
-
it( 'can jump to the link editor using the keyboard shortcut', async () => {
|
82
|
-
await insertBlock( 'Buttons' );
|
83
|
-
await page.keyboard.type( 'WordPress' );
|
84
|
-
await pressKeyWithModifier( 'primary', 'k' );
|
85
|
-
await page.keyboard.type( 'https://www.wordpress.org/' );
|
86
|
-
await page.keyboard.press( 'Enter' );
|
87
|
-
// Make sure that the dialog is still opened, and that focus is retained
|
88
|
-
// within (focusing on the link preview).
|
89
|
-
await page.waitForSelector(
|
90
|
-
':focus.block-editor-link-control__search-item-title'
|
91
|
-
);
|
92
|
-
|
93
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
94
|
-
} );
|
95
|
-
} );
|
@@ -1,48 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
clickBlockAppender,
|
6
|
-
getEditedPostContent,
|
7
|
-
createNewPost,
|
8
|
-
dragAndResize,
|
9
|
-
} from '@wordpress/e2e-test-utils';
|
10
|
-
|
11
|
-
describe( 'Spacer', () => {
|
12
|
-
beforeEach( async () => {
|
13
|
-
await createNewPost();
|
14
|
-
} );
|
15
|
-
|
16
|
-
it( 'can be created by typing "/spacer"', async () => {
|
17
|
-
// Create a spacer with the slash block shortcut.
|
18
|
-
await clickBlockAppender();
|
19
|
-
await page.keyboard.type( '/spacer' );
|
20
|
-
await page.waitForXPath(
|
21
|
-
`//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Spacer')]`
|
22
|
-
);
|
23
|
-
await page.keyboard.press( 'Enter' );
|
24
|
-
|
25
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
26
|
-
} );
|
27
|
-
|
28
|
-
it( 'can be resized using the drag handle and remains selected after being dragged', async () => {
|
29
|
-
// Create a spacer with the slash block shortcut.
|
30
|
-
await clickBlockAppender();
|
31
|
-
await page.keyboard.type( '/spacer' );
|
32
|
-
await page.waitForXPath(
|
33
|
-
`//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Spacer')]`
|
34
|
-
);
|
35
|
-
await page.keyboard.press( 'Enter' );
|
36
|
-
|
37
|
-
const resizableHandle = await page.$(
|
38
|
-
'.block-library-spacer__resize-container .components-resizable-box__handle'
|
39
|
-
);
|
40
|
-
await dragAndResize( resizableHandle, { x: 0, y: 50 } );
|
41
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
42
|
-
|
43
|
-
const selectedSpacer = await page.$(
|
44
|
-
'[data-type="core/spacer"].is-selected'
|
45
|
-
);
|
46
|
-
expect( selectedSpacer ).not.toBe( null );
|
47
|
-
} );
|
48
|
-
} );
|