@wordpress/e2e-tests 7.15.0 → 7.16.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
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.16.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": "^10.
|
27
|
-
"@wordpress/jest-console": "^7.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^6.
|
29
|
-
"@wordpress/scripts": "^26.
|
30
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^10.16.0",
|
27
|
+
"@wordpress/jest-console": "^7.16.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^6.16.0",
|
29
|
+
"@wordpress/scripts": "^26.16.0",
|
30
|
+
"@wordpress/url": "^3.46.0",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
33
33
|
"filenamify": "^4.2.0",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"publishConfig": {
|
46
46
|
"access": "public"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "2a00e87b57b9c27ed2b9b0fd8d423ef3cada72c1"
|
49
49
|
}
|
@@ -54,7 +54,7 @@ function gutenberg_test_register_context_blocks() {
|
|
54
54
|
$block->context['postType'],
|
55
55
|
);
|
56
56
|
|
57
|
-
return implode( ',', $ordered_context );
|
57
|
+
return '<p>' . implode( ',', $ordered_context ) . '</p>';
|
58
58
|
},
|
59
59
|
'editor_script_handles' => array( 'gutenberg-test-block-context' ),
|
60
60
|
)
|
@@ -1,87 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
createNewPost,
|
6
|
-
getOption,
|
7
|
-
insertBlock,
|
8
|
-
loginUser,
|
9
|
-
pressKeyWithModifier,
|
10
|
-
setOption,
|
11
|
-
openDocumentSettingsSidebar,
|
12
|
-
canvas,
|
13
|
-
} from '@wordpress/e2e-test-utils';
|
14
|
-
|
15
|
-
const saveEntities = async () => {
|
16
|
-
const savePostSelector = '.editor-post-publish-button__button';
|
17
|
-
const savePanelSelector = '.entities-saved-states__panel';
|
18
|
-
const entitiesSaveSelector = '.editor-entities-saved-states__save-button';
|
19
|
-
const publishPanelSelector = '.editor-post-publish-panel';
|
20
|
-
const closePanelButtonSelector =
|
21
|
-
'.editor-post-publish-panel__header-cancel-button button';
|
22
|
-
|
23
|
-
await page.click( savePostSelector );
|
24
|
-
await page.waitForSelector( savePanelSelector );
|
25
|
-
await page.click( entitiesSaveSelector );
|
26
|
-
await page.waitForSelector( publishPanelSelector );
|
27
|
-
await page.waitForSelector(
|
28
|
-
'.editor-post-publish-panel__header-cancel-button button:not([disabled])'
|
29
|
-
);
|
30
|
-
await page.click( closePanelButtonSelector );
|
31
|
-
};
|
32
|
-
|
33
|
-
describe( 'Site Title block', () => {
|
34
|
-
let originalSiteTitle, password;
|
35
|
-
const username = 'testuser';
|
36
|
-
beforeAll( async () => {
|
37
|
-
originalSiteTitle = await getOption( 'blogname' );
|
38
|
-
} );
|
39
|
-
|
40
|
-
afterAll( async () => {
|
41
|
-
await setOption( 'blogname', originalSiteTitle );
|
42
|
-
} );
|
43
|
-
|
44
|
-
it( 'Can edit the site title as admin', async () => {
|
45
|
-
await createNewPost();
|
46
|
-
await insertBlock( 'Site Title' );
|
47
|
-
const editableSiteTitleSelector =
|
48
|
-
'[aria-label="Block: Site Title"] a[contenteditable="true"]';
|
49
|
-
await canvas().waitForSelector( editableSiteTitleSelector );
|
50
|
-
await canvas().focus( editableSiteTitleSelector );
|
51
|
-
await pressKeyWithModifier( 'primary', 'a' );
|
52
|
-
|
53
|
-
await page.keyboard.type( 'New Site Title' );
|
54
|
-
|
55
|
-
await saveEntities();
|
56
|
-
|
57
|
-
const siteTitle = await getOption( 'blogname' );
|
58
|
-
expect( siteTitle ).toEqual( 'New Site Title' );
|
59
|
-
} );
|
60
|
-
|
61
|
-
// FIXME: Fix https://github.com/WordPress/gutenberg/issues/33003 and enable this test.
|
62
|
-
// I tried adding an `expect( console ).toHaveErroredWith()` as a workaround, but
|
63
|
-
// the error occurs only sporadically (e.g. locally in interactive mode, but not in
|
64
|
-
// headless mode).
|
65
|
-
it.skip( 'Cannot edit the site title as editor', async () => {
|
66
|
-
await loginUser( username, password );
|
67
|
-
|
68
|
-
await createNewPost();
|
69
|
-
await insertBlock( 'Site Title' );
|
70
|
-
|
71
|
-
await openDocumentSettingsSidebar();
|
72
|
-
|
73
|
-
const [ disableLink ] = await page.$x(
|
74
|
-
"//label[contains(text(), 'Make title link to home')]"
|
75
|
-
);
|
76
|
-
await disableLink.click();
|
77
|
-
|
78
|
-
const siteTitleSelector = '[aria-label="Block: Site Title"] span';
|
79
|
-
await page.waitForSelector( siteTitleSelector );
|
80
|
-
|
81
|
-
const editable = await page.$eval(
|
82
|
-
siteTitleSelector,
|
83
|
-
( element ) => element.contentEditable
|
84
|
-
);
|
85
|
-
expect( editable ).toBe( 'inherit' );
|
86
|
-
} );
|
87
|
-
} );
|
@@ -1,84 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
insertBlock,
|
9
|
-
saveDraft,
|
10
|
-
openPreviewPage,
|
11
|
-
} from '@wordpress/e2e-test-utils';
|
12
|
-
|
13
|
-
describe( 'Block context', () => {
|
14
|
-
beforeAll( async () => {
|
15
|
-
await activatePlugin( 'gutenberg-test-block-context' );
|
16
|
-
} );
|
17
|
-
|
18
|
-
beforeEach( async () => {
|
19
|
-
await createNewPost();
|
20
|
-
} );
|
21
|
-
|
22
|
-
afterAll( async () => {
|
23
|
-
await deactivatePlugin( 'gutenberg-test-block-context' );
|
24
|
-
} );
|
25
|
-
|
26
|
-
test( 'Block context propagates to inner blocks', async () => {
|
27
|
-
await insertBlock( 'Test Context Provider' );
|
28
|
-
|
29
|
-
// Inserting the context provider block should select the first inner
|
30
|
-
// block of the template. Verify the contents of the consumer.
|
31
|
-
let innerBlockText = await page.evaluate(
|
32
|
-
() => document.activeElement.textContent
|
33
|
-
);
|
34
|
-
expect( innerBlockText ).toBe( 'The record ID is: 0' );
|
35
|
-
|
36
|
-
// Change the attribute value associated with the context.
|
37
|
-
await page.keyboard.press( 'ArrowUp' );
|
38
|
-
await page.keyboard.type( '123' );
|
39
|
-
|
40
|
-
// Verify propagated context changes.
|
41
|
-
await page.keyboard.press( 'ArrowDown' );
|
42
|
-
innerBlockText = await page.evaluate(
|
43
|
-
() => document.activeElement.textContent
|
44
|
-
);
|
45
|
-
expect( innerBlockText ).toBe( 'The record ID is: 123' );
|
46
|
-
} );
|
47
|
-
|
48
|
-
test( 'Block context is reflected in the preview', async () => {
|
49
|
-
await insertBlock( 'Test Context Provider' );
|
50
|
-
const editorPage = page;
|
51
|
-
const previewPage = await openPreviewPage( editorPage );
|
52
|
-
await previewPage.waitForSelector( '.entry-content' );
|
53
|
-
|
54
|
-
// Check default context values are populated.
|
55
|
-
let content = await previewPage.$eval(
|
56
|
-
'.entry-content',
|
57
|
-
( contentWrapper ) => contentWrapper.textContent.trim()
|
58
|
-
);
|
59
|
-
expect( content ).toMatch( /^0,\d+,post$/ );
|
60
|
-
|
61
|
-
// Return to editor to change context value to non-default.
|
62
|
-
await editorPage.bringToFront();
|
63
|
-
await editorPage.focus(
|
64
|
-
'[data-type="gutenberg/test-context-provider"] input'
|
65
|
-
);
|
66
|
-
await editorPage.keyboard.press( 'ArrowRight' );
|
67
|
-
await editorPage.keyboard.type( '123' );
|
68
|
-
await editorPage.waitForSelector( '.editor-post-save-draft' ); // Not entirely clear why it's asynchronous, but likely React scheduling prioritizing keyboard event and deferring the UI update.
|
69
|
-
await saveDraft();
|
70
|
-
|
71
|
-
// Check non-default context values are populated.
|
72
|
-
await previewPage.bringToFront();
|
73
|
-
await previewPage.reload();
|
74
|
-
content = await previewPage.$eval(
|
75
|
-
'.entry-content',
|
76
|
-
( contentWrapper ) => contentWrapper.textContent.trim()
|
77
|
-
);
|
78
|
-
expect( content ).toMatch( /^123,\d+,post$/ );
|
79
|
-
|
80
|
-
// Clean up.
|
81
|
-
await editorPage.bringToFront();
|
82
|
-
await previewPage.close();
|
83
|
-
} );
|
84
|
-
} );
|