@wordpress/e2e-test-utils-playwright 1.32.0 → 1.32.1-next.ff1cebbba.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/build/admin/create-new-post.js +46 -28
- package/build/admin/create-new-post.js.map +7 -1
- package/build/admin/edit-post.js +35 -17
- package/build/admin/edit-post.js.map +7 -1
- package/build/admin/get-page-error.js +30 -22
- package/build/admin/get-page-error.js.map +7 -1
- package/build/admin/index.js +54 -34
- package/build/admin/index.js.map +7 -1
- package/build/admin/visit-admin-page.js +42 -29
- package/build/admin/visit-admin-page.js.map +7 -1
- package/build/admin/visit-site-editor.js +71 -64
- package/build/admin/visit-site-editor.js.map +7 -1
- package/build/config.js +40 -10
- package/build/config.js.map +7 -1
- package/build/editor/click-block-options-menu-item.js +29 -14
- package/build/editor/click-block-options-menu-item.js.map +7 -1
- package/build/editor/click-block-toolbar-button.js +33 -13
- package/build/editor/click-block-toolbar-button.js.map +7 -1
- package/build/editor/get-blocks.js +59 -43
- package/build/editor/get-blocks.js.map +7 -1
- package/build/editor/get-edited-post-content.js +31 -12
- package/build/editor/get-edited-post-content.js.map +7 -1
- package/build/editor/index.js +92 -72
- package/build/editor/index.js.map +7 -1
- package/build/editor/insert-block.js +50 -21
- package/build/editor/insert-block.js.map +7 -1
- package/build/editor/open-document-settings-sidebar.js +37 -24
- package/build/editor/open-document-settings-sidebar.js.map +7 -1
- package/build/editor/preview.js +37 -18
- package/build/editor/preview.js.map +7 -1
- package/build/editor/publish-post.js +42 -42
- package/build/editor/publish-post.js.map +7 -1
- package/build/editor/save-draft.js +29 -15
- package/build/editor/save-draft.js.map +7 -1
- package/build/editor/select-blocks.js +46 -25
- package/build/editor/select-blocks.js.map +7 -1
- package/build/editor/set-content.js +34 -14
- package/build/editor/set-content.js.map +7 -1
- package/build/editor/set-is-fixed-toolbar.js +31 -15
- package/build/editor/set-is-fixed-toolbar.js.map +7 -1
- package/build/editor/set-preferences.js +38 -18
- package/build/editor/set-preferences.js.map +7 -1
- package/build/editor/show-block-toolbar.js +30 -16
- package/build/editor/show-block-toolbar.js.map +7 -1
- package/build/editor/site-editor.js +46 -41
- package/build/editor/site-editor.js.map +7 -1
- package/build/editor/switch-editor-tool.js +42 -30
- package/build/editor/switch-editor-tool.js.map +7 -1
- package/build/editor/switch-to-legacy-canvas.js +33 -14
- package/build/editor/switch-to-legacy-canvas.js.map +7 -1
- package/build/editor/transform-block-to.js +41 -21
- package/build/editor/transform-block-to.js.map +7 -1
- package/build/index.js +50 -32
- package/build/index.js.map +7 -1
- package/build/lighthouse/index.js +89 -53
- package/build/lighthouse/index.js.map +7 -1
- package/build/metrics/index.js +298 -249
- package/build/metrics/index.js.map +7 -1
- package/build/page-utils/drag-files.js +134 -112
- package/build/page-utils/drag-files.js.map +7 -1
- package/build/page-utils/emulate-network-conditions.js +92 -66
- package/build/page-utils/emulate-network-conditions.js.map +7 -1
- package/build/page-utils/index.js +54 -34
- package/build/page-utils/index.js.map +7 -1
- package/build/page-utils/is-current-url.js +31 -18
- package/build/page-utils/is-current-url.js.map +7 -1
- package/build/page-utils/keycodes.js +51 -39
- package/build/page-utils/keycodes.js.map +7 -1
- package/build/page-utils/press-keys.js +148 -127
- package/build/page-utils/press-keys.js.map +7 -1
- package/build/page-utils/set-browser-viewport.js +32 -41
- package/build/page-utils/set-browser-viewport.js.map +7 -1
- package/build/request-utils/blocks.js +49 -40
- package/build/request-utils/blocks.js.map +7 -1
- package/build/request-utils/comments.js +57 -45
- package/build/request-utils/comments.js.map +7 -1
- package/build/request-utils/gutenberg-experiments.js +48 -26
- package/build/request-utils/gutenberg-experiments.js.map +7 -1
- package/build/request-utils/index.js +187 -153
- package/build/request-utils/index.js.map +7 -1
- package/build/request-utils/login.js +43 -18
- package/build/request-utils/login.js.map +7 -1
- package/build/request-utils/media.js +72 -64
- package/build/request-utils/media.js.map +7 -1
- package/build/request-utils/menus.js +119 -109
- package/build/request-utils/menus.js.map +7 -1
- package/build/request-utils/pages.js +60 -49
- package/build/request-utils/pages.js.map +7 -1
- package/build/request-utils/patterns.js +39 -24
- package/build/request-utils/patterns.js.map +7 -1
- package/build/request-utils/plugins.js +68 -74
- package/build/request-utils/plugins.js.map +7 -1
- package/build/request-utils/posts.js +52 -39
- package/build/request-utils/posts.js.map +7 -1
- package/build/request-utils/preferences.js +36 -17
- package/build/request-utils/preferences.js.map +7 -1
- package/build/request-utils/rest.js +153 -129
- package/build/request-utils/rest.js.map +7 -1
- package/build/request-utils/site-settings.js +38 -28
- package/build/request-utils/site-settings.js.map +7 -1
- package/build/request-utils/templates.js +57 -45
- package/build/request-utils/templates.js.map +7 -1
- package/build/request-utils/themes.js +78 -53
- package/build/request-utils/themes.js.map +7 -1
- package/build/request-utils/users.js +72 -72
- package/build/request-utils/users.js.map +7 -1
- package/build/request-utils/widgets.js +71 -55
- package/build/request-utils/widgets.js.map +7 -1
- package/build/test.js +128 -146
- package/build/test.js.map +7 -1
- package/build/types.js +16 -2
- package/build/types.js.map +7 -1
- package/package.json +6 -2
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var create_new_post_exports = {};
|
|
20
|
+
__export(create_new_post_exports, {
|
|
21
|
+
createNewPost: () => createNewPost
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(create_new_post_exports);
|
|
10
24
|
async function createNewPost(options = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const query = new URLSearchParams();
|
|
26
|
+
const { postType, title, content, excerpt } = options;
|
|
27
|
+
if (postType) {
|
|
28
|
+
query.set("post_type", postType);
|
|
29
|
+
}
|
|
30
|
+
if (title) {
|
|
31
|
+
query.set("post_title", title);
|
|
32
|
+
}
|
|
33
|
+
if (content) {
|
|
34
|
+
query.set("content", content);
|
|
35
|
+
}
|
|
36
|
+
if (excerpt) {
|
|
37
|
+
query.set("excerpt", excerpt);
|
|
38
|
+
}
|
|
39
|
+
await this.visitAdminPage("post-new.php", query.toString());
|
|
40
|
+
await this.editor.setPreferences("core/edit-post", {
|
|
41
|
+
welcomeGuide: options.showWelcomeGuide ?? false,
|
|
42
|
+
fullscreenMode: options.fullscreenMode ?? false
|
|
43
|
+
});
|
|
30
44
|
}
|
|
31
|
-
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
createNewPost
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=create-new-post.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/admin/create-new-post.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\ninterface NewPostOptions {\n\tpostType?: string;\n\ttitle?: string;\n\tcontent?: string;\n\texcerpt?: string;\n\tshowWelcomeGuide?: boolean;\n\tfullscreenMode?: boolean;\n}\n\n/**\n * Creates new post.\n *\n * @param this\n * @param options Options to create new post.\n */\nexport async function createNewPost(\n\tthis: Admin,\n\toptions: NewPostOptions = {}\n) {\n\tconst query = new URLSearchParams();\n\tconst { postType, title, content, excerpt } = options;\n\n\tif ( postType ) {\n\t\tquery.set( 'post_type', postType );\n\t}\n\tif ( title ) {\n\t\tquery.set( 'post_title', title );\n\t}\n\tif ( content ) {\n\t\tquery.set( 'content', content );\n\t}\n\tif ( excerpt ) {\n\t\tquery.set( 'excerpt', excerpt );\n\t}\n\n\tawait this.visitAdminPage( 'post-new.php', query.toString() );\n\n\tawait this.editor.setPreferences( 'core/edit-post', {\n\t\twelcomeGuide: options.showWelcomeGuide ?? false,\n\t\tfullscreenMode: options.fullscreenMode ?? false,\n\t} );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,eAAsB,cAErB,UAA0B,CAAC,GAC1B;AACD,QAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAM,EAAE,UAAU,OAAO,SAAS,QAAQ,IAAI;AAE9C,MAAK,UAAW;AACf,UAAM,IAAK,aAAa,QAAS;AAAA,EAClC;AACA,MAAK,OAAQ;AACZ,UAAM,IAAK,cAAc,KAAM;AAAA,EAChC;AACA,MAAK,SAAU;AACd,UAAM,IAAK,WAAW,OAAQ;AAAA,EAC/B;AACA,MAAK,SAAU;AACd,UAAM,IAAK,WAAW,OAAQ;AAAA,EAC/B;AAEA,QAAM,KAAK,eAAgB,gBAAgB,MAAM,SAAS,CAAE;AAE5D,QAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,IACnD,cAAc,QAAQ,oBAAoB;AAAA,IAC1C,gBAAgB,QAAQ,kBAAkB;AAAA,EAC3C,CAAE;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/admin/edit-post.js
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var edit_post_exports = {};
|
|
20
|
+
__export(edit_post_exports, {
|
|
21
|
+
editPost: () => editPost
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(edit_post_exports);
|
|
10
24
|
async function editPost(postId) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
const query = new URLSearchParams();
|
|
26
|
+
query.set("post", String(postId));
|
|
27
|
+
query.set("action", "edit");
|
|
28
|
+
await this.visitAdminPage("post.php", query.toString());
|
|
29
|
+
await this.editor.setPreferences("core/edit-post", {
|
|
30
|
+
welcomeGuide: false,
|
|
31
|
+
fullscreenMode: false
|
|
32
|
+
});
|
|
19
33
|
}
|
|
20
|
-
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
editPost
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=edit-post.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/admin/edit-post.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from '.';\n\n/**\n * Open the post with given ID in the editor.\n *\n * @param this\n * @param postId Post ID to visit.\n */\nexport async function editPost( this: Admin, postId: string | number ) {\n\tconst query = new URLSearchParams();\n\n\tquery.set( 'post', String( postId ) );\n\tquery.set( 'action', 'edit' );\n\n\tawait this.visitAdminPage( 'post.php', query.toString() );\n\n\tawait this.editor.setPreferences( 'core/edit-post', {\n\t\twelcomeGuide: false,\n\t\tfullscreenMode: false,\n\t} );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,eAAsB,SAAuB,QAA0B;AACtE,QAAM,QAAQ,IAAI,gBAAgB;AAElC,QAAM,IAAK,QAAQ,OAAQ,MAAO,CAAE;AACpC,QAAM,IAAK,UAAU,MAAO;AAE5B,QAAM,KAAK,eAAgB,YAAY,MAAM,SAAS,CAAE;AAExD,QAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,IACnD,cAAc;AAAA,IACd,gBAAgB;AAAA,EACjB,CAAE;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_page_error_exports = {};
|
|
20
|
+
__export(get_page_error_exports, {
|
|
21
|
+
getPageError: () => getPageError
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(get_page_error_exports);
|
|
9
24
|
const REGEXP_PHP_ERROR = /(<b>)?(Fatal error|Recoverable fatal error|Warning|Parse error|Notice|Strict Standards|Deprecated|Unknown error)(<\/b>)?: (.*?) in (.*?) on line (<b>)?\d+(<\/b>)?/;
|
|
10
|
-
/**
|
|
11
|
-
* Returns a promise resolving to one of either a string or null. A string will
|
|
12
|
-
* be resolved if an error message is present in the contents of the page. If no
|
|
13
|
-
* error is present, a null value will be resolved instead. This requires the
|
|
14
|
-
* environment be configured to display errors.
|
|
15
|
-
*
|
|
16
|
-
* @see http://php.net/manual/en/function.error-reporting.php
|
|
17
|
-
*
|
|
18
|
-
* @param this
|
|
19
|
-
* @return Promise resolving to a string or null, depending whether a page error is present.
|
|
20
|
-
*/
|
|
21
25
|
async function getPageError() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
const content = await this.page.content();
|
|
27
|
+
const match = content.match(REGEXP_PHP_ERROR);
|
|
28
|
+
return match ? match[0] : null;
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getPageError
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=get-page-error.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/admin/get-page-error.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\n/**\n * Regular expression matching a displayed PHP error within a markup string.\n *\n * @see https://github.com/php/php-src/blob/598175e/main/main.c#L1257-L1297\n */\nconst REGEXP_PHP_ERROR =\n\t/(<b>)?(Fatal error|Recoverable fatal error|Warning|Parse error|Notice|Strict Standards|Deprecated|Unknown error)(<\\/b>)?: (.*?) in (.*?) on line (<b>)?\\d+(<\\/b>)?/;\n\n/**\n * Returns a promise resolving to one of either a string or null. A string will\n * be resolved if an error message is present in the contents of the page. If no\n * error is present, a null value will be resolved instead. This requires the\n * environment be configured to display errors.\n *\n * @see http://php.net/manual/en/function.error-reporting.php\n *\n * @param this\n * @return Promise resolving to a string or null, depending whether a page error is present.\n */\nexport async function getPageError( this: Admin ) {\n\tconst content = await this.page.content();\n\tconst match = content.match( REGEXP_PHP_ERROR );\n\treturn match ? match[ 0 ] : null;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,MAAM,mBACL;AAaD,eAAsB,eAA4B;AACjD,QAAM,UAAU,MAAM,KAAK,KAAK,QAAQ;AACxC,QAAM,QAAQ,QAAQ,MAAO,gBAAiB;AAC9C,SAAO,QAAQ,MAAO,CAAE,IAAI;AAC7B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/admin/index.js
CHANGED
|
@@ -1,37 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var admin_exports = {};
|
|
20
|
+
__export(admin_exports, {
|
|
21
|
+
Admin: () => Admin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(admin_exports);
|
|
24
|
+
var import_create_new_post = require("./create-new-post");
|
|
25
|
+
var import_get_page_error = require("./get-page-error");
|
|
26
|
+
var import_visit_admin_page = require("./visit-admin-page");
|
|
27
|
+
var import_edit_post = require("./edit-post");
|
|
28
|
+
var import_visit_site_editor = require("./visit-site-editor");
|
|
12
29
|
class Admin {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
page;
|
|
31
|
+
context;
|
|
32
|
+
browser;
|
|
33
|
+
pageUtils;
|
|
34
|
+
editor;
|
|
35
|
+
constructor({ page, pageUtils, editor }) {
|
|
36
|
+
this.page = page;
|
|
37
|
+
this.context = page.context();
|
|
38
|
+
this.browser = this.context.browser();
|
|
39
|
+
this.pageUtils = pageUtils;
|
|
40
|
+
this.editor = editor;
|
|
41
|
+
}
|
|
42
|
+
/** @borrows createNewPost as this.createNewPost */
|
|
43
|
+
createNewPost = import_create_new_post.createNewPost.bind(this);
|
|
44
|
+
/** @borrows editPost as this.editPost */
|
|
45
|
+
editPost = import_edit_post.editPost.bind(this);
|
|
46
|
+
/** @borrows getPageError as this.getPageError */
|
|
47
|
+
getPageError = import_get_page_error.getPageError.bind(this);
|
|
48
|
+
/** @borrows visitAdminPage as this.visitAdminPage */
|
|
49
|
+
visitAdminPage = import_visit_admin_page.visitAdminPage.bind(this);
|
|
50
|
+
/** @borrows visitSiteEditor as this.visitSiteEditor */
|
|
51
|
+
visitSiteEditor = import_visit_site_editor.visitSiteEditor.bind(this);
|
|
35
52
|
}
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
Admin
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
package/build/admin/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/admin/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { Browser, Page, BrowserContext } from '@playwright/test';\n\n/**\n * Internal dependencies\n */\nimport { createNewPost } from './create-new-post';\nimport { getPageError } from './get-page-error';\nimport { visitAdminPage } from './visit-admin-page';\nimport { editPost } from './edit-post';\nimport { visitSiteEditor } from './visit-site-editor';\nimport type { PageUtils } from '../page-utils';\nimport type { Editor } from '../editor';\n\ntype AdminConstructorProps = {\n\tpage: Page;\n\tpageUtils: PageUtils;\n\teditor: Editor;\n};\n\nexport class Admin {\n\tpage: Page;\n\tcontext: BrowserContext;\n\tbrowser: Browser;\n\tpageUtils: PageUtils;\n\teditor: Editor;\n\n\tconstructor( { page, pageUtils, editor }: AdminConstructorProps ) {\n\t\tthis.page = page;\n\t\tthis.context = page.context();\n\t\tthis.browser = this.context.browser()!;\n\t\tthis.pageUtils = pageUtils;\n\t\tthis.editor = editor;\n\t}\n\n\t/** @borrows createNewPost as this.createNewPost */\n\tcreateNewPost: typeof createNewPost = createNewPost.bind( this );\n\t/** @borrows editPost as this.editPost */\n\teditPost: typeof editPost = editPost.bind( this );\n\t/** @borrows getPageError as this.getPageError */\n\tgetPageError: typeof getPageError = getPageError.bind( this );\n\t/** @borrows visitAdminPage as this.visitAdminPage */\n\tvisitAdminPage: typeof visitAdminPage = visitAdminPage.bind( this );\n\t/** @borrows visitSiteEditor as this.visitSiteEditor */\n\tvisitSiteEditor: typeof visitSiteEditor = visitSiteEditor.bind( this );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,6BAA8B;AAC9B,4BAA6B;AAC7B,8BAA+B;AAC/B,uBAAyB;AACzB,+BAAgC;AAUzB,MAAM,MAAM;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAa,EAAE,MAAM,WAAW,OAAO,GAA2B;AACjE,SAAK,OAAO;AACZ,SAAK,UAAU,KAAK,QAAQ;AAC5B,SAAK,UAAU,KAAK,QAAQ,QAAQ;AACpC,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,EACf;AAAA;AAAA,EAGA,gBAAsC,qCAAc,KAAM,IAAK;AAAA;AAAA,EAE/D,WAA4B,0BAAS,KAAM,IAAK;AAAA;AAAA,EAEhD,eAAoC,mCAAa,KAAM,IAAK;AAAA;AAAA,EAE5D,iBAAwC,uCAAe,KAAM,IAAK;AAAA;AAAA,EAElE,kBAA0C,yCAAgB,KAAM,IAAK;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var visit_admin_page_exports = {};
|
|
20
|
+
__export(visit_admin_page_exports, {
|
|
21
|
+
visitAdminPage: () => visitAdminPage
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(visit_admin_page_exports);
|
|
24
|
+
var import_path = require("path");
|
|
15
25
|
async function visitAdminPage(adminPath, query) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
26
|
+
await this.page.goto(
|
|
27
|
+
(0, import_path.join)("wp-admin", adminPath) + (query ? `?${query}` : "")
|
|
28
|
+
);
|
|
29
|
+
if (this.pageUtils.isCurrentURL("wp-admin/upgrade.php")) {
|
|
30
|
+
await this.page.click(".button.button-large.button-primary");
|
|
31
|
+
await this.page.click(".button.button-large");
|
|
32
|
+
}
|
|
33
|
+
if (this.pageUtils.isCurrentURL("wp-login.php")) {
|
|
34
|
+
throw new Error("Not logged in");
|
|
35
|
+
}
|
|
36
|
+
const error = await this.getPageError();
|
|
37
|
+
if (error) {
|
|
38
|
+
throw new Error("Unexpected error in page content: " + error);
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
|
-
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
visitAdminPage
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=visit-admin-page.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/admin/visit-admin-page.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { join } from 'path';\n\n/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\n/**\n * Visits admin page and handle errors.\n *\n * @param this\n * @param adminPath String to be serialized as pathname.\n * @param query String to be serialized as query portion of URL.\n */\nexport async function visitAdminPage(\n\tthis: Admin,\n\tadminPath: string,\n\tquery?: string\n) {\n\tawait this.page.goto(\n\t\tjoin( 'wp-admin', adminPath ) + ( query ? `?${ query }` : '' )\n\t);\n\n\t// Handle upgrade required screen\n\tif ( this.pageUtils.isCurrentURL( 'wp-admin/upgrade.php' ) ) {\n\t\t// Click update\n\t\tawait this.page.click( '.button.button-large.button-primary' );\n\t\t// Click continue\n\t\tawait this.page.click( '.button.button-large' );\n\t}\n\n\tif ( this.pageUtils.isCurrentURL( 'wp-login.php' ) ) {\n\t\tthrow new Error( 'Not logged in' );\n\t}\n\n\tconst error = await this.getPageError();\n\tif ( error ) {\n\t\tthrow new Error( 'Unexpected error in page content: ' + error );\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAqB;AAcrB,eAAsB,eAErB,WACA,OACC;AACD,QAAM,KAAK,KAAK;AAAA,QACf,kBAAM,YAAY,SAAU,KAAM,QAAQ,IAAK,KAAM,KAAK;AAAA,EAC3D;AAGA,MAAK,KAAK,UAAU,aAAc,sBAAuB,GAAI;AAE5D,UAAM,KAAK,KAAK,MAAO,qCAAsC;AAE7D,UAAM,KAAK,KAAK,MAAO,sBAAuB;AAAA,EAC/C;AAEA,MAAK,KAAK,UAAU,aAAc,cAAe,GAAI;AACpD,UAAM,IAAI,MAAO,eAAgB;AAAA,EAClC;AAEA,QAAM,QAAQ,MAAM,KAAK,aAAa;AACtC,MAAK,OAAQ;AACZ,UAAM,IAAI,MAAO,uCAAuC,KAAM;AAAA,EAC/D;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,68 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var visit_site_editor_exports = {};
|
|
20
|
+
__export(visit_site_editor_exports, {
|
|
21
|
+
visitSiteEditor: () => visitSiteEditor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(visit_site_editor_exports);
|
|
10
24
|
async function visitSiteEditor(options = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// Bigger timeout is needed for larger entities, like the Large Post
|
|
55
|
-
// HTML fixture that we load for performance tests, which often
|
|
56
|
-
// doesn't make it under the default timeout value.
|
|
57
|
-
timeout: 60_000,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
// If the canvas loader is already disappeared, skip the waiting.
|
|
62
|
-
await this.page
|
|
63
|
-
.getByRole('region', { name: 'Editor content' })
|
|
64
|
-
.waitFor();
|
|
65
|
-
}
|
|
25
|
+
const { postId, postType, path, canvas, activeView } = options;
|
|
26
|
+
const query = new URLSearchParams();
|
|
27
|
+
if (postId) {
|
|
28
|
+
query.set("postId", String(postId));
|
|
29
|
+
}
|
|
30
|
+
if (postType) {
|
|
31
|
+
query.set("postType", postType);
|
|
32
|
+
}
|
|
33
|
+
if (path) {
|
|
34
|
+
query.set("path", path);
|
|
35
|
+
}
|
|
36
|
+
if (canvas) {
|
|
37
|
+
query.set("canvas", canvas);
|
|
38
|
+
}
|
|
39
|
+
if (activeView) {
|
|
40
|
+
query.set("activeView", activeView);
|
|
41
|
+
}
|
|
42
|
+
await this.visitAdminPage("site-editor.php", query.toString());
|
|
43
|
+
if (!options.showWelcomeGuide) {
|
|
44
|
+
await this.editor.setPreferences("core/edit-site", {
|
|
45
|
+
welcomeGuide: false,
|
|
46
|
+
welcomeGuideStyles: false,
|
|
47
|
+
welcomeGuidePage: false,
|
|
48
|
+
welcomeGuideTemplate: false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (!query.size || postId || canvas === "edit") {
|
|
52
|
+
const canvasLoader = this.page.locator(
|
|
53
|
+
// Spinner was used instead of the progress bar in an earlier
|
|
54
|
+
// version of the site editor.
|
|
55
|
+
".edit-site-canvas-loader, .edit-site-canvas-spinner"
|
|
56
|
+
);
|
|
57
|
+
try {
|
|
58
|
+
await canvasLoader.waitFor({ state: "visible", timeout: 6e4 });
|
|
59
|
+
await canvasLoader.waitFor({
|
|
60
|
+
state: "hidden",
|
|
61
|
+
// Bigger timeout is needed for larger entities, like the Large Post
|
|
62
|
+
// HTML fixture that we load for performance tests, which often
|
|
63
|
+
// doesn't make it under the default timeout value.
|
|
64
|
+
timeout: 6e4
|
|
65
|
+
});
|
|
66
|
+
} catch (error) {
|
|
67
|
+
await this.page.getByRole("region", { name: "Editor content" }).waitFor();
|
|
66
68
|
}
|
|
69
|
+
}
|
|
67
70
|
}
|
|
68
|
-
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
visitSiteEditor
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=visit-site-editor.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/admin/visit-site-editor.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\ninterface SiteEditorOptions {\n\tpostId?: string | number;\n\tpostType?: string;\n\tpath?: string;\n\tcanvas?: string;\n\tactiveView?: string;\n\tshowWelcomeGuide?: boolean;\n}\n\n/**\n * Visits the Site Editor main page.\n *\n * @param this\n * @param options Options to visit the site editor.\n */\nexport async function visitSiteEditor(\n\tthis: Admin,\n\toptions: SiteEditorOptions = {}\n) {\n\tconst { postId, postType, path, canvas, activeView } = options;\n\tconst query = new URLSearchParams();\n\n\tif ( postId ) {\n\t\tquery.set( 'postId', String( postId ) );\n\t}\n\tif ( postType ) {\n\t\tquery.set( 'postType', postType );\n\t}\n\tif ( path ) {\n\t\tquery.set( 'path', path );\n\t}\n\tif ( canvas ) {\n\t\tquery.set( 'canvas', canvas );\n\t}\n\tif ( activeView ) {\n\t\tquery.set( 'activeView', activeView );\n\t}\n\n\tawait this.visitAdminPage( 'site-editor.php', query.toString() );\n\n\tif ( ! options.showWelcomeGuide ) {\n\t\tawait this.editor.setPreferences( 'core/edit-site', {\n\t\t\twelcomeGuide: false,\n\t\t\twelcomeGuideStyles: false,\n\t\t\twelcomeGuidePage: false,\n\t\t\twelcomeGuideTemplate: false,\n\t\t} );\n\t}\n\n\t/**\n\t * @todo This is a workaround for the fact that the editor canvas is seen as\n\t * ready and visible before the loading spinner is hidden. Ideally, the\n\t * content underneath the loading overlay should be marked inert until the\n\t * loading is done.\n\t */\n\tif ( ! query.size || postId || canvas === 'edit' ) {\n\t\tconst canvasLoader = this.page.locator(\n\t\t\t// Spinner was used instead of the progress bar in an earlier\n\t\t\t// version of the site editor.\n\t\t\t'.edit-site-canvas-loader, .edit-site-canvas-spinner'\n\t\t);\n\n\t\ttry {\n\t\t\t// Wait for the canvas loader to appear first, so that the locator that\n\t\t\t// waits for the hidden state doesn't resolve prematurely.\n\t\t\tawait canvasLoader.waitFor( { state: 'visible', timeout: 60_000 } );\n\t\t\tawait canvasLoader.waitFor( {\n\t\t\t\tstate: 'hidden',\n\t\t\t\t// Bigger timeout is needed for larger entities, like the Large Post\n\t\t\t\t// HTML fixture that we load for performance tests, which often\n\t\t\t\t// doesn't make it under the default timeout value.\n\t\t\t\ttimeout: 60_000,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// If the canvas loader is already disappeared, skip the waiting.\n\t\t\tawait this.page\n\t\t\t\t.getByRole( 'region', { name: 'Editor content' } )\n\t\t\t\t.waitFor();\n\t\t}\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,eAAsB,gBAErB,UAA6B,CAAC,GAC7B;AACD,QAAM,EAAE,QAAQ,UAAU,MAAM,QAAQ,WAAW,IAAI;AACvD,QAAM,QAAQ,IAAI,gBAAgB;AAElC,MAAK,QAAS;AACb,UAAM,IAAK,UAAU,OAAQ,MAAO,CAAE;AAAA,EACvC;AACA,MAAK,UAAW;AACf,UAAM,IAAK,YAAY,QAAS;AAAA,EACjC;AACA,MAAK,MAAO;AACX,UAAM,IAAK,QAAQ,IAAK;AAAA,EACzB;AACA,MAAK,QAAS;AACb,UAAM,IAAK,UAAU,MAAO;AAAA,EAC7B;AACA,MAAK,YAAa;AACjB,UAAM,IAAK,cAAc,UAAW;AAAA,EACrC;AAEA,QAAM,KAAK,eAAgB,mBAAmB,MAAM,SAAS,CAAE;AAE/D,MAAK,CAAE,QAAQ,kBAAmB;AACjC,UAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,MACnD,cAAc;AAAA,MACd,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,sBAAsB;AAAA,IACvB,CAAE;AAAA,EACH;AAQA,MAAK,CAAE,MAAM,QAAQ,UAAU,WAAW,QAAS;AAClD,UAAM,eAAe,KAAK,KAAK;AAAA;AAAA;AAAA,MAG9B;AAAA,IACD;AAEA,QAAI;AAGH,YAAM,aAAa,QAAS,EAAE,OAAO,WAAW,SAAS,IAAO,CAAE;AAClE,YAAM,aAAa,QAAS;AAAA,QAC3B,OAAO;AAAA;AAAA;AAAA;AAAA,QAIP,SAAS;AAAA,MACV,CAAE;AAAA,IACH,SAAU,OAAQ;AAEjB,YAAM,KAAK,KACT,UAAW,UAAU,EAAE,MAAM,iBAAiB,CAAE,EAChD,QAAQ;AAAA,IACX;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|