@wordpress/e2e-test-utils-playwright 1.32.0 → 1.32.1-next.b8c8708f3.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.
Files changed (113) hide show
  1. package/build/admin/create-new-post.js +46 -28
  2. package/build/admin/create-new-post.js.map +7 -1
  3. package/build/admin/edit-post.js +35 -17
  4. package/build/admin/edit-post.js.map +7 -1
  5. package/build/admin/get-page-error.js +30 -22
  6. package/build/admin/get-page-error.js.map +7 -1
  7. package/build/admin/index.js +54 -34
  8. package/build/admin/index.js.map +7 -1
  9. package/build/admin/visit-admin-page.js +42 -29
  10. package/build/admin/visit-admin-page.js.map +7 -1
  11. package/build/admin/visit-site-editor.js +71 -64
  12. package/build/admin/visit-site-editor.js.map +7 -1
  13. package/build/config.js +40 -10
  14. package/build/config.js.map +7 -1
  15. package/build/editor/click-block-options-menu-item.js +29 -14
  16. package/build/editor/click-block-options-menu-item.js.map +7 -1
  17. package/build/editor/click-block-toolbar-button.js +33 -13
  18. package/build/editor/click-block-toolbar-button.js.map +7 -1
  19. package/build/editor/get-blocks.js +59 -43
  20. package/build/editor/get-blocks.js.map +7 -1
  21. package/build/editor/get-edited-post-content.js +31 -12
  22. package/build/editor/get-edited-post-content.js.map +7 -1
  23. package/build/editor/index.js +92 -72
  24. package/build/editor/index.js.map +7 -1
  25. package/build/editor/insert-block.js +50 -21
  26. package/build/editor/insert-block.js.map +7 -1
  27. package/build/editor/open-document-settings-sidebar.js +37 -24
  28. package/build/editor/open-document-settings-sidebar.js.map +7 -1
  29. package/build/editor/preview.js +37 -18
  30. package/build/editor/preview.js.map +7 -1
  31. package/build/editor/publish-post.js +42 -42
  32. package/build/editor/publish-post.js.map +7 -1
  33. package/build/editor/save-draft.js +29 -15
  34. package/build/editor/save-draft.js.map +7 -1
  35. package/build/editor/select-blocks.js +46 -25
  36. package/build/editor/select-blocks.js.map +7 -1
  37. package/build/editor/set-content.js +34 -14
  38. package/build/editor/set-content.js.map +7 -1
  39. package/build/editor/set-is-fixed-toolbar.js +31 -15
  40. package/build/editor/set-is-fixed-toolbar.js.map +7 -1
  41. package/build/editor/set-preferences.js +38 -18
  42. package/build/editor/set-preferences.js.map +7 -1
  43. package/build/editor/show-block-toolbar.js +30 -16
  44. package/build/editor/show-block-toolbar.js.map +7 -1
  45. package/build/editor/site-editor.js +46 -41
  46. package/build/editor/site-editor.js.map +7 -1
  47. package/build/editor/switch-editor-tool.js +42 -30
  48. package/build/editor/switch-editor-tool.js.map +7 -1
  49. package/build/editor/switch-to-legacy-canvas.js +33 -14
  50. package/build/editor/switch-to-legacy-canvas.js.map +7 -1
  51. package/build/editor/transform-block-to.js +41 -21
  52. package/build/editor/transform-block-to.js.map +7 -1
  53. package/build/index.js +50 -32
  54. package/build/index.js.map +7 -1
  55. package/build/lighthouse/index.js +89 -53
  56. package/build/lighthouse/index.js.map +7 -1
  57. package/build/metrics/index.js +298 -249
  58. package/build/metrics/index.js.map +7 -1
  59. package/build/page-utils/drag-files.js +134 -112
  60. package/build/page-utils/drag-files.js.map +7 -1
  61. package/build/page-utils/emulate-network-conditions.js +92 -66
  62. package/build/page-utils/emulate-network-conditions.js.map +7 -1
  63. package/build/page-utils/index.js +54 -34
  64. package/build/page-utils/index.js.map +7 -1
  65. package/build/page-utils/is-current-url.js +31 -18
  66. package/build/page-utils/is-current-url.js.map +7 -1
  67. package/build/page-utils/keycodes.js +51 -39
  68. package/build/page-utils/keycodes.js.map +7 -1
  69. package/build/page-utils/press-keys.js +148 -127
  70. package/build/page-utils/press-keys.js.map +7 -1
  71. package/build/page-utils/set-browser-viewport.js +32 -41
  72. package/build/page-utils/set-browser-viewport.js.map +7 -1
  73. package/build/request-utils/blocks.js +49 -40
  74. package/build/request-utils/blocks.js.map +7 -1
  75. package/build/request-utils/comments.js +57 -45
  76. package/build/request-utils/comments.js.map +7 -1
  77. package/build/request-utils/gutenberg-experiments.js +48 -26
  78. package/build/request-utils/gutenberg-experiments.js.map +7 -1
  79. package/build/request-utils/index.js +187 -153
  80. package/build/request-utils/index.js.map +7 -1
  81. package/build/request-utils/login.js +43 -18
  82. package/build/request-utils/login.js.map +7 -1
  83. package/build/request-utils/media.js +72 -64
  84. package/build/request-utils/media.js.map +7 -1
  85. package/build/request-utils/menus.js +119 -109
  86. package/build/request-utils/menus.js.map +7 -1
  87. package/build/request-utils/pages.js +60 -49
  88. package/build/request-utils/pages.js.map +7 -1
  89. package/build/request-utils/patterns.js +39 -24
  90. package/build/request-utils/patterns.js.map +7 -1
  91. package/build/request-utils/plugins.js +68 -74
  92. package/build/request-utils/plugins.js.map +7 -1
  93. package/build/request-utils/posts.js +52 -39
  94. package/build/request-utils/posts.js.map +7 -1
  95. package/build/request-utils/preferences.js +36 -17
  96. package/build/request-utils/preferences.js.map +7 -1
  97. package/build/request-utils/rest.js +153 -129
  98. package/build/request-utils/rest.js.map +7 -1
  99. package/build/request-utils/site-settings.js +38 -28
  100. package/build/request-utils/site-settings.js.map +7 -1
  101. package/build/request-utils/templates.js +57 -45
  102. package/build/request-utils/templates.js.map +7 -1
  103. package/build/request-utils/themes.js +78 -53
  104. package/build/request-utils/themes.js.map +7 -1
  105. package/build/request-utils/users.js +72 -72
  106. package/build/request-utils/users.js.map +7 -1
  107. package/build/request-utils/widgets.js +71 -55
  108. package/build/request-utils/widgets.js.map +7 -1
  109. package/build/test.js +128 -146
  110. package/build/test.js.map +7 -1
  111. package/build/types.js +16 -2
  112. package/build/types.js.map +7 -1
  113. package/package.json +6 -2
