@wordpress/e2e-test-utils-playwright 1.46.0 → 1.48.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 (295) hide show
  1. package/build-types/admin/index.d.ts +3 -0
  2. package/build-types/admin/index.d.ts.map +1 -1
  3. package/build-types/admin/visit-site-editor.d.ts.map +1 -1
  4. package/build-types/admin/wait-for-site-editor.d.ts +12 -0
  5. package/build-types/admin/wait-for-site-editor.d.ts.map +1 -0
  6. package/build-types/metrics/index.d.ts +22 -5
  7. package/build-types/metrics/index.d.ts.map +1 -1
  8. package/build-types/request-utils/index.d.ts +3 -1
  9. package/build-types/request-utils/index.d.ts.map +1 -1
  10. package/build-types/request-utils/preferences.d.ts +11 -0
  11. package/build-types/request-utils/preferences.d.ts.map +1 -1
  12. package/package.json +4 -5
  13. package/src/admin/create-new-post.ts +47 -0
  14. package/src/admin/edit-post.ts +24 -0
  15. package/{build/admin/get-page-error.js → src/admin/get-page-error.ts} +12 -9
  16. package/src/admin/index.ts +52 -0
  17. package/src/admin/visit-admin-page.ts +43 -0
  18. package/src/admin/visit-site-editor.ts +62 -0
  19. package/src/admin/wait-for-site-editor.ts +52 -0
  20. package/src/config.ts +12 -0
  21. package/src/editor/click-block-options-menu-item.ts +18 -0
  22. package/src/editor/click-block-toolbar-button.ts +21 -0
  23. package/src/editor/get-blocks.ts +75 -0
  24. package/src/editor/get-edited-post-content.ts +19 -0
  25. package/src/editor/index.ts +95 -0
  26. package/src/editor/insert-block.ts +54 -0
  27. package/src/editor/open-document-settings-sidebar.ts +31 -0
  28. package/src/editor/preview.ts +32 -0
  29. package/src/editor/publish-post.ts +51 -0
  30. package/src/editor/save-draft.ts +20 -0
  31. package/src/editor/select-blocks.ts +48 -0
  32. package/src/editor/set-content.ts +24 -0
  33. package/src/editor/set-is-fixed-toolbar.ts +20 -0
  34. package/src/editor/set-preferences.ts +37 -0
  35. package/src/editor/show-block-toolbar.ts +20 -0
  36. package/src/editor/site-editor.ts +55 -0
  37. package/src/editor/switch-editor-tool.ts +34 -0
  38. package/src/editor/switch-to-legacy-canvas.ts +20 -0
  39. package/src/editor/transform-block-to.ts +34 -0
  40. package/src/index.ts +8 -0
  41. package/src/lighthouse/index.ts +75 -0
  42. package/src/metrics/index.ts +441 -0
  43. package/src/page-utils/drag-files.ts +173 -0
  44. package/src/page-utils/emulate-network-conditions.ts +101 -0
  45. package/src/page-utils/index.ts +54 -0
  46. package/src/page-utils/is-current-url.ts +20 -0
  47. package/src/page-utils/keycodes.ts +48 -0
  48. package/src/page-utils/press-keys.ts +195 -0
  49. package/{build → src}/page-utils/set-browser-viewport.js +14 -12
  50. package/src/request-utils/blocks.ts +58 -0
  51. package/src/request-utils/comments.ts +80 -0
  52. package/src/request-utils/gutenberg-experiments.ts +62 -0
  53. package/src/request-utils/index.ts +222 -0
  54. package/src/request-utils/login.ts +34 -0
  55. package/src/request-utils/media.ts +102 -0
  56. package/src/request-utils/menus.ts +145 -0
  57. package/src/request-utils/pages.ts +75 -0
  58. package/src/request-utils/patterns.ts +31 -0
  59. package/src/request-utils/plugins.ts +103 -0
  60. package/src/request-utils/posts.ts +69 -0
  61. package/src/request-utils/preferences.ts +63 -0
  62. package/{build/request-utils/records.js → src/request-utils/records.ts} +15 -10
  63. package/src/request-utils/rest.ts +222 -0
  64. package/src/request-utils/site-settings.ts +58 -0
  65. package/src/request-utils/templates.ts +83 -0
  66. package/src/request-utils/themes.ts +110 -0
  67. package/src/request-utils/users.ts +125 -0
  68. package/src/request-utils/widgets.js +68 -0
  69. package/src/test.ts +204 -0
  70. package/src/types.ts +13 -0
  71. package/build/admin/create-new-post.cjs +0 -51
  72. package/build/admin/create-new-post.cjs.map +0 -7
  73. package/build/admin/create-new-post.js +0 -31
  74. package/build/admin/create-new-post.js.map +0 -1
  75. package/build/admin/edit-post.cjs +0 -40
  76. package/build/admin/edit-post.cjs.map +0 -7
  77. package/build/admin/edit-post.js +0 -20
  78. package/build/admin/edit-post.js.map +0 -1
  79. package/build/admin/get-page-error.cjs +0 -36
  80. package/build/admin/get-page-error.cjs.map +0 -7
  81. package/build/admin/get-page-error.js.map +0 -1
  82. package/build/admin/index.cjs +0 -59
  83. package/build/admin/index.cjs.map +0 -7
  84. package/build/admin/index.js +0 -37
  85. package/build/admin/index.js.map +0 -1
  86. package/build/admin/visit-admin-page.cjs +0 -47
  87. package/build/admin/visit-admin-page.cjs.map +0 -7
  88. package/build/admin/visit-admin-page.js +0 -32
  89. package/build/admin/visit-admin-page.js.map +0 -1
  90. package/build/admin/visit-site-editor.cjs +0 -90
  91. package/build/admin/visit-site-editor.cjs.map +0 -7
  92. package/build/admin/visit-site-editor.js +0 -73
  93. package/build/admin/visit-site-editor.js.map +0 -1
  94. package/build/config.cjs +0 -45
  95. package/build/config.cjs.map +0 -7
  96. package/build/config.js +0 -13
  97. package/build/config.js.map +0 -1
  98. package/build/editor/click-block-options-menu-item.cjs +0 -34
  99. package/build/editor/click-block-options-menu-item.cjs.map +0 -7
  100. package/build/editor/click-block-options-menu-item.js +0 -17
  101. package/build/editor/click-block-options-menu-item.js.map +0 -1
  102. package/build/editor/click-block-toolbar-button.cjs +0 -38
  103. package/build/editor/click-block-toolbar-button.cjs.map +0 -7
  104. package/build/editor/click-block-toolbar-button.js +0 -16
  105. package/build/editor/click-block-toolbar-button.js.map +0 -1
  106. package/build/editor/get-blocks.cjs +0 -64
  107. package/build/editor/get-blocks.cjs.map +0 -7
  108. package/build/editor/get-blocks.js +0 -45
  109. package/build/editor/get-blocks.js.map +0 -1
  110. package/build/editor/get-edited-post-content.cjs +0 -36
  111. package/build/editor/get-edited-post-content.cjs.map +0 -7
  112. package/build/editor/get-edited-post-content.js +0 -15
  113. package/build/editor/get-edited-post-content.js.map +0 -1
  114. package/build/editor/index.cjs +0 -97
  115. package/build/editor/index.cjs.map +0 -7
  116. package/build/editor/index.js +0 -75
  117. package/build/editor/index.js.map +0 -1
  118. package/build/editor/insert-block.cjs +0 -55
  119. package/build/editor/insert-block.cjs.map +0 -7
  120. package/build/editor/insert-block.js +0 -23
  121. package/build/editor/insert-block.js.map +0 -1
  122. package/build/editor/open-document-settings-sidebar.cjs +0 -42
  123. package/build/editor/open-document-settings-sidebar.cjs.map +0 -7
  124. package/build/editor/open-document-settings-sidebar.js +0 -27
  125. package/build/editor/open-document-settings-sidebar.js.map +0 -1
  126. package/build/editor/preview.cjs +0 -42
  127. package/build/editor/preview.cjs.map +0 -7
  128. package/build/editor/preview.js +0 -21
  129. package/build/editor/preview.js.map +0 -1
  130. package/build/editor/publish-post.cjs +0 -47
  131. package/build/editor/publish-post.cjs.map +0 -7
  132. package/build/editor/publish-post.js +0 -45
  133. package/build/editor/publish-post.js.map +0 -1
  134. package/build/editor/save-draft.cjs +0 -34
  135. package/build/editor/save-draft.cjs.map +0 -7
  136. package/build/editor/save-draft.js +0 -18
  137. package/build/editor/save-draft.js.map +0 -1
  138. package/build/editor/select-blocks.cjs +0 -51
  139. package/build/editor/select-blocks.cjs.map +0 -7
  140. package/build/editor/select-blocks.js +0 -28
  141. package/build/editor/select-blocks.js.map +0 -1
  142. package/build/editor/set-content.cjs +0 -39
  143. package/build/editor/set-content.cjs.map +0 -7
  144. package/build/editor/set-content.js +0 -17
  145. package/build/editor/set-content.js.map +0 -1
  146. package/build/editor/set-is-fixed-toolbar.cjs +0 -36
  147. package/build/editor/set-is-fixed-toolbar.cjs.map +0 -7
  148. package/build/editor/set-is-fixed-toolbar.js +0 -18
  149. package/build/editor/set-is-fixed-toolbar.js.map +0 -1
  150. package/build/editor/set-preferences.cjs +0 -43
  151. package/build/editor/set-preferences.cjs.map +0 -7
  152. package/build/editor/set-preferences.js +0 -21
  153. package/build/editor/set-preferences.js.map +0 -1
  154. package/build/editor/show-block-toolbar.cjs +0 -35
  155. package/build/editor/show-block-toolbar.cjs.map +0 -7
  156. package/build/editor/show-block-toolbar.js +0 -19
  157. package/build/editor/show-block-toolbar.js.map +0 -1
  158. package/build/editor/site-editor.cjs +0 -51
  159. package/build/editor/site-editor.cjs.map +0 -7
  160. package/build/editor/site-editor.js +0 -44
  161. package/build/editor/site-editor.js.map +0 -1
  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-editor-tool.js +0 -33
  165. package/build/editor/switch-editor-tool.js.map +0 -1
  166. package/build/editor/switch-to-legacy-canvas.cjs +0 -39
  167. package/build/editor/switch-to-legacy-canvas.cjs.map +0 -7
  168. package/build/editor/switch-to-legacy-canvas.js +0 -18
  169. package/build/editor/switch-to-legacy-canvas.js.map +0 -1
  170. package/build/editor/transform-block-to.cjs +0 -46
  171. package/build/editor/transform-block-to.cjs.map +0 -7
  172. package/build/editor/transform-block-to.js +0 -24
  173. package/build/editor/transform-block-to.js.map +0 -1
  174. package/build/index.cjs +0 -51
  175. package/build/index.cjs.map +0 -7
  176. package/build/index.js +0 -19
  177. package/build/index.js.map +0 -1
  178. package/build/lighthouse/index.cjs +0 -96
  179. package/build/lighthouse/index.cjs.map +0 -7
  180. package/build/lighthouse/index.js +0 -61
  181. package/build/lighthouse/index.js.map +0 -1
  182. package/build/metrics/index.cjs +0 -309
  183. package/build/metrics/index.cjs.map +0 -7
  184. package/build/metrics/index.js +0 -258
  185. package/build/metrics/index.js.map +0 -1
  186. package/build/page-utils/drag-files.cjs +0 -143
  187. package/build/page-utils/drag-files.cjs.map +0 -7
  188. package/build/page-utils/drag-files.js +0 -119
  189. package/build/page-utils/drag-files.js.map +0 -1
  190. package/build/page-utils/emulate-network-conditions.cjs +0 -99
  191. package/build/page-utils/emulate-network-conditions.cjs.map +0 -7
  192. package/build/page-utils/emulate-network-conditions.js +0 -71
  193. package/build/page-utils/emulate-network-conditions.js.map +0 -1
  194. package/build/page-utils/index.cjs +0 -59
  195. package/build/page-utils/index.cjs.map +0 -7
  196. package/build/page-utils/index.js +0 -37
  197. package/build/page-utils/index.js.map +0 -1
  198. package/build/page-utils/is-current-url.cjs +0 -36
  199. package/build/page-utils/is-current-url.cjs.map +0 -7
  200. package/build/page-utils/is-current-url.js +0 -21
  201. package/build/page-utils/is-current-url.js.map +0 -1
  202. package/build/page-utils/keycodes.cjs +0 -55
  203. package/build/page-utils/keycodes.cjs.map +0 -7
  204. package/build/page-utils/keycodes.js +0 -41
  205. package/build/page-utils/keycodes.js.map +0 -1
  206. package/build/page-utils/press-keys.cjs +0 -165
  207. package/build/page-utils/press-keys.cjs.map +0 -7
  208. package/build/page-utils/press-keys.js +0 -141
  209. package/build/page-utils/press-keys.js.map +0 -1
  210. package/build/page-utils/set-browser-viewport.cjs +0 -39
  211. package/build/page-utils/set-browser-viewport.cjs.map +0 -7
  212. package/build/page-utils/set-browser-viewport.js.map +0 -1
  213. package/build/request-utils/blocks.cjs +0 -51
  214. package/build/request-utils/blocks.cjs.map +0 -7
  215. package/build/request-utils/blocks.js +0 -40
  216. package/build/request-utils/blocks.js.map +0 -1
  217. package/build/request-utils/comments.cjs +0 -66
  218. package/build/request-utils/comments.cjs.map +0 -7
  219. package/build/request-utils/comments.js +0 -52
  220. package/build/request-utils/comments.js.map +0 -1
  221. package/build/request-utils/gutenberg-experiments.cjs +0 -56
  222. package/build/request-utils/gutenberg-experiments.cjs.map +0 -7
  223. package/build/request-utils/gutenberg-experiments.js +0 -47
  224. package/build/request-utils/gutenberg-experiments.js.map +0 -1
  225. package/build/request-utils/index.cjs +0 -199
  226. package/build/request-utils/index.cjs.map +0 -7
  227. package/build/request-utils/index.js +0 -194
  228. package/build/request-utils/index.js.map +0 -1
  229. package/build/request-utils/login.cjs +0 -48
  230. package/build/request-utils/login.cjs.map +0 -7
  231. package/build/request-utils/login.js +0 -21
  232. package/build/request-utils/login.js.map +0 -1
  233. package/build/request-utils/media.cjs +0 -83
  234. package/build/request-utils/media.cjs.map +0 -7
  235. package/build/request-utils/media.js +0 -106
  236. package/build/request-utils/media.js.map +0 -1
  237. package/build/request-utils/menus.cjs +0 -128
  238. package/build/request-utils/menus.cjs.map +0 -7
  239. package/build/request-utils/menus.js +0 -116
  240. package/build/request-utils/menus.js.map +0 -1
  241. package/build/request-utils/pages.cjs +0 -66
  242. package/build/request-utils/pages.cjs.map +0 -7
  243. package/build/request-utils/pages.js +0 -53
  244. package/build/request-utils/pages.js.map +0 -1
  245. package/build/request-utils/patterns.cjs +0 -44
  246. package/build/request-utils/patterns.cjs.map +0 -7
  247. package/build/request-utils/patterns.js +0 -27
  248. package/build/request-utils/patterns.js.map +0 -1
  249. package/build/request-utils/plugins.cjs +0 -81
  250. package/build/request-utils/plugins.cjs.map +0 -7
  251. package/build/request-utils/plugins.js +0 -85
  252. package/build/request-utils/plugins.js.map +0 -1
  253. package/build/request-utils/posts.cjs +0 -56
  254. package/build/request-utils/posts.cjs.map +0 -7
  255. package/build/request-utils/posts.js +0 -42
  256. package/build/request-utils/posts.js.map +0 -1
  257. package/build/request-utils/preferences.cjs +0 -41
  258. package/build/request-utils/preferences.cjs.map +0 -7
  259. package/build/request-utils/preferences.js +0 -20
  260. package/build/request-utils/preferences.js.map +0 -1
  261. package/build/request-utils/records.cjs +0 -37
  262. package/build/request-utils/records.cjs.map +0 -7
  263. package/build/request-utils/records.js.map +0 -1
  264. package/build/request-utils/rest.cjs +0 -174
  265. package/build/request-utils/rest.cjs.map +0 -7
  266. package/build/request-utils/rest.js +0 -181
  267. package/build/request-utils/rest.js.map +0 -1
  268. package/build/request-utils/site-settings.cjs +0 -45
  269. package/build/request-utils/site-settings.cjs.map +0 -7
  270. package/build/request-utils/site-settings.js +0 -33
  271. package/build/request-utils/site-settings.js.map +0 -1
  272. package/build/request-utils/templates.cjs +0 -68
  273. package/build/request-utils/templates.cjs.map +0 -7
  274. package/build/request-utils/templates.js +0 -54
  275. package/build/request-utils/templates.js.map +0 -1
  276. package/build/request-utils/themes.cjs +0 -92
  277. package/build/request-utils/themes.cjs.map +0 -7
  278. package/build/request-utils/themes.js +0 -69
  279. package/build/request-utils/themes.js.map +0 -1
  280. package/build/request-utils/users.cjs +0 -83
  281. package/build/request-utils/users.cjs.map +0 -7
  282. package/build/request-utils/users.js +0 -81
  283. package/build/request-utils/users.js.map +0 -1
  284. package/build/request-utils/widgets.cjs +0 -79
  285. package/build/request-utils/widgets.cjs.map +0 -7
  286. package/build/request-utils/widgets.js +0 -61
  287. package/build/request-utils/widgets.js.map +0 -1
  288. package/build/test.cjs +0 -136
  289. package/build/test.cjs.map +0 -7
  290. package/build/test.js +0 -189
  291. package/build/test.js.map +0 -1
  292. package/build/types.cjs +0 -19
  293. package/build/types.cjs.map +0 -7
  294. package/build/types.js +0 -3
  295. package/build/types.js.map +0 -1
