@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.
Files changed (227) hide show
  1. package/build/admin/create-new-post.js +48 -28
  2. package/build/admin/create-new-post.js.map +7 -1
  3. package/build/admin/edit-post.js +37 -17
  4. package/build/admin/edit-post.js.map +7 -1
  5. package/build/admin/get-page-error.js +33 -23
  6. package/build/admin/get-page-error.js.map +7 -1
  7. package/build/admin/index.js +58 -36
  8. package/build/admin/index.js.map +7 -1
  9. package/build/admin/visit-admin-page.js +44 -29
  10. package/build/admin/visit-admin-page.js.map +7 -1
  11. package/build/admin/visit-site-editor.js +73 -64
  12. package/build/admin/visit-site-editor.js.map +7 -1
  13. package/build/config.js +43 -11
  14. package/build/config.js.map +7 -1
  15. package/build/editor/click-block-options-menu-item.js +31 -14
  16. package/build/editor/click-block-options-menu-item.js.map +7 -1
  17. package/build/editor/click-block-toolbar-button.js +35 -13
  18. package/build/editor/click-block-toolbar-button.js.map +7 -1
  19. package/build/editor/get-blocks.js +61 -43
  20. package/build/editor/get-blocks.js.map +7 -1
  21. package/build/editor/get-edited-post-content.js +33 -12
  22. package/build/editor/get-edited-post-content.js.map +7 -1
  23. package/build/editor/index.js +96 -74
  24. package/build/editor/index.js.map +7 -1
  25. package/build/editor/insert-block.js +52 -21
  26. package/build/editor/insert-block.js.map +7 -1
  27. package/build/editor/open-document-settings-sidebar.js +39 -24
  28. package/build/editor/open-document-settings-sidebar.js.map +7 -1
  29. package/build/editor/preview.js +39 -18
  30. package/build/editor/preview.js.map +7 -1
  31. package/build/editor/publish-post.js +44 -42
  32. package/build/editor/publish-post.js.map +7 -1
  33. package/build/editor/save-draft.js +31 -15
  34. package/build/editor/save-draft.js.map +7 -1
  35. package/build/editor/select-blocks.js +48 -25
  36. package/build/editor/select-blocks.js.map +7 -1
  37. package/build/editor/set-content.js +36 -14
  38. package/build/editor/set-content.js.map +7 -1
  39. package/build/editor/set-is-fixed-toolbar.js +33 -15
  40. package/build/editor/set-is-fixed-toolbar.js.map +7 -1
  41. package/build/editor/set-preferences.js +40 -18
  42. package/build/editor/set-preferences.js.map +7 -1
  43. package/build/editor/show-block-toolbar.js +32 -16
  44. package/build/editor/show-block-toolbar.js.map +7 -1
  45. package/build/editor/site-editor.js +48 -41
  46. package/build/editor/site-editor.js.map +7 -1
  47. package/build/editor/switch-editor-tool.js +44 -30
  48. package/build/editor/switch-editor-tool.js.map +7 -1
  49. package/build/editor/switch-to-legacy-canvas.js +35 -14
  50. package/build/editor/switch-to-legacy-canvas.js.map +7 -1
  51. package/build/editor/transform-block-to.js +43 -21
  52. package/build/editor/transform-block-to.js.map +7 -1
  53. package/build/index.js +53 -18
  54. package/build/index.js.map +7 -1
  55. package/build/lighthouse/index.js +93 -55
  56. package/build/lighthouse/index.js.map +7 -1
  57. package/build/metrics/index.js +302 -251
  58. package/build/metrics/index.js.map +7 -1
  59. package/build/page-utils/drag-files.js +136 -112
  60. package/build/page-utils/drag-files.js.map +7 -1
  61. package/build/page-utils/emulate-network-conditions.js +95 -67
  62. package/build/page-utils/emulate-network-conditions.js.map +7 -1
  63. package/build/page-utils/index.js +58 -36
  64. package/build/page-utils/index.js.map +7 -1
  65. package/build/page-utils/is-current-url.js +33 -18
  66. package/build/page-utils/is-current-url.js.map +7 -1
  67. package/build/page-utils/keycodes.js +53 -39
  68. package/build/page-utils/keycodes.js.map +7 -1
  69. package/build/page-utils/press-keys.js +153 -130
  70. package/build/page-utils/press-keys.js.map +7 -1
  71. package/build/page-utils/set-browser-viewport.js +35 -42
  72. package/build/page-utils/set-browser-viewport.js.map +7 -1
  73. package/build/request-utils/blocks.js +51 -40
  74. package/build/request-utils/blocks.js.map +7 -1
  75. package/build/request-utils/comments.js +59 -45
  76. package/build/request-utils/comments.js.map +7 -1
  77. package/build/request-utils/gutenberg-experiments.js +63 -38
  78. package/build/request-utils/gutenberg-experiments.js.map +7 -1
  79. package/build/request-utils/index.js +191 -155
  80. package/build/request-utils/index.js.map +7 -1
  81. package/build/request-utils/login.js +45 -18
  82. package/build/request-utils/login.js.map +7 -1
  83. package/build/request-utils/media.js +74 -64
  84. package/build/request-utils/media.js.map +7 -1
  85. package/build/request-utils/menus.js +121 -109
  86. package/build/request-utils/menus.js.map +7 -1
  87. package/build/request-utils/pages.js +63 -50
  88. package/build/request-utils/pages.js.map +7 -1
  89. package/build/request-utils/patterns.js +41 -24
  90. package/build/request-utils/patterns.js.map +7 -1
  91. package/build/request-utils/plugins.js +70 -74
  92. package/build/request-utils/plugins.js.map +7 -1
  93. package/build/request-utils/posts.js +55 -41
  94. package/build/request-utils/posts.js.map +7 -1
  95. package/build/request-utils/preferences.js +38 -17
  96. package/build/request-utils/preferences.js.map +7 -1
  97. package/build/request-utils/rest.js +155 -129
  98. package/build/request-utils/rest.js.map +7 -1
  99. package/build/request-utils/site-settings.js +40 -28
  100. package/build/request-utils/site-settings.js.map +7 -1
  101. package/build/request-utils/templates.js +60 -46
  102. package/build/request-utils/templates.js.map +7 -1
  103. package/build/request-utils/themes.js +80 -53
  104. package/build/request-utils/themes.js.map +7 -1
  105. package/build/request-utils/users.js +74 -72
  106. package/build/request-utils/users.js.map +7 -1
  107. package/build/request-utils/widgets.js +73 -55
  108. package/build/request-utils/widgets.js.map +7 -1
  109. package/build/test.js +130 -146
  110. package/build/test.js.map +7 -1
  111. package/build/types.js +18 -2
  112. package/build/types.js.map +7 -1
  113. package/build-types/index.d.ts +1 -1
  114. package/build-types/index.d.ts.map +1 -1
  115. package/package.json +2 -2
  116. package/build/admin/create-new-post.cjs +0 -51
  117. package/build/admin/create-new-post.cjs.map +0 -7
  118. package/build/admin/edit-post.cjs +0 -40
  119. package/build/admin/edit-post.cjs.map +0 -7
  120. package/build/admin/get-page-error.cjs +0 -36
  121. package/build/admin/get-page-error.cjs.map +0 -7
  122. package/build/admin/index.cjs +0 -59
  123. package/build/admin/index.cjs.map +0 -7
  124. package/build/admin/visit-admin-page.cjs +0 -47
  125. package/build/admin/visit-admin-page.cjs.map +0 -7
  126. package/build/admin/visit-site-editor.cjs +0 -77
  127. package/build/admin/visit-site-editor.cjs.map +0 -7
  128. package/build/config.cjs +0 -45
  129. package/build/config.cjs.map +0 -7
  130. package/build/editor/click-block-options-menu-item.cjs +0 -34
  131. package/build/editor/click-block-options-menu-item.cjs.map +0 -7
  132. package/build/editor/click-block-toolbar-button.cjs +0 -38
  133. package/build/editor/click-block-toolbar-button.cjs.map +0 -7
  134. package/build/editor/get-blocks.cjs +0 -64
  135. package/build/editor/get-blocks.cjs.map +0 -7
  136. package/build/editor/get-edited-post-content.cjs +0 -36
  137. package/build/editor/get-edited-post-content.cjs.map +0 -7
  138. package/build/editor/index.cjs +0 -97
  139. package/build/editor/index.cjs.map +0 -7
  140. package/build/editor/insert-block.cjs +0 -55
  141. package/build/editor/insert-block.cjs.map +0 -7
  142. package/build/editor/open-document-settings-sidebar.cjs +0 -42
  143. package/build/editor/open-document-settings-sidebar.cjs.map +0 -7
  144. package/build/editor/preview.cjs +0 -42
  145. package/build/editor/preview.cjs.map +0 -7
  146. package/build/editor/publish-post.cjs +0 -47
  147. package/build/editor/publish-post.cjs.map +0 -7
  148. package/build/editor/save-draft.cjs +0 -34
  149. package/build/editor/save-draft.cjs.map +0 -7
  150. package/build/editor/select-blocks.cjs +0 -51
  151. package/build/editor/select-blocks.cjs.map +0 -7
  152. package/build/editor/set-content.cjs +0 -39
  153. package/build/editor/set-content.cjs.map +0 -7
  154. package/build/editor/set-is-fixed-toolbar.cjs +0 -36
  155. package/build/editor/set-is-fixed-toolbar.cjs.map +0 -7
  156. package/build/editor/set-preferences.cjs +0 -43
  157. package/build/editor/set-preferences.cjs.map +0 -7
  158. package/build/editor/show-block-toolbar.cjs +0 -35
  159. package/build/editor/show-block-toolbar.cjs.map +0 -7
  160. package/build/editor/site-editor.cjs +0 -51
  161. package/build/editor/site-editor.cjs.map +0 -7
  162. package/build/editor/switch-editor-tool.cjs +0 -47
  163. package/build/editor/switch-editor-tool.cjs.map +0 -7
  164. package/build/editor/switch-to-legacy-canvas.cjs +0 -39
  165. package/build/editor/switch-to-legacy-canvas.cjs.map +0 -7
  166. package/build/editor/transform-block-to.cjs +0 -46
  167. package/build/editor/transform-block-to.cjs.map +0 -7
  168. package/build/index.cjs +0 -51
  169. package/build/index.cjs.map +0 -7
  170. package/build/lighthouse/index.cjs +0 -96
  171. package/build/lighthouse/index.cjs.map +0 -7
  172. package/build/metrics/index.cjs +0 -309
  173. package/build/metrics/index.cjs.map +0 -7
  174. package/build/page-utils/drag-files.cjs +0 -143
  175. package/build/page-utils/drag-files.cjs.map +0 -7
  176. package/build/page-utils/emulate-network-conditions.cjs +0 -99
  177. package/build/page-utils/emulate-network-conditions.cjs.map +0 -7
  178. package/build/page-utils/index.cjs +0 -59
  179. package/build/page-utils/index.cjs.map +0 -7
  180. package/build/page-utils/is-current-url.cjs +0 -36
  181. package/build/page-utils/is-current-url.cjs.map +0 -7
  182. package/build/page-utils/keycodes.cjs +0 -55
  183. package/build/page-utils/keycodes.cjs.map +0 -7
  184. package/build/page-utils/press-keys.cjs +0 -165
  185. package/build/page-utils/press-keys.cjs.map +0 -7
  186. package/build/page-utils/set-browser-viewport.cjs +0 -39
  187. package/build/page-utils/set-browser-viewport.cjs.map +0 -7
  188. package/build/request-utils/blocks.cjs +0 -56
  189. package/build/request-utils/blocks.cjs.map +0 -7
  190. package/build/request-utils/comments.cjs +0 -66
  191. package/build/request-utils/comments.cjs.map +0 -7
  192. package/build/request-utils/gutenberg-experiments.cjs +0 -66
  193. package/build/request-utils/gutenberg-experiments.cjs.map +0 -7
  194. package/build/request-utils/index.cjs +0 -194
  195. package/build/request-utils/index.cjs.map +0 -7
  196. package/build/request-utils/login.cjs +0 -48
  197. package/build/request-utils/login.cjs.map +0 -7
  198. package/build/request-utils/media.cjs +0 -83
  199. package/build/request-utils/media.cjs.map +0 -7
  200. package/build/request-utils/menus.cjs +0 -132
  201. package/build/request-utils/menus.cjs.map +0 -7
  202. package/build/request-utils/pages.cjs +0 -71
  203. package/build/request-utils/pages.cjs.map +0 -7
  204. package/build/request-utils/patterns.cjs +0 -44
  205. package/build/request-utils/patterns.cjs.map +0 -7
  206. package/build/request-utils/plugins.cjs +0 -81
  207. package/build/request-utils/plugins.cjs.map +0 -7
  208. package/build/request-utils/posts.cjs +0 -61
  209. package/build/request-utils/posts.cjs.map +0 -7
  210. package/build/request-utils/preferences.cjs +0 -41
  211. package/build/request-utils/preferences.cjs.map +0 -7
  212. package/build/request-utils/rest.cjs +0 -174
  213. package/build/request-utils/rest.cjs.map +0 -7
  214. package/build/request-utils/site-settings.cjs +0 -45
  215. package/build/request-utils/site-settings.cjs.map +0 -7
  216. package/build/request-utils/templates.cjs +0 -68
  217. package/build/request-utils/templates.cjs.map +0 -7
  218. package/build/request-utils/themes.cjs +0 -89
  219. package/build/request-utils/themes.cjs.map +0 -7
  220. package/build/request-utils/users.cjs +0 -83
  221. package/build/request-utils/users.cjs.map +0 -7
  222. package/build/request-utils/widgets.cjs +0 -79
  223. package/build/request-utils/widgets.cjs.map +0 -7
  224. package/build/test.cjs +0 -136
  225. package/build/test.cjs.map +0 -7
  226. package/build/types.cjs +0 -19
  227. package/build/types.cjs.map +0 -7
