@wordpress/e2e-test-utils-playwright 1.32.0 → 1.32.1-next.b8c8708f3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/build/admin/create-new-post.js +46 -28
  2. package/build/admin/create-new-post.js.map +7 -1
  3. package/build/admin/edit-post.js +35 -17
  4. package/build/admin/edit-post.js.map +7 -1
  5. package/build/admin/get-page-error.js +30 -22
  6. package/build/admin/get-page-error.js.map +7 -1
  7. package/build/admin/index.js +54 -34
  8. package/build/admin/index.js.map +7 -1
  9. package/build/admin/visit-admin-page.js +42 -29
  10. package/build/admin/visit-admin-page.js.map +7 -1
  11. package/build/admin/visit-site-editor.js +71 -64
  12. package/build/admin/visit-site-editor.js.map +7 -1
  13. package/build/config.js +40 -10
  14. package/build/config.js.map +7 -1
  15. package/build/editor/click-block-options-menu-item.js +29 -14
  16. package/build/editor/click-block-options-menu-item.js.map +7 -1
  17. package/build/editor/click-block-toolbar-button.js +33 -13
  18. package/build/editor/click-block-toolbar-button.js.map +7 -1
  19. package/build/editor/get-blocks.js +59 -43
  20. package/build/editor/get-blocks.js.map +7 -1
  21. package/build/editor/get-edited-post-content.js +31 -12
  22. package/build/editor/get-edited-post-content.js.map +7 -1
  23. package/build/editor/index.js +92 -72
  24. package/build/editor/index.js.map +7 -1
  25. package/build/editor/insert-block.js +50 -21
  26. package/build/editor/insert-block.js.map +7 -1
  27. package/build/editor/open-document-settings-sidebar.js +37 -24
  28. package/build/editor/open-document-settings-sidebar.js.map +7 -1
  29. package/build/editor/preview.js +37 -18
  30. package/build/editor/preview.js.map +7 -1
  31. package/build/editor/publish-post.js +42 -42
  32. package/build/editor/publish-post.js.map +7 -1
  33. package/build/editor/save-draft.js +29 -15
  34. package/build/editor/save-draft.js.map +7 -1
  35. package/build/editor/select-blocks.js +46 -25
  36. package/build/editor/select-blocks.js.map +7 -1
  37. package/build/editor/set-content.js +34 -14
  38. package/build/editor/set-content.js.map +7 -1
  39. package/build/editor/set-is-fixed-toolbar.js +31 -15
  40. package/build/editor/set-is-fixed-toolbar.js.map +7 -1
  41. package/build/editor/set-preferences.js +38 -18
  42. package/build/editor/set-preferences.js.map +7 -1
  43. package/build/editor/show-block-toolbar.js +30 -16
  44. package/build/editor/show-block-toolbar.js.map +7 -1
  45. package/build/editor/site-editor.js +46 -41
  46. package/build/editor/site-editor.js.map +7 -1
  47. package/build/editor/switch-editor-tool.js +42 -30
  48. package/build/editor/switch-editor-tool.js.map +7 -1
  49. package/build/editor/switch-to-legacy-canvas.js +33 -14
  50. package/build/editor/switch-to-legacy-canvas.js.map +7 -1
  51. package/build/editor/transform-block-to.js +41 -21
  52. package/build/editor/transform-block-to.js.map +7 -1
  53. package/build/index.js +50 -32
  54. package/build/index.js.map +7 -1
  55. package/build/lighthouse/index.js +89 -53
  56. package/build/lighthouse/index.js.map +7 -1
  57. package/build/metrics/index.js +298 -249
  58. package/build/metrics/index.js.map +7 -1
  59. package/build/page-utils/drag-files.js +134 -112
  60. package/build/page-utils/drag-files.js.map +7 -1
  61. package/build/page-utils/emulate-network-conditions.js +92 -66
  62. package/build/page-utils/emulate-network-conditions.js.map +7 -1
  63. package/build/page-utils/index.js +54 -34
  64. package/build/page-utils/index.js.map +7 -1
  65. package/build/page-utils/is-current-url.js +31 -18
  66. package/build/page-utils/is-current-url.js.map +7 -1
  67. package/build/page-utils/keycodes.js +51 -39
  68. package/build/page-utils/keycodes.js.map +7 -1
  69. package/build/page-utils/press-keys.js +148 -127
  70. package/build/page-utils/press-keys.js.map +7 -1
  71. package/build/page-utils/set-browser-viewport.js +32 -41
  72. package/build/page-utils/set-browser-viewport.js.map +7 -1
  73. package/build/request-utils/blocks.js +49 -40
  74. package/build/request-utils/blocks.js.map +7 -1
  75. package/build/request-utils/comments.js +57 -45
  76. package/build/request-utils/comments.js.map +7 -1
  77. package/build/request-utils/gutenberg-experiments.js +48 -26
  78. package/build/request-utils/gutenberg-experiments.js.map +7 -1
  79. package/build/request-utils/index.js +187 -153
  80. package/build/request-utils/index.js.map +7 -1
  81. package/build/request-utils/login.js +43 -18
  82. package/build/request-utils/login.js.map +7 -1
  83. package/build/request-utils/media.js +72 -64
  84. package/build/request-utils/media.js.map +7 -1
  85. package/build/request-utils/menus.js +119 -109
  86. package/build/request-utils/menus.js.map +7 -1
  87. package/build/request-utils/pages.js +60 -49
  88. package/build/request-utils/pages.js.map +7 -1
  89. package/build/request-utils/patterns.js +39 -24
  90. package/build/request-utils/patterns.js.map +7 -1
  91. package/build/request-utils/plugins.js +68 -74
  92. package/build/request-utils/plugins.js.map +7 -1
  93. package/build/request-utils/posts.js +52 -39
  94. package/build/request-utils/posts.js.map +7 -1
  95. package/build/request-utils/preferences.js +36 -17
  96. package/build/request-utils/preferences.js.map +7 -1
  97. package/build/request-utils/rest.js +153 -129
  98. package/build/request-utils/rest.js.map +7 -1
  99. package/build/request-utils/site-settings.js +38 -28
  100. package/build/request-utils/site-settings.js.map +7 -1
  101. package/build/request-utils/templates.js +57 -45
  102. package/build/request-utils/templates.js.map +7 -1
  103. package/build/request-utils/themes.js +78 -53
  104. package/build/request-utils/themes.js.map +7 -1
  105. package/build/request-utils/users.js +72 -72
  106. package/build/request-utils/users.js.map +7 -1
  107. package/build/request-utils/widgets.js +71 -55
  108. package/build/request-utils/widgets.js.map +7 -1
  109. package/build/test.js +128 -146
  110. package/build/test.js.map +7 -1
  111. package/build/types.js +16 -2
  112. package/build/types.js.map +7 -1
  113. package/package.json +6 -2
