@wordpress/e2e-test-utils-playwright 1.36.1-next.738bb1424.0 → 1.37.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 +48 -28
- package/build/admin/create-new-post.js.map +7 -1
- package/build/admin/edit-post.js +37 -17
- package/build/admin/edit-post.js.map +7 -1
- package/build/admin/get-page-error.js +33 -23
- package/build/admin/get-page-error.js.map +7 -1
- package/build/admin/index.js +58 -36
- package/build/admin/index.js.map +7 -1
- package/build/admin/visit-admin-page.js +44 -29
- package/build/admin/visit-admin-page.js.map +7 -1
- package/build/admin/visit-site-editor.js +73 -64
- package/build/admin/visit-site-editor.js.map +7 -1
- package/build/config.js +43 -11
- package/build/config.js.map +7 -1
- package/build/editor/click-block-options-menu-item.js +31 -14
- package/build/editor/click-block-options-menu-item.js.map +7 -1
- package/build/editor/click-block-toolbar-button.js +35 -13
- package/build/editor/click-block-toolbar-button.js.map +7 -1
- package/build/editor/get-blocks.js +61 -43
- package/build/editor/get-blocks.js.map +7 -1
- package/build/editor/get-edited-post-content.js +33 -12
- package/build/editor/get-edited-post-content.js.map +7 -1
- package/build/editor/index.js +96 -74
- package/build/editor/index.js.map +7 -1
- package/build/editor/insert-block.js +52 -21
- package/build/editor/insert-block.js.map +7 -1
- package/build/editor/open-document-settings-sidebar.js +39 -24
- package/build/editor/open-document-settings-sidebar.js.map +7 -1
- package/build/editor/preview.js +39 -18
- package/build/editor/preview.js.map +7 -1
- package/build/editor/publish-post.js +44 -42
- package/build/editor/publish-post.js.map +7 -1
- package/build/editor/save-draft.js +31 -15
- package/build/editor/save-draft.js.map +7 -1
- package/build/editor/select-blocks.js +48 -25
- package/build/editor/select-blocks.js.map +7 -1
- package/build/editor/set-content.js +36 -14
- package/build/editor/set-content.js.map +7 -1
- package/build/editor/set-is-fixed-toolbar.js +33 -15
- package/build/editor/set-is-fixed-toolbar.js.map +7 -1
- package/build/editor/set-preferences.js +40 -18
- package/build/editor/set-preferences.js.map +7 -1
- package/build/editor/show-block-toolbar.js +32 -16
- package/build/editor/show-block-toolbar.js.map +7 -1
- package/build/editor/site-editor.js +48 -41
- package/build/editor/site-editor.js.map +7 -1
- package/build/editor/switch-editor-tool.js +44 -30
- package/build/editor/switch-editor-tool.js.map +7 -1
- package/build/editor/switch-to-legacy-canvas.js +35 -14
- package/build/editor/switch-to-legacy-canvas.js.map +7 -1
- package/build/editor/transform-block-to.js +43 -21
- package/build/editor/transform-block-to.js.map +7 -1
- package/build/index.js +53 -18
- package/build/index.js.map +7 -1
- package/build/lighthouse/index.js +93 -55
- package/build/lighthouse/index.js.map +7 -1
- package/build/metrics/index.js +302 -251
- package/build/metrics/index.js.map +7 -1
- package/build/page-utils/drag-files.js +136 -112
- package/build/page-utils/drag-files.js.map +7 -1
- package/build/page-utils/emulate-network-conditions.js +95 -67
- package/build/page-utils/emulate-network-conditions.js.map +7 -1
- package/build/page-utils/index.js +58 -36
- package/build/page-utils/index.js.map +7 -1
- package/build/page-utils/is-current-url.js +33 -18
- package/build/page-utils/is-current-url.js.map +7 -1
- package/build/page-utils/keycodes.js +53 -39
- package/build/page-utils/keycodes.js.map +7 -1
- package/build/page-utils/press-keys.js +153 -130
- package/build/page-utils/press-keys.js.map +7 -1
- package/build/page-utils/set-browser-viewport.js +35 -42
- package/build/page-utils/set-browser-viewport.js.map +7 -1
- package/build/request-utils/blocks.js +51 -40
- package/build/request-utils/blocks.js.map +7 -1
- package/build/request-utils/comments.js +59 -45
- package/build/request-utils/comments.js.map +7 -1
- package/build/request-utils/gutenberg-experiments.js +63 -38
- package/build/request-utils/gutenberg-experiments.js.map +7 -1
- package/build/request-utils/index.js +191 -155
- package/build/request-utils/index.js.map +7 -1
- package/build/request-utils/login.js +45 -18
- package/build/request-utils/login.js.map +7 -1
- package/build/request-utils/media.js +74 -64
- package/build/request-utils/media.js.map +7 -1
- package/build/request-utils/menus.js +121 -109
- package/build/request-utils/menus.js.map +7 -1
- package/build/request-utils/pages.js +63 -50
- package/build/request-utils/pages.js.map +7 -1
- package/build/request-utils/patterns.js +41 -24
- package/build/request-utils/patterns.js.map +7 -1
- package/build/request-utils/plugins.js +70 -74
- package/build/request-utils/plugins.js.map +7 -1
- package/build/request-utils/posts.js +55 -41
- package/build/request-utils/posts.js.map +7 -1
- package/build/request-utils/preferences.js +38 -17
- package/build/request-utils/preferences.js.map +7 -1
- package/build/request-utils/rest.js +155 -129
- package/build/request-utils/rest.js.map +7 -1
- package/build/request-utils/site-settings.js +40 -28
- package/build/request-utils/site-settings.js.map +7 -1
- package/build/request-utils/templates.js +60 -46
- package/build/request-utils/templates.js.map +7 -1
- package/build/request-utils/themes.js +80 -53
- package/build/request-utils/themes.js.map +7 -1
- package/build/request-utils/users.js +74 -72
- package/build/request-utils/users.js.map +7 -1
- package/build/request-utils/widgets.js +73 -55
- package/build/request-utils/widgets.js.map +7 -1
- package/build/test.js +130 -146
- package/build/test.js.map +7 -1
- package/build/types.js +18 -2
- package/build/types.js.map +7 -1
- package/build-types/index.d.ts +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/build/admin/create-new-post.cjs +0 -51
- package/build/admin/create-new-post.cjs.map +0 -7
- package/build/admin/edit-post.cjs +0 -40
- package/build/admin/edit-post.cjs.map +0 -7
- package/build/admin/get-page-error.cjs +0 -36
- package/build/admin/get-page-error.cjs.map +0 -7
- package/build/admin/index.cjs +0 -59
- package/build/admin/index.cjs.map +0 -7
- package/build/admin/visit-admin-page.cjs +0 -47
- package/build/admin/visit-admin-page.cjs.map +0 -7
- package/build/admin/visit-site-editor.cjs +0 -77
- package/build/admin/visit-site-editor.cjs.map +0 -7
- package/build/config.cjs +0 -45
- package/build/config.cjs.map +0 -7
- package/build/editor/click-block-options-menu-item.cjs +0 -34
- package/build/editor/click-block-options-menu-item.cjs.map +0 -7
- package/build/editor/click-block-toolbar-button.cjs +0 -38
- package/build/editor/click-block-toolbar-button.cjs.map +0 -7
- package/build/editor/get-blocks.cjs +0 -64
- package/build/editor/get-blocks.cjs.map +0 -7
- package/build/editor/get-edited-post-content.cjs +0 -36
- package/build/editor/get-edited-post-content.cjs.map +0 -7
- package/build/editor/index.cjs +0 -97
- package/build/editor/index.cjs.map +0 -7
- package/build/editor/insert-block.cjs +0 -55
- package/build/editor/insert-block.cjs.map +0 -7
- package/build/editor/open-document-settings-sidebar.cjs +0 -42
- package/build/editor/open-document-settings-sidebar.cjs.map +0 -7
- package/build/editor/preview.cjs +0 -42
- package/build/editor/preview.cjs.map +0 -7
- package/build/editor/publish-post.cjs +0 -47
- package/build/editor/publish-post.cjs.map +0 -7
- package/build/editor/save-draft.cjs +0 -34
- package/build/editor/save-draft.cjs.map +0 -7
- package/build/editor/select-blocks.cjs +0 -51
- package/build/editor/select-blocks.cjs.map +0 -7
- package/build/editor/set-content.cjs +0 -39
- package/build/editor/set-content.cjs.map +0 -7
- package/build/editor/set-is-fixed-toolbar.cjs +0 -36
- package/build/editor/set-is-fixed-toolbar.cjs.map +0 -7
- package/build/editor/set-preferences.cjs +0 -43
- package/build/editor/set-preferences.cjs.map +0 -7
- package/build/editor/show-block-toolbar.cjs +0 -35
- package/build/editor/show-block-toolbar.cjs.map +0 -7
- package/build/editor/site-editor.cjs +0 -51
- package/build/editor/site-editor.cjs.map +0 -7
- package/build/editor/switch-editor-tool.cjs +0 -47
- package/build/editor/switch-editor-tool.cjs.map +0 -7
- package/build/editor/switch-to-legacy-canvas.cjs +0 -39
- package/build/editor/switch-to-legacy-canvas.cjs.map +0 -7
- package/build/editor/transform-block-to.cjs +0 -46
- package/build/editor/transform-block-to.cjs.map +0 -7
- package/build/index.cjs +0 -51
- package/build/index.cjs.map +0 -7
- package/build/lighthouse/index.cjs +0 -96
- package/build/lighthouse/index.cjs.map +0 -7
- package/build/metrics/index.cjs +0 -309
- package/build/metrics/index.cjs.map +0 -7
- package/build/page-utils/drag-files.cjs +0 -143
- package/build/page-utils/drag-files.cjs.map +0 -7
- package/build/page-utils/emulate-network-conditions.cjs +0 -99
- package/build/page-utils/emulate-network-conditions.cjs.map +0 -7
- package/build/page-utils/index.cjs +0 -59
- package/build/page-utils/index.cjs.map +0 -7
- package/build/page-utils/is-current-url.cjs +0 -36
- package/build/page-utils/is-current-url.cjs.map +0 -7
- package/build/page-utils/keycodes.cjs +0 -55
- package/build/page-utils/keycodes.cjs.map +0 -7
- package/build/page-utils/press-keys.cjs +0 -165
- package/build/page-utils/press-keys.cjs.map +0 -7
- package/build/page-utils/set-browser-viewport.cjs +0 -39
- package/build/page-utils/set-browser-viewport.cjs.map +0 -7
- package/build/request-utils/blocks.cjs +0 -56
- package/build/request-utils/blocks.cjs.map +0 -7
- package/build/request-utils/comments.cjs +0 -66
- package/build/request-utils/comments.cjs.map +0 -7
- package/build/request-utils/gutenberg-experiments.cjs +0 -66
- package/build/request-utils/gutenberg-experiments.cjs.map +0 -7
- package/build/request-utils/index.cjs +0 -194
- package/build/request-utils/index.cjs.map +0 -7
- package/build/request-utils/login.cjs +0 -48
- package/build/request-utils/login.cjs.map +0 -7
- package/build/request-utils/media.cjs +0 -83
- package/build/request-utils/media.cjs.map +0 -7
- package/build/request-utils/menus.cjs +0 -132
- package/build/request-utils/menus.cjs.map +0 -7
- package/build/request-utils/pages.cjs +0 -71
- package/build/request-utils/pages.cjs.map +0 -7
- package/build/request-utils/patterns.cjs +0 -44
- package/build/request-utils/patterns.cjs.map +0 -7
- package/build/request-utils/plugins.cjs +0 -81
- package/build/request-utils/plugins.cjs.map +0 -7
- package/build/request-utils/posts.cjs +0 -61
- package/build/request-utils/posts.cjs.map +0 -7
- package/build/request-utils/preferences.cjs +0 -41
- package/build/request-utils/preferences.cjs.map +0 -7
- package/build/request-utils/rest.cjs +0 -174
- package/build/request-utils/rest.cjs.map +0 -7
- package/build/request-utils/site-settings.cjs +0 -45
- package/build/request-utils/site-settings.cjs.map +0 -7
- package/build/request-utils/templates.cjs +0 -68
- package/build/request-utils/templates.cjs.map +0 -7
- package/build/request-utils/themes.cjs +0 -89
- package/build/request-utils/themes.cjs.map +0 -7
- package/build/request-utils/users.cjs +0 -83
- package/build/request-utils/users.cjs.map +0 -7
- package/build/request-utils/widgets.cjs +0 -79
- package/build/request-utils/widgets.cjs.map +0 -7
- package/build/test.cjs +0 -136
- package/build/test.cjs.map +0 -7
- package/build/types.cjs +0 -19
- package/build/types.cjs.map +0 -7
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/page-utils/set-browser-viewport.js
|
|
21
|
-
var set_browser_viewport_exports = {};
|
|
22
|
-
__export(set_browser_viewport_exports, {
|
|
23
|
-
setBrowserViewport: () => setBrowserViewport
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(set_browser_viewport_exports);
|
|
26
|
-
var PREDEFINED_DIMENSIONS = {
|
|
27
|
-
large: { width: 960, height: 700 },
|
|
28
|
-
medium: { width: 768, height: 700 },
|
|
29
|
-
small: { width: 600, height: 700 }
|
|
30
|
-
};
|
|
31
|
-
async function setBrowserViewport(viewport) {
|
|
32
|
-
const dimensions = typeof viewport === "string" ? PREDEFINED_DIMENSIONS[viewport] : viewport;
|
|
33
|
-
await this.page.setViewportSize(dimensions);
|
|
34
|
-
}
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
setBrowserViewport
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=set-browser-viewport.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/page-utils/set-browser-viewport.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Named viewport options.\n *\n * @typedef {\"large\"|\"medium\"|\"small\"} WPDimensionsName\n */\n\n/**\n * Viewport dimensions object.\n *\n * @typedef {Object} WPViewportDimensions\n *\n * @property {number} width Width, in pixels.\n * @property {number} height Height, in pixels.\n */\n\n/**\n * Predefined viewport dimensions to reference by name.\n *\n * @enum {WPViewportDimensions}\n *\n * @type {Record<WPDimensionsName, WPViewportDimensions>}\n */\nconst PREDEFINED_DIMENSIONS = {\n\tlarge: { width: 960, height: 700 },\n\tmedium: { width: 768, height: 700 },\n\tsmall: { width: 600, height: 700 },\n};\n\n/**\n * Valid argument argument type from which to derive viewport dimensions.\n *\n * @typedef {WPDimensionsName|WPViewportDimensions} WPViewport\n */\n\n/**\n * Sets browser viewport to specified type.\n *\n * @this {import('./').PageUtils}\n * @param {WPViewport} viewport Viewport name or dimensions object to assign.\n */\nexport async function setBrowserViewport( viewport ) {\n\tconst dimensions =\n\t\ttypeof viewport === 'string'\n\t\t\t? PREDEFINED_DIMENSIONS[ viewport ]\n\t\t\t: viewport;\n\n\tawait this.page.setViewportSize( dimensions );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,IAAM,wBAAwB;AAAA,EAC7B,OAAO,EAAE,OAAO,KAAK,QAAQ,IAAI;AAAA,EACjC,QAAQ,EAAE,OAAO,KAAK,QAAQ,IAAI;AAAA,EAClC,OAAO,EAAE,OAAO,KAAK,QAAQ,IAAI;AAClC;AAcA,eAAsB,mBAAoB,UAAW;AACpD,QAAM,aACL,OAAO,aAAa,WACjB,sBAAuB,QAAS,IAChC;AAEJ,QAAM,KAAK,KAAK,gBAAiB,UAAW;AAC7C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/blocks.ts
|
|
21
|
-
var blocks_exports = {};
|
|
22
|
-
__export(blocks_exports, {
|
|
23
|
-
createBlock: () => createBlock,
|
|
24
|
-
deleteAllBlocks: () => deleteAllBlocks
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(blocks_exports);
|
|
27
|
-
async function deleteAllBlocks() {
|
|
28
|
-
const blocks = await this.rest({
|
|
29
|
-
path: "/wp/v2/blocks",
|
|
30
|
-
params: {
|
|
31
|
-
per_page: 100,
|
|
32
|
-
// All possible statuses.
|
|
33
|
-
status: "publish,future,draft,pending,private,trash"
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
await this.batchRest(
|
|
37
|
-
blocks.map((block) => ({
|
|
38
|
-
method: "DELETE",
|
|
39
|
-
path: `/wp/v2/blocks/${block.id}?force=true`
|
|
40
|
-
}))
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
async function createBlock(payload) {
|
|
44
|
-
const block = await this.rest({
|
|
45
|
-
path: "/wp/v2/blocks",
|
|
46
|
-
method: "POST",
|
|
47
|
-
data: { ...payload }
|
|
48
|
-
});
|
|
49
|
-
return block;
|
|
50
|
-
}
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {
|
|
53
|
-
createBlock,
|
|
54
|
-
deleteAllBlocks
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=blocks.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/blocks.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\ntype CreateBlockPayload = {\n\tdate?: string;\n\tdate_gmt?: string;\n\tslug?: string;\n\ttitle: string;\n\tstatus: 'publish' | 'future' | 'draft' | 'pending' | 'private';\n\tcontent?: string;\n\tmeta?: unknown;\n\twp_pattern_category?: number[];\n};\n\n/**\n * Delete all blocks using REST API.\n *\n * @see https://developer.wordpress.org/rest-api/reference/blocks/#list-editor-blocks\n * @param this\n */\nexport async function deleteAllBlocks( this: RequestUtils ) {\n\t// List all blocks.\n\t// https://developer.wordpress.org/rest-api/reference/blocks/#list-editor-blocks\n\tconst blocks = await this.rest( {\n\t\tpath: '/wp/v2/blocks',\n\t\tparams: {\n\t\t\tper_page: 100,\n\t\t\t// All possible statuses.\n\t\t\tstatus: 'publish,future,draft,pending,private,trash',\n\t\t},\n\t} );\n\n\t// Delete blocks.\n\t// https://developer.wordpress.org/rest-api/reference/blocks/#delete-a-editor-block\n\t// \"/wp/v2/posts\" not yet supports batch requests.\n\tawait this.batchRest(\n\t\tblocks.map( ( block: { id: number } ) => ( {\n\t\t\tmethod: 'DELETE',\n\t\t\tpath: `/wp/v2/blocks/${ block.id }?force=true`,\n\t\t} ) )\n\t);\n}\n\n/**\n * Creates a new block using the REST API.\n *\n * @see https://developer.wordpress.org/rest-api/reference/blocks/#create-a-editor-block.\n * @param this\n * @param payload Block payload.\n */\nexport async function createBlock(\n\tthis: RequestUtils,\n\tpayload: CreateBlockPayload\n) {\n\tconst block = await this.rest( {\n\t\tpath: '/wp/v2/blocks',\n\t\tmethod: 'POST',\n\t\tdata: { ...payload },\n\t} );\n\n\treturn block;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,eAAsB,kBAAsC;AAG3D,QAAM,SAAS,MAAM,KAAK,KAAM;AAAA,IAC/B,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,UAAU;AAAA;AAAA,MAEV,QAAQ;AAAA,IACT;AAAA,EACD,CAAE;AAKF,QAAM,KAAK;AAAA,IACV,OAAO,IAAK,CAAE,WAA6B;AAAA,MAC1C,QAAQ;AAAA,MACR,MAAM,iBAAkB,MAAM,EAAG;AAAA,IAClC,EAAI;AAAA,EACL;AACD;AASA,eAAsB,YAErB,SACC;AACD,QAAM,QAAQ,MAAM,KAAK,KAAM;AAAA,IAC9B,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM,EAAE,GAAG,QAAQ;AAAA,EACpB,CAAE;AAEF,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/comments.ts
|
|
21
|
-
var comments_exports = {};
|
|
22
|
-
__export(comments_exports, {
|
|
23
|
-
createComment: () => createComment,
|
|
24
|
-
deleteAllComments: () => deleteAllComments
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(comments_exports);
|
|
27
|
-
async function createComment(payload) {
|
|
28
|
-
const currentUser = await this.rest({
|
|
29
|
-
path: "/wp/v2/users/me",
|
|
30
|
-
method: "GET"
|
|
31
|
-
});
|
|
32
|
-
const author = currentUser.id;
|
|
33
|
-
const comment = await this.rest({
|
|
34
|
-
method: "POST",
|
|
35
|
-
path: "/wp/v2/comments",
|
|
36
|
-
data: { ...payload, author }
|
|
37
|
-
});
|
|
38
|
-
return comment;
|
|
39
|
-
}
|
|
40
|
-
async function deleteAllComments(type) {
|
|
41
|
-
const comments = await this.rest({
|
|
42
|
-
path: "/wp/v2/comments",
|
|
43
|
-
params: {
|
|
44
|
-
per_page: 100,
|
|
45
|
-
status: "all",
|
|
46
|
-
type: type || "comment"
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
await Promise.all(
|
|
50
|
-
comments.map(
|
|
51
|
-
(comment) => this.rest({
|
|
52
|
-
method: "DELETE",
|
|
53
|
-
path: `/wp/v2/comments/${comment.id}`,
|
|
54
|
-
params: {
|
|
55
|
-
force: true
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
-
0 && (module.exports = {
|
|
63
|
-
createComment,
|
|
64
|
-
deleteAllComments
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=comments.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/comments.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\nexport interface Comment {\n\tid: number;\n\tauthor: number;\n\tcontent: string;\n\tpost: number;\n}\n\nexport interface CreateCommentPayload {\n\tcontent: string;\n\tpost: number;\n}\n\nexport interface User {\n\tid: number;\n}\n\n/**\n * Create new comment using the REST API.\n *\n * @param this\n * @param payload\n */\nexport async function createComment(\n\tthis: RequestUtils,\n\tpayload: CreateCommentPayload\n) {\n\tconst currentUser = await this.rest< User >( {\n\t\tpath: '/wp/v2/users/me',\n\t\tmethod: 'GET',\n\t} );\n\n\tconst author = currentUser.id;\n\n\tconst comment = await this.rest< Comment >( {\n\t\tmethod: 'POST',\n\t\tpath: '/wp/v2/comments',\n\t\tdata: { ...payload, author },\n\t} );\n\n\treturn comment;\n}\n\n/**\n * Delete all comments using the REST API.\n *\n * @param this\n * @param type - Optional comment type to delete.\n */\nexport async function deleteAllComments( this: RequestUtils, type?: string ) {\n\t// List all comments.\n\t// https://developer.wordpress.org/rest-api/reference/comments/#list-comments\n\tconst comments = await this.rest( {\n\t\tpath: '/wp/v2/comments',\n\t\tparams: {\n\t\t\tper_page: 100,\n\t\t\tstatus: 'all',\n\t\t\ttype: type || 'comment',\n\t\t},\n\t} );\n\n\t// Delete all comments one by one.\n\t// https://developer.wordpress.org/rest-api/reference/comments/#delete-a-comment\n\t// \"/wp/v2/comments\" doesn't support batch requests yet.\n\tawait Promise.all(\n\t\tcomments.map( ( comment: Comment ) =>\n\t\t\tthis.rest( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\tpath: `/wp/v2/comments/${ comment.id }`,\n\t\t\t\tparams: {\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t} )\n\t\t)\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,eAAsB,cAErB,SACC;AACD,QAAM,cAAc,MAAM,KAAK,KAAc;AAAA,IAC5C,MAAM;AAAA,IACN,QAAQ;AAAA,EACT,CAAE;AAEF,QAAM,SAAS,YAAY;AAE3B,QAAM,UAAU,MAAM,KAAK,KAAiB;AAAA,IAC3C,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM,EAAE,GAAG,SAAS,OAAO;AAAA,EAC5B,CAAE;AAEF,SAAO;AACR;AAQA,eAAsB,kBAAuC,MAAgB;AAG5E,QAAM,WAAW,MAAM,KAAK,KAAM;AAAA,IACjC,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,MAAM,QAAQ;AAAA,IACf;AAAA,EACD,CAAE;AAKF,QAAM,QAAQ;AAAA,IACb,SAAS;AAAA,MAAK,CAAE,YACf,KAAK,KAAM;AAAA,QACV,QAAQ;AAAA,QACR,MAAM,mBAAoB,QAAQ,EAAG;AAAA,QACrC,QAAQ;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/gutenberg-experiments.ts
|
|
21
|
-
var gutenberg_experiments_exports = {};
|
|
22
|
-
__export(gutenberg_experiments_exports, {
|
|
23
|
-
setGutenbergExperiments: () => setGutenbergExperiments
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(gutenberg_experiments_exports);
|
|
26
|
-
async function setGutenbergExperiments(experiments) {
|
|
27
|
-
const response = await this.request.get(
|
|
28
|
-
"/wp-admin/admin.php?page=gutenberg-experiments"
|
|
29
|
-
);
|
|
30
|
-
const html = await response.text();
|
|
31
|
-
const nonce = html.match(/name="_wpnonce" value="([^"]+)"/)[1];
|
|
32
|
-
const formData = {
|
|
33
|
-
option_page: "gutenberg-experiments",
|
|
34
|
-
action: "update",
|
|
35
|
-
_wpnonce: nonce,
|
|
36
|
-
_wp_http_referer: "/wp-admin/admin.php?page=gutenberg-experiments",
|
|
37
|
-
submit: "Save Changes"
|
|
38
|
-
};
|
|
39
|
-
const regularExperiments = experiments.filter(
|
|
40
|
-
(exp) => exp !== "active_templates"
|
|
41
|
-
);
|
|
42
|
-
const hasActiveTemplates = experiments.includes("active_templates");
|
|
43
|
-
if (regularExperiments.length > 0) {
|
|
44
|
-
Object.assign(
|
|
45
|
-
formData,
|
|
46
|
-
Object.fromEntries(
|
|
47
|
-
regularExperiments.map((experiment) => [
|
|
48
|
-
`gutenberg-experiments[${experiment}]`,
|
|
49
|
-
1
|
|
50
|
-
])
|
|
51
|
-
)
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
if (hasActiveTemplates) {
|
|
55
|
-
formData.active_templates = 1;
|
|
56
|
-
}
|
|
57
|
-
await this.request.post("/wp-admin/options.php", {
|
|
58
|
-
form: formData,
|
|
59
|
-
failOnStatusCode: true
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {
|
|
64
|
-
setGutenbergExperiments
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=gutenberg-experiments.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/gutenberg-experiments.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\n/**\n * Sets the Gutenberg experiments.\n *\n * @param this\n * @param experiments Array of experimental flags to enable. Pass in an empty array to disable all experiments.\n * Use 'active_templates' for the template activation feature.\n */\nasync function setGutenbergExperiments(\n\tthis: RequestUtils,\n\texperiments: string[]\n) {\n\tconst response = await this.request.get(\n\t\t'/wp-admin/admin.php?page=gutenberg-experiments'\n\t);\n\tconst html = await response.text();\n\tconst nonce = html.match( /name=\"_wpnonce\" value=\"([^\"]+)\"/ )![ 1 ];\n\n\tconst formData: Record< string, string | number > = {\n\t\toption_page: 'gutenberg-experiments',\n\t\taction: 'update',\n\t\t_wpnonce: nonce,\n\t\t_wp_http_referer: '/wp-admin/admin.php?page=gutenberg-experiments',\n\t\tsubmit: 'Save Changes',\n\t};\n\n\t// Separate regular experiments from active_templates.\n\tconst regularExperiments = experiments.filter(\n\t\t( exp ) => exp !== 'active_templates'\n\t);\n\tconst hasActiveTemplates = experiments.includes( 'active_templates' );\n\n\t// Add regular experiments to the gutenberg-experiments array.\n\tif ( regularExperiments.length > 0 ) {\n\t\tObject.assign(\n\t\t\tformData,\n\t\t\tObject.fromEntries(\n\t\t\t\tregularExperiments.map( ( experiment ) => [\n\t\t\t\t\t`gutenberg-experiments[${ experiment }]`,\n\t\t\t\t\t1,\n\t\t\t\t] )\n\t\t\t)\n\t\t);\n\t}\n\n\t// Template activation uses the active_templates checkbox field.\n\tif ( hasActiveTemplates ) {\n\t\tformData.active_templates = 1;\n\t}\n\n\tawait this.request.post( '/wp-admin/options.php', {\n\t\tform: formData,\n\t\tfailOnStatusCode: true,\n\t} );\n}\n\nexport { setGutenbergExperiments };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,eAAe,wBAEd,aACC;AACD,QAAM,WAAW,MAAM,KAAK,QAAQ;AAAA,IACnC;AAAA,EACD;AACA,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,QAAM,QAAQ,KAAK,MAAO,iCAAkC,EAAI,CAAE;AAElE,QAAM,WAA8C;AAAA,IACnD,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,kBAAkB;AAAA,IAClB,QAAQ;AAAA,EACT;AAGA,QAAM,qBAAqB,YAAY;AAAA,IACtC,CAAE,QAAS,QAAQ;AAAA,EACpB;AACA,QAAM,qBAAqB,YAAY,SAAU,kBAAmB;AAGpE,MAAK,mBAAmB,SAAS,GAAI;AACpC,WAAO;AAAA,MACN;AAAA,MACA,OAAO;AAAA,QACN,mBAAmB,IAAK,CAAE,eAAgB;AAAA,UACzC,yBAA0B,UAAW;AAAA,UACrC;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AAGA,MAAK,oBAAqB;AACzB,aAAS,mBAAmB;AAAA,EAC7B;AAEA,QAAM,KAAK,QAAQ,KAAM,yBAAyB;AAAA,IACjD,MAAM;AAAA,IACN,kBAAkB;AAAA,EACnB,CAAE;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/e2e-test-utils-playwright/src/request-utils/index.ts
|
|
31
|
-
var request_utils_exports = {};
|
|
32
|
-
__export(request_utils_exports, {
|
|
33
|
-
RequestUtils: () => RequestUtils
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(request_utils_exports);
|
|
36
|
-
var fs = __toESM(require("fs/promises"));
|
|
37
|
-
var path = __toESM(require("path"));
|
|
38
|
-
var import_test = require("@playwright/test");
|
|
39
|
-
var import_config = require("../config.cjs");
|
|
40
|
-
var import_login = require("./login.cjs");
|
|
41
|
-
var import_media = require("./media.cjs");
|
|
42
|
-
var import_users = require("./users.cjs");
|
|
43
|
-
var import_rest = require("./rest.cjs");
|
|
44
|
-
var import_plugins = require("./plugins.cjs");
|
|
45
|
-
var import_templates = require("./templates.cjs");
|
|
46
|
-
var import_themes = require("./themes.cjs");
|
|
47
|
-
var import_blocks = require("./blocks.cjs");
|
|
48
|
-
var import_comments = require("./comments.cjs");
|
|
49
|
-
var import_posts = require("./posts.cjs");
|
|
50
|
-
var import_menus = require("./menus.cjs");
|
|
51
|
-
var import_pages = require("./pages.cjs");
|
|
52
|
-
var import_preferences = require("./preferences.cjs");
|
|
53
|
-
var import_site_settings = require("./site-settings.cjs");
|
|
54
|
-
var import_widgets = require("./widgets.cjs");
|
|
55
|
-
var import_patterns = require("./patterns.cjs");
|
|
56
|
-
var import_gutenberg_experiments = require("./gutenberg-experiments.cjs");
|
|
57
|
-
var RequestUtils = class {
|
|
58
|
-
request;
|
|
59
|
-
user;
|
|
60
|
-
maxBatchSize;
|
|
61
|
-
storageState;
|
|
62
|
-
storageStatePath;
|
|
63
|
-
baseURL;
|
|
64
|
-
pluginsMap = null;
|
|
65
|
-
static async setup({
|
|
66
|
-
user,
|
|
67
|
-
storageStatePath,
|
|
68
|
-
baseURL = import_config.WP_BASE_URL
|
|
69
|
-
}) {
|
|
70
|
-
let storageState;
|
|
71
|
-
if (storageStatePath) {
|
|
72
|
-
await fs.mkdir(path.dirname(storageStatePath), {
|
|
73
|
-
recursive: true
|
|
74
|
-
});
|
|
75
|
-
try {
|
|
76
|
-
storageState = JSON.parse(
|
|
77
|
-
await fs.readFile(storageStatePath, "utf-8")
|
|
78
|
-
);
|
|
79
|
-
} catch (error) {
|
|
80
|
-
if (error instanceof Error && error.code === "ENOENT") {
|
|
81
|
-
} else {
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const requestContext = await import_test.request.newContext({
|
|
87
|
-
baseURL,
|
|
88
|
-
storageState: storageState && {
|
|
89
|
-
cookies: storageState.cookies,
|
|
90
|
-
origins: []
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
const requestUtils = new this(requestContext, {
|
|
94
|
-
user,
|
|
95
|
-
storageState,
|
|
96
|
-
storageStatePath,
|
|
97
|
-
baseURL
|
|
98
|
-
});
|
|
99
|
-
return requestUtils;
|
|
100
|
-
}
|
|
101
|
-
constructor(requestContext, {
|
|
102
|
-
user = import_config.WP_ADMIN_USER,
|
|
103
|
-
storageState,
|
|
104
|
-
storageStatePath,
|
|
105
|
-
baseURL = import_config.WP_BASE_URL
|
|
106
|
-
} = {}) {
|
|
107
|
-
this.user = user;
|
|
108
|
-
this.request = requestContext;
|
|
109
|
-
this.storageStatePath = storageStatePath;
|
|
110
|
-
this.storageState = storageState;
|
|
111
|
-
this.baseURL = baseURL;
|
|
112
|
-
}
|
|
113
|
-
/** @borrows login as this.login */
|
|
114
|
-
login = import_login.login.bind(this);
|
|
115
|
-
/** @borrows setupRest as this.setupRest */
|
|
116
|
-
setupRest = import_rest.setupRest.bind(this);
|
|
117
|
-
// .bind() drops the generic types. Re-casting it to keep the type signature.
|
|
118
|
-
rest = import_rest.rest.bind(this);
|
|
119
|
-
/** @borrows getMaxBatchSize as this.getMaxBatchSize */
|
|
120
|
-
getMaxBatchSize = import_rest.getMaxBatchSize.bind(this);
|
|
121
|
-
// .bind() drops the generic types. Re-casting it to keep the type signature.
|
|
122
|
-
batchRest = import_rest.batchRest.bind(this);
|
|
123
|
-
/** @borrows getPluginsMap as this.getPluginsMap */
|
|
124
|
-
getPluginsMap = import_plugins.getPluginsMap.bind(this);
|
|
125
|
-
/** @borrows activatePlugin as this.activatePlugin */
|
|
126
|
-
activatePlugin = import_plugins.activatePlugin.bind(this);
|
|
127
|
-
/** @borrows deactivatePlugin as this.deactivatePlugin */
|
|
128
|
-
deactivatePlugin = import_plugins.deactivatePlugin.bind(this);
|
|
129
|
-
/** @borrows activateTheme as this.activateTheme */
|
|
130
|
-
activateTheme = import_themes.activateTheme.bind(this);
|
|
131
|
-
/** @borrows createBlock as this.createBlock */
|
|
132
|
-
createBlock = import_blocks.createBlock.bind(this);
|
|
133
|
-
/** @borrows deleteAllBlocks as this.deleteAllBlocks */
|
|
134
|
-
deleteAllBlocks = import_blocks.deleteAllBlocks.bind(this);
|
|
135
|
-
/** @borrows createPost as this.createPost */
|
|
136
|
-
createPost = import_posts.createPost.bind(this);
|
|
137
|
-
/** @borrows deleteAllPosts as this.deleteAllPosts */
|
|
138
|
-
deleteAllPosts = import_posts.deleteAllPosts.bind(this);
|
|
139
|
-
/** @borrows createClassicMenu as this.createClassicMenu */
|
|
140
|
-
createClassicMenu = import_menus.createClassicMenu.bind(this);
|
|
141
|
-
/** @borrows createNavigationMenu as this.createNavigationMenu */
|
|
142
|
-
createNavigationMenu = import_menus.createNavigationMenu.bind(this);
|
|
143
|
-
/** @borrows deleteAllMenus as this.deleteAllMenus */
|
|
144
|
-
deleteAllMenus = import_menus.deleteAllMenus.bind(this);
|
|
145
|
-
/** @borrows getNavigationMenus as this.getNavigationMenus */
|
|
146
|
-
getNavigationMenus = import_menus.getNavigationMenus.bind(this);
|
|
147
|
-
/** @borrows createComment as this.createComment */
|
|
148
|
-
createComment = import_comments.createComment.bind(this);
|
|
149
|
-
/** @borrows deleteAllComments as this.deleteAllComments */
|
|
150
|
-
deleteAllComments = import_comments.deleteAllComments.bind(this);
|
|
151
|
-
/** @borrows deleteAllWidgets as this.deleteAllWidgets */
|
|
152
|
-
deleteAllWidgets = import_widgets.deleteAllWidgets.bind(this);
|
|
153
|
-
/** @borrows addWidgetBlock as this.addWidgetBlock */
|
|
154
|
-
addWidgetBlock = import_widgets.addWidgetBlock.bind(this);
|
|
155
|
-
/** @borrows deleteAllTemplates as this.deleteAllTemplates */
|
|
156
|
-
deleteAllTemplates = import_templates.deleteAllTemplates.bind(this);
|
|
157
|
-
/** @borrows createTemplate as this.createTemplate */
|
|
158
|
-
createTemplate = import_templates.createTemplate.bind(this);
|
|
159
|
-
/** @borrows resetPreferences as this.resetPreferences */
|
|
160
|
-
resetPreferences = import_preferences.resetPreferences.bind(this);
|
|
161
|
-
/** @borrows listMedia as this.listMedia */
|
|
162
|
-
listMedia = import_media.listMedia.bind(this);
|
|
163
|
-
/** @borrows uploadMedia as this.uploadMedia */
|
|
164
|
-
uploadMedia = import_media.uploadMedia.bind(this);
|
|
165
|
-
/** @borrows deleteMedia as this.deleteMedia */
|
|
166
|
-
deleteMedia = import_media.deleteMedia.bind(this);
|
|
167
|
-
/** @borrows deleteAllMedia as this.deleteAllMedia */
|
|
168
|
-
deleteAllMedia = import_media.deleteAllMedia.bind(this);
|
|
169
|
-
/** @borrows createUser as this.createUser */
|
|
170
|
-
createUser = import_users.createUser.bind(this);
|
|
171
|
-
/** @borrows deleteAllUsers as this.deleteAllUsers */
|
|
172
|
-
deleteAllUsers = import_users.deleteAllUsers.bind(this);
|
|
173
|
-
/** @borrows getSiteSettings as this.getSiteSettings */
|
|
174
|
-
getSiteSettings = import_site_settings.getSiteSettings.bind(this);
|
|
175
|
-
/** @borrows updateSiteSettings as this.updateSiteSettings */
|
|
176
|
-
updateSiteSettings = import_site_settings.updateSiteSettings.bind(this);
|
|
177
|
-
/** @borrows deleteAllPages as this.deleteAllPages */
|
|
178
|
-
deleteAllPages = import_pages.deleteAllPages.bind(this);
|
|
179
|
-
/** @borrows createPage as this.createPage */
|
|
180
|
-
createPage = import_pages.createPage.bind(this);
|
|
181
|
-
/** @borrows getCurrentThemeGlobalStylesPostId as this.getCurrentThemeGlobalStylesPostId */
|
|
182
|
-
getCurrentThemeGlobalStylesPostId = import_themes.getCurrentThemeGlobalStylesPostId.bind(this);
|
|
183
|
-
/** @borrows getThemeGlobalStylesRevisions as this.getThemeGlobalStylesRevisions */
|
|
184
|
-
getThemeGlobalStylesRevisions = import_themes.getThemeGlobalStylesRevisions.bind(this);
|
|
185
|
-
/** @borrows deleteAllPatternCategories as this.deleteAllPatternCategories */
|
|
186
|
-
deleteAllPatternCategories = import_patterns.deleteAllPatternCategories.bind(this);
|
|
187
|
-
/** @borrows setGutenbergExperiments as this.setGutenbergExperiments */
|
|
188
|
-
setGutenbergExperiments = import_gutenberg_experiments.setGutenbergExperiments.bind(this);
|
|
189
|
-
};
|
|
190
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
191
|
-
0 && (module.exports = {
|
|
192
|
-
RequestUtils
|
|
193
|
-
});
|
|
194
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { request } from '@playwright/test';\nimport type { APIRequestContext, Cookie } from '@playwright/test';\n\n/**\n * Internal dependencies\n */\nimport { WP_ADMIN_USER, WP_BASE_URL } from '../config';\nimport type { User } from './login';\nimport { login } from './login';\nimport { listMedia, uploadMedia, deleteMedia, deleteAllMedia } from './media';\nimport { createUser, deleteAllUsers } from './users';\nimport { setupRest, rest, getMaxBatchSize, batchRest } from './rest';\nimport { getPluginsMap, activatePlugin, deactivatePlugin } from './plugins';\nimport { deleteAllTemplates, createTemplate } from './templates';\nimport {\n\tactivateTheme,\n\tgetCurrentThemeGlobalStylesPostId,\n\tgetThemeGlobalStylesRevisions,\n} from './themes';\nimport { createBlock, deleteAllBlocks } from './blocks';\nimport { createComment, deleteAllComments } from './comments';\nimport { createPost, deleteAllPosts } from './posts';\nimport {\n\tcreateClassicMenu,\n\tcreateNavigationMenu,\n\tdeleteAllMenus,\n\tgetNavigationMenus,\n} from './menus';\nimport { deleteAllPages, createPage } from './pages';\nimport { resetPreferences } from './preferences';\nimport { getSiteSettings, updateSiteSettings } from './site-settings';\nimport { deleteAllWidgets, addWidgetBlock } from './widgets';\nimport { deleteAllPatternCategories } from './patterns';\nimport { setGutenbergExperiments } from './gutenberg-experiments';\n\ninterface StorageState {\n\tcookies: Cookie[];\n\tnonce: string;\n\trootURL: string;\n}\n\nclass RequestUtils {\n\trequest: APIRequestContext;\n\tuser: User;\n\tmaxBatchSize?: number;\n\tstorageState?: StorageState;\n\tstorageStatePath?: string;\n\tbaseURL?: string;\n\n\tpluginsMap: Record< string, string > | null = null;\n\n\tstatic async setup( {\n\t\tuser,\n\t\tstorageStatePath,\n\t\tbaseURL = WP_BASE_URL,\n\t}: {\n\t\tuser?: User;\n\t\tstorageStatePath?: string;\n\t\tbaseURL?: string;\n\t} ) {\n\t\tlet storageState: StorageState | undefined;\n\t\tif ( storageStatePath ) {\n\t\t\tawait fs.mkdir( path.dirname( storageStatePath ), {\n\t\t\t\trecursive: true,\n\t\t\t} );\n\n\t\t\ttry {\n\t\t\t\tstorageState = JSON.parse(\n\t\t\t\t\tawait fs.readFile( storageStatePath, 'utf-8' )\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tif (\n\t\t\t\t\terror instanceof Error &&\n\t\t\t\t\t( error as NodeJS.ErrnoException ).code === 'ENOENT'\n\t\t\t\t) {\n\t\t\t\t\t// Ignore errors if the state is not found.\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst requestContext = await request.newContext( {\n\t\t\tbaseURL,\n\t\t\tstorageState: storageState && {\n\t\t\t\tcookies: storageState.cookies,\n\t\t\t\torigins: [],\n\t\t\t},\n\t\t} );\n\n\t\tconst requestUtils = new this( requestContext, {\n\t\t\tuser,\n\t\t\tstorageState,\n\t\t\tstorageStatePath,\n\t\t\tbaseURL,\n\t\t} );\n\n\t\treturn requestUtils;\n\t}\n\n\tconstructor(\n\t\trequestContext: APIRequestContext,\n\t\t{\n\t\t\tuser = WP_ADMIN_USER,\n\t\t\tstorageState,\n\t\t\tstorageStatePath,\n\t\t\tbaseURL = WP_BASE_URL,\n\t\t}: {\n\t\t\tuser?: User;\n\t\t\tstorageState?: StorageState;\n\t\t\tstorageStatePath?: string;\n\t\t\tbaseURL?: string;\n\t\t} = {}\n\t) {\n\t\tthis.user = user;\n\t\tthis.request = requestContext;\n\t\tthis.storageStatePath = storageStatePath;\n\t\tthis.storageState = storageState;\n\t\tthis.baseURL = baseURL;\n\t}\n\n\t/** @borrows login as this.login */\n\tlogin: typeof login = login.bind( this );\n\t/** @borrows setupRest as this.setupRest */\n\tsetupRest: typeof setupRest = setupRest.bind( this );\n\t// .bind() drops the generic types. Re-casting it to keep the type signature.\n\trest: typeof rest = rest.bind( this ) as typeof rest;\n\t/** @borrows getMaxBatchSize as this.getMaxBatchSize */\n\tgetMaxBatchSize: typeof getMaxBatchSize = getMaxBatchSize.bind( this );\n\t// .bind() drops the generic types. Re-casting it to keep the type signature.\n\tbatchRest: typeof batchRest = batchRest.bind( this ) as typeof batchRest;\n\t/** @borrows getPluginsMap as this.getPluginsMap */\n\tgetPluginsMap: typeof getPluginsMap = getPluginsMap.bind( this );\n\t/** @borrows activatePlugin as this.activatePlugin */\n\tactivatePlugin: typeof activatePlugin = activatePlugin.bind( this );\n\t/** @borrows deactivatePlugin as this.deactivatePlugin */\n\tdeactivatePlugin: typeof deactivatePlugin = deactivatePlugin.bind( this );\n\t/** @borrows activateTheme as this.activateTheme */\n\tactivateTheme: typeof activateTheme = activateTheme.bind( this );\n\t/** @borrows createBlock as this.createBlock */\n\tcreateBlock: typeof createBlock = createBlock.bind( this );\n\t/** @borrows deleteAllBlocks as this.deleteAllBlocks */\n\tdeleteAllBlocks = deleteAllBlocks.bind( this );\n\t/** @borrows createPost as this.createPost */\n\tcreatePost: typeof createPost = createPost.bind( this );\n\t/** @borrows deleteAllPosts as this.deleteAllPosts */\n\tdeleteAllPosts: typeof deleteAllPosts = deleteAllPosts.bind( this );\n\t/** @borrows createClassicMenu as this.createClassicMenu */\n\tcreateClassicMenu: typeof createClassicMenu =\n\t\tcreateClassicMenu.bind( this );\n\t/** @borrows createNavigationMenu as this.createNavigationMenu */\n\tcreateNavigationMenu: typeof createNavigationMenu =\n\t\tcreateNavigationMenu.bind( this );\n\t/** @borrows deleteAllMenus as this.deleteAllMenus */\n\tdeleteAllMenus: typeof deleteAllMenus = deleteAllMenus.bind( this );\n\t/** @borrows getNavigationMenus as this.getNavigationMenus */\n\tgetNavigationMenus: typeof getNavigationMenus =\n\t\tgetNavigationMenus.bind( this );\n\t/** @borrows createComment as this.createComment */\n\tcreateComment: typeof createComment = createComment.bind( this );\n\t/** @borrows deleteAllComments as this.deleteAllComments */\n\tdeleteAllComments: typeof deleteAllComments =\n\t\tdeleteAllComments.bind( this );\n\t/** @borrows deleteAllWidgets as this.deleteAllWidgets */\n\tdeleteAllWidgets: typeof deleteAllWidgets = deleteAllWidgets.bind( this );\n\t/** @borrows addWidgetBlock as this.addWidgetBlock */\n\taddWidgetBlock: typeof addWidgetBlock = addWidgetBlock.bind( this );\n\t/** @borrows deleteAllTemplates as this.deleteAllTemplates */\n\tdeleteAllTemplates: typeof deleteAllTemplates =\n\t\tdeleteAllTemplates.bind( this );\n\t/** @borrows createTemplate as this.createTemplate */\n\tcreateTemplate: typeof createTemplate = createTemplate.bind( this );\n\t/** @borrows resetPreferences as this.resetPreferences */\n\tresetPreferences: typeof resetPreferences = resetPreferences.bind( this );\n\t/** @borrows listMedia as this.listMedia */\n\tlistMedia: typeof listMedia = listMedia.bind( this );\n\t/** @borrows uploadMedia as this.uploadMedia */\n\tuploadMedia: typeof uploadMedia = uploadMedia.bind( this );\n\t/** @borrows deleteMedia as this.deleteMedia */\n\tdeleteMedia: typeof deleteMedia = deleteMedia.bind( this );\n\t/** @borrows deleteAllMedia as this.deleteAllMedia */\n\tdeleteAllMedia: typeof deleteAllMedia = deleteAllMedia.bind( this );\n\t/** @borrows createUser as this.createUser */\n\tcreateUser: typeof createUser = createUser.bind( this );\n\t/** @borrows deleteAllUsers as this.deleteAllUsers */\n\tdeleteAllUsers: typeof deleteAllUsers = deleteAllUsers.bind( this );\n\t/** @borrows getSiteSettings as this.getSiteSettings */\n\tgetSiteSettings: typeof getSiteSettings = getSiteSettings.bind( this );\n\t/** @borrows updateSiteSettings as this.updateSiteSettings */\n\tupdateSiteSettings: typeof updateSiteSettings =\n\t\tupdateSiteSettings.bind( this );\n\t/** @borrows deleteAllPages as this.deleteAllPages */\n\tdeleteAllPages: typeof deleteAllPages = deleteAllPages.bind( this );\n\t/** @borrows createPage as this.createPage */\n\tcreatePage: typeof createPage = createPage.bind( this );\n\t/** @borrows getCurrentThemeGlobalStylesPostId as this.getCurrentThemeGlobalStylesPostId */\n\tgetCurrentThemeGlobalStylesPostId: typeof getCurrentThemeGlobalStylesPostId =\n\t\tgetCurrentThemeGlobalStylesPostId.bind( this );\n\t/** @borrows getThemeGlobalStylesRevisions as this.getThemeGlobalStylesRevisions */\n\tgetThemeGlobalStylesRevisions: typeof getThemeGlobalStylesRevisions =\n\t\tgetThemeGlobalStylesRevisions.bind( this );\n\t/** @borrows deleteAllPatternCategories as this.deleteAllPatternCategories */\n\tdeleteAllPatternCategories = deleteAllPatternCategories.bind( this );\n\t/** @borrows setGutenbergExperiments as this.setGutenbergExperiments */\n\tsetGutenbergExperiments: typeof setGutenbergExperiments =\n\t\tsetGutenbergExperiments.bind( this );\n}\n\nexport type { StorageState };\nexport { RequestUtils };\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/login.ts
|
|
21
|
-
var login_exports = {};
|
|
22
|
-
__export(login_exports, {
|
|
23
|
-
login: () => login
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(login_exports);
|
|
26
|
-
async function login(user = this.user) {
|
|
27
|
-
let response = await this.request.post("wp-login.php", {
|
|
28
|
-
failOnStatusCode: true,
|
|
29
|
-
form: {
|
|
30
|
-
log: user.username,
|
|
31
|
-
pwd: user.password
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
await response.dispose();
|
|
35
|
-
response = await this.request.get(
|
|
36
|
-
"wp-admin/admin-ajax.php?action=rest-nonce",
|
|
37
|
-
{
|
|
38
|
-
failOnStatusCode: true
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
const nonce = await response.text();
|
|
42
|
-
return nonce;
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
login
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=login.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/login.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\nexport interface User {\n\tusername: string;\n\tpassword: string;\n}\n\nasync function login( this: RequestUtils, user: User = this.user ) {\n\t// Login to admin using request context.\n\tlet response = await this.request.post( 'wp-login.php', {\n\t\tfailOnStatusCode: true,\n\t\tform: {\n\t\t\tlog: user.username,\n\t\t\tpwd: user.password,\n\t\t},\n\t} );\n\tawait response.dispose();\n\n\t// Get the nonce.\n\tresponse = await this.request.get(\n\t\t'wp-admin/admin-ajax.php?action=rest-nonce',\n\t\t{\n\t\t\tfailOnStatusCode: true,\n\t\t}\n\t);\n\tconst nonce = await response.text();\n\n\treturn nonce;\n}\n\nexport { login };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,eAAe,MAA2B,OAAa,KAAK,MAAO;AAElE,MAAI,WAAW,MAAM,KAAK,QAAQ,KAAM,gBAAgB;AAAA,IACvD,kBAAkB;AAAA,IAClB,MAAM;AAAA,MACL,KAAK,KAAK;AAAA,MACV,KAAK,KAAK;AAAA,IACX;AAAA,EACD,CAAE;AACF,QAAM,SAAS,QAAQ;AAGvB,aAAW,MAAM,KAAK,QAAQ;AAAA,IAC7B;AAAA,IACA;AAAA,MACC,kBAAkB;AAAA,IACnB;AAAA,EACD;AACA,QAAM,QAAQ,MAAM,SAAS,KAAK;AAElC,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/e2e-test-utils-playwright/src/request-utils/media.ts
|
|
31
|
-
var media_exports = {};
|
|
32
|
-
__export(media_exports, {
|
|
33
|
-
deleteAllMedia: () => deleteAllMedia,
|
|
34
|
-
deleteMedia: () => deleteMedia,
|
|
35
|
-
listMedia: () => listMedia,
|
|
36
|
-
uploadMedia: () => uploadMedia
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(media_exports);
|
|
39
|
-
var fs = __toESM(require("fs"));
|
|
40
|
-
async function listMedia() {
|
|
41
|
-
const response = await this.rest({
|
|
42
|
-
method: "GET",
|
|
43
|
-
path: "/wp/v2/media",
|
|
44
|
-
params: {
|
|
45
|
-
per_page: 100
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return response;
|
|
49
|
-
}
|
|
50
|
-
async function uploadMedia(filePathOrData) {
|
|
51
|
-
const file = typeof filePathOrData === "string" ? fs.createReadStream(filePathOrData) : filePathOrData;
|
|
52
|
-
const response = await this.rest({
|
|
53
|
-
method: "POST",
|
|
54
|
-
path: "/wp/v2/media",
|
|
55
|
-
multipart: {
|
|
56
|
-
file
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return response;
|
|
60
|
-
}
|
|
61
|
-
async function deleteMedia(mediaId) {
|
|
62
|
-
const response = await this.rest({
|
|
63
|
-
method: "DELETE",
|
|
64
|
-
path: `/wp/v2/media/${mediaId}`,
|
|
65
|
-
params: { force: true }
|
|
66
|
-
});
|
|
67
|
-
return response;
|
|
68
|
-
}
|
|
69
|
-
async function deleteAllMedia() {
|
|
70
|
-
const files = await this.listMedia();
|
|
71
|
-
const responses = await Promise.all(
|
|
72
|
-
files.map((media) => this.deleteMedia(media.id))
|
|
73
|
-
);
|
|
74
|
-
return responses;
|
|
75
|
-
}
|
|
76
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
-
0 && (module.exports = {
|
|
78
|
-
deleteAllMedia,
|
|
79
|
-
deleteMedia,
|
|
80
|
-
listMedia,
|
|
81
|
-
uploadMedia
|
|
82
|
-
});
|
|
83
|
-
//# sourceMappingURL=media.cjs.map
|