package/build/test.js CHANGED
@@ -1,152 +1,136 @@
1
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
- const get_port_1 = require("get-port");
11
- /**
12
- * Internal dependencies
13
- */
14
- const index_1 = require("./index");
15
- const STORAGE_STATE_PATH = process.env.STORAGE_STATE_PATH ||
16
- path.join(process.cwd(), 'artifacts/storage-states/admin.json');
17
- /**
18
- * Set of console logging types observed to protect against unexpected yet
19
- * handled (i.e. not catastrophic) errors or warnings. Each key corresponds
20
- * to the Playwright ConsoleMessage type, its value the corresponding function
21
- * on the console global object.
22
- */
23
- const OBSERVED_CONSOLE_MESSAGE_TYPES = ['warn', 'error'];
24
- /**
25
- * Adds a page event handler to emit uncaught exception to process if one of
26
- * the observed console logging types is encountered.
27
- *
28
- * @param message The console message.
29
- */
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/test.ts
31
+ var test_exports = {};
32
+ __export(test_exports, {
33
+ expect: () => import_test.expect,
34
+ test: () => test
35
+ });
36
+ module.exports = __toCommonJS(test_exports);
37
+ var path = __toESM(require("path"));
38
+ var import_test = require("@playwright/test");
39
+ var import_get_port = __toESM(require("get-port"));
40
+ var import_index = require("./index");
41
+ var STORAGE_STATE_PATH = process.env.STORAGE_STATE_PATH || path.join(process.cwd(), "artifacts/storage-states/admin.json");
42
+ var OBSERVED_CONSOLE_MESSAGE_TYPES = ["warn", "error"];
30
43
  function observeConsoleLogging(message) {
31
- const type = message.type();
32
- if (!OBSERVED_CONSOLE_MESSAGE_TYPES.includes(type)) {
33
- return;
34
- }
35
- const text = message.text();
36
- // An exception is made for _blanket_ deprecation warnings: Those
37
- // which log regardless of whether a deprecated feature is in use.
38
- if (text.includes('This is a global warning')) {
39
- return;
40
- }
41
- // A chrome advisory warning about SameSite cookies is informational
42
- // about future changes, tracked separately for improvement in core.
43
- //
44
- // See: https://core.trac.wordpress.org/ticket/37000
45
- // See: https://www.chromestatus.com/feature/5088147346030592
46
- // See: https://www.chromestatus.com/feature/5633521622188032
47
- if (text.includes('A cookie associated with a cross-site resource') ||
48
- text.includes('https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite')) {
49
- return;
50
- }
51
- // Viewing posts on the front end can result in this error, which
52
- // has nothing to do with Gutenberg.
53
- if (text.includes('net::ERR_UNKNOWN_URL_SCHEME')) {
54
- return;
55
- }
56
- // TODO: Not implemented yet.
57
- // Network errors are ignored only if we are intentionally testing
58
- // offline mode.
59
- // if (
60
- // text.includes( 'net::ERR_INTERNET_DISCONNECTED' ) &&
61
- // isOfflineMode()
62
- // ) {
63
- // return;
64
- // }
65
- // As of WordPress 5.3.2 in Chrome 79, navigating to the block editor
66
- // (Posts > Add New) will display a console warning about
67
- // non - unique IDs.
68
- // See: https://core.trac.wordpress.org/ticket/23165
69
- if (text.includes('elements with non-unique id #_wpnonce')) {
70
- return;
71
- }
72
- // Ignore all JQMIGRATE (jQuery migrate) deprecation warnings.
73
- if (text.includes('JQMIGRATE')) {
74
- return;
75
- }
76
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1404468
77
- if (text.includes('Layout was forced before the page was fully loaded')) {
78
- return;
79
- }
80
- // Deprecated warnings coming from the third-party libraries.
81
- if (text.includes('MouseEvent.moz')) {
82
- return;
83
- }
84
- const logFunction = type;
85
- // Disable reason: We intentionally bubble up the console message
86
- // which, unless the test explicitly anticipates the logging via
87
- // @wordpress/jest-console matchers, will cause the intended test
88
- // failure.
89
- // eslint-disable-next-line no-console
90
- console[logFunction](text);
44
+ const type = message.type();
45
+ if (!OBSERVED_CONSOLE_MESSAGE_TYPES.includes(
46
+ type
47
+ )) {
48
+ return;
49
+ }
50
+ const text = message.text();
51
+ if (text.includes("This is a global warning")) {
52
+ return;
53
+ }
54
+ if (text.includes("A cookie associated with a cross-site resource") || text.includes(
55
+ "https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite"
56
+ )) {
57
+ return;
58
+ }
59
+ if (text.includes("net::ERR_UNKNOWN_URL_SCHEME")) {
60
+ return;
61
+ }
62
+ if (text.includes("elements with non-unique id #_wpnonce")) {
63
+ return;
64
+ }
65
+ if (text.includes("JQMIGRATE")) {
66
+ return;
67
+ }
68
+ if (text.includes("Layout was forced before the page was fully loaded")) {
69
+ return;
70
+ }
71
+ if (text.includes("MouseEvent.moz")) {
72
+ return;
73
+ }
74
+ const logFunction = type;
75
+ console[logFunction](text);
91
76
  }