@@ -1,31 +1,49 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNewPost = createNewPost;
4
- /**
5
- * Creates new post.
6
- *
7
- * @param this
8
- * @param options Options to create new post.
9
- */
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
+ var create_new_post_exports = {};
20
+ __export(create_new_post_exports, {
21
+ createNewPost: () => createNewPost
22
+ });
23
+ module.exports = __toCommonJS(create_new_post_exports);
10
24
  async function createNewPost(options = {}) {
11
- const query = new URLSearchParams();
12
- const { postType, title, content, excerpt } = options;
13
- if (postType) {
14
- query.set('post_type', postType);
15
- }
16
- if (title) {
17
- query.set('post_title', title);
18
- }
19
- if (content) {
20
- query.set('content', content);
21
- }
22
- if (excerpt) {
23
- query.set('excerpt', excerpt);
24
- }
25
- await this.visitAdminPage('post-new.php', query.toString());
26
- await this.editor.setPreferences('core/edit-post', {
27
- welcomeGuide: options.showWelcomeGuide ?? false,
28
- fullscreenMode: options.fullscreenMode ?? false,
29
- });
25
+ const query = new URLSearchParams();
26
+ const { postType, title, content, excerpt } = options;
27
+ if (postType) {
28
+ query.set("post_type", postType);
29
+ }
30
+ if (title) {
31
+ query.set("post_title", title);
32
+ }
33
+ if (content) {
34
+ query.set("content", content);
35
+ }
36
+ if (excerpt) {
37
+ query.set("excerpt", excerpt);
38
+ }
39
+ await this.visitAdminPage("post-new.php", query.toString());
40
+ await this.editor.setPreferences("core/edit-post", {
41
+ welcomeGuide: options.showWelcomeGuide ?? false,
42
+ fullscreenMode: options.fullscreenMode ?? false
43
+ });
30
44
  }
