@wordpress/e2e-tests 5.3.0 → 5.4.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 +2 -0
- package/package.json +7 -7
- package/specs/editor/blocks/gallery.test.js +2 -1
- package/specs/editor/various/block-switcher.test.js +2 -2
- package/specs/editor/various/splitting-merging.test.js +27 -3
- package/specs/site-editor/multi-entity-saving.test.js +1 -1
- package/specs/site-editor/settings-sidebar.test.js +2 -2
- package/specs/site-editor/site-editor-inserter.test.js +2 -2
- package/plugins/nonce.php +0 -16
- package/specs/editor/plugins/nonce.test.js +0 -34
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.4.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": ">=14"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^8.
|
27
|
-
"@wordpress/jest-console": "^6.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^5.
|
29
|
-
"@wordpress/scripts": "^24.
|
30
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^8.4.0",
|
27
|
+
"@wordpress/jest-console": "^6.3.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^5.3.0",
|
29
|
+
"@wordpress/scripts": "^24.4.0",
|
30
|
+
"@wordpress/url": "^3.21.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": "a2ff0e6471c88436dad0287beb88d1729aa6f5dd"
|
50
50
|
}
|
@@ -16,6 +16,7 @@ import {
|
|
16
16
|
clickButton,
|
17
17
|
openListView,
|
18
18
|
getListViewBlocks,
|
19
|
+
clickBlockToolbarButton,
|
19
20
|
} from '@wordpress/e2e-test-utils';
|
20
21
|
|
21
22
|
async function upload( selector ) {
|
@@ -110,7 +111,7 @@ describe( 'Gallery', () => {
|
|
110
111
|
|
111
112
|
const imageListLink = ( await getListViewBlocks( 'Image' ) )[ 0 ];
|
112
113
|
await imageListLink.click();
|
113
|
-
|
114
|
+
await clickBlockToolbarButton( 'Caption' );
|
114
115
|
const captionElement = await figureElement.$(
|
115
116
|
'.block-editor-rich-text__editable'
|
116
117
|
);
|
@@ -82,9 +82,9 @@ describe( 'Block Switcher', () => {
|
|
82
82
|
await pressKeyWithModifier( 'alt', 'F10' );
|
83
83
|
|
84
84
|
// Verify the block switcher exists.
|
85
|
-
expect( await hasBlockSwitcher() ).
|
85
|
+
expect( await hasBlockSwitcher() ).toBeTruthy();
|
86
86
|
// Verify the correct block transforms appear.
|
87
|
-
expect( await getAvailableBlockTransforms() ).toHaveLength(
|
87
|
+
expect( await getAvailableBlockTransforms() ).toHaveLength( 1 );
|
88
88
|
} );
|
89
89
|
|
90
90
|
describe( 'Conditional tranformation options', () => {
|
@@ -236,6 +236,20 @@ describe( 'splitting and merging blocks', () => {
|
|
236
236
|
await page.keyboard.press( 'Enter' );
|
237
237
|
await page.keyboard.type( 'item 2' );
|
238
238
|
await pressKeyTimes( 'ArrowUp', 3 );
|
239
|
+
await page.keyboard.press( 'Delete' );
|
240
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
241
|
+
"<!-- wp:paragraph -->
|
242
|
+
<p>hi</p>
|
243
|
+
<!-- /wp:paragraph -->
|
244
|
+
|
245
|
+
<!-- wp:paragraph -->
|
246
|
+
<p>item 1</p>
|
247
|
+
<!-- /wp:paragraph -->
|
248
|
+
|
249
|
+
<!-- wp:paragraph -->
|
250
|
+
<p>item 2</p>
|
251
|
+
<!-- /wp:paragraph -->"
|
252
|
+
` );
|
239
253
|
await page.keyboard.press( 'Delete' );
|
240
254
|
// Carret should be in the first block and at the proper position.
|
241
255
|
await page.keyboard.type( '-' );
|
@@ -259,15 +273,25 @@ describe( 'splitting and merging blocks', () => {
|
|
259
273
|
await page.keyboard.press( 'ArrowUp' );
|
260
274
|
await pressKeyTimes( 'ArrowLeft', 6 );
|
261
275
|
await page.keyboard.press( 'Backspace' );
|
262
|
-
// Carret should be in the first block and at the proper position.
|
263
|
-
await page.keyboard.type( '-' );
|
264
276
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
265
277
|
"<!-- wp:paragraph -->
|
266
278
|
<p>hi</p>
|
267
279
|
<!-- /wp:paragraph -->
|
268
280
|
|
269
281
|
<!-- wp:paragraph -->
|
270
|
-
<p
|
282
|
+
<p>item 1</p>
|
283
|
+
<!-- /wp:paragraph -->
|
284
|
+
|
285
|
+
<!-- wp:paragraph -->
|
286
|
+
<p>item 2</p>
|
287
|
+
<!-- /wp:paragraph -->"
|
288
|
+
` );
|
289
|
+
await page.keyboard.press( 'Backspace' );
|
290
|
+
// Carret should be in the first block and at the proper position.
|
291
|
+
await page.keyboard.type( '-' );
|
292
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
293
|
+
"<!-- wp:paragraph -->
|
294
|
+
<p>hi-item 1</p>
|
271
295
|
<!-- /wp:paragraph -->
|
272
296
|
|
273
297
|
<!-- wp:paragraph -->
|
@@ -266,7 +266,7 @@ describe( 'Multi-entity save flow', () => {
|
|
266
266
|
} );
|
267
267
|
|
268
268
|
// Select the header template part via list view.
|
269
|
-
await page.click( '.edit-site-header-
|
269
|
+
await page.click( '.edit-site-header-edit-mode__list-view-toggle' );
|
270
270
|
const headerTemplatePartListViewButton = await page.waitForXPath(
|
271
271
|
'//a[contains(@class, "block-editor-list-view-block-select-button")][contains(., "header")]'
|
272
272
|
);
|
@@ -12,13 +12,13 @@ import {
|
|
12
12
|
|
13
13
|
async function toggleSidebar() {
|
14
14
|
await page.click(
|
15
|
-
'.edit-site-
|
15
|
+
'.edit-site-header-edit-mode__actions button[aria-label="Settings"]'
|
16
16
|
);
|
17
17
|
}
|
18
18
|
|
19
19
|
async function getActiveTabLabel() {
|
20
20
|
return await page.$eval(
|
21
|
-
'.edit-site-
|
21
|
+
'.edit-site-sidebar-edit-mode__panel-tab.is-active',
|
22
22
|
( element ) => element.getAttribute( 'aria-label' )
|
23
23
|
);
|
24
24
|
}
|
@@ -21,11 +21,11 @@ describe( 'Site Editor Inserter', () => {
|
|
21
21
|
} );
|
22
22
|
|
23
23
|
it( 'inserter toggle button should toggle global inserter', async () => {
|
24
|
-
await page.click( '.edit-site-header-
|
24
|
+
await page.click( '.edit-site-header-edit-mode__inserter-toggle' );
|
25
25
|
await page.waitForSelector( '.edit-site-editor__inserter-panel', {
|
26
26
|
visible: true,
|
27
27
|
} );
|
28
|
-
await page.click( '.edit-site-header-
|
28
|
+
await page.click( '.edit-site-header-edit-mode__inserter-toggle' );
|
29
29
|
await page.waitForSelector( '.edit-site-editor__inserter-panel', {
|
30
30
|
hidden: true,
|
31
31
|
} );
|
package/plugins/nonce.php
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
/**
|
3
|
-
* Plugin Name: Gutenberg Test Plugin, Nonce
|
4
|
-
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
-
* Author: Gutenberg Team
|
6
|
-
*
|
7
|
-
* @package gutenberg-test-plugin-nonce
|
8
|
-
*/
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Returns the nonce life time.
|
12
|
-
*/
|
13
|
-
function gutenberg_test_plugin_nonce_life() {
|
14
|
-
return 5;
|
15
|
-
}
|
16
|
-
add_filter( 'nonce_life', 'gutenberg_test_plugin_nonce_life' );
|
@@ -1,34 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
saveDraft,
|
9
|
-
} from '@wordpress/e2e-test-utils';
|
10
|
-
|
11
|
-
describe( 'Nonce', () => {
|
12
|
-
// While using beforeEach/afterEach is suboptimal for multiple tests, they
|
13
|
-
// are used here to ensure that the nonce plugin doesn't interfere with API
|
14
|
-
// calls made in global before/after calls, which may perform API requests.
|
15
|
-
beforeEach( async () => {
|
16
|
-
await activatePlugin( 'gutenberg-test-plugin-nonce' );
|
17
|
-
} );
|
18
|
-
afterEach( async () => {
|
19
|
-
await deactivatePlugin( 'gutenberg-test-plugin-nonce' );
|
20
|
-
} );
|
21
|
-
|
22
|
-
it( 'should refresh when expired', async () => {
|
23
|
-
await createNewPost();
|
24
|
-
await page.keyboard.press( 'Enter' );
|
25
|
-
// eslint-disable-next-line no-restricted-syntax
|
26
|
-
await page.waitForTimeout( 5000 );
|
27
|
-
await page.keyboard.type( 'test' );
|
28
|
-
// `saveDraft` waits for saving to be successful, so this test would
|
29
|
-
// timeout if it's not.
|
30
|
-
await saveDraft();
|
31
|
-
// We expect a 403 status once.
|
32
|
-
expect( console ).toHaveErrored();
|
33
|
-
} );
|
34
|
-
} );
|