@wordpress/e2e-tests 2.5.9 → 3.0.1-next.33ec3857e2.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 +6 -0
- package/config/flaky-tests-reporter.js +2 -1
- package/package.json +10 -9
- package/specs/editor/blocks/__snapshots__/heading.test.js.snap +2 -2
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +27 -59
- package/specs/editor/blocks/columns.test.js +1 -1
- package/specs/editor/blocks/cover.test.js +4 -1
- package/specs/editor/blocks/heading.test.js +15 -3
- package/specs/editor/blocks/image.test.js +15 -11
- package/specs/editor/blocks/navigation.test.js +264 -370
- 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/custom-post-types.test.js +4 -3
- package/specs/editor/various/adding-patterns.test.js +1 -1
- package/specs/editor/various/block-grouping.test.js +30 -0
- 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 +1 -7
- package/specs/editor/various/format-library/__snapshots__/text-color.test.js.snap +13 -0
- package/specs/editor/various/format-library/text-color.test.js +46 -0
- 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/preview.test.js +1 -1
- package/specs/editor/various/reusable-blocks.test.js +1 -26
- package/specs/editor/various/writing-flow.test.js +8 -4
- package/specs/site-editor/document-settings.test.js +6 -6
- package/specs/site-editor/multi-entity-saving.test.js +108 -55
- package/specs/site-editor/settings-sidebar.test.js +2 -3
- package/specs/site-editor/template-part.test.js +88 -68
- package/specs/widgets/customizing-widgets.test.js +4 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 3.0.0-next.0 (2021-12-20)
|
6
|
+
|
7
|
+
### Breaking Changes
|
8
|
+
|
9
|
+
- The peer `puppeteer` dependency has been replaced with `puppeteer-core` requiring version `>=11` (see [Breaking Changes](https://github.com/puppeteer/puppeteer/releases/tag/v11.0.0), [#36040](https://github.com/WordPress/gutenberg/pull/36040)).
|
10
|
+
|
5
11
|
## 2.5.0 (2021-09-09)
|
6
12
|
|
7
13
|
### New Features
|
@@ -12,6 +12,7 @@
|
|
12
12
|
const fs = require( 'fs' ).promises;
|
13
13
|
const path = require( 'path' );
|
14
14
|
const { formatResultsErrors } = require( 'jest-message-util' );
|
15
|
+
const filenamify = require( 'filenamify' );
|
15
16
|
|
16
17
|
class FlakyTestsReporter {
|
17
18
|
constructor( globalConfig, options ) {
|
@@ -53,7 +54,7 @@ class FlakyTestsReporter {
|
|
53
54
|
);
|
54
55
|
|
55
56
|
await fs.writeFile(
|
56
|
-
`flaky-tests/${ testTitle }.json`,
|
57
|
+
`flaky-tests/${ filenamify( testTitle ) }.json`,
|
57
58
|
JSON.stringify( {
|
58
59
|
title: testTitle,
|
59
60
|
path: testPath,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.1-next.33ec3857e2.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,25 +23,26 @@
|
|
23
23
|
"node": ">=12"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^
|
27
|
-
"@wordpress/jest-console": "^4.1.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^
|
29
|
-
"@wordpress/scripts": "^
|
30
|
-
"@wordpress/url": "^3.3.
|
26
|
+
"@wordpress/e2e-test-utils": "^6.0.1-next.33ec3857e2.0",
|
27
|
+
"@wordpress/jest-console": "^4.1.2-next.33ec3857e2.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^4.0.1-next.33ec3857e2.0",
|
29
|
+
"@wordpress/scripts": "^20.0.1-next.33ec3857e2.0",
|
30
|
+
"@wordpress/url": "^3.3.2-next.33ec3857e2.0",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
33
|
+
"filenamify": "^4.2.0",
|
33
34
|
"jest-message-util": "^27.0.6",
|
35
|
+
"jest-snapshot": "^27.4.5",
|
34
36
|
"lodash": "^4.17.21",
|
35
37
|
"puppeteer-testing-library": "^0.5.0",
|
36
38
|
"uuid": "^8.3.0"
|
37
39
|
},
|
38
40
|
"peerDependencies": {
|
39
41
|
"jest": ">=26",
|
40
|
-
"
|
41
|
-
"puppeteer": ">=1.19.0"
|
42
|
+
"puppeteer-core": ">=11"
|
42
43
|
},
|
43
44
|
"publishConfig": {
|
44
45
|
"access": "public"
|
45
46
|
},
|
46
|
-
"gitHead": "
|
47
|
+
"gitHead": "51c7917ea7fac72953702f24d6daac87d99e7617"
|
47
48
|
}
|
@@ -13,8 +13,8 @@ exports[`Heading can be created by prefixing number sign and a space 1`] = `
|
|
13
13
|
`;
|
14
14
|
|
15
15
|
exports[`Heading should correctly apply custom colors 1`] = `
|
16
|
-
"<!-- wp:heading {\\"level\\":3,\\"style\\":{\\"color\\":{\\"text\\":\\"#
|
17
|
-
<h3 class=\\"has-text-color\\" id=\\"heading\\" style=\\"color:#
|
16
|
+
"<!-- wp:heading {\\"level\\":3,\\"style\\":{\\"color\\":{\\"text\\":\\"#0782f6\\"}}} -->
|
17
|
+
<h3 class=\\"has-text-color\\" id=\\"heading\\" style=\\"color:#0782f6\\">Heading</h3>
|
18
18
|
<!-- /wp:heading -->"
|
19
19
|
`;
|
20
20
|
|
@@ -1,77 +1,45 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
-
exports[`Navigation
|
4
|
-
"<!-- wp:navigation
|
5
|
-
<!-- wp:navigation-link {\\"label\\":\\"Home\\",\\"type\\":\\"custom\\",\\"url\\":\\"http://localhost:8889/\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
3
|
+
exports[`Navigation allows an empty navigation block to be created and manually populated using a mixture of internal and external links 1`] = `
|
4
|
+
"<!-- wp:navigation-link {\\"label\\":\\"WP\\",\\"url\\":\\"https://wordpress.org\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
6
5
|
|
7
|
-
<!-- wp:navigation-
|
8
|
-
|
9
|
-
<!-- /wp:navigation-submenu -->
|
6
|
+
<!-- wp:navigation-link {\\"label\\":\\"Contact\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"https://this/is/a/test/search/get-in-touch\\",\\"kind\\":\\"post-type\\",\\"isTopLevelLink\\":true} /-->"
|
7
|
+
`;
|
10
8
|
|
11
|
-
|
12
|
-
<!-- wp:navigation-
|
13
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"In consectetur repellendus eveniet maiores aperiam\\",\\"type\\":\\"page\\",\\"id\\":15,\\"url\\":\\"http://localhost:8889/?page_id=15\\",\\"kind\\":\\"post-type\\",\\"isTopLevelItem\\":false} -->
|
14
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"Mollitia maiores consequatur ea dolorem blanditiis\\",\\"type\\":\\"page\\",\\"id\\":45,\\"url\\":\\"http://localhost:8889/?page_id=45\\",\\"kind\\":\\"post-type\\",\\"isTopLevelItem\\":false} -->
|
15
|
-
<!-- wp:navigation-link {\\"label\\":\\"Necessitatibus nisi qui qui necessitatibus quaerat possimus\\",\\"type\\":\\"page\\",\\"id\\":27,\\"url\\":\\"http://localhost:8889/?page_id=27\\",\\"kind\\":\\"post-type\\",\\"isTopLevelLink\\":false} /-->
|
16
|
-
<!-- /wp:navigation-submenu -->
|
17
|
-
<!-- /wp:navigation-submenu -->
|
18
|
-
<!-- /wp:navigation-submenu -->
|
19
|
-
<!-- /wp:navigation-submenu -->
|
9
|
+
exports[`Navigation encodes URL when create block if needed 1`] = `
|
10
|
+
"<!-- wp:navigation-link {\\"label\\":\\"wordpress.org/шеллы\\",\\"url\\":\\"https://wordpress.org/%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
20
11
|
|
21
|
-
<!-- wp:navigation-link {\\"label\\":\\"
|
12
|
+
<!-- wp:navigation-link {\\"label\\":\\"お問い合わせ\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"https://this/is/a/test/search/%E3%81%8A%E5%95%8F%E3%81%84%E5%90%88%E3%82%8F%E3%81%9B\\",\\"kind\\":\\"post-type\\",\\"isTopLevelLink\\":true} /-->"
|
13
|
+
`;
|
22
14
|
|
23
|
-
|
15
|
+
exports[`Navigation placeholder allows a navigation block to be created from existing menus 1`] = `
|
16
|
+
"<!-- wp:navigation-link {\\"label\\":\\"Home\\",\\"type\\":\\"custom\\",\\"url\\":\\"http://localhost:8889/\\",\\"kind\\":\\"custom\\"} /-->
|
24
17
|
|
25
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"
|
26
|
-
<!-- wp:navigation-
|
27
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"Et quas a et mollitia et voluptas optio voluptate quia quo unde aut in nostrum iste impedit quisquam id aut\\",\\"type\\":\\"category\\",\\"description\\":\\"Quas sit labore earum omnis eos sint iste est possimus harum aut soluta sint optio quos distinctio inventore voluptate non ut aliquam ad ut voluptates fugiat numquam magnam modi repellendus modi laudantium et debitis officia est voluptatum quidem unde molestiae animi vero fuga accusamus nam\\",\\"id\\":6,\\"url\\":\\"http://localhost:8889/?cat=6\\",\\"kind\\":\\"taxonomy\\",\\"isTopLevelItem\\":false} -->
|
28
|
-
<!-- wp:navigation-link {\\"label\\":\\"Illo quis sit impedit itaque expedita earum deserunt magni doloremque velit eum id error\\",\\"type\\":\\"category\\",\\"description\\":\\"Doloremque vero sunt officiis iste voluptatibus voluptas molestiae sint asperiores recusandae amet praesentium et explicabo nesciunt similique voluptatum laudantium amet officiis quas distinctio quis enim nihil tempora\\",\\"id\\":16,\\"url\\":\\"http://localhost:8889/?cat=16\\",\\"kind\\":\\"taxonomy\\",\\"isTopLevelLink\\":false} /-->
|
29
|
-
<!-- /wp:navigation-submenu -->
|
30
|
-
<!-- /wp:navigation-submenu -->
|
18
|
+
<!-- wp:navigation-submenu {\\"label\\":\\"About\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} -->
|
19
|
+
<!-- wp:navigation-link {\\"label\\":\\"Our team\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
31
20
|
<!-- /wp:navigation-submenu -->
|
32
21
|
|
33
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"
|
34
|
-
<!-- wp:navigation-
|
35
|
-
<!--
|
36
|
-
<!-- /wp:navigation -->"
|
37
|
-
`;
|
38
|
-
|
39
|
-
exports[`Navigation Creating from existing Menus creates an empty navigation block when the selected existing menu is also empty 1`] = `"<!-- wp:navigation /-->"`;
|
40
|
-
|
41
|
-
exports[`Navigation Creating from existing Pages allows a navigation block to be created using existing pages 1`] = `
|
42
|
-
"<!-- wp:navigation -->
|
43
|
-
<!-- wp:page-list /-->
|
44
|
-
<!-- /wp:navigation -->"
|
45
|
-
`;
|
22
|
+
<!-- wp:navigation-submenu {\\"label\\":\\"Shop\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} -->
|
23
|
+
<!-- wp:navigation-submenu {\\"label\\":\\"Winter apparel\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} -->
|
24
|
+
<!-- wp:navigation-link {\\"label\\":\\"Chunky socks\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
46
25
|
|
47
|
-
|
48
|
-
"<!-- wp:navigation -->
|
49
|
-
<!-- wp:navigation-link {\\"label\\":\\"WP\\",\\"url\\":\\"https://wordpress.org\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
26
|
+
<!-- wp:navigation-link {\\"label\\":\\"Hideous hats\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
50
27
|
|
51
|
-
<!-- wp:
|
28
|
+
<!-- wp:navigation-link {\\"label\\":\\"Glorious gloves\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
52
29
|
|
53
|
-
<!-- wp:navigation-link {\\"label\\":\\"
|
54
|
-
<!-- /wp:navigation -->
|
55
|
-
|
30
|
+
<!-- wp:navigation-link {\\"label\\":\\"Jazzy Jumpers\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
31
|
+
<!-- /wp:navigation-submenu -->
|
32
|
+
<!-- /wp:navigation-submenu -->
|
56
33
|
|
57
|
-
|
58
|
-
"<!-- wp:navigation -->
|
59
|
-
<!-- wp:navigation-link {\\"label\\":\\"WP\\",\\"url\\":\\"https://wordpress.org\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
34
|
+
<!-- wp:navigation-link {\\"label\\":\\"Shipping\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
60
35
|
|
61
|
-
<!-- wp:navigation-link {\\"label\\":\\"Contact\\",\\"type\\":\\"page\\",\\"id\\":
|
62
|
-
<!-- /wp:navigation -->"
|
63
|
-
`;
|
36
|
+
<!-- wp:navigation-link {\\"label\\":\\"Contact Us\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
64
37
|
|
65
|
-
|
66
|
-
|
67
|
-
<!-- wp:navigation-
|
68
|
-
<!-- /wp:navigation -->"
|
38
|
+
<!-- wp:navigation-submenu {\\"label\\":\\"WordPress.org\\",\\"type\\":\\"custom\\",\\"url\\":\\"https://wordpress.org\\",\\"kind\\":\\"custom\\"} -->
|
39
|
+
<!-- wp:navigation-link {\\"label\\":\\"Google\\",\\"type\\":\\"custom\\",\\"url\\":\\"https://google.com\\",\\"kind\\":\\"custom\\"} /-->
|
40
|
+
<!-- /wp:navigation-submenu -->"
|
69
41
|
`;
|
70
42
|
|
71
|
-
exports[`Navigation
|
72
|
-
"<!-- wp:navigation -->
|
73
|
-
<!-- wp:navigation-link {\\"label\\":\\"wordpress.org/шеллы\\",\\"url\\":\\"https://wordpress.org/%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
43
|
+
exports[`Navigation placeholder allows a navigation block to be created using existing pages 1`] = `"<!-- wp:page-list /-->"`;
|
74
44
|
|
75
|
-
|
76
|
-
<!-- /wp:navigation -->"
|
77
|
-
`;
|
45
|
+
exports[`Navigation placeholder creates an empty navigation block when the selected existing menu is also empty 1`] = `""`;
|
@@ -21,7 +21,7 @@ describe( 'Columns', () => {
|
|
21
21
|
await page.click( '.edit-post-header-toolbar__list-view-toggle' );
|
22
22
|
const columnBlockMenuItem = (
|
23
23
|
await page.$x(
|
24
|
-
'//
|
24
|
+
'//a[contains(concat(" ", @class, " "), " block-editor-list-view-block-select-button ")][text()="Column"]'
|
25
25
|
)
|
26
26
|
)[ 0 ];
|
27
27
|
await columnBlockMenuItem.click();
|
@@ -131,7 +131,7 @@ describe( 'Cover', () => {
|
|
131
131
|
// Select the cover block.By default the child paragraph gets selected.
|
132
132
|
await page.click( '.edit-post-header-toolbar__list-view-toggle' );
|
133
133
|
await page.click(
|
134
|
-
'.block-editor-list-view-block__contents-container
|
134
|
+
'.block-editor-list-view-block__contents-container a'
|
135
135
|
);
|
136
136
|
|
137
137
|
const heightInput = (
|
@@ -197,6 +197,9 @@ describe( 'Cover', () => {
|
|
197
197
|
await insertBlock( 'Image' );
|
198
198
|
// Upload image and transform to the Cover block
|
199
199
|
await upload( '.wp-block-image' );
|
200
|
+
// Click the block wrapper before trying to convert to make sure figcaption toolbar is not obscuring
|
201
|
+
// the block toolbar.
|
202
|
+
await page.click( '.wp-block-image' );
|
200
203
|
await transformBlockTo( 'Cover' );
|
201
204
|
|
202
205
|
// Get the block's background dim color and its opacity
|
@@ -9,6 +9,8 @@ import {
|
|
9
9
|
} from '@wordpress/e2e-test-utils';
|
10
10
|
|
11
11
|
describe( 'Heading', () => {
|
12
|
+
const COLOR_ITEM_SELECTOR =
|
13
|
+
'.block-editor-panel-color-gradient-settings__item';
|
12
14
|
const CUSTOM_COLOR_BUTTON_X_SELECTOR = `.components-color-palette__custom-color`;
|
13
15
|
const CUSTOM_COLOR_DETAILS_BUTTON_SELECTOR =
|
14
16
|
'.components-color-picker button[aria-label="Show detailed inputs"]';
|
@@ -76,6 +78,11 @@ describe( 'Heading', () => {
|
|
76
78
|
);
|
77
79
|
await colorPanelToggle.click();
|
78
80
|
|
81
|
+
const textColorButton = await page.waitForSelector(
|
82
|
+
COLOR_ITEM_SELECTOR
|
83
|
+
);
|
84
|
+
await textColorButton.click();
|
85
|
+
|
79
86
|
const customTextColorButton = await page.waitForSelector(
|
80
87
|
CUSTOM_COLOR_BUTTON_X_SELECTOR
|
81
88
|
);
|
@@ -85,9 +92,9 @@ describe( 'Heading', () => {
|
|
85
92
|
await page.waitForSelector( COLOR_INPUT_FIELD_SELECTOR );
|
86
93
|
await page.click( COLOR_INPUT_FIELD_SELECTOR );
|
87
94
|
await pressKeyWithModifier( 'primary', 'A' );
|
88
|
-
await page.keyboard.type( '
|
95
|
+
await page.keyboard.type( '0782f6' );
|
89
96
|
await page.click( 'h3[data-type="core/heading"]' );
|
90
|
-
await page.waitForXPath( '//button[text()="#
|
97
|
+
await page.waitForXPath( '//button[text()="#0782f6"]' );
|
91
98
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
92
99
|
} );
|
93
100
|
|
@@ -99,13 +106,18 @@ describe( 'Heading', () => {
|
|
99
106
|
);
|
100
107
|
await colorPanelToggle.click();
|
101
108
|
|
109
|
+
const textColorButton = await page.waitForSelector(
|
110
|
+
COLOR_ITEM_SELECTOR
|
111
|
+
);
|
112
|
+
await textColorButton.click();
|
113
|
+
|
102
114
|
const colorButtonSelector = `//button[@aria-label='Color: Luminous vivid orange']`;
|
103
115
|
const [ colorButton ] = await page.$x( colorButtonSelector );
|
104
116
|
await colorButton.click();
|
105
|
-
await page.click( 'h2[data-type="core/heading"]' );
|
106
117
|
await page.waitForXPath(
|
107
118
|
`${ colorButtonSelector }[@aria-pressed='true']`
|
108
119
|
);
|
120
|
+
await page.click( 'h2[data-type="core/heading"]' );
|
109
121
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
110
122
|
} );
|
111
123
|
} );
|
@@ -74,7 +74,7 @@ describe( 'Image', () => {
|
|
74
74
|
expect( await getEditedPostContent() ).toMatch( regex );
|
75
75
|
} );
|
76
76
|
|
77
|
-
it
|
77
|
+
it( 'should replace, reset size, and keep selection', async () => {
|
78
78
|
await insertBlock( 'Image' );
|
79
79
|
const filename1 = await upload( '.wp-block-image input[type="file"]' );
|
80
80
|
await waitForImage( filename1 );
|
@@ -103,8 +103,9 @@ describe( 'Image', () => {
|
|
103
103
|
`<!-- wp:image {"id":\\d+,"sizeSlug":"full","linkDestination":"none"} -->\\s*<figure class="wp-block-image size-full"><img src="[^"]+\\/${ filename2 }\\.png" alt="" class="wp-image-\\d+"/></figure>\\s*<!-- \\/wp:image -->`
|
104
104
|
);
|
105
105
|
expect( await getEditedPostContent() ).toMatch( regex3 );
|
106
|
-
|
107
|
-
|
106
|
+
// For some reason just clicking the block wrapper causes figcaption to get focus
|
107
|
+
// in puppeteer but not in live browser, so clicking on the image wrapper div here instead.
|
108
|
+
await page.click( '.wp-block-image > div' );
|
108
109
|
await page.keyboard.press( 'Backspace' );
|
109
110
|
|
110
111
|
expect( await getEditedPostContent() ).toBe( '' );
|
@@ -314,9 +315,13 @@ describe( 'Image', () => {
|
|
314
315
|
|
315
316
|
// Upload an initial image.
|
316
317
|
const filename = await upload( '.wp-block-image input[type="file"]' );
|
317
|
-
|
318
|
+
await waitForImage( filename );
|
318
319
|
// Resize the Uploaded Image.
|
319
320
|
await openDocumentSettingsSidebar();
|
321
|
+
await page.waitForSelector(
|
322
|
+
'[aria-label="Image size presets"] button:first-child',
|
323
|
+
{ visible: true }
|
324
|
+
);
|
320
325
|
await page.click(
|
321
326
|
'[aria-label="Image size presets"] button:first-child'
|
322
327
|
);
|
@@ -337,15 +342,14 @@ describe( 'Image', () => {
|
|
337
342
|
await editButton.click();
|
338
343
|
|
339
344
|
await page.waitForSelector( '.block-editor-url-input__input' );
|
340
|
-
await page.evaluate(
|
341
|
-
() =>
|
342
|
-
( document.querySelector(
|
343
|
-
'.block-editor-url-input__input'
|
344
|
-
).value = '' )
|
345
|
-
);
|
346
345
|
|
346
|
+
// Clear the input field. Delay added to account for typing delays.
|
347
|
+
const inputField = await page.$( '.block-editor-url-input__input' );
|
348
|
+
await inputField.click( { clickCount: 3, delay: 200 } );
|
349
|
+
|
350
|
+
// Replace the url. Delay added to account for typing delays.
|
347
351
|
await page.focus( '.block-editor-url-input__input' );
|
348
|
-
await page.keyboard.type( imageUrl );
|
352
|
+
await page.keyboard.type( imageUrl, { delay: 100 } );
|
349
353
|
await page.click( '.block-editor-link-control__search-submit' );
|
350
354
|
|
351
355
|
const regexAfter = new RegExp(
|