31
- //# sourceMappingURL=create-new-post.js.map
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ createNewPost
48
+ });
49
+ //# sourceMappingURL=create-new-post.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"create-new-post.js","sourceRoot":"","sources":["../../src/admin/create-new-post.ts"],"names":[],"mappings":";;AAoBA,sCA0BC;AAhCD;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAElC,UAA0B,EAAE;IAE5B,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;IACpC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAEtD,IAAK,QAAQ,EAAG,CAAC;QAChB,KAAK,CAAC,GAAG,CAAE,WAAW,EAAE,QAAQ,CAAE,CAAC;IACpC,CAAC;IACD,IAAK,KAAK,EAAG,CAAC;QACb,KAAK,CAAC,GAAG,CAAE,YAAY,EAAE,KAAK,CAAE,CAAC;IAClC,CAAC;IACD,IAAK,OAAO,EAAG,CAAC;QACf,KAAK,CAAC,GAAG,CAAE,SAAS,EAAE,OAAO,CAAE,CAAC;IACjC,CAAC;IACD,IAAK,OAAO,EAAG,CAAC;QACf,KAAK,CAAC,GAAG,CAAE,SAAS,EAAE,OAAO,CAAE,CAAC;IACjC,CAAC;IAED,MAAM,IAAI,CAAC,cAAc,CAAE,cAAc,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAE,CAAC;IAE9D,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAE,gBAAgB,EAAE;QACnD,YAAY,EAAE,OAAO,CAAC,gBAAgB,IAAI,KAAK;QAC/C,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;KAC/C,CAAE,CAAC;AACL,CAAC"}
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,20 +1,38 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.editPost = editPost;
4
- /**
5
- * Open the post with given ID in the editor.
6
- *
7
- * @param this
8
- * @param postId Post ID to visit.
9
- */
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
+ var edit_post_exports = {};
20
+ __export(edit_post_exports, {
21
+ editPost: () => editPost
22
+ });
23
+ module.exports = __toCommonJS(edit_post_exports);
10
24
  async function editPost(postId) {
11
- const query = new URLSearchParams();
12
- query.set('post', String(postId));
13
- query.set('action', 'edit');
14
- await this.visitAdminPage('post.php', query.toString());
15
- await this.editor.setPreferences('core/edit-post', {
16
- welcomeGuide: false,
17
- fullscreenMode: false,
18
- });
25
+ const query = new URLSearchParams();
26
+ query.set("post", String(postId));
27
+ query.set("action", "edit");
28
+ await this.visitAdminPage("post.php", query.toString());
29
+ await this.editor.setPreferences("core/edit-post", {
30
+ welcomeGuide: false,
31
+ fullscreenMode: false
32
+ });
19
33
  }
20
- //# sourceMappingURL=edit-post.js.map
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ editPost
37
+ });
38
+ //# sourceMappingURL=edit-post.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"edit-post.js","sourceRoot":"","sources":["../../src/admin/edit-post.ts"],"names":[],"mappings":";;AAWA,4BAYC;AAlBD;;;;;GAKG;AACI,KAAK,UAAU,QAAQ,CAAe,MAAuB;IACnE,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;IAEpC,KAAK,CAAC,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE,MAAM,CAAE,CAAE,CAAC;IACtC,KAAK,CAAC,GAAG,CAAE,QAAQ,EAAE,MAAM,CAAE,CAAC;IAE9B,MAAM,IAAI,CAAC,cAAc,CAAE,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAE,CAAC;IAE1D,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAE,gBAAgB,EAAE;QACnD,YAAY,EAAE,KAAK;QACnB,cAAc,EAAE,KAAK;KACrB,CAAE,CAAC;AACL,CAAC"}
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,26 +1,34 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPageError = getPageError;
4
- /**
5
- * Regular expression matching a displayed PHP error within a markup string.
6
- *
7
- * @see https://github.com/php/php-src/blob/598175e/main/main.c#L1257-L1297
8
- */
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
+ var get_page_error_exports = {};
20
+ __export(get_page_error_exports, {
21
+ getPageError: () => getPageError
22
+ });
23
+ module.exports = __toCommonJS(get_page_error_exports);
9
24
  const 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>)?/;
10
- /**
11
- * Returns a promise resolving to one of either a string or null. A string will
12
- * be resolved if an error message is present in the contents of the page. If no
13
- * error is present, a null value will be resolved instead. This requires the
14
- * environment be configured to display errors.
15
- *
16
- * @see http://php.net/manual/en/function.error-reporting.php
17
- *
18
- * @param this
19
- * @return Promise resolving to a string or null, depending whether a page error is present.
20
- */
21
25
  async function getPageError() {
22
- const content = await this.page.content();
23
- const match = content.match(REGEXP_PHP_ERROR);
24
- return match ? match[0] : null;
26
+ const content = await this.page.content();
27
+ const match = content.match(REGEXP_PHP_ERROR);
28
+ return match ? match[0] : null;
25
29
  }