@@ -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/editor/site-editor.ts
21
- var site_editor_exports = {};
22
- __export(site_editor_exports, {
23
- saveSiteEditorEntities: () => saveSiteEditorEntities
24
- });
25
- module.exports = __toCommonJS(site_editor_exports);
26
- async function saveSiteEditorEntities(options = {}) {
27
- const editorTopBar = this.page.getByRole("region", {
28
- name: "Editor top bar"
29
- });
30
- const saveButton = editorTopBar.getByRole("button", {
31
- name: "Save",
32
- exact: true
33
- });
34
- const publishButton = editorTopBar.getByRole("button", {
35
- name: "Publish"
36
- });
37
- const publishButtonIsVisible = !await saveButton.isVisible();
38
- const buttonToClick = publishButtonIsVisible ? publishButton : saveButton;
39
- await buttonToClick.click();
40
- if (!options.isOnlyCurrentEntityDirty) {
41
- await this.page.getByRole("region", {
42
- name: /(Editor publish|Save panel)/
43
- }).getByRole("button", { name: "Save", exact: true }).click();
44
- }
45
- await this.page.getByRole("button", { name: "Dismiss this notice" }).getByText(/(updated|published)\./).first().waitFor();
46
- }
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- saveSiteEditorEntities
50
- });
51
- //# sourceMappingURL=site-editor.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/editor/site-editor.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Editor } from './index';\n\ninterface Options {\n\t// If the only dirty entity is the current one, skip opening the save panel.\n\tisOnlyCurrentEntityDirty?: boolean;\n}\n\n/**\n * Save entities in the site editor. Assumes the editor is in a dirty state.\n *\n * @param this\n * @param options\n */\nexport async function saveSiteEditorEntities(\n\tthis: Editor,\n\toptions: Options = {}\n) {\n\tconst editorTopBar = this.page.getByRole( 'region', {\n\t\tname: 'Editor top bar',\n\t} );\n\n\t// If we have changes in a single entity which can be published the label is `Publish`.\n\tconst saveButton = editorTopBar.getByRole( 'button', {\n\t\tname: 'Save',\n\t\texact: true,\n\t} );\n\tconst publishButton = editorTopBar.getByRole( 'button', {\n\t\tname: 'Publish',\n\t} );\n\tconst publishButtonIsVisible = ! ( await saveButton.isVisible() );\n\t// First Save button in the top bar.\n\tconst buttonToClick = publishButtonIsVisible ? publishButton : saveButton;\n\tawait buttonToClick.click();\n\n\tif ( ! options.isOnlyCurrentEntityDirty ) {\n\t\t// Second Save button in the entities panel.\n\t\tawait this.page\n\t\t\t.getByRole( 'region', {\n\t\t\t\tname: /(Editor publish|Save panel)/,\n\t\t\t} )\n\t\t\t.getByRole( 'button', { name: 'Save', exact: true } )\n\t\t\t.click();\n\t}\n\t// The text in the notice can be different based on the edited entity, whether\n\t// we are saving multiple entities and whether we publish or update. So for now,\n\t// we locate it based on the last part.\n\tawait this.page\n\t\t.getByRole( 'button', { name: 'Dismiss this notice' } )\n\t\t.getByText( /(updated|published)\\./ )\n\t\t.first()\n\t\t.waitFor();\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,eAAsB,uBAErB,UAAmB,CAAC,GACnB;AACD,QAAM,eAAe,KAAK,KAAK,UAAW,UAAU;AAAA,IACnD,MAAM;AAAA,EACP,CAAE;AAGF,QAAM,aAAa,aAAa,UAAW,UAAU;AAAA,IACpD,MAAM;AAAA,IACN,OAAO;AAAA,EACR,CAAE;AACF,QAAM,gBAAgB,aAAa,UAAW,UAAU;AAAA,IACvD,MAAM;AAAA,EACP,CAAE;AACF,QAAM,yBAAyB,CAAI,MAAM,WAAW,UAAU;AAE9D,QAAM,gBAAgB,yBAAyB,gBAAgB;AAC/D,QAAM,cAAc,MAAM;AAE1B,MAAK,CAAE,QAAQ,0BAA2B;AAEzC,UAAM,KAAK,KACT,UAAW,UAAU;AAAA,MACrB,MAAM;AAAA,IACP,CAAE,EACD,UAAW,UAAU,EAAE,MAAM,QAAQ,OAAO,KAAK,CAAE,EACnD,MAAM;AAAA,EACT;AAIA,QAAM,KAAK,KACT,UAAW,UAAU,EAAE,MAAM,sBAAsB,CAAE,EACrD,UAAW,uBAAwB,EACnC,MAAM,EACN,QAAQ;AACX;",
6
- "names": []
7
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveSiteEditorEntities = saveSiteEditorEntities;
4
- /**
5
- * Save entities in the site editor. Assumes the editor is in a dirty state.
6
- *
7
- * @param this
8
- * @param options
9
- */
10
- async function saveSiteEditorEntities(options = {}) {
11
- const editorTopBar = this.page.getByRole('region', {
12
- name: 'Editor top bar',
13
- });
14
- // If we have changes in a single entity which can be published the label is `Publish`.
15
- const saveButton = editorTopBar.getByRole('button', {
16
- name: 'Save',
17
- exact: true,
18
- });
19
- const publishButton = editorTopBar.getByRole('button', {
20
- name: 'Publish',
21
- });
22
- const publishButtonIsVisible = !(await saveButton.isVisible());
23
- // First Save button in the top bar.
24
- const buttonToClick = publishButtonIsVisible ? publishButton : saveButton;
25
- await buttonToClick.click();
26
- if (!options.isOnlyCurrentEntityDirty) {
27
- // Second Save button in the entities panel.
28
- await this.page
29
- .getByRole('region', {
30
- name: /(Editor publish|Save panel)/,
31
- })
32
- .getByRole('button', { name: 'Save', exact: true })
33
- .click();
34
- }
35
- // The text in the notice can be different based on the edited entity, whether
36
- // we are saving multiple entities and whether we publish or update. So for now,
37
- // we locate it based on the last part.
38
- await this.page
39
- .getByRole('button', { name: 'Dismiss this notice' })
40
- .getByText(/(updated|published)\./)
41
- .first()
42
- .waitFor();
43
- }
44
- //# sourceMappingURL=site-editor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"site-editor.js","sourceRoot":"","sources":["../../src/editor/site-editor.ts"],"names":[],"mappings":";;;AAUA;;;;;GAKG;AACI,KAAK,iCAEX,OAAO,GAAY,EAAE;IAErB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAE,QAAQ,EAAE;QACnD,IAAI,EAAE,gBAAgB;KACtB,CAAE,CAAC;IAEJ,uFAAuF;IACvF,MAAM,UAAU,GAAG,YAAY,CAAC,SAAS,CAAE,QAAQ,EAAE;QACpD,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,IAAI;KACX,CAAE,CAAC;IACJ,MAAM,aAAa,GAAG,YAAY,CAAC,SAAS,CAAE,QAAQ,EAAE;QACvD,IAAI,EAAE,SAAS;KACf,CAAE,CAAC;IACJ,MAAM,sBAAsB,GAAG,CAAE,CAAE,MAAM,UAAU,CAAC,SAAS,EAAE,CAAE,CAAC;IAClE,oCAAoC;IACpC,MAAM,aAAa,GAAG,sBAAsB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC;IAC1E,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC;IAE5B,IAAK,CAAE,OAAO,CAAC,wBAAwB,EAAG,CAAC;QAC1C,4CAA4C;QAC5C,MAAM,IAAI,CAAC,IAAI;aACb,SAAS,CAAE,QAAQ,EAAE;YACrB,IAAI,EAAE,6BAA6B;SACnC,CAAE;aACF,SAAS,CAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAE;aACpD,KAAK,EAAE,CAAC;IACX,CAAC;IACD,8EAA8E;IAC9E,gFAAgF;IAChF,uCAAuC;IACvC,MAAM,IAAI,CAAC,IAAI;SACb,SAAS,CAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAE;SACtD,SAAS,CAAE,uBAAuB,CAAE;SACpC,KAAK,EAAE;SACP,OAAO,EAAE,CAAC;AACb,CAAC"}
@@ -1,47 +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/editor/switch-editor-tool.ts
21
- var switch_editor_tool_exports = {};
22
- __export(switch_editor_tool_exports, {
23
- switchEditorTool: () => switchEditorTool
24
- });
25
- module.exports = __toCommonJS(switch_editor_tool_exports);
26
- async function switchEditorTool(label) {
27
- const toolsToolbar = this.page.getByRole("toolbar", {
28
- name: "Document tools"
29
- });
30
- await toolsToolbar.getByRole("button", {
31
- name: "Tools"
32
- }).click();
33
- const menu = this.page.getByRole("menu", {
34
- name: "Tools"
35
- });
36
- await menu.getByRole("menuitemradio", {
37
- name: label
38
- }).click();
39
- await toolsToolbar.getByRole("button", {
40
- name: "Tools"
41
- }).click();
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- switchEditorTool
46
- });
47
- //# sourceMappingURL=switch-editor-tool.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/editor/switch-editor-tool.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Editor } from './index';\n\n/**\n * Switch the editor tool being used.\n *\n * @param this\n * @param label The text string of the button label.\n */\nexport async function switchEditorTool( this: Editor, label: string ) {\n\tconst toolsToolbar = this.page.getByRole( 'toolbar', {\n\t\tname: 'Document tools',\n\t} );\n\tawait toolsToolbar\n\t\t.getByRole( 'button', {\n\t\t\tname: 'Tools',\n\t\t} )\n\t\t.click();\n\tconst menu = this.page.getByRole( 'menu', {\n\t\tname: 'Tools',\n\t} );\n\tawait menu\n\t\t.getByRole( 'menuitemradio', {\n\t\t\tname: label,\n\t\t} )\n\t\t.click();\n\tawait toolsToolbar\n\t\t.getByRole( 'button', {\n\t\t\tname: 'Tools',\n\t\t} )\n\t\t.click();\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,eAAsB,iBAAgC,OAAgB;AACrE,QAAM,eAAe,KAAK,KAAK,UAAW,WAAW;AAAA,IACpD,MAAM;AAAA,EACP,CAAE;AACF,QAAM,aACJ,UAAW,UAAU;AAAA,IACrB,MAAM;AAAA,EACP,CAAE,EACD,MAAM;AACR,QAAM,OAAO,KAAK,KAAK,UAAW,QAAQ;AAAA,IACzC,MAAM;AAAA,EACP,CAAE;AACF,QAAM,KACJ,UAAW,iBAAiB;AAAA,IAC5B,MAAM;AAAA,EACP,CAAE,EACD,MAAM;AACR,QAAM,aACJ,UAAW,UAAU;AAAA,IACrB,MAAM;AAAA,EACP,CAAE,EACD,MAAM;AACT;",
6
- "names": []
7
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.switchEditorTool = switchEditorTool;
4
- /**
5
- * Switch the editor tool being used.
6
- *
7
- * @param this
8
- * @param label The text string of the button label.
9
- */
10
- async function switchEditorTool(label) {
11
- const toolsToolbar = this.page.getByRole('toolbar', {
12
- name: 'Document tools',
13
- });
14
- await toolsToolbar
15
- .getByRole('button', {
16
- name: 'Tools',
17
- })
18
- .click();
19
- const menu = this.page.getByRole('menu', {
20
- name: 'Tools',
21
- });
22
- await menu
23
- .getByRole('menuitemradio', {
24
- name: label,
25
- })
26
- .click();
27
- await toolsToolbar
28
- .getByRole('button', {
29
- name: 'Tools',
30
- })
31
- .click();
32
- }
33
- //# sourceMappingURL=switch-editor-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"switch-editor-tool.js","sourceRoot":"","sources":["../../src/editor/switch-editor-tool.ts"],"names":[],"mappings":";;;AAKA;;;;;GAKG;AACI,KAAK,2BAA0C,KAAa;IAClE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAE,SAAS,EAAE;QACpD,IAAI,EAAE,gBAAgB;KACtB,CAAE,CAAC;IACJ,MAAM,YAAY;SAChB,SAAS,CAAE,QAAQ,EAAE;QACrB,IAAI,EAAE,OAAO;KACb,CAAE;SACF,KAAK,EAAE,CAAC;IACV,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAE,MAAM,EAAE;QACzC,IAAI,EAAE,OAAO;KACb,CAAE,CAAC;IACJ,MAAM,IAAI;SACR,SAAS,CAAE,eAAe,EAAE;QAC5B,IAAI,EAAE,KAAK;KACX,CAAE;SACF,KAAK,EAAE,CAAC;IACV,MAAM,YAAY;SAChB,SAAS,CAAE,QAAQ,EAAE;QACrB,IAAI,EAAE,OAAO;KACb,CAAE;SACF,KAAK,EAAE,CAAC;AACX,CAAC"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/e2e-test-utils-playwright/src/editor/switch-to-legacy-canvas.ts
21
- var switch_to_legacy_canvas_exports = {};
22
- __export(switch_to_legacy_canvas_exports, {
23
- switchToLegacyCanvas: () => switchToLegacyCanvas
24
- });
25
- module.exports = __toCommonJS(switch_to_legacy_canvas_exports);
26
- async function switchToLegacyCanvas() {
27
- await this.page.waitForFunction(() => window?.wp?.blocks);
28
- await this.page.evaluate(() => {
29
- window.wp.blocks.registerBlockType("test/v2", {
30
- apiVersion: "2",
31
- title: "test"
32
- });
33
- });
34
- }
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- switchToLegacyCanvas
38
- });
39
- //# sourceMappingURL=switch-to-legacy-canvas.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/editor/switch-to-legacy-canvas.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Editor } from './index';\n\n/**\n * Switches to legacy (non-iframed) canvas.\n *\n * @param this\n */\nexport async function switchToLegacyCanvas( this: Editor ) {\n\tawait this.page.waitForFunction( () => window?.wp?.blocks );\n\n\tawait this.page.evaluate( () => {\n\t\twindow.wp.blocks.registerBlockType( 'test/v2', {\n\t\t\tapiVersion: '2',\n\t\t\ttitle: 'test',\n\t\t} );\n\t} );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,eAAsB,uBAAqC;AAC1D,QAAM,KAAK,KAAK,gBAAiB,MAAM,QAAQ,IAAI,MAAO;AAE1D,QAAM,KAAK,KAAK,SAAU,MAAM;AAC/B,WAAO,GAAG,OAAO,kBAAmB,WAAW;AAAA,MAC9C,YAAY;AAAA,MACZ,OAAO;AAAA,IACR,CAAE;AAAA,EACH,CAAE;AACH;",
6
- "names": []
7
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.switchToLegacyCanvas = switchToLegacyCanvas;
4
- /**
5
- * Switches to legacy (non-iframed) canvas.
6
- *
7
- * @param this
8
- */
9
- async function switchToLegacyCanvas() {
10
- await this.page.waitForFunction(() => window?.wp?.blocks);
11
- await this.page.evaluate(() => {
12
- window.wp.blocks.registerBlockType('test/v2', {
13
- apiVersion: '2',
14
- title: 'test',
15
- });
16
- });
17
- }
18
- //# sourceMappingURL=switch-to-legacy-canvas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"switch-to-legacy-canvas.js","sourceRoot":"","sources":["../../src/editor/switch-to-legacy-canvas.ts"],"names":[],"mappings":";;;AAKA;;;;GAIG;AACI,KAAK;IACX,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAE,CAAC;IAE5D,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAE,SAAS,EAAE;YAC9C,UAAU,EAAE,GAAG;YACf,KAAK,EAAE,MAAM;SACb,CAAE,CAAC;IACL,CAAC,CAAE,CAAC;AACL,CAAC"}
@@ -1,46 +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/editor/transform-block-to.ts
21
- var transform_block_to_exports = {};
22
- __export(transform_block_to_exports, {
23
- transformBlockTo: () => transformBlockTo
24
- });
25
- module.exports = __toCommonJS(transform_block_to_exports);
26
- async function transformBlockTo(name) {
27
- await this.page.waitForFunction(
28
- () => window?.wp?.blocks && window?.wp?.data
29
- );
30
- await this.page.evaluate(
31
- ([blockName]) => {
32
- const clientIds = window.wp.data.select("core/block-editor").getSelectedBlockClientIds();
33
- const blocks = window.wp.data.select("core/block-editor").getBlocksByClientId(clientIds);
34
- window.wp.data.dispatch("core/block-editor").replaceBlocks(
35
- clientIds,
36
- window.wp.blocks.switchToBlockType(blocks, blockName)
37
- );
38
- },
39
- [name]
40
- );
41
- }
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- transformBlockTo
45
- });
46
- //# sourceMappingURL=transform-block-to.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/editor/transform-block-to.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Editor } from './index';\n\n/**\n * Clicks the default block appender.\n *\n * @param this\n * @param name Block name.\n */\nexport async function transformBlockTo( this: Editor, name: string ) {\n\tawait this.page.waitForFunction(\n\t\t() => window?.wp?.blocks && window?.wp?.data\n\t);\n\n\tawait this.page.evaluate(\n\t\t( [ blockName ] ) => {\n\t\t\tconst clientIds = window.wp.data\n\t\t\t\t.select( 'core/block-editor' )\n\t\t\t\t.getSelectedBlockClientIds();\n\t\t\tconst blocks = window.wp.data\n\t\t\t\t.select( 'core/block-editor' )\n\t\t\t\t.getBlocksByClientId( clientIds );\n\t\t\twindow.wp.data\n\t\t\t\t.dispatch( 'core/block-editor' )\n\t\t\t\t.replaceBlocks(\n\t\t\t\t\tclientIds,\n\t\t\t\t\twindow.wp.blocks.switchToBlockType( blocks, blockName )\n\t\t\t\t);\n\t\t},\n\t\t[ name ]\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,eAAsB,iBAAgC,MAAe;AACpE,QAAM,KAAK,KAAK;AAAA,IACf,MAAM,QAAQ,IAAI,UAAU,QAAQ,IAAI;AAAA,EACzC;AAEA,QAAM,KAAK,KAAK;AAAA,IACf,CAAE,CAAE,SAAU,MAAO;AACpB,YAAM,YAAY,OAAO,GAAG,KAC1B,OAAQ,mBAAoB,EAC5B,0BAA0B;AAC5B,YAAM,SAAS,OAAO,GAAG,KACvB,OAAQ,mBAAoB,EAC5B,oBAAqB,SAAU;AACjC,aAAO,GAAG,KACR,SAAU,mBAAoB,EAC9B;AAAA,QACA;AAAA,QACA,OAAO,GAAG,OAAO,kBAAmB,QAAQ,SAAU;AAAA,MACvD;AAAA,IACF;AAAA,IACA,CAAE,IAAK;AAAA,EACR;AACD;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformBlockTo = transformBlockTo;
4
- /**
5
- * Clicks the default block appender.
6
- *
7
- * @param this
8
- * @param name Block name.
9
- */
10
- async function transformBlockTo(name) {
11
- await this.page.waitForFunction(() => window?.wp?.blocks && window?.wp?.data);
12
- await this.page.evaluate(([blockName]) => {
13
- const clientIds = window.wp.data
14
- .select('core/block-editor')
15
- .getSelectedBlockClientIds();
16
- const blocks = window.wp.data
17
- .select('core/block-editor')
18
- .getBlocksByClientId(clientIds);
19
- window.wp.data
20
- .dispatch('core/block-editor')
21
- .replaceBlocks(clientIds, window.wp.blocks.switchToBlockType(blocks, blockName));
22
- }, [name]);
23
- }
24
- //# sourceMappingURL=transform-block-to.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-block-to.js","sourceRoot":"","sources":["../../src/editor/transform-block-to.ts"],"names":[],"mappings":";;;AAKA;;;;;GAKG;AACI,KAAK,2BAA0C,IAAY;IACjE,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,MAAM,EAAE,EAAE,EAAE,IAAI,CAC5C,CAAC;IAEF,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CACvB,CAAE,CAAE,SAAS,CAAE,EAAG,EAAE;QACnB,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI;aAC9B,MAAM,CAAE,mBAAmB,CAAE;aAC7B,yBAAyB,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI;aAC3B,MAAM,CAAE,mBAAmB,CAAE;aAC7B,mBAAmB,CAAE,SAAS,CAAE,CAAC;QACnC,MAAM,CAAC,EAAE,CAAC,IAAI;aACZ,QAAQ,CAAE,mBAAmB,CAAE;aAC/B,aAAa,CACb,SAAS,EACT,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAE,MAAM,EAAE,SAAS,CAAE,CACvD,CAAC;IACJ,CAAC,EACD,CAAE,IAAI,CAAE,CACR,CAAC;AACH,CAAC"}
package/build/index.cjs DELETED
@@ -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/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Admin: () => import_admin.Admin,
24
- Editor: () => import_editor.Editor,
25
- Lighthouse: () => import_lighthouse.Lighthouse,
26
- Metrics: () => import_metrics.Metrics,
27
- PageUtils: () => import_page_utils.PageUtils,
28
- RequestUtils: () => import_request_utils.RequestUtils,
29
- expect: () => import_test.expect,
30
- test: () => import_test.test
31
- });
32
- module.exports = __toCommonJS(index_exports);
33
- var import_admin = require("./admin/index.cjs");
34
- var import_editor = require("./editor/index.cjs");
35
- var import_page_utils = require("./page-utils/index.cjs");
36
- var import_request_utils = require("./request-utils/index.cjs");
37
- var import_metrics = require("./metrics/index.cjs");
38
- var import_lighthouse = require("./lighthouse/index.cjs");
39
- var import_test = require("./test.cjs");
40
- // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- Admin,
43
- Editor,
44
- Lighthouse,
45
- Metrics,
46
- PageUtils,
47
- RequestUtils,
48
- expect,
49
- test
50
- });
51
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export type * from './types';\nexport { Admin } from './admin';\nexport { Editor } from './editor';\nexport { PageUtils } from './page-utils';\nexport { RequestUtils } from './request-utils';\nexport { Metrics } from './metrics';\nexport { Lighthouse } from './lighthouse';\nexport { test, expect } from './test';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsB;AACtB,oBAAuB;AACvB,wBAA0B;AAC1B,2BAA6B;AAC7B,qBAAwB;AACxB,wBAA2B;AAC3B,kBAA6B;",
6
- "names": []
7
- }
package/build/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expect = exports.test = exports.Lighthouse = exports.Metrics = exports.RequestUtils = exports.PageUtils = exports.Editor = exports.Admin = void 0;
4
- var admin_1 = require("./admin");
5
- Object.defineProperty(exports, "Admin", { enumerable: true, get: function () { return admin_1.Admin; } });
6
- var editor_1 = require("./editor");
7
- Object.defineProperty(exports, "Editor", { enumerable: true, get: function () { return editor_1.Editor; } });
8
- var page_utils_1 = require("./page-utils");
9
- Object.defineProperty(exports, "PageUtils", { enumerable: true, get: function () { return page_utils_1.PageUtils; } });
10
- var request_utils_1 = require("./request-utils");
11
- Object.defineProperty(exports, "RequestUtils", { enumerable: true, get: function () { return request_utils_1.RequestUtils; } });
12
- var metrics_1 = require("./metrics");
13
- Object.defineProperty(exports, "Metrics", { enumerable: true, get: function () { return metrics_1.Metrics; } });
14
- var lighthouse_1 = require("./lighthouse");
15
- Object.defineProperty(exports, "Lighthouse", { enumerable: true, get: function () { return lighthouse_1.Lighthouse; } });
16
- var test_1 = require("./test");
17
- Object.defineProperty(exports, "test", { enumerable: true, get: function () { return test_1.test; } });
18
- Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_1.expect; } });
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+BAAsC;AAA7B,4FAAA,IAAI,OAAA;AAAE,8FAAA,MAAM,OAAA"}
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/e2e-test-utils-playwright/src/lighthouse/index.ts
31
- var lighthouse_exports = {};
32
- __export(lighthouse_exports, {
33
- Lighthouse: () => Lighthouse
34
- });
35
- module.exports = __toCommonJS(lighthouse_exports);
36
- var import_core = __toESM(require("lighthouse/core/index.cjs"));
37
- var Lighthouse = class {
38
- page;
39
- port;
40
- constructor({ page, port }) {
41
- this.page = page;
42
- this.port = port;
43
- }
44
- /**
45
- * Returns the Lighthouse report for the current URL.
46
- *
47
- * Runs several Lighthouse audits in a separate browser window and returns
48
- * the summary.
49
- */
50
- async getReport() {
51
- const audits = {
52
- "largest-contentful-paint": "LCP",
53
- "total-blocking-time": "TBT",
54
- interactive: "TTI",
55
- "cumulative-layout-shift": "CLS",
56
- "interaction-to-next-paint": "INP"
57
- };
58
- const report = await (0, import_core.default)(
59
- this.page.url(),
60
- { port: this.port },
61
- {
62
- extends: "lighthouse:default",
63
- settings: {
64
- // "provided" means no throttling.
65
- // TODO: Make configurable.
66
- throttlingMethod: "provided",
67
- // Default is "mobile".
68
- // See https://github.com/GoogleChrome/lighthouse/blob/main/docs/emulation.md
69
- // TODO: Make configurable.
70
- formFactor: "desktop",
71
- screenEmulation: {
72
- disabled: true
73
- },
74
- // Speeds up the report.
75
- disableFullPageScreenshot: true,
76
- // Only run certain audits to speed things up.
77
- onlyAudits: Object.keys(audits)
78
- }
79
- }
80
- );
81
- const result = {};
82
- if (!report) {
83
- return result;
84
- }
85
- const { lhr } = report;
86
- for (const [audit, acronym] of Object.entries(audits)) {
87
- result[acronym] = lhr.audits[audit]?.numericValue || 0;
88
- }
89
- return result;
90
- }
91
- };
92
- // Annotate the CommonJS export names for ESM import in node:
93
- 0 && (module.exports = {
94
- Lighthouse
95
- });
96
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
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,IAAM,aAAN,MAAiB;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
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Lighthouse = void 0;
7
- const index_cjs_1 = __importDefault(require("lighthouse/core/index.cjs"));
8
- class Lighthouse {
9
- page;
10
- port;
11
- constructor({ page, port }) {
12
- this.page = page;
13
- this.port = port;
14
- }
15
- /**
16
- * Returns the Lighthouse report for the current URL.
17
- *
18
- * Runs several Lighthouse audits in a separate browser window and returns
19
- * the summary.
20
- */
21
- async getReport() {
22
- // From https://github.com/GoogleChrome/lighthouse/blob/36cac182a6c637b1671c57326d7c0241633d0076/core/config/default-config.js#L381-L446
23
- const audits = {
24
- 'largest-contentful-paint': 'LCP',
25
- 'total-blocking-time': 'TBT',
26
- interactive: 'TTI',
27
- 'cumulative-layout-shift': 'CLS',
28
- 'interaction-to-next-paint': 'INP',
29
- };
30
- const report = await (0, index_cjs_1.default)(this.page.url(), { port: this.port }, {
31
- extends: 'lighthouse:default',
32
- settings: {
33
- // "provided" means no throttling.
34
- // TODO: Make configurable.
35
- throttlingMethod: 'provided',
36
- // Default is "mobile".
37
- // See https://github.com/GoogleChrome/lighthouse/blob/main/docs/emulation.md
38
- // TODO: Make configurable.
39
- formFactor: 'desktop',
40
- screenEmulation: {
41
- disabled: true,
42
- },
43
- // Speeds up the report.
44
- disableFullPageScreenshot: true,
45
- // Only run certain audits to speed things up.
46
- onlyAudits: Object.keys(audits),
47
- },
48
- });
49
- const result = {};
50
- if (!report) {
51
- return result;
52
- }
53
- const { lhr } = report;
54
- for (const [audit, acronym] of Object.entries(audits)) {
55
- result[acronym] = lhr.audits[audit]?.numericValue || 0;
56
- }
57
- return result;
58
- }
59
- }
60
- exports.Lighthouse = Lighthouse;
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lighthouse/index.ts"],"names":[],"mappings":";;;;;;AAIA,0EAAmD;AAOnD;IACC,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,IAAA,mBAAU,EAC9B,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"}