@wordpress/e2e-test-utils-playwright 0.1.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/LICENSE.md +788 -0
- package/README.md +89 -0
- package/build/admin/create-new-post.js +49 -0
- package/build/admin/create-new-post.js.map +1 -0
- package/build/admin/get-page-error.js +27 -0
- package/build/admin/get-page-error.js.map +1 -0
- package/build/admin/index.js +32 -0
- package/build/admin/index.js.map +1 -0
- package/build/admin/visit-admin-page.js +33 -0
- package/build/admin/visit-admin-page.js.map +1 -0
- package/build/admin/visit-site-editor.js +42 -0
- package/build/admin/visit-site-editor.js.map +1 -0
- package/build/config.js +13 -0
- package/build/config.js.map +1 -0
- package/build/editor/click-block-options-menu-item.js +17 -0
- package/build/editor/click-block-options-menu-item.js.map +1 -0
- package/build/editor/click-block-toolbar-button.js +17 -0
- package/build/editor/click-block-toolbar-button.js.map +1 -0
- package/build/editor/get-blocks.js +23 -0
- package/build/editor/get-blocks.js.map +1 -0
- package/build/editor/get-edited-post-content.js +15 -0
- package/build/editor/get-edited-post-content.js.map +1 -0
- package/build/editor/index.js +63 -0
- package/build/editor/index.js.map +1 -0
- package/build/editor/insert-block.js +20 -0
- package/build/editor/insert-block.js.map +1 -0
- package/build/editor/open-document-settings-sidebar.js +27 -0
- package/build/editor/open-document-settings-sidebar.js.map +1 -0
- package/build/editor/preview.js +22 -0
- package/build/editor/preview.js.map +1 -0
- package/build/editor/publish-post.js +30 -0
- package/build/editor/publish-post.js.map +1 -0
- package/build/editor/select-blocks.js +29 -0
- package/build/editor/select-blocks.js.map +1 -0
- package/build/editor/set-content.js +17 -0
- package/build/editor/set-content.js.map +1 -0
- package/build/editor/set-is-fixed-toolbar.js +20 -0
- package/build/editor/set-is-fixed-toolbar.js.map +1 -0
- package/build/editor/show-block-toolbar.js +20 -0
- package/build/editor/show-block-toolbar.js.map +1 -0
- package/build/editor/site-editor.js +19 -0
- package/build/editor/site-editor.js.map +1 -0
- package/build/editor/transform-block-to.js +24 -0
- package/build/editor/transform-block-to.js.map +1 -0
- package/build/index.js +30 -0
- package/build/index.js.map +1 -0
- package/build/page-utils/drag-files.js +115 -0
- package/build/page-utils/drag-files.js.map +1 -0
- package/build/page-utils/index.js +32 -0
- package/build/page-utils/index.js.map +1 -0
- package/build/page-utils/is-current-url.js +22 -0
- package/build/page-utils/is-current-url.js.map +1 -0
- package/build/page-utils/press-keys.js +123 -0
- package/build/page-utils/press-keys.js.map +1 -0
- package/build/page-utils/set-browser-viewport.js +47 -0
- package/build/page-utils/set-browser-viewport.js.map +1 -0
- package/build/request-utils/blocks.js +30 -0
- package/build/request-utils/blocks.js.map +1 -0
- package/build/request-utils/comments.js +52 -0
- package/build/request-utils/comments.js.map +1 -0
- package/build/request-utils/index.js +148 -0
- package/build/request-utils/index.js.map +1 -0
- package/build/request-utils/login.js +22 -0
- package/build/request-utils/login.js.map +1 -0
- package/build/request-utils/media.js +74 -0
- package/build/request-utils/media.js.map +1 -0
- package/build/request-utils/menus.js +121 -0
- package/build/request-utils/menus.js.map +1 -0
- package/build/request-utils/pages.js +59 -0
- package/build/request-utils/pages.js.map +1 -0
- package/build/request-utils/plugins.js +69 -0
- package/build/request-utils/plugins.js.map +1 -0
- package/build/request-utils/posts.js +47 -0
- package/build/request-utils/posts.js.map +1 -0
- package/build/request-utils/preferences.js +21 -0
- package/build/request-utils/preferences.js.map +1 -0
- package/build/request-utils/rest.js +130 -0
- package/build/request-utils/rest.js.map +1 -0
- package/build/request-utils/site-settings.js +34 -0
- package/build/request-utils/site-settings.js.map +1 -0
- package/build/request-utils/templates.js +39 -0
- package/build/request-utils/templates.js.map +1 -0
- package/build/request-utils/themes.js +56 -0
- package/build/request-utils/themes.js.map +1 -0
- package/build/request-utils/users.js +82 -0
- package/build/request-utils/users.js.map +1 -0
- package/build/request-utils/widgets.js +62 -0
- package/build/request-utils/widgets.js.map +1 -0
- package/build/test.js +122 -0
- package/build/test.js.map +1 -0
- package/build/types.js +3 -0
- package/build/types.js.map +1 -0
- package/build-types/admin/create-new-post.d.ts +19 -0
- package/build-types/admin/create-new-post.d.ts.map +1 -0
- package/build-types/admin/get-page-error.d.ts +17 -0
- package/build-types/admin/get-page-error.d.ts.map +1 -0
- package/build-types/admin/index.d.ts +33 -0
- package/build-types/admin/index.d.ts.map +1 -0
- package/build-types/admin/visit-admin-page.d.ts +13 -0
- package/build-types/admin/visit-admin-page.d.ts.map +1 -0
- package/build-types/admin/visit-site-editor.d.ts +19 -0
- package/build-types/admin/visit-site-editor.d.ts.map +1 -0
- package/build-types/config.d.ts +7 -0
- package/build-types/config.d.ts.map +1 -0
- package/build-types/editor/click-block-options-menu-item.d.ts +12 -0
- package/build-types/editor/click-block-options-menu-item.d.ts.map +1 -0
- package/build-types/editor/click-block-toolbar-button.d.ts +12 -0
- package/build-types/editor/click-block-toolbar-button.d.ts.map +1 -0
- package/build-types/editor/get-blocks.d.ts +13 -0
- package/build-types/editor/get-blocks.d.ts.map +1 -0
- package/build-types/editor/get-edited-post-content.d.ts +13 -0
- package/build-types/editor/get-edited-post-content.d.ts.map +1 -0
- package/build-types/editor/index.d.ts +61 -0
- package/build-types/editor/index.d.ts.map +1 -0
- package/build-types/editor/insert-block.d.ts +19 -0
- package/build-types/editor/insert-block.d.ts.map +1 -0
- package/build-types/editor/open-document-settings-sidebar.d.ts +12 -0
- package/build-types/editor/open-document-settings-sidebar.d.ts.map +1 -0
- package/build-types/editor/preview.d.ts +17 -0
- package/build-types/editor/preview.d.ts.map +1 -0
- package/build-types/editor/publish-post.d.ts +12 -0
- package/build-types/editor/publish-post.d.ts.map +1 -0
- package/build-types/editor/select-blocks.d.ts +10 -0
- package/build-types/editor/select-blocks.d.ts.map +1 -0
- package/build-types/editor/set-content.d.ts +13 -0
- package/build-types/editor/set-content.d.ts.map +1 -0
- package/build-types/editor/set-is-fixed-toolbar.d.ts +12 -0
- package/build-types/editor/set-is-fixed-toolbar.d.ts.map +1 -0
- package/build-types/editor/show-block-toolbar.d.ts +12 -0
- package/build-types/editor/show-block-toolbar.d.ts.map +1 -0
- package/build-types/editor/site-editor.d.ts +11 -0
- package/build-types/editor/site-editor.d.ts.map +1 -0
- package/build-types/editor/transform-block-to.d.ts +12 -0
- package/build-types/editor/transform-block-to.d.ts.map +1 -0
- package/build-types/index.d.ts +7 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/page-utils/drag-files.d.ts +40 -0
- package/build-types/page-utils/drag-files.d.ts.map +1 -0
- package/build-types/page-utils/index.d.ts +32 -0
- package/build-types/page-utils/index.d.ts.map +1 -0
- package/build-types/page-utils/is-current-url.d.ts +11 -0
- package/build-types/page-utils/is-current-url.d.ts.map +1 -0
- package/build-types/page-utils/press-keys.d.ts +25 -0
- package/build-types/page-utils/press-keys.d.ts.map +1 -0
- package/build-types/page-utils/set-browser-viewport.d.ts +34 -0
- package/build-types/page-utils/set-browser-viewport.d.ts.map +1 -0
- package/build-types/request-utils/blocks.d.ts +8 -0
- package/build-types/request-utils/blocks.d.ts.map +1 -0
- package/build-types/request-utils/comments.d.ts +31 -0
- package/build-types/request-utils/comments.d.ts.map +1 -0
- package/build-types/request-utils/index.d.ts +111 -0
- package/build-types/request-utils/index.d.ts.map +1 -0
- package/build-types/request-utils/login.d.ts +11 -0
- package/build-types/request-utils/login.d.ts.map +1 -0
- package/build-types/request-utils/media.d.ts +54 -0
- package/build-types/request-utils/media.d.ts.map +1 -0
- package/build-types/request-utils/menus.d.ts +43 -0
- package/build-types/request-utils/menus.d.ts.map +1 -0
- package/build-types/request-utils/pages.d.ts +32 -0
- package/build-types/request-utils/pages.d.ts.map +1 -0
- package/build-types/request-utils/plugins.d.ts +28 -0
- package/build-types/request-utils/plugins.d.ts.map +1 -0
- package/build-types/request-utils/posts.d.ts +30 -0
- package/build-types/request-utils/posts.d.ts.map +1 -0
- package/build-types/request-utils/preferences.d.ts +11 -0
- package/build-types/request-utils/preferences.d.ts.map +1 -0
- package/build-types/request-utils/rest.d.ts +24 -0
- package/build-types/request-utils/rest.d.ts.map +1 -0
- package/build-types/request-utils/site-settings.d.ts +40 -0
- package/build-types/request-utils/site-settings.d.ts.map +1 -0
- package/build-types/request-utils/templates.d.ts +14 -0
- package/build-types/request-utils/templates.d.ts.map +1 -0
- package/build-types/request-utils/themes.d.ts +15 -0
- package/build-types/request-utils/themes.d.ts.map +1 -0
- package/build-types/request-utils/users.d.ts +40 -0
- package/build-types/request-utils/users.d.ts.map +1 -0
- package/build-types/request-utils/widgets.d.ts +15 -0
- package/build-types/request-utils/widgets.d.ts.map +1 -0
- package/build-types/test.d.ts +15 -0
- package/build-types/test.d.ts.map +1 -0
- package/build-types/types.d.ts +7 -0
- package/build-types/types.d.ts.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.batchRest = exports.getMaxBatchSize = exports.rest = exports.setupRest = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
const fs = require("fs/promises");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
const config_1 = require("../config");
|
|
13
|
+
function splitRequestsToChunks(requests, chunkSize) {
|
|
14
|
+
const arr = [...requests];
|
|
15
|
+
const cache = [];
|
|
16
|
+
while (arr.length) {
|
|
17
|
+
cache.push(arr.splice(0, chunkSize));
|
|
18
|
+
}
|
|
19
|
+
return cache;
|
|
20
|
+
}
|
|
21
|
+
async function getAPIRootURL(request) {
|
|
22
|
+
// Discover the API root url using link header.
|
|
23
|
+
// See https://developer.wordpress.org/rest-api/using-the-rest-api/discovery/#link-header
|
|
24
|
+
const response = await request.head(config_1.WP_BASE_URL);
|
|
25
|
+
const links = response.headers().link;
|
|
26
|
+
const restLink = links?.match(/<([^>]+)>; rel="https:\/\/api\.w\.org\/"/);
|
|
27
|
+
if (!restLink) {
|
|
28
|
+
throw new Error(`Failed to discover REST API endpoint.
|
|
29
|
+
Link header: ${links}`);
|
|
30
|
+
}
|
|
31
|
+
const [, rootURL] = restLink;
|
|
32
|
+
return rootURL;
|
|
33
|
+
}
|
|
34
|
+
async function setupRest() {
|
|
35
|
+
const [nonce, rootURL] = await Promise.all([
|
|
36
|
+
this.login(),
|
|
37
|
+
getAPIRootURL(this.request),
|
|
38
|
+
]);
|
|
39
|
+
const { cookies } = await this.request.storageState();
|
|
40
|
+
const storageState = {
|
|
41
|
+
cookies,
|
|
42
|
+
nonce,
|
|
43
|
+
rootURL,
|
|
44
|
+
};
|
|
45
|
+
if (this.storageStatePath) {
|
|
46
|
+
await fs.mkdir((0, path_1.dirname)(this.storageStatePath), { recursive: true });
|
|
47
|
+
await fs.writeFile(this.storageStatePath, JSON.stringify(storageState), 'utf-8');
|
|
48
|
+
}
|
|
49
|
+
this.storageState = storageState;
|
|
50
|
+
return storageState;
|
|
51
|
+
}
|
|
52
|
+
exports.setupRest = setupRest;
|
|
53
|
+
async function rest(options) {
|
|
54
|
+
const { path, ...fetchOptions } = options;
|
|
55
|
+
if (!path) {
|
|
56
|
+
throw new Error('"path" is required to make a REST call');
|
|
57
|
+
}
|
|
58
|
+
if (!this.storageState?.nonce || !this.storageState?.rootURL) {
|
|
59
|
+
await this.setupRest();
|
|
60
|
+
}
|
|
61
|
+
const relativePath = path.startsWith('/') ? path.slice(1) : path;
|
|
62
|
+
const url = this.storageState.rootURL + relativePath;
|
|
63
|
+
try {
|
|
64
|
+
const response = await this.request.fetch(url, {
|
|
65
|
+
...fetchOptions,
|
|
66
|
+
failOnStatusCode: false,
|
|
67
|
+
headers: {
|
|
68
|
+
'X-WP-Nonce': this.storageState.nonce,
|
|
69
|
+
...(fetchOptions.headers || {}),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const json = await response.json();
|
|
73
|
+
if (!response.ok()) {
|
|
74
|
+
throw json;
|
|
75
|
+
}
|
|
76
|
+
return json;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
// Nonce in invalid, retry again with a renewed nonce.
|
|
80
|
+
if (typeof error === 'object' &&
|
|
81
|
+
error !== null &&
|
|
82
|
+
Object.prototype.hasOwnProperty.call(error, 'code') &&
|
|
83
|
+
error.code === 'rest_cookie_invalid_nonce') {
|
|
84
|
+
await this.setupRest();
|
|
85
|
+
return this.rest(options);
|
|
86
|
+
}
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.rest = rest;
|
|
91
|
+
/**
|
|
92
|
+
* Get the maximum batch size for the REST API.
|
|
93
|
+
*
|
|
94
|
+
* @param this
|
|
95
|
+
* @param forceRefetch Force revalidate the cached max batch size.
|
|
96
|
+
*/
|
|
97
|
+
async function getMaxBatchSize(forceRefetch = false) {
|
|
98
|
+
if (!forceRefetch && this.maxBatchSize) {
|
|
99
|
+
return this.maxBatchSize;
|
|
100
|
+
}
|
|
101
|
+
const response = await this.rest({
|
|
102
|
+
method: 'OPTIONS',
|
|
103
|
+
path: '/batch/v1',
|
|
104
|
+
});
|
|
105
|
+
this.maxBatchSize = response.endpoints[0].args.requests.maxItems;
|
|
106
|
+
return this.maxBatchSize;
|
|
107
|
+
}
|
|
108
|
+
exports.getMaxBatchSize = getMaxBatchSize;
|
|
109
|
+
async function batchRest(requests) {
|
|
110
|
+
const maxBatchSize = await this.getMaxBatchSize();
|
|
111
|
+
if (requests.length > maxBatchSize) {
|
|
112
|
+
const chunks = splitRequestsToChunks(requests, maxBatchSize);
|
|
113
|
+
const chunkResponses = await Promise.all(chunks.map((chunkRequests) => this.batchRest(chunkRequests)));
|
|
114
|
+
return chunkResponses.flat();
|
|
115
|
+
}
|
|
116
|
+
const batchResponses = await this.rest({
|
|
117
|
+
method: 'POST',
|
|
118
|
+
path: '/batch/v1',
|
|
119
|
+
data: {
|
|
120
|
+
requests,
|
|
121
|
+
validation: 'require-all-validate',
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
if (batchResponses.failed) {
|
|
125
|
+
throw batchResponses;
|
|
126
|
+
}
|
|
127
|
+
return batchResponses.responses;
|
|
128
|
+
}
|
|
129
|
+
exports.batchRest = batchRest;
|
|
130
|
+
//# sourceMappingURL=rest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/request-utils/rest.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,kCAAkC;AAClC,+BAA+B;AAG/B;;GAEG;AACH,sCAAwC;AAGxC,SAAS,qBAAqB,CAAE,QAAwB,EAAE,SAAiB;IAC1E,MAAM,GAAG,GAAG,CAAE,GAAG,QAAQ,CAAE,CAAC;IAC5B,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,OAAQ,GAAG,CAAC,MAAM,EAAG;QACpB,KAAK,CAAC,IAAI,CAAE,GAAG,CAAC,MAAM,CAAE,CAAC,EAAE,SAAS,CAAE,CAAE,CAAC;KACzC;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAED,KAAK,UAAU,aAAa,CAAE,OAA0B;IACvD,+CAA+C;IAC/C,yFAAyF;IACzF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAE,oBAAW,CAAE,CAAC;IACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;IACtC,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAK,CAAE,0CAA0C,CAAE,CAAC;IAE5E,IAAK,CAAE,QAAQ,EAAG;QACjB,MAAM,IAAI,KAAK,CAAE;gBACF,KAAM,EAAE,CAAE,CAAC;KAC1B;IAED,MAAM,CAAE,AAAD,EAAG,OAAO,CAAE,GAAG,QAAQ,CAAC;IAE/B,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,SAAS;IACvB,MAAM,CAAE,KAAK,EAAE,OAAO,CAAE,GAAG,MAAM,OAAO,CAAC,GAAG,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;AAC1B,CAAC;AA8CyB,0CAAe;AArCzC,KAAK,UAAU,SAAS,CAEvB,QAAwB;IAExB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;IAElD,IAAK,QAAQ,CAAC,MAAM,GAAG,YAAY,EAAG;QACrC,MAAM,MAAM,GAAG,qBAAqB,CAAE,QAAQ,EAAE,YAAY,CAAE,CAAC;QAE/D,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,GAAG,CACvC,MAAM,CAAC,GAAG,CAAE,CAAE,aAAa,EAAG,EAAE,CAC/B,IAAI,CAAC,SAAS,CAAmB,aAAa,CAAE,CAChD,CACD,CAAC;QAEF,OAAO,cAAc,CAAC,IAAI,EAAE,CAAC;KAC7B;IAED,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,IAAI,CAGjC;QACJ,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE;YACL,QAAQ;YACR,UAAU,EAAE,sBAAsB;SAClC;KACD,CAAE,CAAC;IAEJ,IAAK,cAAc,CAAC,MAAM,EAAG;QAC5B,MAAM,cAAc,CAAC;KACrB;IAED,OAAO,cAAc,CAAC,SAAS,CAAC;AACjC,CAAC;AAE0C,8BAAS"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateSiteSettings = exports.getSiteSettings = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Get the site settings.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.wordpress.org/rest-api/reference/settings/#retrieve-a-site-setting
|
|
8
|
+
*
|
|
9
|
+
* @param this RequestUtils.
|
|
10
|
+
*/
|
|
11
|
+
async function getSiteSettings() {
|
|
12
|
+
return await this.rest({
|
|
13
|
+
path: '/wp/v2/settings',
|
|
14
|
+
method: 'GET',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.getSiteSettings = getSiteSettings;
|
|
18
|
+
/**
|
|
19
|
+
* Update the site settings.
|
|
20
|
+
*
|
|
21
|
+
* @see https://developer.wordpress.org/rest-api/reference/settings/#update-a-site-setting
|
|
22
|
+
*
|
|
23
|
+
* @param this RequestUtils.
|
|
24
|
+
* @param siteSettings The partial settings payload to update.
|
|
25
|
+
*/
|
|
26
|
+
async function updateSiteSettings(siteSettings) {
|
|
27
|
+
return await this.rest({
|
|
28
|
+
path: '/wp/v2/settings',
|
|
29
|
+
method: 'POST',
|
|
30
|
+
data: siteSettings,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.updateSiteSettings = updateSiteSettings;
|
|
34
|
+
//# sourceMappingURL=site-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-settings.js","sourceRoot":"","sources":["../../src/request-utils/site-settings.ts"],"names":[],"mappings":";;;AAuBA;;;;;;GAMG;AACI,KAAK,UAAU,eAAe;IACpC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAkB;QACvC,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,KAAK;KACb,CAAE,CAAC;AACL,CAAC;AALD,0CAKC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,kBAAkB,CAEvC,YAAqC;IAErC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAkB;QACvC,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,YAAY;KAClB,CAAE,CAAC;AACL,CAAC;AATD,gDASC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteAllTemplates = void 0;
|
|
4
|
+
const PATH_MAPPING = {
|
|
5
|
+
wp_template: '/wp/v2/templates',
|
|
6
|
+
wp_template_part: '/wp/v2/template-parts',
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Delete all the templates of given type.
|
|
10
|
+
*
|
|
11
|
+
* @param this
|
|
12
|
+
* @param type - Template type to delete.
|
|
13
|
+
*/
|
|
14
|
+
async function deleteAllTemplates(type) {
|
|
15
|
+
const path = PATH_MAPPING[type];
|
|
16
|
+
if (!path) {
|
|
17
|
+
throw new Error(`Unsupported template type: ${type}.`);
|
|
18
|
+
}
|
|
19
|
+
const templates = await this.rest({ path });
|
|
20
|
+
for (const template of templates) {
|
|
21
|
+
if (!template?.id || !template?.wp_id) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
await this.rest({
|
|
26
|
+
method: 'DELETE',
|
|
27
|
+
path: `${path}/${template.id}`,
|
|
28
|
+
params: { force: true },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (responseError) {
|
|
32
|
+
// Disable reason - the error provides valuable feedback about issues with tests.
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.warn(`deleteAllTemplates failed to delete template (id: ${template.wp_id}) with the following error`, responseError);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.deleteAllTemplates = deleteAllTemplates;
|
|
39
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/request-utils/templates.ts"],"names":[],"mappings":";;;AAYA,MAAM,YAAY,GAAG;IACpB,WAAW,EAAE,kBAAkB;IAC/B,gBAAgB,EAAE,uBAAuB;CACzC,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,kBAAkB,CAAsB,IAAkB;IACxE,MAAM,IAAI,GAAG,YAAY,CAAE,IAAI,CAAE,CAAC;IAElC,IAAK,CAAE,IAAI,EAAG;QACb,MAAM,IAAI,KAAK,CAAE,8BAA+B,IAAK,GAAG,CAAE,CAAC;KAC3D;IAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAgB,EAAE,IAAI,EAAE,CAAE,CAAC;IAE5D,KAAM,MAAM,QAAQ,IAAI,SAAS,EAAG;QACnC,IAAK,CAAE,QAAQ,EAAE,EAAE,IAAI,CAAE,QAAQ,EAAE,KAAK,EAAG;YAC1C,SAAS;SACT;QAED,IAAI;YACH,MAAM,IAAI,CAAC,IAAI,CAAE;gBAChB,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,GAAI,IAAK,IAAK,QAAQ,CAAC,EAAG,EAAE;gBAClC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;aACvB,CAAE,CAAC;SACJ;QAAC,OAAQ,aAAa,EAAG;YACzB,iFAAiF;YACjF,sCAAsC;YACtC,OAAO,CAAC,IAAI,CACX,qDAAsD,QAAQ,CAAC,KAAM,4BAA4B,EACjG,aAAa,CACb,CAAC;SACF;KACD;AACF,CAAC;AAEQ,gDAAkB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemeGlobalStylesRevisions = exports.getCurrentThemeGlobalStylesPostId = exports.activateTheme = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const THEMES_URL = new URL('wp-admin/themes.php', config_1.WP_BASE_URL).href;
|
|
6
|
+
async function activateTheme(themeSlug) {
|
|
7
|
+
let response = await this.request.get(THEMES_URL);
|
|
8
|
+
const html = await response.text();
|
|
9
|
+
const optionalFolder = '([a-z0-9-]+%2F)?';
|
|
10
|
+
const matchGroup = html.match(`action=activate&stylesheet=${optionalFolder}${encodeURIComponent(themeSlug)}&_wpnonce=[a-z0-9]+`);
|
|
11
|
+
if (!matchGroup) {
|
|
12
|
+
if (html.includes(`data-slug="${themeSlug}"`)) {
|
|
13
|
+
// The theme is already activated.
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`The theme "${themeSlug}" is not installed`);
|
|
17
|
+
}
|
|
18
|
+
const [activateQuery] = matchGroup;
|
|
19
|
+
const activateLink = THEMES_URL + `?${activateQuery}`.replace(/&/g, '&');
|
|
20
|
+
response = await this.request.get(activateLink);
|
|
21
|
+
await response.dispose();
|
|
22
|
+
}
|
|
23
|
+
exports.activateTheme = activateTheme;
|
|
24
|
+
// https://developer.wordpress.org/rest-api/reference/themes/#definition
|
|
25
|
+
async function getCurrentThemeGlobalStylesPostId() {
|
|
26
|
+
const themes = await this.rest({
|
|
27
|
+
path: '/wp/v2/themes',
|
|
28
|
+
});
|
|
29
|
+
let themeGlobalStylesId = '';
|
|
30
|
+
if (themes && themes.length) {
|
|
31
|
+
const currentTheme = themes.find(({ status }) => status === 'active');
|
|
32
|
+
const globalStylesURL = currentTheme?._links?.['wp:user-global-styles']?.[0]?.href;
|
|
33
|
+
if (globalStylesURL) {
|
|
34
|
+
themeGlobalStylesId = globalStylesURL?.split('rest_route=/wp/v2/global-styles/')[1];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return themeGlobalStylesId;
|
|
38
|
+
}
|
|
39
|
+
exports.getCurrentThemeGlobalStylesPostId = getCurrentThemeGlobalStylesPostId;
|
|
40
|
+
/**
|
|
41
|
+
* Deletes all post revisions using the REST API.
|
|
42
|
+
*
|
|
43
|
+
* @param {} this RequestUtils.
|
|
44
|
+
* @param {string|number} parentId Post attributes.
|
|
45
|
+
*/
|
|
46
|
+
async function getThemeGlobalStylesRevisions(parentId) {
|
|
47
|
+
// Lists all global styles revisions.
|
|
48
|
+
return await this.rest({
|
|
49
|
+
path: `/wp/v2/global-styles/${parentId}/revisions`,
|
|
50
|
+
params: {
|
|
51
|
+
per_page: 100,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.getThemeGlobalStylesRevisions = getThemeGlobalStylesRevisions;
|
|
56
|
+
//# sourceMappingURL=themes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.js","sourceRoot":"","sources":["../../src/request-utils/themes.ts"],"names":[],"mappings":";;;AAIA,sC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M,EAAE,EAAG,EAAE,CAAC,MAAM,KAAK,QAAQ,CACrC,CAAC;QAEF,MAAM,eAAe,GACpB,YAAY,EAAE,MAAM,EAAE,CAAE,uBAAuB,CAAE,EAAE,CAAE,CAAC,CAAE,EAAE,IAAI,CAAC;QAChE,IAAK,eAAe,EAAG;YACtB,mBAAmB,GAAG,eAAe,EAAE,KAAK,CAC3C,kCAAkC,CAClC,CAAE,CAAC,CAAE,CAAC;SACP;KACD;IACD,OAAO,mBAAmB,CAAC;AAC5B,CAAC;AAuBA,8EAAiC;AArBlC;;;;;GAKG;AACH,KAAK,UAAU,6BAA6B,CAE3C,QAAyB;IAEzB,qCAAqC;IACrC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAgC;QACrD,IAAI,EAAE,wBAAyB,QAAS,YAAY;QACpD,MAAM,EAAE;YACP,QAAQ,EAAE,GAAG;SACb;KACD,CAAE,CAAC;AACL,CAAC;AAKA,sEAA6B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteAllUsers = exports.createUser = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* List all users.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.wordpress.org/rest-api/reference/users/#list-users
|
|
8
|
+
* @param this
|
|
9
|
+
*/
|
|
10
|
+
async function listUsers() {
|
|
11
|
+
const response = await this.rest({
|
|
12
|
+
method: 'GET',
|
|
13
|
+
path: '/wp/v2/users',
|
|
14
|
+
params: {
|
|
15
|
+
per_page: 100,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Add a test user.
|
|
22
|
+
*
|
|
23
|
+
* @see https://developer.wordpress.org/rest-api/reference/users/#create-a-user
|
|
24
|
+
* @param this
|
|
25
|
+
* @param user User data to create.
|
|
26
|
+
*/
|
|
27
|
+
async function createUser(user) {
|
|
28
|
+
const userData = {
|
|
29
|
+
username: user.username,
|
|
30
|
+
email: user.email,
|
|
31
|
+
};
|
|
32
|
+
if (user.firstName) {
|
|
33
|
+
userData.first_name = user.firstName;
|
|
34
|
+
}
|
|
35
|
+
if (user.lastName) {
|
|
36
|
+
userData.last_name = user.lastName;
|
|
37
|
+
}
|
|
38
|
+
if (user.password) {
|
|
39
|
+
userData.password = user.password;
|
|
40
|
+
}
|
|
41
|
+
if (user.roles) {
|
|
42
|
+
userData.roles = user.roles;
|
|
43
|
+
}
|
|
44
|
+
const response = await this.rest({
|
|
45
|
+
method: 'POST',
|
|
46
|
+
path: '/wp/v2/users',
|
|
47
|
+
data: userData,
|
|
48
|
+
});
|
|
49
|
+
return response;
|
|
50
|
+
}
|
|
51
|
+
exports.createUser = createUser;
|
|
52
|
+
/**
|
|
53
|
+
* Delete a user.
|
|
54
|
+
*
|
|
55
|
+
* @see https://developer.wordpress.org/rest-api/reference/users/#delete-a-user
|
|
56
|
+
* @param this
|
|
57
|
+
* @param userId The ID of the user.
|
|
58
|
+
*/
|
|
59
|
+
async function deleteUser(userId) {
|
|
60
|
+
const response = await this.rest({
|
|
61
|
+
method: 'DELETE',
|
|
62
|
+
path: `/wp/v2/users/${userId}`,
|
|
63
|
+
params: { force: true, reassign: 1 },
|
|
64
|
+
});
|
|
65
|
+
return response;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Delete all users except main root user.
|
|
69
|
+
*
|
|
70
|
+
* @param this
|
|
71
|
+
*/
|
|
72
|
+
async function deleteAllUsers() {
|
|
73
|
+
const users = await listUsers.bind(this)();
|
|
74
|
+
// The users endpoint doesn't support batch request yet.
|
|
75
|
+
const responses = await Promise.all(users
|
|
76
|
+
// Do not delete root user.
|
|
77
|
+
.filter((user) => user.id !== 1)
|
|
78
|
+
.map((user) => deleteUser.bind(this)(user.id)));
|
|
79
|
+
return responses;
|
|
80
|
+
}
|
|
81
|
+
exports.deleteAllUsers = deleteAllUsers;
|
|
82
|
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AI,CAAE;QACjC,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,gBAAiB,MAAO,EAAE;QAChC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE;KACpC,CAAE,CAAC;IAEJ,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,IAAI,CAAE,IAAI,CAAE,EAAE,CAAC;IAE7C,wDAAwD;IACxD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,KAAK;QACJ,2BAA2B;SAC1B,MAAM,CAAE,CAAE,IAAU,EAAG,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAE;SACzC,GAAG,CAAE,CAAE,IAAU,EAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAE,IAAI,CAAE,CAAE,IAAI,CAAC,EAAE,CAAE,CAAE,CAC7D,CAAC;IAEF,OAAO,SAAS,CAAC;AAClB,CAAC;AAEoB,wCAAc"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addWidgetBlock = exports.deleteAllWidgets = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Delete all the widgets in the widgets screen.
|
|
6
|
+
*
|
|
7
|
+
* @this {import('./index').RequestUtils}
|
|
8
|
+
*/
|
|
9
|
+
async function deleteAllWidgets() {
|
|
10
|
+
const [widgets, sidebars] = await Promise.all([
|
|
11
|
+
this.rest({ path: '/wp/v2/widgets' }),
|
|
12
|
+
this.rest({ path: '/wp/v2/sidebars' }),
|
|
13
|
+
]);
|
|
14
|
+
await this.batchRest(widgets.map((widget) => ({
|
|
15
|
+
method: 'DELETE',
|
|
16
|
+
path: `/wp/v2/widgets/${widget.id}?force=true`,
|
|
17
|
+
})));
|
|
18
|
+
// The endpoint doesn't support batch requests yet.
|
|
19
|
+
await Promise.all(sidebars.map((sidebar) => this.rest({
|
|
20
|
+
method: 'POST',
|
|
21
|
+
path: `/wp/v2/sidebars/${sidebar.id}`,
|
|
22
|
+
data: { id: sidebar.id, widgets: [] },
|
|
23
|
+
})));
|
|
24
|
+
}
|
|
25
|
+
exports.deleteAllWidgets = deleteAllWidgets;
|
|
26
|
+
/**
|
|
27
|
+
* Add a widget block to the widget area.
|
|
28
|
+
*
|
|
29
|
+
* @this {import('./index').RequestUtils}
|
|
30
|
+
* @param {string} serializedBlock The serialized content of the inserted block HTML.
|
|
31
|
+
* @param {string} widgetAreaId The ID of the widget area.
|
|
32
|
+
*/
|
|
33
|
+
async function addWidgetBlock(serializedBlock, widgetAreaId) {
|
|
34
|
+
const { id: blockId } = await this.rest({
|
|
35
|
+
method: 'POST',
|
|
36
|
+
path: '/wp/v2/widgets',
|
|
37
|
+
data: {
|
|
38
|
+
id_base: 'block',
|
|
39
|
+
sidebar: widgetAreaId,
|
|
40
|
+
instance: {
|
|
41
|
+
raw: { content: serializedBlock },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const { widgets } = await this.rest({
|
|
46
|
+
path: `/wp/v2/sidebars/${widgetAreaId}`,
|
|
47
|
+
});
|
|
48
|
+
const updatedWidgets = new Set(widgets);
|
|
49
|
+
// Remove duplicate.
|
|
50
|
+
updatedWidgets.delete(blockId);
|
|
51
|
+
// Add to last block.
|
|
52
|
+
updatedWidgets.add(blockId);
|
|
53
|
+
await this.rest({
|
|
54
|
+
method: 'PUT',
|
|
55
|
+
path: `/wp/v2/sidebars/${widgetAreaId}`,
|
|
56
|
+
data: {
|
|
57
|
+
widgets: [...updatedWidgets],
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.addWidgetBlock = addWidgetBlock;
|
|
62
|
+
//# sourceMappingURL=widgets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AC;IAEJ,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAE;QACpC,IAAI,EAAE,mBAAoB,YAAa,EAAE;KACzC,CAAE,CAAC;IAEJ,MAAM,cAAc,GAAG,IAAI,GAAG,CAAE,OAAO,CAAE,CAAC;IAC1C,oBAAoB;IACpB,cAAc,CAAC,MAAM,CAAE,OAAO,CAAE,CAAC;IACjC,qBAAqB;IACrB,cAAc,CAAC,GAAG,CAAE,OAAO,CAAE,CAAC;IAE9B,MAAM,IAAI,CAAC,IAAI,CAAE;QAChB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,mBAAoB,YAAa,EAAE;QACzC,IAAI,EAAE;YACL,OAAO,EAAE,CAAE,GAAG,cAAc,CAAE;SAC9B;KACD,CAAE,CAAC;AACL,CAAC;AA9BD,wCA8BC"}
|
package/build/test.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expect = exports.test = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const test_1 = require("@playwright/test");
|
|
9
|
+
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_1.expect; } });
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
const index_1 = require("./index");
|
|
14
|
+
const STORAGE_STATE_PATH = process.env.STORAGE_STATE_PATH ||
|
|
15
|
+
path.join(process.cwd(), 'artifacts/storage-states/admin.json');
|
|
16
|
+
/**
|
|
17
|
+
* Set of console logging types observed to protect against unexpected yet
|
|
18
|
+
* handled (i.e. not catastrophic) errors or warnings. Each key corresponds
|
|
19
|
+
* to the Playwright ConsoleMessage type, its value the corresponding function
|
|
20
|
+
* on the console global object.
|
|
21
|
+
*/
|
|
22
|
+
const OBSERVED_CONSOLE_MESSAGE_TYPES = ['warn', 'error'];
|
|
23
|
+
/**
|
|
24
|
+
* Adds a page event handler to emit uncaught exception to process if one of
|
|
25
|
+
* the observed console logging types is encountered.
|
|
26
|
+
*
|
|
27
|
+
* @param message The console message.
|
|
28
|
+
*/
|
|
29
|
+
function observeConsoleLogging(message) {
|
|
30
|
+
const type = message.type();
|
|
31
|
+
if (!OBSERVED_CONSOLE_MESSAGE_TYPES.includes(type)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const text = message.text();
|
|
35
|
+
// An exception is made for _blanket_ deprecation warnings: Those
|
|
36
|
+
// which log regardless of whether a deprecated feature is in use.
|
|
37
|
+
if (text.includes('This is a global warning')) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// A chrome advisory warning about SameSite cookies is informational
|
|
41
|
+
// about future changes, tracked separately for improvement in core.
|
|
42
|
+
//
|
|
43
|
+
// See: https://core.trac.wordpress.org/ticket/37000
|
|
44
|
+
// See: https://www.chromestatus.com/feature/5088147346030592
|
|
45
|
+
// See: https://www.chromestatus.com/feature/5633521622188032
|
|
46
|
+
if (text.includes('A cookie associated with a cross-site resource')) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Viewing posts on the front end can result in this error, which
|
|
50
|
+
// has nothing to do with Gutenberg.
|
|
51
|
+
if (text.includes('net::ERR_UNKNOWN_URL_SCHEME')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// TODO: Not implemented yet.
|
|
55
|
+
// Network errors are ignored only if we are intentionally testing
|
|
56
|
+
// offline mode.
|
|
57
|
+
// if (
|
|
58
|
+
// text.includes( 'net::ERR_INTERNET_DISCONNECTED' ) &&
|
|
59
|
+
// isOfflineMode()
|
|
60
|
+
// ) {
|
|
61
|
+
// return;
|
|
62
|
+
// }
|
|
63
|
+
// As of WordPress 5.3.2 in Chrome 79, navigating to the block editor
|
|
64
|
+
// (Posts > Add New) will display a console warning about
|
|
65
|
+
// non - unique IDs.
|
|
66
|
+
// See: https://core.trac.wordpress.org/ticket/23165
|
|
67
|
+
if (text.includes('elements with non-unique id #_wpnonce')) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Ignore all JQMIGRATE (jQuery migrate) deprecation warnings.
|
|
71
|
+
if (text.includes('JQMIGRATE')) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const logFunction = type;
|
|
75
|
+
// Disable reason: We intentionally bubble up the console message
|
|
76
|
+
// which, unless the test explicitly anticipates the logging via
|
|
77
|
+
// @wordpress/jest-console matchers, will cause the intended test
|
|
78
|
+
// failure.
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console[logFunction](text);
|
|
81
|
+
}
|
|
82
|
+
const test = test_1.test.extend({
|
|
83
|
+
admin: async ({ page, pageUtils }, use) => {
|
|
84
|
+
await use(new index_1.Admin({ page, pageUtils }));
|
|
85
|
+
},
|
|
86
|
+
editor: async ({ page }, use) => {
|
|
87
|
+
await use(new index_1.Editor({ page }));
|
|
88
|
+
},
|
|
89
|
+
page: async ({ page }, use) => {
|
|
90
|
+
page.on('console', observeConsoleLogging);
|
|
91
|
+
await use(page);
|
|
92
|
+
// Clear local storage after each test.
|
|
93
|
+
await page.evaluate(() => {
|
|
94
|
+
window.localStorage.clear();
|
|
95
|
+
});
|
|
96
|
+
await page.close();
|
|
97
|
+
},
|
|
98
|
+
pageUtils: async ({ page }, use) => {
|
|
99
|
+
await use(new index_1.PageUtils({ page }));
|
|
100
|
+
},
|
|
101
|
+
requestUtils: [
|
|
102
|
+
async ({}, use, workerInfo) => {
|
|
103
|
+
const requestUtils = await index_1.RequestUtils.setup({
|
|
104
|
+
baseURL: workerInfo.project.use.baseURL,
|
|
105
|
+
storageStatePath: STORAGE_STATE_PATH,
|
|
106
|
+
});
|
|
107
|
+
await Promise.all([
|
|
108
|
+
requestUtils.activateTheme('twentytwentyone'),
|
|
109
|
+
// Disable this test plugin as it's conflicting with some of the tests.
|
|
110
|
+
// We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
|
|
111
|
+
requestUtils.deactivatePlugin('gutenberg-test-plugin-disables-the-css-animations'),
|
|
112
|
+
requestUtils.deleteAllPosts(),
|
|
113
|
+
requestUtils.deleteAllBlocks(),
|
|
114
|
+
requestUtils.resetPreferences(),
|
|
115
|
+
]);
|
|
116
|
+
await use(requestUtils);
|
|
117
|
+
},
|
|
118
|
+
{ scope: 'worker', auto: true },
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
exports.test = test;
|
|
122
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,6BAA6B;AAC7B,2CAAwD;AAwJzC,uFAxJQ,aAAM,OAwJR;AArJrB;;GAEG;AACH,mCAAiE;AAEjE,MAAM,kBAAkB,GACvB,OAAO,CAAC,GAAG,CAAC,kBAAkB;IAC9B,IAAI,CAAC,IAAI,CAAE,OAAO,CAAC,GAAG,EAAE,EAAE,qCAAqC,CAAE,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,8BAA8B,GAAG,CAAE,MAAM,EAAE,OAAO,CAAW,CAAC;AAEpE;;;;;GAKG;AACH,SAAS,qBAAqB,CAAE,OAAuB;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,IACC,CAAE,8BAA8B,CAAC,QAAQ,CACxC,IAA2D,CAC3D,EACA;QACD,OAAO;KACP;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAE5B,iEAAiE;IACjE,kEAAkE;IAClE,IAAK,IAAI,CAAC,QAAQ,CAAE,0BAA0B,CAAE,EAAG;QAClD,OAAO;KACP;IAED,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,oDAAoD;IACpD,6DAA6D;IAC7D,6DAA6D;IAC7D,IAAK,IAAI,CAAC,QAAQ,CAA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
* @this {import('.').Editor}
|
|
5
|
+
* @param {Object} object Object to create new post, along with tips enabling option.
|
|
6
|
+
* @param {string} [object.postType] Post type of the new post.
|
|
7
|
+
* @param {string} [object.title] Title of the new post.
|
|
8
|
+
* @param {string} [object.content] Content of the new post.
|
|
9
|
+
* @param {string} [object.excerpt] Excerpt of the new post.
|
|
10
|
+
* @param {boolean} [object.showWelcomeGuide] Whether to show the welcome guide.
|
|
11
|
+
*/
|
|
12
|
+
export function createNewPost(this: any, { postType, title, content, excerpt, showWelcomeGuide, }?: {
|
|
13
|
+
postType?: string | undefined;
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
content?: string | undefined;
|
|
16
|
+
excerpt?: string | undefined;
|
|
17
|
+
showWelcomeGuide?: boolean | undefined;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=create-new-post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-new-post.d.ts","sourceRoot":"","sources":["../../src/admin/create-new-post.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH;IAN4B,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,gBAAgB;kBAmD3C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Admin } from './';
|
|
5
|
+
/**
|
|
6
|
+
* Returns a promise resolving to one of either a string or null. A string will
|
|
7
|
+
* be resolved if an error message is present in the contents of the page. If no
|
|
8
|
+
* error is present, a null value will be resolved instead. This requires the
|
|
9
|
+
* environment be configured to display errors.
|
|
10
|
+
*
|
|
11
|
+
* @see http://php.net/manual/en/function.error-reporting.php
|
|
12
|
+
*
|
|
13
|
+
* @param this
|
|
14
|
+
* @return Promise resolving to a string or null, depending whether a page error is present.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPageError(this: Admin): Promise<string | null>;
|
|
17
|
+
//# sourceMappingURL=get-page-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-page-error.d.ts","sourceRoot":"","sources":["../../src/admin/get-page-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAUhC;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,KAAK,0BAI9C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Browser, Page, BrowserContext } from '@playwright/test';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { createNewPost } from './create-new-post';
|
|
9
|
+
import { getPageError } from './get-page-error';
|
|
10
|
+
import { visitAdminPage } from './visit-admin-page';
|
|
11
|
+
import { visitSiteEditor } from './visit-site-editor';
|
|
12
|
+
import type { PageUtils } from '../page-utils';
|
|
13
|
+
type AdminConstructorProps = {
|
|
14
|
+
page: Page;
|
|
15
|
+
pageUtils: PageUtils;
|
|
16
|
+
};
|
|
17
|
+
export declare class Admin {
|
|
18
|
+
browser: Browser;
|
|
19
|
+
page: Page;
|
|
20
|
+
pageUtils: PageUtils;
|
|
21
|
+
context: BrowserContext;
|
|
22
|
+
constructor({ page, pageUtils }: AdminConstructorProps);
|
|
23
|
+
/** @borrows createNewPost as this.createNewPost */
|
|
24
|
+
createNewPost: typeof createNewPost;
|
|
25
|
+
/** @borrows getPageError as this.getPageError */
|
|
26
|
+
getPageError: typeof getPageError;
|
|
27
|
+
/** @borrows visitAdminPage as this.visitAdminPage */
|
|
28
|
+
visitAdminPage: typeof visitAdminPage;
|
|
29
|
+
/** @borrows visitSiteEditor as this.visitSiteEditor */
|
|
30
|
+
visitSiteEditor: typeof visitSiteEditor;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,KAAK,qBAAqB,GAAG;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,qBAAa,KAAK;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,cAAc,CAAC;gBAEX,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,qBAAqB;IAOvD,mDAAmD;IACnD,aAAa,EAAE,OAAO,aAAa,CAA8B;IACjE,iDAAiD;IACjD,YAAY,EAAE,OAAO,YAAY,CAA6B;IAC9D,qDAAqD;IACrD,cAAc,EAAE,OAAO,cAAc,CAA+B;IACpE,uDAAuD;IACvD,eAAe,EAAE,OAAO,eAAe,CAAgC;CACvE"}
|