26
- //# sourceMappingURL=get-page-error.js.map
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ getPageError
33
+ });
34
+ //# sourceMappingURL=get-page-error.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"get-page-error.js","sourceRoot":"","sources":["../../src/admin/get-page-error.ts"],"names":[],"mappings":";;AAwBA,oCAIC;AAvBD;;;;GAIG;AACH,MAAM,gBAAgB,GACrB,oKAAoK,CAAC;AAEtK;;;;;;;;;;GAUG;AACI,KAAK,UAAU,YAAY;IACjC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAE,gBAAgB,CAAE,CAAC;IAChD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAE,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAClC,CAAC"}
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,MAAM,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,37 +1,57 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Admin = void 0;
4
- /**
5
- * Internal dependencies
6
- */
7
- const create_new_post_1 = require("./create-new-post");
8
- const get_page_error_1 = require("./get-page-error");
9
- const visit_admin_page_1 = require("./visit-admin-page");
10
- const edit_post_1 = require("./edit-post");
11
- const visit_site_editor_1 = require("./visit-site-editor");
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
+ var admin_exports = {};
20
+ __export(admin_exports, {
21
+ Admin: () => Admin
22
+ });
23
+ module.exports = __toCommonJS(admin_exports);
24
+ var import_create_new_post = require("./create-new-post");
25
+ var import_get_page_error = require("./get-page-error");
26
+ var import_visit_admin_page = require("./visit-admin-page");
27
+ var import_edit_post = require("./edit-post");
28
+ var import_visit_site_editor = require("./visit-site-editor");
12
29
  class Admin {
13
- page;
14
- context;
15
- browser;
16
- pageUtils;
17
- editor;
18
- constructor({ page, pageUtils, editor }) {
19
- this.page = page;
20
- this.context = page.context();
21
- this.browser = this.context.browser();
22
- this.pageUtils = pageUtils;
23
- this.editor = editor;
24
- }
25
- /** @borrows createNewPost as this.createNewPost */
26
- createNewPost = create_new_post_1.createNewPost.bind(this);
27
- /** @borrows editPost as this.editPost */
28
- editPost = edit_post_1.editPost.bind(this);
29
- /** @borrows getPageError as this.getPageError */
30
- getPageError = get_page_error_1.getPageError.bind(this);
31
- /** @borrows visitAdminPage as this.visitAdminPage */
32
- visitAdminPage = visit_admin_page_1.visitAdminPage.bind(this);
33
- /** @borrows visitSiteEditor as this.visitSiteEditor */
34
- visitSiteEditor = visit_site_editor_1.visitSiteEditor.bind(this);
30
+ page;
31
+ context;
32
+ browser;
33
+ pageUtils;
34
+ editor;
35
+ constructor({ page, pageUtils, editor }) {
36
+ this.page = page;
37
+ this.context = page.context();
38
+ this.browser = this.context.browser();
39
+ this.pageUtils = pageUtils;
40
+ this.editor = editor;
41
+ }
42
+ /** @borrows createNewPost as this.createNewPost */
43
+ createNewPost = import_create_new_post.createNewPost.bind(this);
44
+ /** @borrows editPost as this.editPost */
45
+ editPost = import_edit_post.editPost.bind(this);
46
+ /** @borrows getPageError as this.getPageError */
47
+ getPageError = import_get_page_error.getPageError.bind(this);
48
+ /** @borrows visitAdminPage as this.visitAdminPage */
49
+ visitAdminPage = import_visit_admin_page.visitAdminPage.bind(this);
50
+ /** @borrows visitSiteEditor as this.visitSiteEditor */
51
+ visitSiteEditor = import_visit_site_editor.visitSiteEditor.bind(this);
35
52
  }