@@ -1,58 +1,94 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Lighthouse = void 0;
4
- const lighthouse = require("lighthouse/core/index.cjs");
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
- page;
7
- port;
8
- constructor({ page, port }) {
9
- this.page = page;
10
- this.port = port;
11
- }
12
- /**
13
- * Returns the Lighthouse report for the current URL.
14
- *
15
- * Runs several Lighthouse audits in a separate browser window and returns
16
- * the summary.
17
- */
18
- async getReport() {
19
- // From https://github.com/GoogleChrome/lighthouse/blob/36cac182a6c637b1671c57326d7c0241633d0076/core/config/default-config.js#L381-L446
20
- const audits = {
21
- 'largest-contentful-paint': 'LCP',
22
- 'total-blocking-time': 'TBT',
23
- interactive: 'TTI',
24
- 'cumulative-layout-shift': 'CLS',
25
- 'interaction-to-next-paint': 'INP',
26
- };
27
- const report = await lighthouse(this.page.url(), { port: this.port }, {
28
- extends: 'lighthouse:default',
29
- settings: {
30
- // "provided" means no throttling.
31
- // TODO: Make configurable.
32
- throttlingMethod: 'provided',
33
- // Default is "mobile".
34
- // See https://github.com/GoogleChrome/lighthouse/blob/main/docs/emulation.md
35
- // TODO: Make configurable.
36
- formFactor: 'desktop',
37
- screenEmulation: {
38
- disabled: true,
39
- },
40
- // Speeds up the report.
41
- disableFullPageScreenshot: true,
42
- // Only run certain audits to speed things up.
43
- onlyAudits: Object.keys(audits),
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
- return result;
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
- exports.Lighthouse = Lighthouse;
58
- //# sourceMappingURL=index.js.map
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
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lighthouse/index.ts"],"names":[],"mappings":";;;AAIA,wDAAwD;AAOxD,MAAa,UAAU;IACtB,IAAI,CAAO;IACX,IAAI,CAAS;IAEb,YAAa,EAAE,IAAI,EAAE,IAAI,EAA8B;QACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS;QACd,wIAAwI;QACxI,MAAM,MAAM,GAAG;YACd,0BAA0B,EAAE,KAAK;YACjC,qBAAqB,EAAE,KAAK;YAC5B,WAAW,EAAE,KAAK;YAClB,yBAAyB,EAAE,KAAK;YAChC,2BAA2B,EAAE,KAAK;SAClC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EACf,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EACnB;YACC,OAAO,EAAE,oBAAoB;YAC7B,QAAQ,EAAE;gBACT,kCAAkC;gBAClC,2BAA2B;gBAC3B,gBAAgB,EAAE,UAAU;gBAC5B,uBAAuB;gBACvB,6EAA6E;gBAC7E,2BAA2B;gBAC3B,UAAU,EAAE,SAAS;gBACrB,eAAe,EAAE;oBAChB,QAAQ,EAAE,IAAI;iBACd;gBACD,wBAAwB;gBACxB,yBAAyB,EAAE,IAAI;gBAC/B,8CAA8C;gBAC9C,UAAU,EAAE,MAAM,CAAC,IAAI,CAAE,MAAM,CAAE;aACjC;SACD,CACD,CAAC;QAEF,MAAM,MAAM,GAA6B,EAAE,CAAC;QAE5C,IAAK,CAAE,MAAM,EAAG,CAAC;YAChB,OAAO,MAAM,CAAC;QACf,CAAC;QAED,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;QAEvB,KAAM,MAAM,CAAE,KAAK,EAAE,OAAO,CAAE,IAAI,MAAM,CAAC,OAAO,CAAE,MAAM,CAAE,EAAG,CAAC;YAC7D,MAAM,CAAE,OAAO,CAAE,GAAG,GAAG,CAAC,MAAM,CAAE,KAAK,CAAE,EAAE,YAAY,IAAI,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AA/DD,gCA+DC"}
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
+ }