@wordpress/e2e-test-utils-playwright 1.32.0 → 1.32.1-next.ff1cebbba.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/admin/create-new-post.js +46 -28
- package/build/admin/create-new-post.js.map +7 -1
- package/build/admin/edit-post.js +35 -17
- package/build/admin/edit-post.js.map +7 -1
- package/build/admin/get-page-error.js +30 -22
- package/build/admin/get-page-error.js.map +7 -1
- package/build/admin/index.js +54 -34
- package/build/admin/index.js.map +7 -1
- package/build/admin/visit-admin-page.js +42 -29
- package/build/admin/visit-admin-page.js.map +7 -1
- package/build/admin/visit-site-editor.js +71 -64
- package/build/admin/visit-site-editor.js.map +7 -1
- package/build/config.js +40 -10
- package/build/config.js.map +7 -1
- package/build/editor/click-block-options-menu-item.js +29 -14
- package/build/editor/click-block-options-menu-item.js.map +7 -1
- package/build/editor/click-block-toolbar-button.js +33 -13
- package/build/editor/click-block-toolbar-button.js.map +7 -1
- package/build/editor/get-blocks.js +59 -43
- package/build/editor/get-blocks.js.map +7 -1
- package/build/editor/get-edited-post-content.js +31 -12
- package/build/editor/get-edited-post-content.js.map +7 -1
- package/build/editor/index.js +92 -72
- package/build/editor/index.js.map +7 -1
- package/build/editor/insert-block.js +50 -21
- package/build/editor/insert-block.js.map +7 -1
- package/build/editor/open-document-settings-sidebar.js +37 -24
- package/build/editor/open-document-settings-sidebar.js.map +7 -1
- package/build/editor/preview.js +37 -18
- package/build/editor/preview.js.map +7 -1
- package/build/editor/publish-post.js +42 -42
- package/build/editor/publish-post.js.map +7 -1
- package/build/editor/save-draft.js +29 -15
- package/build/editor/save-draft.js.map +7 -1
- package/build/editor/select-blocks.js +46 -25
- package/build/editor/select-blocks.js.map +7 -1
- package/build/editor/set-content.js +34 -14
- package/build/editor/set-content.js.map +7 -1
- package/build/editor/set-is-fixed-toolbar.js +31 -15
- package/build/editor/set-is-fixed-toolbar.js.map +7 -1
- package/build/editor/set-preferences.js +38 -18
- package/build/editor/set-preferences.js.map +7 -1
- package/build/editor/show-block-toolbar.js +30 -16
- package/build/editor/show-block-toolbar.js.map +7 -1
- package/build/editor/site-editor.js +46 -41
- package/build/editor/site-editor.js.map +7 -1
- package/build/editor/switch-editor-tool.js +42 -30
- package/build/editor/switch-editor-tool.js.map +7 -1
- package/build/editor/switch-to-legacy-canvas.js +33 -14
- package/build/editor/switch-to-legacy-canvas.js.map +7 -1
- package/build/editor/transform-block-to.js +41 -21
- package/build/editor/transform-block-to.js.map +7 -1
- package/build/index.js +50 -32
- package/build/index.js.map +7 -1
- package/build/lighthouse/index.js +89 -53
- package/build/lighthouse/index.js.map +7 -1
- package/build/metrics/index.js +298 -249
- package/build/metrics/index.js.map +7 -1
- package/build/page-utils/drag-files.js +134 -112
- package/build/page-utils/drag-files.js.map +7 -1
- package/build/page-utils/emulate-network-conditions.js +92 -66
- package/build/page-utils/emulate-network-conditions.js.map +7 -1
- package/build/page-utils/index.js +54 -34
- package/build/page-utils/index.js.map +7 -1
- package/build/page-utils/is-current-url.js +31 -18
- package/build/page-utils/is-current-url.js.map +7 -1
- package/build/page-utils/keycodes.js +51 -39
- package/build/page-utils/keycodes.js.map +7 -1
- package/build/page-utils/press-keys.js +148 -127
- package/build/page-utils/press-keys.js.map +7 -1
- package/build/page-utils/set-browser-viewport.js +32 -41
- package/build/page-utils/set-browser-viewport.js.map +7 -1
- package/build/request-utils/blocks.js +49 -40
- package/build/request-utils/blocks.js.map +7 -1
- package/build/request-utils/comments.js +57 -45
- package/build/request-utils/comments.js.map +7 -1
- package/build/request-utils/gutenberg-experiments.js +48 -26
- package/build/request-utils/gutenberg-experiments.js.map +7 -1
- package/build/request-utils/index.js +187 -153
- package/build/request-utils/index.js.map +7 -1
- package/build/request-utils/login.js +43 -18
- package/build/request-utils/login.js.map +7 -1
- package/build/request-utils/media.js +72 -64
- package/build/request-utils/media.js.map +7 -1
- package/build/request-utils/menus.js +119 -109
- package/build/request-utils/menus.js.map +7 -1
- package/build/request-utils/pages.js +60 -49
- package/build/request-utils/pages.js.map +7 -1
- package/build/request-utils/patterns.js +39 -24
- package/build/request-utils/patterns.js.map +7 -1
- package/build/request-utils/plugins.js +68 -74
- package/build/request-utils/plugins.js.map +7 -1
- package/build/request-utils/posts.js +52 -39
- package/build/request-utils/posts.js.map +7 -1
- package/build/request-utils/preferences.js +36 -17
- package/build/request-utils/preferences.js.map +7 -1
- package/build/request-utils/rest.js +153 -129
- package/build/request-utils/rest.js.map +7 -1
- package/build/request-utils/site-settings.js +38 -28
- package/build/request-utils/site-settings.js.map +7 -1
- package/build/request-utils/templates.js +57 -45
- package/build/request-utils/templates.js.map +7 -1
- package/build/request-utils/themes.js +78 -53
- package/build/request-utils/themes.js.map +7 -1
- package/build/request-utils/users.js +72 -72
- package/build/request-utils/users.js.map +7 -1
- package/build/request-utils/widgets.js +71 -55
- package/build/request-utils/widgets.js.map +7 -1
- package/build/test.js +128 -146
- package/build/test.js.map +7 -1
- package/build/types.js +16 -2
- package/build/types.js.map +7 -1
- package/package.json +6 -2
|
@@ -1,58 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
var lighthouse_exports = {};
|
|
30
|
+
__export(lighthouse_exports, {
|
|
31
|
+
Lighthouse: () => Lighthouse
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(lighthouse_exports);
|
|
34
|
+
var import_core = __toESM(require("lighthouse/core/index.cjs"));
|
|
5
35
|
class Lighthouse {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const result = {};
|
|
47
|
-
if (!report) {
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
const { lhr } = report;
|
|
51
|
-
for (const [audit, acronym] of Object.entries(audits)) {
|
|
52
|
-
result[acronym] = lhr.audits[audit]?.numericValue || 0;
|
|
36
|
+
page;
|
|
37
|
+
port;
|
|
38
|
+
constructor({ page, port }) {
|
|
39
|
+
this.page = page;
|
|
40
|
+
this.port = port;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns the Lighthouse report for the current URL.
|
|
44
|
+
*
|
|
45
|
+
* Runs several Lighthouse audits in a separate browser window and returns
|
|
46
|
+
* the summary.
|
|
47
|
+
*/
|
|
48
|
+
async getReport() {
|
|
49
|
+
const audits = {
|
|
50
|
+
"largest-contentful-paint": "LCP",
|
|
51
|
+
"total-blocking-time": "TBT",
|
|
52
|
+
interactive: "TTI",
|
|
53
|
+
"cumulative-layout-shift": "CLS",
|
|
54
|
+
"interaction-to-next-paint": "INP"
|
|
55
|
+
};
|
|
56
|
+
const report = await (0, import_core.default)(
|
|
57
|
+
this.page.url(),
|
|
58
|
+
{ port: this.port },
|
|
59
|
+
{
|
|
60
|
+
extends: "lighthouse:default",
|
|
61
|
+
settings: {
|
|
62
|
+
// "provided" means no throttling.
|
|
63
|
+
// TODO: Make configurable.
|
|
64
|
+
throttlingMethod: "provided",
|
|
65
|
+
// Default is "mobile".
|
|
66
|
+
// See https://github.com/GoogleChrome/lighthouse/blob/main/docs/emulation.md
|
|
67
|
+
// TODO: Make configurable.
|
|
68
|
+
formFactor: "desktop",
|
|
69
|
+
screenEmulation: {
|
|
70
|
+
disabled: true
|
|
71
|
+
},
|
|
72
|
+
// Speeds up the report.
|
|
73
|
+
disableFullPageScreenshot: true,
|
|
74
|
+
// Only run certain audits to speed things up.
|
|
75
|
+
onlyAudits: Object.keys(audits)
|
|
53
76
|
}
|
|
54
|
-
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const result = {};
|
|
80
|
+
if (!report) {
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
const { lhr } = report;
|
|
84
|
+
for (const [audit, acronym] of Object.entries(audits)) {
|
|
85
|
+
result[acronym] = lhr.audits[audit]?.numericValue || 0;
|
|
55
86
|
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
56
89
|
}
|
|
57
|
-
|
|
58
|
-
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
Lighthouse
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/lighthouse/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { Page } from '@playwright/test';\nimport lighthouse from 'lighthouse/core/index.cjs';\n\ntype LighthouseConstructorProps = {\n\tpage: Page;\n\tport: number;\n};\n\nexport class Lighthouse {\n\tpage: Page;\n\tport: number;\n\n\tconstructor( { page, port }: LighthouseConstructorProps ) {\n\t\tthis.page = page;\n\t\tthis.port = port;\n\t}\n\n\t/**\n\t * Returns the Lighthouse report for the current URL.\n\t *\n\t * Runs several Lighthouse audits in a separate browser window and returns\n\t * the summary.\n\t */\n\tasync getReport() {\n\t\t// From https://github.com/GoogleChrome/lighthouse/blob/36cac182a6c637b1671c57326d7c0241633d0076/core/config/default-config.js#L381-L446\n\t\tconst audits = {\n\t\t\t'largest-contentful-paint': 'LCP',\n\t\t\t'total-blocking-time': 'TBT',\n\t\t\tinteractive: 'TTI',\n\t\t\t'cumulative-layout-shift': 'CLS',\n\t\t\t'interaction-to-next-paint': 'INP',\n\t\t};\n\n\t\tconst report = await lighthouse(\n\t\t\tthis.page.url(),\n\t\t\t{ port: this.port },\n\t\t\t{\n\t\t\t\textends: 'lighthouse:default',\n\t\t\t\tsettings: {\n\t\t\t\t\t// \"provided\" means no throttling.\n\t\t\t\t\t// TODO: Make configurable.\n\t\t\t\t\tthrottlingMethod: 'provided',\n\t\t\t\t\t// Default is \"mobile\".\n\t\t\t\t\t// See https://github.com/GoogleChrome/lighthouse/blob/main/docs/emulation.md\n\t\t\t\t\t// TODO: Make configurable.\n\t\t\t\t\tformFactor: 'desktop',\n\t\t\t\t\tscreenEmulation: {\n\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t},\n\t\t\t\t\t// Speeds up the report.\n\t\t\t\t\tdisableFullPageScreenshot: true,\n\t\t\t\t\t// Only run certain audits to speed things up.\n\t\t\t\t\tonlyAudits: Object.keys( audits ),\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\n\t\tconst result: Record< string, number > = {};\n\n\t\tif ( ! report ) {\n\t\t\treturn result;\n\t\t}\n\n\t\tconst { lhr } = report;\n\n\t\tfor ( const [ audit, acronym ] of Object.entries( audits ) ) {\n\t\t\tresult[ acronym ] = lhr.audits[ audit ]?.numericValue || 0;\n\t\t}\n\n\t\treturn result;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAuB;AAOhB,MAAM,WAAW;AAAA,EACvB;AAAA,EACA;AAAA,EAEA,YAAa,EAAE,MAAM,KAAK,GAAgC;AACzD,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,YAAY;AAEjB,UAAM,SAAS;AAAA,MACd,4BAA4B;AAAA,MAC5B,uBAAuB;AAAA,MACvB,aAAa;AAAA,MACb,2BAA2B;AAAA,MAC3B,6BAA6B;AAAA,IAC9B;AAEA,UAAM,SAAS,UAAM,YAAAA;AAAA,MACpB,KAAK,KAAK,IAAI;AAAA,MACd,EAAE,MAAM,KAAK,KAAK;AAAA,MAClB;AAAA,QACC,SAAS;AAAA,QACT,UAAU;AAAA;AAAA;AAAA,UAGT,kBAAkB;AAAA;AAAA;AAAA;AAAA,UAIlB,YAAY;AAAA,UACZ,iBAAiB;AAAA,YAChB,UAAU;AAAA,UACX;AAAA;AAAA,UAEA,2BAA2B;AAAA;AAAA,UAE3B,YAAY,OAAO,KAAM,MAAO;AAAA,QACjC;AAAA,MACD;AAAA,IACD;AAEA,UAAM,SAAmC,CAAC;AAE1C,QAAK,CAAE,QAAS;AACf,aAAO;AAAA,IACR;AAEA,UAAM,EAAE,IAAI,IAAI;AAEhB,eAAY,CAAE,OAAO,OAAQ,KAAK,OAAO,QAAS,MAAO,GAAI;AAC5D,aAAQ,OAAQ,IAAI,IAAI,OAAQ,KAAM,GAAG,gBAAgB;AAAA,IAC1D;AAEA,WAAO;AAAA,EACR;AACD;",
|
|
6
|
+
"names": ["lighthouse"]
|
|
7
|
+
}
|