36
- exports.Admin = Admin;
37
- //# sourceMappingURL=index.js.map
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ Admin
56
+ });
57
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,uDAAkD;AAClD,qDAAgD;AAChD,yDAAoD;AACpD,2CAAuC;AACvC,2DAAsD;AAUtD,MAAa,KAAK;IACjB,IAAI,CAAO;IACX,OAAO,CAAiB;IACxB,OAAO,CAAU;IACjB,SAAS,CAAY;IACrB,MAAM,CAAS;IAEf,YAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAyB;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAG,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,mDAAmD;IACnD,aAAa,GAAyB,+BAAa,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;IACjE,yCAAyC;IACzC,QAAQ,GAAoB,oBAAQ,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;IAClD,iDAAiD;IACjD,YAAY,GAAwB,6BAAY,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;IAC9D,qDAAqD;IACrD,cAAc,GAA0B,iCAAc,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;IACpE,uDAAuD;IACvD,eAAe,GAA2B,mCAAe,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;CACvE;AAzBD,sBAyBC"}
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,MAAM,MAAM;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
+ }
@@ -1,32 +1,45 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.visitAdminPage = visitAdminPage;
4
- /**
5
- * External dependencies
6
- */
7
- const path_1 = require("path");
8
- /**
9
- * Visits admin page and handle errors.
10
- *
11
- * @param this
12
- * @param adminPath String to be serialized as pathname.
13
- * @param query String to be serialized as query portion of URL.
14
- */
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
+ var visit_admin_page_exports = {};
20
+ __export(visit_admin_page_exports, {
21
+ visitAdminPage: () => visitAdminPage
22
+ });
23
+ module.exports = __toCommonJS(visit_admin_page_exports);
24
+ var import_path = require("path");
15
25
  async function visitAdminPage(adminPath, query) {
16
- await this.page.goto((0, path_1.join)('wp-admin', adminPath) + (query ? `?${query}` : ''));
17
- // Handle upgrade required screen
18
- if (this.pageUtils.isCurrentURL('wp-admin/upgrade.php')) {
19
- // Click update
20
- await this.page.click('.button.button-large.button-primary');
21
- // Click continue
22
- await this.page.click('.button.button-large');
23
- }
24
- if (this.pageUtils.isCurrentURL('wp-login.php')) {
25
- throw new Error('Not logged in');
26
- }
27
- const error = await this.getPageError();
28
- if (error) {
29
- throw new Error('Unexpected error in page content: ' + error);
30
- }
26
+ await this.page.goto(
27
+ (0, import_path.join)("wp-admin", adminPath) + (query ? `?${query}` : "")
28
+ );
29
+ if (this.pageUtils.isCurrentURL("wp-admin/upgrade.php")) {
30
+ await this.page.click(".button.button-large.button-primary");
31
+ await this.page.click(".button.button-large");
32
+ }
33
+ if (this.pageUtils.isCurrentURL("wp-login.php")) {
34
+ throw new Error("Not logged in");
35
+ }
36
+ const error = await this.getPageError();
37
+ if (error) {
38
+ throw new Error("Unexpected error in page content: " + error);
39
+ }
31
40
  }