92
- const test = test_1.test.extend({
93
- admin: async ({ page, pageUtils, editor }, use) => {
94
- await use(new index_1.Admin({ page, pageUtils, editor }));
95
- },
96
- editor: async ({ page }, use) => {
97
- await use(new index_1.Editor({ page }));
98
- },
99
- page: async ({ page }, use) => {
100
- page.on('console', observeConsoleLogging);
101
- await use(page);
102
- // Clear local storage after each test.
103
- // This needs to be wrapped with a try/catch because it can fail when
104
- // the test is skipped (e.g. via fixme).
105
- try {
106
- await page.evaluate(() => {
107
- window.localStorage.clear();
108
- });
109
- }
110
- catch (error) {
111
- // noop.
112
- }
113
- await page.close();
114
- },
115
- pageUtils: async ({ page, browserName }, use) => {
116
- await use(new index_1.PageUtils({ page, browserName }));
117
- },
118
- requestUtils: [
119
- async ({}, use, workerInfo) => {
120
- const requestUtils = await index_1.RequestUtils.setup({
121
- baseURL: workerInfo.project.use.baseURL,
122
- storageStatePath: STORAGE_STATE_PATH,
123
- });
124
- await use(requestUtils);
125
- },
126
- { scope: 'worker', auto: true },
127
- ],
128
- // Spins up a new browser for use by the Lighthouse fixture
129
- // so that Lighthouse can connect to the debugging port.
130
- // As a worker-scoped fixture, this will only launch 1
131
- // instance for the whole test worker, so multiple tests
132
- // will share the same instance with the same port.
133
- lighthousePort: [
134
- async ({}, use) => {
135
- const port = await (0, get_port_1.default)();
136
- const browser = await test_1.chromium.launch({
137
- args: [`--remote-debugging-port=${port}`],
138
- });
139
- await use(port);
140
- await browser.close();
141
- },
142
- { scope: 'worker' },
143
- ],
144
- lighthouse: async ({ page, lighthousePort }, use) => {
145
- await use(new index_1.Lighthouse({ page, port: lighthousePort }));
77
+ var test = import_test.test.extend({
78
+ admin: async ({ page, pageUtils, editor }, use) => {
79
+ await use(new import_index.Admin({ page, pageUtils, editor }));
80
+ },
81
+ editor: async ({ page }, use) => {
82
+ await use(new import_index.Editor({ page }));
83
+ },
84
+ page: async ({ page }, use) => {
85
+ page.on("console", observeConsoleLogging);
86
+ await use(page);
87
+ try {
88
+ await page.evaluate(() => {
89
+ window.localStorage.clear();
90
+ });
91
+ } catch (error) {
92
+ }
93
+ await page.close();
94
+ },
95
+ pageUtils: async ({ page, browserName }, use) => {
96
+ await use(new import_index.PageUtils({ page, browserName }));
97
+ },
98
+ requestUtils: [
99
+ async ({}, use, workerInfo) => {
100
+ const requestUtils = await import_index.RequestUtils.setup({
101
+ baseURL: workerInfo.project.use.baseURL,
102
+ storageStatePath: STORAGE_STATE_PATH
103
+ });
104
+ await use(requestUtils);
146
105
  },
147
- metrics: async ({ page }, use) => {
148
- await use(new index_1.Metrics({ page }));
106
+ { scope: "worker", auto: true }
107
+ ],
108
+ // Spins up a new browser for use by the Lighthouse fixture
109
+ // so that Lighthouse can connect to the debugging port.
110
+ // As a worker-scoped fixture, this will only launch 1
111
+ // instance for the whole test worker, so multiple tests
112
+ // will share the same instance with the same port.
113
+ lighthousePort: [
114
+ async ({}, use) => {
115
+ const port = await (0, import_get_port.default)();
116
+ const browser = await import_test.chromium.launch({
117
+ args: [`--remote-debugging-port=${port}`]
118
+ });
119
+ await use(port);
120
+ await browser.close();
149
121
  },
122
+ { scope: "worker" }
123
+ ],
124
+ lighthouse: async ({ page, lighthousePort }, use) => {
125
+ await use(new import_index.Lighthouse({ page, port: lighthousePort }));
126
+ },
127
+ metrics: async ({ page }, use) => {
128
+ await use(new import_index.Metrics({ page }));
129
+ }
130
+ });
131
+ // Annotate the CommonJS export names for ESM import in node:
132
+ 0 && (module.exports = {
133
+ expect,
134
+ test
150
135
  });
151
- exports.test = test;
152
- //# sourceMappingURL=test.js.map
136
+ //# sourceMappingURL=test.js.map
package/build/test.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,6BAA6B;AAC7B,2CAAkE;AAqMnD,uFArMQ,aAAM,OAqMR;AAnMrB,uCAA+B;AAE/B;;GAEG;AACH,mCAOiB;AAEjB,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,CAAC;QACF,OAAO;IACR,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAE5B,iEAAiE;IACjE,kEAAkE;IAClE,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AAC;YAEJ,MAAM,GAAG,CAAE,YAAY,CAAE,CAAC;QAC3B,CAAC;QACD,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;KAC/B;IACD,2DAA2D;IAC3D,wDAAwD;IACxD,sDAAsD;IACtD,wDAAwD;IACxD,mDAAmD;IACnD,cAAc,EAAE;QACf,KAAK,EAAG,EAAE,EAAE,GAAG,EAAG,EAAE;YACnB,MAAM,IAAI,GAAG,MAAM,IAAA,kBAAO,GAAE,CAAC;YAC7B,MAAM,OAAO,GAAG,MAAM,eAAQ,CAAC,MAAM,CAAE;gBACtC,IAAI,EAAE,CAAE,2BAA4B,IAAK,EAAE,CAAE;aAC7C,CAAE,CAAC;YAEJ,MAAM,GAAG,CAAE,IAAI,CAAE,CAAC;YAElB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;QACD,EAAE,KAAK,EAAE,QAAQ,EAAE;KACnB;IACD,UAAU,EAAE,KAAK,EAAG,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,GAAG,EAAG,EAAE;QACrD,MAAM,GAAG,CAAE,IAAI,kBAAU,CAAE,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,CAAE,CAAE,CAAC;IAC/D,CAAC;IACD,OAAO,EAAE,KAAK,EAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAG,EAAE;QAClC,MAAM,GAAG,CAAE,IAAI,eAAO,CAAE,EAAE,IAAI,EAAE,CAAE,CAAE,CAAC;IACtC,CAAC;CACD,CAAE,CAAC;AAEK,oBAAI"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/test.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport * as path from 'path';\nimport { test as base, expect, chromium } from '@playwright/test';\nimport type { ConsoleMessage } from '@playwright/test';\nimport getPort from 'get-port';\n\n/**\n * Internal dependencies\n */\nimport {\n\tAdmin,\n\tEditor,\n\tPageUtils,\n\tRequestUtils,\n\tMetrics,\n\tLighthouse,\n} from './index';\n\nconst STORAGE_STATE_PATH =\n\tprocess.env.STORAGE_STATE_PATH ||\n\tpath.join( process.cwd(), 'artifacts/storage-states/admin.json' );\n\n/**\n * Set of console logging types observed to protect against unexpected yet\n * handled (i.e. not catastrophic) errors or warnings. Each key corresponds\n * to the Playwright ConsoleMessage type, its value the corresponding function\n * on the console global object.\n */\nconst OBSERVED_CONSOLE_MESSAGE_TYPES = [ 'warn', 'error' ] as const;\n\n/**\n * Adds a page event handler to emit uncaught exception to process if one of\n * the observed console logging types is encountered.\n *\n * @param message The console message.\n */\nfunction observeConsoleLogging( message: ConsoleMessage ) {\n\tconst type = message.type();\n\tif (\n\t\t! OBSERVED_CONSOLE_MESSAGE_TYPES.includes(\n\t\t\ttype as ( typeof OBSERVED_CONSOLE_MESSAGE_TYPES )[ number ]\n\t\t)\n\t) {\n\t\treturn;\n\t}\n\n\tconst text = message.text();\n\n\t// An exception is made for _blanket_ deprecation warnings: Those\n\t// which log regardless of whether a deprecated feature is in use.\n\tif ( text.includes( 'This is a global warning' ) ) {\n\t\treturn;\n\t}\n\n\t// A chrome advisory warning about SameSite cookies is informational\n\t// about future changes, tracked separately for improvement in core.\n\t//\n\t// See: https://core.trac.wordpress.org/ticket/37000\n\t// See: https://www.chromestatus.com/feature/5088147346030592\n\t// See: https://www.chromestatus.com/feature/5633521622188032\n\tif (\n\t\ttext.includes( 'A cookie associated with a cross-site resource' ) ||\n\t\ttext.includes(\n\t\t\t'https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite'\n\t\t)\n\t) {\n\t\treturn;\n\t}\n\n\t// Viewing posts on the front end can result in this error, which\n\t// has nothing to do with Gutenberg.\n\tif ( text.includes( 'net::ERR_UNKNOWN_URL_SCHEME' ) ) {\n\t\treturn;\n\t}\n\n\t// TODO: Not implemented yet.\n\t// Network errors are ignored only if we are intentionally testing\n\t// offline mode.\n\t// if (\n\t// \ttext.includes( 'net::ERR_INTERNET_DISCONNECTED' ) &&\n\t// \tisOfflineMode()\n\t// ) {\n\t// \treturn;\n\t// }\n\n\t// As of WordPress 5.3.2 in Chrome 79, navigating to the block editor\n\t// (Posts > Add New) will display a console warning about\n\t// non - unique IDs.\n\t// See: https://core.trac.wordpress.org/ticket/23165\n\tif ( text.includes( 'elements with non-unique id #_wpnonce' ) ) {\n\t\treturn;\n\t}\n\n\t// Ignore all JQMIGRATE (jQuery migrate) deprecation warnings.\n\tif ( text.includes( 'JQMIGRATE' ) ) {\n\t\treturn;\n\t}\n\n\t// https://bugzilla.mozilla.org/show_bug.cgi?id=1404468\n\tif (\n\t\ttext.includes( 'Layout was forced before the page was fully loaded' )\n\t) {\n\t\treturn;\n\t}\n\n\t// Deprecated warnings coming from the third-party libraries.\n\tif ( text.includes( 'MouseEvent.moz' ) ) {\n\t\treturn;\n\t}\n\n\tconst logFunction =\n\t\ttype as ( typeof OBSERVED_CONSOLE_MESSAGE_TYPES )[ number ];\n\n\t// Disable reason: We intentionally bubble up the console message\n\t// which, unless the test explicitly anticipates the logging via\n\t// @wordpress/jest-console matchers, will cause the intended test\n\t// failure.\n\t// eslint-disable-next-line no-console\n\tconsole[ logFunction ]( text );\n}\n\nconst test = base.extend<\n\t{\n\t\tadmin: Admin;\n\t\teditor: Editor;\n\t\tpageUtils: PageUtils;\n\t\tsnapshotConfig: void;\n\t\tmetrics: Metrics;\n\t\tlighthouse: Lighthouse;\n\t},\n\t{\n\t\trequestUtils: RequestUtils;\n\t\tlighthousePort: number;\n\t}\n>( {\n\tadmin: async ( { page, pageUtils, editor }, use ) => {\n\t\tawait use( new Admin( { page, pageUtils, editor } ) );\n\t},\n\teditor: async ( { page }, use ) => {\n\t\tawait use( new Editor( { page } ) );\n\t},\n\tpage: async ( { page }, use ) => {\n\t\tpage.on( 'console', observeConsoleLogging );\n\n\t\tawait use( page );\n\n\t\t// Clear local storage after each test.\n\t\t// This needs to be wrapped with a try/catch because it can fail when\n\t\t// the test is skipped (e.g. via fixme).\n\t\ttry {\n\t\t\tawait page.evaluate( () => {\n\t\t\t\twindow.localStorage.clear();\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// noop.\n\t\t}\n\n\t\tawait page.close();\n\t},\n\tpageUtils: async ( { page, browserName }, use ) => {\n\t\tawait use( new PageUtils( { page, browserName } ) );\n\t},\n\trequestUtils: [\n\t\tasync ( {}, use, workerInfo ) => {\n\t\t\tconst requestUtils = await RequestUtils.setup( {\n\t\t\t\tbaseURL: workerInfo.project.use.baseURL,\n\t\t\t\tstorageStatePath: STORAGE_STATE_PATH,\n\t\t\t} );\n\n\t\t\tawait use( requestUtils );\n\t\t},\n\t\t{ scope: 'worker', auto: true },\n\t],\n\t// Spins up a new browser for use by the Lighthouse fixture\n\t// so that Lighthouse can connect to the debugging port.\n\t// As a worker-scoped fixture, this will only launch 1\n\t// instance for the whole test worker, so multiple tests\n\t// will share the same instance with the same port.\n\tlighthousePort: [\n\t\tasync ( {}, use ) => {\n\t\t\tconst port = await getPort();\n\t\t\tconst browser = await chromium.launch( {\n\t\t\t\targs: [ `--remote-debugging-port=${ port }` ],\n\t\t\t} );\n\n\t\t\tawait use( port );\n\n\t\t\tawait browser.close();\n\t\t},\n\t\t{ scope: 'worker' },\n\t],\n\tlighthouse: async ( { page, lighthousePort }, use ) => {\n\t\tawait use( new Lighthouse( { page, port: lighthousePort } ) );\n\t},\n\tmetrics: async ( { page }, use ) => {\n\t\tawait use( new Metrics( { page } ) );\n\t},\n} );\n\nexport { test, expect };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,WAAsB;AACtB,kBAA+C;AAE/C,sBAAoB;AAKpB,mBAOO;AAEP,IAAM,qBACL,QAAQ,IAAI,sBACP,UAAM,QAAQ,IAAI,GAAG,qCAAsC;AAQjE,IAAM,iCAAiC,CAAE,QAAQ,OAAQ;AAQzD,SAAS,sBAAuB,SAA0B;AACzD,QAAM,OAAO,QA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E,MAAM,YAAY,CAAE,CAAE;AAAA,EACnD;AAAA,EACA,cAAc;AAAA,IACb,OAAQ,CAAC,GAAG,KAAK,eAAgB;AAChC,YAAM,eAAe,MAAM,0BAAa,MAAO;AAAA,QAC9C,SAAS,WAAW,QAAQ,IAAI;AAAA,QAChC,kBAAkB;AAAA,MACnB,CAAE;AAEF,YAAM,IAAK,YAAa;AAAA,IACzB;AAAA,IACA,EAAE,OAAO,UAAU,MAAM,KAAK;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAgB;AAAA,IACf,OAAQ,CAAC,GAAG,QAAS;AACpB,YAAM,OAAO,UAAM,gBAAAC,SAAQ;AAC3B,YAAM,UAAU,MAAM,qBAAS,OAAQ;AAAA,QACtC,MAAM,CAAE,2BAA4B,IAAK,EAAG;AAAA,MAC7C,CAAE;AAEF,YAAM,IAAK,IAAK;AAEhB,YAAM,QAAQ,MAAM;AAAA,IACrB;AAAA,IACA,EAAE,OAAO,SAAS;AAAA,EACnB;AAAA,EACA,YAAY,OAAQ,EAAE,MAAM,eAAe,GAAG,QAAS;AACtD,UAAM,IAAK,IAAI,wBAAY,EAAE,MAAM,MAAM,eAAe,CAAE,CAAE;AAAA,EAC7D;AAAA,EACA,SAAS,OAAQ,EAAE,KAAK,GAAG,QAAS;AACnC,UAAM,IAAK,IAAI,qBAAS,EAAE,KAAK,CAAE,CAAE;AAAA,EACpC;AACD,CAAE;",
6
+ "names": ["base", "getPort"]
7
+ }
package/build/types.js CHANGED
@@ -1,3 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/e2e-test-utils-playwright/src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/types.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\ndeclare global {\n\tinterface Window {\n\t\t// Silence the warning for `window.wp` in Playwright's evaluate functions.\n\t\twp: any;\n\t\t// Helper function added by Metrics fixture for web-vitals.js.\n\t\t__reportVitals__: ( data: string ) => void;\n\t}\n}\n\nexport {};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,4 +1,4 @@
1
- export type * from './types';
1
+ export * from './types';
2
2
  export { Admin } from './admin';
3
3
  export { Editor } from './editor';
4
4
  export { PageUtils } from './page-utils';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-test-utils-playwright",
3
- "version": "1.36.1-next.738bb1424.0",
3
+ "version": "1.37.0",
4
4
  "description": "End-To-End (E2E) test utils for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "ab1b004c0d61c295aa34bc86ea07f979343983ce"
53
+ "gitHead": "2cf13ec6cf86153c9b3cf369bf5c59046f5cd950"
54
54
  }
@@ -1,51 +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/admin/create-new-post.ts
21
- var create_new_post_exports = {};
22
- __export(create_new_post_exports, {
23
- createNewPost: () => createNewPost
24
- });
25
- module.exports = __toCommonJS(create_new_post_exports);
26
- async function createNewPost(options = {}) {
27
- const query = new URLSearchParams();
28
- const { postType, title, content, excerpt } = options;
29
- if (postType) {
30
- query.set("post_type", postType);
31
- }
32
- if (title) {
33
- query.set("post_title", title);
34
- }
35
- if (content) {
36
- query.set("content", content);
37
- }
38
- if (excerpt) {
39
- query.set("excerpt", excerpt);
40
- }
41
- await this.visitAdminPage("post-new.php", query.toString());
42
- await this.editor.setPreferences("core/edit-post", {
43
- welcomeGuide: options.showWelcomeGuide ?? false,
44
- fullscreenMode: options.fullscreenMode ?? false
45
- });
46
- }
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- createNewPost
50
- });
51
- //# sourceMappingURL=create-new-post.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/admin/create-new-post.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\ninterface NewPostOptions {\n\tpostType?: string;\n\ttitle?: string;\n\tcontent?: string;\n\texcerpt?: string;\n\tshowWelcomeGuide?: boolean;\n\tfullscreenMode?: boolean;\n}\n\n/**\n * Creates new post.\n *\n * @param this\n * @param options Options to create new post.\n */\nexport async function createNewPost(\n\tthis: Admin,\n\toptions: NewPostOptions = {}\n) {\n\tconst query = new URLSearchParams();\n\tconst { postType, title, content, excerpt } = options;\n\n\tif ( postType ) {\n\t\tquery.set( 'post_type', postType );\n\t}\n\tif ( title ) {\n\t\tquery.set( 'post_title', title );\n\t}\n\tif ( content ) {\n\t\tquery.set( 'content', content );\n\t}\n\tif ( excerpt ) {\n\t\tquery.set( 'excerpt', excerpt );\n\t}\n\n\tawait this.visitAdminPage( 'post-new.php', query.toString() );\n\n\tawait this.editor.setPreferences( 'core/edit-post', {\n\t\twelcomeGuide: options.showWelcomeGuide ?? false,\n\t\tfullscreenMode: options.fullscreenMode ?? false,\n\t} );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,eAAsB,cAErB,UAA0B,CAAC,GAC1B;AACD,QAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAM,EAAE,UAAU,OAAO,SAAS,QAAQ,IAAI;AAE9C,MAAK,UAAW;AACf,UAAM,IAAK,aAAa,QAAS;AAAA,EAClC;AACA,MAAK,OAAQ;AACZ,UAAM,IAAK,cAAc,KAAM;AAAA,EAChC;AACA,MAAK,SAAU;AACd,UAAM,IAAK,WAAW,OAAQ;AAAA,EAC/B;AACA,MAAK,SAAU;AACd,UAAM,IAAK,WAAW,OAAQ;AAAA,EAC/B;AAEA,QAAM,KAAK,eAAgB,gBAAgB,MAAM,SAAS,CAAE;AAE5D,QAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,IACnD,cAAc,QAAQ,oBAAoB;AAAA,IAC1C,gBAAgB,QAAQ,kBAAkB;AAAA,EAC3C,CAAE;AACH;",
6
- "names": []
7
- }
@@ -1,40 +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/admin/edit-post.ts
21
- var edit_post_exports = {};
22
- __export(edit_post_exports, {
23
- editPost: () => editPost
24
- });
25
- module.exports = __toCommonJS(edit_post_exports);
26
- async function editPost(postId) {
27
- const query = new URLSearchParams();
28
- query.set("post", String(postId));
29
- query.set("action", "edit");
30
- await this.visitAdminPage("post.php", query.toString());
31
- await this.editor.setPreferences("core/edit-post", {
32
- welcomeGuide: false,
33
- fullscreenMode: false
34
- });
35
- }
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- editPost
39
- });
40
- //# sourceMappingURL=edit-post.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/admin/edit-post.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from '.';\n\n/**\n * Open the post with given ID in the editor.\n *\n * @param this\n * @param postId Post ID to visit.\n */\nexport async function editPost( this: Admin, postId: string | number ) {\n\tconst query = new URLSearchParams();\n\n\tquery.set( 'post', String( postId ) );\n\tquery.set( 'action', 'edit' );\n\n\tawait this.visitAdminPage( 'post.php', query.toString() );\n\n\tawait this.editor.setPreferences( 'core/edit-post', {\n\t\twelcomeGuide: false,\n\t\tfullscreenMode: false,\n\t} );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,eAAsB,SAAuB,QAA0B;AACtE,QAAM,QAAQ,IAAI,gBAAgB;AAElC,QAAM,IAAK,QAAQ,OAAQ,MAAO,CAAE;AACpC,QAAM,IAAK,UAAU,MAAO;AAE5B,QAAM,KAAK,eAAgB,YAAY,MAAM,SAAS,CAAE;AAExD,QAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,IACnD,cAAc;AAAA,IACd,gBAAgB;AAAA,EACjB,CAAE;AACH;",
6
- "names": []
7
- }
@@ -1,36 +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/admin/get-page-error.ts
21
- var get_page_error_exports = {};
22
- __export(get_page_error_exports, {
23
- getPageError: () => getPageError
24
- });
25
- module.exports = __toCommonJS(get_page_error_exports);
26
- var REGEXP_PHP_ERROR = /(<b>)?(Fatal error|Recoverable fatal error|Warning|Parse error|Notice|Strict Standards|Deprecated|Unknown error)(<\/b>)?: (.*?) in (.*?) on line (<b>)?\d+(<\/b>)?/;
27
- async function getPageError() {
28
- const content = await this.page.content();
29
- const match = content.match(REGEXP_PHP_ERROR);
30
- return match ? match[0] : null;
31
- }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- getPageError
35
- });
36
- //# sourceMappingURL=get-page-error.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/admin/get-page-error.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\n/**\n * Regular expression matching a displayed PHP error within a markup string.\n *\n * @see https://github.com/php/php-src/blob/598175e/main/main.c#L1257-L1297\n */\nconst REGEXP_PHP_ERROR =\n\t/(<b>)?(Fatal error|Recoverable fatal error|Warning|Parse error|Notice|Strict Standards|Deprecated|Unknown error)(<\\/b>)?: (.*?) in (.*?) on line (<b>)?\\d+(<\\/b>)?/;\n\n/**\n * Returns a promise resolving to one of either a string or null. A string will\n * be resolved if an error message is present in the contents of the page. If no\n * error is present, a null value will be resolved instead. This requires the\n * environment be configured to display errors.\n *\n * @see http://php.net/manual/en/function.error-reporting.php\n *\n * @param this\n * @return Promise resolving to a string or null, depending whether a page error is present.\n */\nexport async function getPageError( this: Admin ) {\n\tconst content = await this.page.content();\n\tconst match = content.match( REGEXP_PHP_ERROR );\n\treturn match ? match[ 0 ] : null;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,mBACL;AAaD,eAAsB,eAA4B;AACjD,QAAM,UAAU,MAAM,KAAK,KAAK,QAAQ;AACxC,QAAM,QAAQ,QAAQ,MAAO,gBAAiB;AAC9C,SAAO,QAAQ,MAAO,CAAE,IAAI;AAC7B;",
6
- "names": []
7
- }
@@ -1,59 +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/admin/index.ts
21
- var admin_exports = {};
22
- __export(admin_exports, {
23
- Admin: () => Admin
24
- });
25
- module.exports = __toCommonJS(admin_exports);
26
- var import_create_new_post = require("./create-new-post.cjs");
27
- var import_get_page_error = require("./get-page-error.cjs");
28
- var import_visit_admin_page = require("./visit-admin-page.cjs");
29
- var import_edit_post = require("./edit-post.cjs");
30
- var import_visit_site_editor = require("./visit-site-editor.cjs");
31
- var Admin = class {
32
- page;
33
- context;
34
- browser;
35
- pageUtils;
36
- editor;
37
- constructor({ page, pageUtils, editor }) {
38
- this.page = page;
39
- this.context = page.context();
40
- this.browser = this.context.browser();
41
- this.pageUtils = pageUtils;
42
- this.editor = editor;
43
- }
44
- /** @borrows createNewPost as this.createNewPost */
45
- createNewPost = import_create_new_post.createNewPost.bind(this);
46
- /** @borrows editPost as this.editPost */
47
- editPost = import_edit_post.editPost.bind(this);
48
- /** @borrows getPageError as this.getPageError */
49
- getPageError = import_get_page_error.getPageError.bind(this);
50
- /** @borrows visitAdminPage as this.visitAdminPage */
51
- visitAdminPage = import_visit_admin_page.visitAdminPage.bind(this);
52
- /** @borrows visitSiteEditor as this.visitSiteEditor */
53
- visitSiteEditor = import_visit_site_editor.visitSiteEditor.bind(this);
54
- };
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- Admin
58
- });
59
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/admin/index.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport type { Browser, Page, BrowserContext } from '@playwright/test';\n\n/**\n * Internal dependencies\n */\nimport { createNewPost } from './create-new-post';\nimport { getPageError } from './get-page-error';\nimport { visitAdminPage } from './visit-admin-page';\nimport { editPost } from './edit-post';\nimport { visitSiteEditor } from './visit-site-editor';\nimport type { PageUtils } from '../page-utils';\nimport type { Editor } from '../editor';\n\ntype AdminConstructorProps = {\n\tpage: Page;\n\tpageUtils: PageUtils;\n\teditor: Editor;\n};\n\nexport class Admin {\n\tpage: Page;\n\tcontext: BrowserContext;\n\tbrowser: Browser;\n\tpageUtils: PageUtils;\n\teditor: Editor;\n\n\tconstructor( { page, pageUtils, editor }: AdminConstructorProps ) {\n\t\tthis.page = page;\n\t\tthis.context = page.context();\n\t\tthis.browser = this.context.browser()!;\n\t\tthis.pageUtils = pageUtils;\n\t\tthis.editor = editor;\n\t}\n\n\t/** @borrows createNewPost as this.createNewPost */\n\tcreateNewPost: typeof createNewPost = createNewPost.bind( this );\n\t/** @borrows editPost as this.editPost */\n\teditPost: typeof editPost = editPost.bind( this );\n\t/** @borrows getPageError as this.getPageError */\n\tgetPageError: typeof getPageError = getPageError.bind( this );\n\t/** @borrows visitAdminPage as this.visitAdminPage */\n\tvisitAdminPage: typeof visitAdminPage = visitAdminPage.bind( this );\n\t/** @borrows visitSiteEditor as this.visitSiteEditor */\n\tvisitSiteEditor: typeof visitSiteEditor = visitSiteEditor.bind( this );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,6BAA8B;AAC9B,4BAA6B;AAC7B,8BAA+B;AAC/B,uBAAyB;AACzB,+BAAgC;AAUzB,IAAM,QAAN,MAAY;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAa,EAAE,MAAM,WAAW,OAAO,GAA2B;AACjE,SAAK,OAAO;AACZ,SAAK,UAAU,KAAK,QAAQ;AAC5B,SAAK,UAAU,KAAK,QAAQ,QAAQ;AACpC,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,EACf;AAAA;AAAA,EAGA,gBAAsC,qCAAc,KAAM,IAAK;AAAA;AAAA,EAE/D,WAA4B,0BAAS,KAAM,IAAK;AAAA;AAAA,EAEhD,eAAoC,mCAAa,KAAM,IAAK;AAAA;AAAA,EAE5D,iBAAwC,uCAAe,KAAM,IAAK;AAAA;AAAA,EAElE,kBAA0C,yCAAgB,KAAM,IAAK;AACtE;",
6
- "names": []
7
- }