32
- //# sourceMappingURL=visit-admin-page.js.map
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ visitAdminPage
44
+ });
45
+ //# sourceMappingURL=visit-admin-page.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"visit-admin-page.js","sourceRoot":"","sources":["../../src/admin/visit-admin-page.ts"],"names":[],"mappings":";;AAiBA,wCAyBC;AA1CD;;GAEG;AACH,+BAA4B;AAO5B;;;;;;GAMG;AACI,KAAK,UAAU,cAAc,CAEnC,SAAiB,EACjB,KAAc;IAEd,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,IAAA,WAAI,EAAE,UAAU,EAAE,SAAS,CAAE,GAAG,CAAE,KAAK,CAAC,CAAC,CAAC,IAAK,KAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAE,CAC9D,CAAC;IAEF,iCAAiC;IACjC,IAAK,IAAI,CAAC,SAAS,CAAC,YAAY,CAAE,sBAAsB,CAAE,EAAG,CAAC;QAC7D,eAAe;QACf,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAE,qCAAqC,CAAE,CAAC;QAC/D,iBAAiB;QACjB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAE,sBAAsB,CAAE,CAAC;IACjD,CAAC;IAED,IAAK,IAAI,CAAC,SAAS,CAAC,YAAY,CAAE,cAAc,CAAE,EAAG,CAAC;QACrD,MAAM,IAAI,KAAK,CAAE,eAAe,CAAE,CAAC;IACpC,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IACxC,IAAK,KAAK,EAAG,CAAC;QACb,MAAM,IAAI,KAAK,CAAE,oCAAoC,GAAG,KAAK,CAAE,CAAC;IACjE,CAAC;AACF,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/admin/visit-admin-page.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { join } from 'path';\n\n/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\n/**\n * Visits admin page and handle errors.\n *\n * @param this\n * @param adminPath String to be serialized as pathname.\n * @param query String to be serialized as query portion of URL.\n */\nexport async function visitAdminPage(\n\tthis: Admin,\n\tadminPath: string,\n\tquery?: string\n) {\n\tawait this.page.goto(\n\t\tjoin( 'wp-admin', adminPath ) + ( query ? `?${ query }` : '' )\n\t);\n\n\t// Handle upgrade required screen\n\tif ( this.pageUtils.isCurrentURL( 'wp-admin/upgrade.php' ) ) {\n\t\t// Click update\n\t\tawait this.page.click( '.button.button-large.button-primary' );\n\t\t// Click continue\n\t\tawait this.page.click( '.button.button-large' );\n\t}\n\n\tif ( this.pageUtils.isCurrentURL( 'wp-login.php' ) ) {\n\t\tthrow new Error( 'Not logged in' );\n\t}\n\n\tconst error = await this.getPageError();\n\tif ( error ) {\n\t\tthrow new Error( 'Unexpected error in page content: ' + error );\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAqB;AAcrB,eAAsB,eAErB,WACA,OACC;AACD,QAAM,KAAK,KAAK;AAAA,QACf,kBAAM,YAAY,SAAU,KAAM,QAAQ,IAAK,KAAM,KAAK;AAAA,EAC3D;AAGA,MAAK,KAAK,UAAU,aAAc,sBAAuB,GAAI;AAE5D,UAAM,KAAK,KAAK,MAAO,qCAAsC;AAE7D,UAAM,KAAK,KAAK,MAAO,sBAAuB;AAAA,EAC/C;AAEA,MAAK,KAAK,UAAU,aAAc,cAAe,GAAI;AACpD,UAAM,IAAI,MAAO,eAAgB;AAAA,EAClC;AAEA,QAAM,QAAQ,MAAM,KAAK,aAAa;AACtC,MAAK,OAAQ;AACZ,UAAM,IAAI,MAAO,uCAAuC,KAAM;AAAA,EAC/D;AACD;",
6
+ "names": []
7
+ }
@@ -1,68 +1,75 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.visitSiteEditor = visitSiteEditor;
4
- /**
5
- * Visits the Site Editor main page.
6
- *
7
- * @param this
8
- * @param options Options to visit the site editor.
9
- */
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
+ var visit_site_editor_exports = {};
20
+ __export(visit_site_editor_exports, {
21
+ visitSiteEditor: () => visitSiteEditor
22
+ });
23
+ module.exports = __toCommonJS(visit_site_editor_exports);
10
24
  async function visitSiteEditor(options = {}) {
11
- const { postId, postType, path, canvas, activeView } = options;
12
- const query = new URLSearchParams();
13
- if (postId) {
14
- query.set('postId', String(postId));
15
- }
16
- if (postType) {
17
- query.set('postType', postType);
18
- }
19
- if (path) {
20
- query.set('path', path);
21
- }
22
- if (canvas) {
23
- query.set('canvas', canvas);
24
- }
25
- if (activeView) {
26
- query.set('activeView', activeView);
27
- }
28
- await this.visitAdminPage('site-editor.php', query.toString());
29
- if (!options.showWelcomeGuide) {
30
- await this.editor.setPreferences('core/edit-site', {
31
- welcomeGuide: false,
32
- welcomeGuideStyles: false,
33
- welcomeGuidePage: false,
34
- welcomeGuideTemplate: false,
35
- });
36
- }
37
- /**
38
- * @todo This is a workaround for the fact that the editor canvas is seen as
39
- * ready and visible before the loading spinner is hidden. Ideally, the
40
- * content underneath the loading overlay should be marked inert until the
41
- * loading is done.
42
- */
43
- if (!query.size || postId || canvas === 'edit') {
44
- const canvasLoader = this.page.locator(
45
- // Spinner was used instead of the progress bar in an earlier
46
- // version of the site editor.
47
- '.edit-site-canvas-loader, .edit-site-canvas-spinner');
48
- try {
49
- // Wait for the canvas loader to appear first, so that the locator that
50
- // waits for the hidden state doesn't resolve prematurely.
51
- await canvasLoader.waitFor({ state: 'visible', timeout: 60_000 });
52
- await canvasLoader.waitFor({
53
- state: 'hidden',
54
- // Bigger timeout is needed for larger entities, like the Large Post
55
- // HTML fixture that we load for performance tests, which often
56
- // doesn't make it under the default timeout value.
57
- timeout: 60_000,
58
- });
59
- }
60
- catch (error) {
61
- // If the canvas loader is already disappeared, skip the waiting.
62
- await this.page
63
- .getByRole('region', { name: 'Editor content' })
64
- .waitFor();
65
- }
25
+ const { postId, postType, path, canvas, activeView } = options;
26
+ const query = new URLSearchParams();
27
+ if (postId) {
28
+ query.set("postId", String(postId));
29
+ }
30
+ if (postType) {
31
+ query.set("postType", postType);
32
+ }
33
+ if (path) {
34
+ query.set("path", path);
35
+ }
36
+ if (canvas) {
37
+ query.set("canvas", canvas);
38
+ }
39
+ if (activeView) {
40
+ query.set("activeView", activeView);
41
+ }
42
+ await this.visitAdminPage("site-editor.php", query.toString());
43
+ if (!options.showWelcomeGuide) {
44
+ await this.editor.setPreferences("core/edit-site", {
45
+ welcomeGuide: false,
46
+ welcomeGuideStyles: false,
47
+ welcomeGuidePage: false,
48
+ welcomeGuideTemplate: false
49
+ });
50
+ }
51
+ if (!query.size || postId || canvas === "edit") {
52
+ const canvasLoader = this.page.locator(
53
+ // Spinner was used instead of the progress bar in an earlier
54
+ // version of the site editor.
55
+ ".edit-site-canvas-loader, .edit-site-canvas-spinner"
56
+ );
57
+ try {
58
+ await canvasLoader.waitFor({ state: "visible", timeout: 6e4 });
59
+ await canvasLoader.waitFor({
60
+ state: "hidden",
61
+ // Bigger timeout is needed for larger entities, like the Large Post
62
+ // HTML fixture that we load for performance tests, which often
63
+ // doesn't make it under the default timeout value.
64
+ timeout: 6e4
65
+ });
66
+ } catch (error) {
67
+ await this.page.getByRole("region", { name: "Editor content" }).waitFor();
66
68
  }
69
+ }
67
70
  }
68
- //# sourceMappingURL=visit-site-editor.js.map
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ visitSiteEditor
74
+ });
75
+ //# sourceMappingURL=visit-site-editor.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"visit-site-editor.js","sourceRoot":"","sources":["../../src/admin/visit-site-editor.ts"],"names":[],"mappings":";;AAoBA,0CAiEC;AAvED;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CAEpC,UAA6B,EAAE;IAE/B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;IAEpC,IAAK,MAAM,EAAG,CAAC;QACd,KAAK,CAAC,GAAG,CAAE,QAAQ,EAAE,MAAM,CAAE,MAAM,CAAE,CAAE,CAAC;IACzC,CAAC;IACD,IAAK,QAAQ,EAAG,CAAC;QAChB,KAAK,CAAC,GAAG,CAAE,UAAU,EAAE,QAAQ,CAAE,CAAC;IACnC,CAAC;IACD,IAAK,IAAI,EAAG,CAAC;QACZ,KAAK,CAAC,GAAG,CAAE,MAAM,EAAE,IAAI,CAAE,CAAC;IAC3B,CAAC;IACD,IAAK,MAAM,EAAG,CAAC;QACd,KAAK,CAAC,GAAG,CAAE,QAAQ,EAAE,MAAM,CAAE,CAAC;IAC/B,CAAC;IACD,IAAK,UAAU,EAAG,CAAC;QAClB,KAAK,CAAC,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE,CAAC;IACvC,CAAC;IAED,MAAM,IAAI,CAAC,cAAc,CAAE,iBAAiB,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAE,CAAC;IAEjE,IAAK,CAAE,OAAO,CAAC,gBAAgB,EAAG,CAAC;QAClC,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAE,gBAAgB,EAAE;YACnD,YAAY,EAAE,KAAK;YACnB,kBAAkB,EAAE,KAAK;YACzB,gBAAgB,EAAE,KAAK;YACvB,oBAAoB,EAAE,KAAK;SAC3B,CAAE,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,IAAK,CAAE,KAAK,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,KAAK,MAAM,EAAG,CAAC;QACnD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO;QACrC,6DAA6D;QAC7D,8BAA8B;QAC9B,qDAAqD,CACrD,CAAC;QAEF,IAAI,CAAC;YACJ,uEAAuE;YACvE,0DAA0D;YAC1D,MAAM,YAAY,CAAC,OAAO,CAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,CAAE,CAAC;YACpE,MAAM,YAAY,CAAC,OAAO,CAAE;gBAC3B,KAAK,EAAE,QAAQ;gBACf,oEAAoE;gBACpE,+DAA+D;gBAC/D,mDAAmD;gBACnD,OAAO,EAAE,MAAM;aACf,CAAE,CAAC;QACL,CAAC;QAAC,OAAQ,KAAK,EAAG,CAAC;YAClB,iEAAiE;YACjE,MAAM,IAAI,CAAC,IAAI;iBACb,SAAS,CAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAE;iBACjD,OAAO,EAAE,CAAC;QACb,CAAC;IACF,CAAC;AACF,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/admin/visit-site-editor.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\ninterface SiteEditorOptions {\n\tpostId?: string | number;\n\tpostType?: string;\n\tpath?: string;\n\tcanvas?: string;\n\tactiveView?: string;\n\tshowWelcomeGuide?: boolean;\n}\n\n/**\n * Visits the Site Editor main page.\n *\n * @param this\n * @param options Options to visit the site editor.\n */\nexport async function visitSiteEditor(\n\tthis: Admin,\n\toptions: SiteEditorOptions = {}\n) {\n\tconst { postId, postType, path, canvas, activeView } = options;\n\tconst query = new URLSearchParams();\n\n\tif ( postId ) {\n\t\tquery.set( 'postId', String( postId ) );\n\t}\n\tif ( postType ) {\n\t\tquery.set( 'postType', postType );\n\t}\n\tif ( path ) {\n\t\tquery.set( 'path', path );\n\t}\n\tif ( canvas ) {\n\t\tquery.set( 'canvas', canvas );\n\t}\n\tif ( activeView ) {\n\t\tquery.set( 'activeView', activeView );\n\t}\n\n\tawait this.visitAdminPage( 'site-editor.php', query.toString() );\n\n\tif ( ! options.showWelcomeGuide ) {\n\t\tawait this.editor.setPreferences( 'core/edit-site', {\n\t\t\twelcomeGuide: false,\n\t\t\twelcomeGuideStyles: false,\n\t\t\twelcomeGuidePage: false,\n\t\t\twelcomeGuideTemplate: false,\n\t\t} );\n\t}\n\n\t/**\n\t * @todo This is a workaround for the fact that the editor canvas is seen as\n\t * ready and visible before the loading spinner is hidden. Ideally, the\n\t * content underneath the loading overlay should be marked inert until the\n\t * loading is done.\n\t */\n\tif ( ! query.size || postId || canvas === 'edit' ) {\n\t\tconst canvasLoader = this.page.locator(\n\t\t\t// Spinner was used instead of the progress bar in an earlier\n\t\t\t// version of the site editor.\n\t\t\t'.edit-site-canvas-loader, .edit-site-canvas-spinner'\n\t\t);\n\n\t\ttry {\n\t\t\t// Wait for the canvas loader to appear first, so that the locator that\n\t\t\t// waits for the hidden state doesn't resolve prematurely.\n\t\t\tawait canvasLoader.waitFor( { state: 'visible', timeout: 60_000 } );\n\t\t\tawait canvasLoader.waitFor( {\n\t\t\t\tstate: 'hidden',\n\t\t\t\t// Bigger timeout is needed for larger entities, like the Large Post\n\t\t\t\t// HTML fixture that we load for performance tests, which often\n\t\t\t\t// doesn't make it under the default timeout value.\n\t\t\t\ttimeout: 60_000,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// If the canvas loader is already disappeared, skip the waiting.\n\t\t\tawait this.page\n\t\t\t\t.getByRole( 'region', { name: 'Editor content' } )\n\t\t\t\t.waitFor();\n\t\t}\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,eAAsB,gBAErB,UAA6B,CAAC,GAC7B;AACD,QAAM,EAAE,QAAQ,UAAU,MAAM,QAAQ,WAAW,IAAI;AACvD,QAAM,QAAQ,IAAI,gBAAgB;AAElC,MAAK,QAAS;AACb,UAAM,IAAK,UAAU,OAAQ,MAAO,CAAE;AAAA,EACvC;AACA,MAAK,UAAW;AACf,UAAM,IAAK,YAAY,QAAS;AAAA,EACjC;AACA,MAAK,MAAO;AACX,UAAM,IAAK,QAAQ,IAAK;AAAA,EACzB;AACA,MAAK,QAAS;AACb,UAAM,IAAK,UAAU,MAAO;AAAA,EAC7B;AACA,MAAK,YAAa;AACjB,UAAM,IAAK,cAAc,UAAW;AAAA,EACrC;AAEA,QAAM,KAAK,eAAgB,mBAAmB,MAAM,SAAS,CAAE;AAE/D,MAAK,CAAE,QAAQ,kBAAmB;AACjC,UAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,MACnD,cAAc;AAAA,MACd,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,sBAAsB;AAAA,IACvB,CAAE;AAAA,EACH;AAQA,MAAK,CAAE,MAAM,QAAQ,UAAU,WAAW,QAAS;AAClD,UAAM,eAAe,KAAK,KAAK;AAAA;AAAA;AAAA,MAG9B;AAAA,IACD;AAEA,QAAI;AAGH,YAAM,aAAa,QAAS,EAAE,OAAO,WAAW,SAAS,IAAO,CAAE;AAClE,YAAM,aAAa,QAAS;AAAA,QAC3B,OAAO;AAAA;AAAA;AAAA;AAAA,QAIP,SAAS;AAAA,MACV,CAAE;AAAA,IACH,SAAU,OAAQ;AAEjB,YAAM,KAAK,KACT,UAAW,UAAU,EAAE,MAAM,iBAAiB,CAAE,EAChD,QAAQ;AAAA,IACX;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }