@wordpress/e2e-test-utils-playwright 0.1.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 (183) hide show
  1. package/LICENSE.md +788 -0
  2. package/README.md +89 -0
  3. package/build/admin/create-new-post.js +49 -0
  4. package/build/admin/create-new-post.js.map +1 -0
  5. package/build/admin/get-page-error.js +27 -0
  6. package/build/admin/get-page-error.js.map +1 -0
  7. package/build/admin/index.js +32 -0
  8. package/build/admin/index.js.map +1 -0
  9. package/build/admin/visit-admin-page.js +33 -0
  10. package/build/admin/visit-admin-page.js.map +1 -0
  11. package/build/admin/visit-site-editor.js +42 -0
  12. package/build/admin/visit-site-editor.js.map +1 -0
  13. package/build/config.js +13 -0
  14. package/build/config.js.map +1 -0
  15. package/build/editor/click-block-options-menu-item.js +17 -0
  16. package/build/editor/click-block-options-menu-item.js.map +1 -0
  17. package/build/editor/click-block-toolbar-button.js +17 -0
  18. package/build/editor/click-block-toolbar-button.js.map +1 -0
  19. package/build/editor/get-blocks.js +23 -0
  20. package/build/editor/get-blocks.js.map +1 -0
  21. package/build/editor/get-edited-post-content.js +15 -0
  22. package/build/editor/get-edited-post-content.js.map +1 -0
  23. package/build/editor/index.js +63 -0
  24. package/build/editor/index.js.map +1 -0
  25. package/build/editor/insert-block.js +20 -0
  26. package/build/editor/insert-block.js.map +1 -0
  27. package/build/editor/open-document-settings-sidebar.js +27 -0
  28. package/build/editor/open-document-settings-sidebar.js.map +1 -0
  29. package/build/editor/preview.js +22 -0
  30. package/build/editor/preview.js.map +1 -0
  31. package/build/editor/publish-post.js +30 -0
  32. package/build/editor/publish-post.js.map +1 -0
  33. package/build/editor/select-blocks.js +29 -0
  34. package/build/editor/select-blocks.js.map +1 -0
  35. package/build/editor/set-content.js +17 -0
  36. package/build/editor/set-content.js.map +1 -0
  37. package/build/editor/set-is-fixed-toolbar.js +20 -0
  38. package/build/editor/set-is-fixed-toolbar.js.map +1 -0
  39. package/build/editor/show-block-toolbar.js +20 -0
  40. package/build/editor/show-block-toolbar.js.map +1 -0
  41. package/build/editor/site-editor.js +19 -0
  42. package/build/editor/site-editor.js.map +1 -0
  43. package/build/editor/transform-block-to.js +24 -0
  44. package/build/editor/transform-block-to.js.map +1 -0
  45. package/build/index.js +30 -0
  46. package/build/index.js.map +1 -0
  47. package/build/page-utils/drag-files.js +115 -0
  48. package/build/page-utils/drag-files.js.map +1 -0
  49. package/build/page-utils/index.js +32 -0
  50. package/build/page-utils/index.js.map +1 -0
  51. package/build/page-utils/is-current-url.js +22 -0
  52. package/build/page-utils/is-current-url.js.map +1 -0
  53. package/build/page-utils/press-keys.js +123 -0
  54. package/build/page-utils/press-keys.js.map +1 -0
  55. package/build/page-utils/set-browser-viewport.js +47 -0
  56. package/build/page-utils/set-browser-viewport.js.map +1 -0
  57. package/build/request-utils/blocks.js +30 -0
  58. package/build/request-utils/blocks.js.map +1 -0
  59. package/build/request-utils/comments.js +52 -0
  60. package/build/request-utils/comments.js.map +1 -0
  61. package/build/request-utils/index.js +148 -0
  62. package/build/request-utils/index.js.map +1 -0
  63. package/build/request-utils/login.js +22 -0
  64. package/build/request-utils/login.js.map +1 -0
  65. package/build/request-utils/media.js +74 -0
  66. package/build/request-utils/media.js.map +1 -0
  67. package/build/request-utils/menus.js +121 -0
  68. package/build/request-utils/menus.js.map +1 -0
  69. package/build/request-utils/pages.js +59 -0
  70. package/build/request-utils/pages.js.map +1 -0
  71. package/build/request-utils/plugins.js +69 -0
  72. package/build/request-utils/plugins.js.map +1 -0
  73. package/build/request-utils/posts.js +47 -0
  74. package/build/request-utils/posts.js.map +1 -0
  75. package/build/request-utils/preferences.js +21 -0
  76. package/build/request-utils/preferences.js.map +1 -0
  77. package/build/request-utils/rest.js +130 -0
  78. package/build/request-utils/rest.js.map +1 -0
  79. package/build/request-utils/site-settings.js +34 -0
  80. package/build/request-utils/site-settings.js.map +1 -0
  81. package/build/request-utils/templates.js +39 -0
  82. package/build/request-utils/templates.js.map +1 -0
  83. package/build/request-utils/themes.js +56 -0
  84. package/build/request-utils/themes.js.map +1 -0
  85. package/build/request-utils/users.js +82 -0
  86. package/build/request-utils/users.js.map +1 -0
  87. package/build/request-utils/widgets.js +62 -0
  88. package/build/request-utils/widgets.js.map +1 -0
  89. package/build/test.js +122 -0
  90. package/build/test.js.map +1 -0
  91. package/build/types.js +3 -0
  92. package/build/types.js.map +1 -0
  93. package/build-types/admin/create-new-post.d.ts +19 -0
  94. package/build-types/admin/create-new-post.d.ts.map +1 -0
  95. package/build-types/admin/get-page-error.d.ts +17 -0
  96. package/build-types/admin/get-page-error.d.ts.map +1 -0
  97. package/build-types/admin/index.d.ts +33 -0
  98. package/build-types/admin/index.d.ts.map +1 -0
  99. package/build-types/admin/visit-admin-page.d.ts +13 -0
  100. package/build-types/admin/visit-admin-page.d.ts.map +1 -0
  101. package/build-types/admin/visit-site-editor.d.ts +19 -0
  102. package/build-types/admin/visit-site-editor.d.ts.map +1 -0
  103. package/build-types/config.d.ts +7 -0
  104. package/build-types/config.d.ts.map +1 -0
  105. package/build-types/editor/click-block-options-menu-item.d.ts +12 -0
  106. package/build-types/editor/click-block-options-menu-item.d.ts.map +1 -0
  107. package/build-types/editor/click-block-toolbar-button.d.ts +12 -0
  108. package/build-types/editor/click-block-toolbar-button.d.ts.map +1 -0
  109. package/build-types/editor/get-blocks.d.ts +13 -0
  110. package/build-types/editor/get-blocks.d.ts.map +1 -0
  111. package/build-types/editor/get-edited-post-content.d.ts +13 -0
  112. package/build-types/editor/get-edited-post-content.d.ts.map +1 -0
  113. package/build-types/editor/index.d.ts +61 -0
  114. package/build-types/editor/index.d.ts.map +1 -0
  115. package/build-types/editor/insert-block.d.ts +19 -0
  116. package/build-types/editor/insert-block.d.ts.map +1 -0
  117. package/build-types/editor/open-document-settings-sidebar.d.ts +12 -0
  118. package/build-types/editor/open-document-settings-sidebar.d.ts.map +1 -0
  119. package/build-types/editor/preview.d.ts +17 -0
  120. package/build-types/editor/preview.d.ts.map +1 -0
  121. package/build-types/editor/publish-post.d.ts +12 -0
  122. package/build-types/editor/publish-post.d.ts.map +1 -0
  123. package/build-types/editor/select-blocks.d.ts +10 -0
  124. package/build-types/editor/select-blocks.d.ts.map +1 -0
  125. package/build-types/editor/set-content.d.ts +13 -0
  126. package/build-types/editor/set-content.d.ts.map +1 -0
  127. package/build-types/editor/set-is-fixed-toolbar.d.ts +12 -0
  128. package/build-types/editor/set-is-fixed-toolbar.d.ts.map +1 -0
  129. package/build-types/editor/show-block-toolbar.d.ts +12 -0
  130. package/build-types/editor/show-block-toolbar.d.ts.map +1 -0
  131. package/build-types/editor/site-editor.d.ts +11 -0
  132. package/build-types/editor/site-editor.d.ts.map +1 -0
  133. package/build-types/editor/transform-block-to.d.ts +12 -0
  134. package/build-types/editor/transform-block-to.d.ts.map +1 -0
  135. package/build-types/index.d.ts +7 -0
  136. package/build-types/index.d.ts.map +1 -0
  137. package/build-types/page-utils/drag-files.d.ts +40 -0
  138. package/build-types/page-utils/drag-files.d.ts.map +1 -0
  139. package/build-types/page-utils/index.d.ts +32 -0
  140. package/build-types/page-utils/index.d.ts.map +1 -0
  141. package/build-types/page-utils/is-current-url.d.ts +11 -0
  142. package/build-types/page-utils/is-current-url.d.ts.map +1 -0
  143. package/build-types/page-utils/press-keys.d.ts +25 -0
  144. package/build-types/page-utils/press-keys.d.ts.map +1 -0
  145. package/build-types/page-utils/set-browser-viewport.d.ts +34 -0
  146. package/build-types/page-utils/set-browser-viewport.d.ts.map +1 -0
  147. package/build-types/request-utils/blocks.d.ts +8 -0
  148. package/build-types/request-utils/blocks.d.ts.map +1 -0
  149. package/build-types/request-utils/comments.d.ts +31 -0
  150. package/build-types/request-utils/comments.d.ts.map +1 -0
  151. package/build-types/request-utils/index.d.ts +111 -0
  152. package/build-types/request-utils/index.d.ts.map +1 -0
  153. package/build-types/request-utils/login.d.ts +11 -0
  154. package/build-types/request-utils/login.d.ts.map +1 -0
  155. package/build-types/request-utils/media.d.ts +54 -0
  156. package/build-types/request-utils/media.d.ts.map +1 -0
  157. package/build-types/request-utils/menus.d.ts +43 -0
  158. package/build-types/request-utils/menus.d.ts.map +1 -0
  159. package/build-types/request-utils/pages.d.ts +32 -0
  160. package/build-types/request-utils/pages.d.ts.map +1 -0
  161. package/build-types/request-utils/plugins.d.ts +28 -0
  162. package/build-types/request-utils/plugins.d.ts.map +1 -0
  163. package/build-types/request-utils/posts.d.ts +30 -0
  164. package/build-types/request-utils/posts.d.ts.map +1 -0
  165. package/build-types/request-utils/preferences.d.ts +11 -0
  166. package/build-types/request-utils/preferences.d.ts.map +1 -0
  167. package/build-types/request-utils/rest.d.ts +24 -0
  168. package/build-types/request-utils/rest.d.ts.map +1 -0
  169. package/build-types/request-utils/site-settings.d.ts +40 -0
  170. package/build-types/request-utils/site-settings.d.ts.map +1 -0
  171. package/build-types/request-utils/templates.d.ts +14 -0
  172. package/build-types/request-utils/templates.d.ts.map +1 -0
  173. package/build-types/request-utils/themes.d.ts +15 -0
  174. package/build-types/request-utils/themes.d.ts.map +1 -0
  175. package/build-types/request-utils/users.d.ts +40 -0
  176. package/build-types/request-utils/users.d.ts.map +1 -0
  177. package/build-types/request-utils/widgets.d.ts +15 -0
  178. package/build-types/request-utils/widgets.d.ts.map +1 -0
  179. package/build-types/test.d.ts +15 -0
  180. package/build-types/test.d.ts.map +1 -0
  181. package/build-types/types.d.ts +7 -0
  182. package/build-types/types.d.ts.map +1 -0
  183. package/package.json +47 -0
@@ -0,0 +1,111 @@
1
+ import type { APIRequestContext, Cookie } from '@playwright/test';
2
+ import type { User } from './login';
3
+ import { login } from './login';
4
+ import { listMedia, uploadMedia, deleteMedia, deleteAllMedia } from './media';
5
+ import { createUser, deleteAllUsers } from './users';
6
+ import { setupRest, rest, getMaxBatchSize, batchRest } from './rest';
7
+ import { getPluginsMap, activatePlugin, deactivatePlugin } from './plugins';
8
+ import { deleteAllTemplates } from './templates';
9
+ import { activateTheme, getCurrentThemeGlobalStylesPostId, getThemeGlobalStylesRevisions } from './themes';
10
+ import { deleteAllBlocks } from './blocks';
11
+ import { createComment, deleteAllComments } from './comments';
12
+ import { createPost, deleteAllPosts } from './posts';
13
+ import { createClassicMenu, createNavigationMenu, deleteAllMenus, getNavigationMenus } from './menus';
14
+ import { deleteAllPages, createPage } from './pages';
15
+ import { resetPreferences } from './preferences';
16
+ import { getSiteSettings, updateSiteSettings } from './site-settings';
17
+ import { deleteAllWidgets, addWidgetBlock } from './widgets';
18
+ interface StorageState {
19
+ cookies: Cookie[];
20
+ nonce: string;
21
+ rootURL: string;
22
+ }
23
+ declare class RequestUtils {
24
+ request: APIRequestContext;
25
+ user: User;
26
+ maxBatchSize?: number;
27
+ storageState?: StorageState;
28
+ storageStatePath?: string;
29
+ baseURL?: string;
30
+ pluginsMap: Record<string, string> | null;
31
+ static setup({ user, storageStatePath, baseURL, }: {
32
+ user?: User;
33
+ storageStatePath?: string;
34
+ baseURL?: string;
35
+ }): Promise<RequestUtils>;
36
+ constructor(requestContext: APIRequestContext, { user, storageState, storageStatePath, baseURL, }?: {
37
+ user?: User;
38
+ storageState?: StorageState;
39
+ storageStatePath?: string;
40
+ baseURL?: string;
41
+ });
42
+ /** @borrows login as this.login */
43
+ login: typeof login;
44
+ /** @borrows setupRest as this.setupRest */
45
+ setupRest: typeof setupRest;
46
+ rest: typeof rest;
47
+ /** @borrows getMaxBatchSize as this.getMaxBatchSize */
48
+ getMaxBatchSize: typeof getMaxBatchSize;
49
+ batchRest: typeof batchRest;
50
+ /** @borrows getPluginsMap as this.getPluginsMap */
51
+ getPluginsMap: typeof getPluginsMap;
52
+ /** @borrows activatePlugin as this.activatePlugin */
53
+ activatePlugin: typeof activatePlugin;
54
+ /** @borrows deactivatePlugin as this.deactivatePlugin */
55
+ deactivatePlugin: typeof deactivatePlugin;
56
+ /** @borrows activateTheme as this.activateTheme */
57
+ activateTheme: typeof activateTheme;
58
+ /** @borrows deleteAllBlocks as this.deleteAllBlocks */
59
+ deleteAllBlocks: typeof deleteAllBlocks;
60
+ /** @borrows createPost as this.createPost */
61
+ createPost: typeof createPost;
62
+ /** @borrows deleteAllPosts as this.deleteAllPosts */
63
+ deleteAllPosts: typeof deleteAllPosts;
64
+ /** @borrows createClassicMenu as this.createClassicMenu */
65
+ createClassicMenu: typeof createClassicMenu;
66
+ /** @borrows createNavigationMenu as this.createNavigationMenu */
67
+ createNavigationMenu: typeof createNavigationMenu;
68
+ /** @borrows deleteAllMenus as this.deleteAllMenus */
69
+ deleteAllMenus: typeof deleteAllMenus;
70
+ /** @borrows getNavigationMenus as this.getNavigationMenus */
71
+ getNavigationMenus: typeof getNavigationMenus;
72
+ /** @borrows createComment as this.createComment */
73
+ createComment: typeof createComment;
74
+ /** @borrows deleteAllComments as this.deleteAllComments */
75
+ deleteAllComments: typeof deleteAllComments;
76
+ /** @borrows deleteAllWidgets as this.deleteAllWidgets */
77
+ deleteAllWidgets: typeof deleteAllWidgets;
78
+ /** @borrows addWidgetBlock as this.addWidgetBlock */
79
+ addWidgetBlock: typeof addWidgetBlock;
80
+ /** @borrows deleteAllTemplates as this.deleteAllTemplates */
81
+ deleteAllTemplates: typeof deleteAllTemplates;
82
+ /** @borrows resetPreferences as this.resetPreferences */
83
+ resetPreferences: typeof resetPreferences;
84
+ /** @borrows listMedia as this.listMedia */
85
+ listMedia: typeof listMedia;
86
+ /** @borrows uploadMedia as this.uploadMedia */
87
+ uploadMedia: typeof uploadMedia;
88
+ /** @borrows deleteMedia as this.deleteMedia */
89
+ deleteMedia: typeof deleteMedia;
90
+ /** @borrows deleteAllMedia as this.deleteAllMedia */
91
+ deleteAllMedia: typeof deleteAllMedia;
92
+ /** @borrows createUser as this.createUser */
93
+ createUser: typeof createUser;
94
+ /** @borrows deleteAllUsers as this.deleteAllUsers */
95
+ deleteAllUsers: typeof deleteAllUsers;
96
+ /** @borrows getSiteSettings as this.getSiteSettings */
97
+ getSiteSettings: typeof getSiteSettings;
98
+ /** @borrows updateSiteSettings as this.updateSiteSettings */
99
+ updateSiteSettings: typeof updateSiteSettings;
100
+ /** @borrows deleteAllPages as this.deleteAllPages */
101
+ deleteAllPages: typeof deleteAllPages;
102
+ /** @borrows createPage as this.createPage */
103
+ createPage: typeof createPage;
104
+ /** @borrows getCurrentThemeGlobalStylesPostId as this.getCurrentThemeGlobalStylesPostId */
105
+ getCurrentThemeGlobalStylesPostId: typeof getCurrentThemeGlobalStylesPostId;
106
+ /** @borrows getThemeGlobalStylesRevisions as this.getThemeGlobalStylesRevisions */
107
+ getThemeGlobalStylesRevisions: typeof getThemeGlobalStylesRevisions;
108
+ }
109
+ export type { StorageState };
110
+ export { RequestUtils };
111
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-utils/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ export interface User {
6
+ username: string;
7
+ password: string;
8
+ }
9
+ declare function login(this: RequestUtils, user?: User): Promise<string>;
10
+ export { login };
11
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/request-utils/login.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,IAAI;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,iBAAe,KAAK,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,GAAE,IAAgB,mBAqB/D;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,54 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import * as fs from 'fs';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import type { RequestUtils } from './index';
10
+ export interface Media {
11
+ id: number;
12
+ title: {
13
+ raw: string;
14
+ rendered: string;
15
+ };
16
+ source_url: string;
17
+ slug: string;
18
+ alt_text: string;
19
+ caption: {
20
+ rendered: string;
21
+ };
22
+ link: string;
23
+ }
24
+ /**
25
+ * List all media files.
26
+ *
27
+ * @see https://developer.wordpress.org/rest-api/reference/media/#list-media
28
+ * @param this
29
+ */
30
+ declare function listMedia(this: RequestUtils): Promise<Media[]>;
31
+ /**
32
+ * Upload a media file.
33
+ *
34
+ * @see https://developer.wordpress.org/rest-api/reference/media/#create-a-media-item
35
+ * @param this
36
+ * @param filePathOrData The path or data of the file being uploaded.
37
+ */
38
+ declare function uploadMedia(this: RequestUtils, filePathOrData: string | fs.ReadStream): Promise<Media>;
39
+ /**
40
+ * delete a media file.
41
+ *
42
+ * @see https://developer.wordpress.org/rest-api/reference/media/#delete-a-media-item
43
+ * @param this
44
+ * @param mediaId The ID of the media file.
45
+ */
46
+ declare function deleteMedia(this: RequestUtils, mediaId: number): Promise<any>;
47
+ /**
48
+ * delete all media files.
49
+ *
50
+ * @param this
51
+ */
52
+ declare function deleteAllMedia(this: RequestUtils): Promise<any[]>;
53
+ export { listMedia, uploadMedia, deleteMedia, deleteAllMedia };
54
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/request-utils/media.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,iBAAe,SAAS,CAAE,IAAI,EAAE,YAAY,oBAU3C;AAED;;;;;;GAMG;AACH,iBAAe,WAAW,CACzB,IAAI,EAAE,YAAY,EAClB,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,kBAgBtC;AAED;;;;;;GAMG;AACH,iBAAe,WAAW,CAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAQ9D;AAED;;;;GAIG;AACH,iBAAe,cAAc,CAAE,IAAI,EAAE,YAAY,kBAShD;AAED,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ export interface MenuData {
6
+ title: string;
7
+ content: string;
8
+ }
9
+ export interface NavigationMenu {
10
+ id: number;
11
+ content: string;
12
+ status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
13
+ }
14
+ /**
15
+ * Create a classic menu
16
+ *
17
+ * @param name Menu name.
18
+ * @return Menu content.
19
+ */
20
+ export declare function createClassicMenu(this: RequestUtils, name: string): Promise<NavigationMenu>;
21
+ /**
22
+ * Create a navigation menu
23
+ *
24
+ * @param menuData navigation menu post data.
25
+ * @return Menu content.
26
+ */
27
+ export declare function createNavigationMenu(this: RequestUtils, menuData: MenuData): Promise<any>;
28
+ /**
29
+ * Delete all navigation and classic menus
30
+ *
31
+ */
32
+ export declare function deleteAllMenus(this: RequestUtils): Promise<void>;
33
+ /**
34
+ * Get latest navigation menus
35
+ *
36
+ * @param args
37
+ * @param args.status
38
+ * @return {string} Menu content.
39
+ */
40
+ export declare function getNavigationMenus(this: RequestUtils, args: {
41
+ status: 'publish';
42
+ }): Promise<NavigationMenu[]>;
43
+ //# sourceMappingURL=menus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/request-utils/menus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CAC/D;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,2BAgCxE;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,QAAQ,gBAUlB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAE,IAAI,EAAE,YAAY,iBAkDvD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,6BAQ3B"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ declare const PAGE_STATUS: readonly ["publish", "future", "draft", "pending", "private", "trash"];
6
+ export type Page = {
7
+ id: number;
8
+ status: (typeof PAGE_STATUS)[number];
9
+ };
10
+ export type CreatePagePayload = {
11
+ title?: string;
12
+ content?: string;
13
+ status: (typeof PAGE_STATUS)[number];
14
+ date?: string;
15
+ date_gmt?: string;
16
+ };
17
+ export declare function deletePage(this: RequestUtils, id: number): Promise<any>;
18
+ /**
19
+ * Delete all pages using REST API.
20
+ *
21
+ * @param this
22
+ */
23
+ export declare function deleteAllPages(this: RequestUtils): Promise<void>;
24
+ /**
25
+ * Create a new page.
26
+ *
27
+ * @param this
28
+ * @param payload The page payload.
29
+ */
30
+ export declare function createPage(this: RequestUtils, payload: CreatePagePayload): Promise<Page>;
31
+ export {};
32
+ //# sourceMappingURL=pages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/request-utils/pages.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,QAAA,MAAM,WAAW,wEAOP,CAAC;AAEX,MAAM,MAAM,IAAI,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,CAAE,OAAO,WAAW,CAAE,CAAE,MAAM,CAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAE,OAAO,WAAW,CAAE,CAAE,MAAM,CAAE,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,UAAU,CAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,gBAS/D;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAE,IAAI,EAAE,YAAY,iBAiBvD;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,iBAAiB,iBAU1B"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ /**
6
+ * Fetch the plugins from API and cache them in memory,
7
+ * since they are unlikely to change during testing.
8
+ *
9
+ * @param this
10
+ * @param forceRefetch Force refetch the installed plugins to update the cache.
11
+ */
12
+ declare function getPluginsMap(this: RequestUtils, forceRefetch?: boolean): Promise<Record<string, string>>;
13
+ /**
14
+ * Activates an installed plugin.
15
+ *
16
+ * @param this RequestUtils.
17
+ * @param slug Plugin slug.
18
+ */
19
+ declare function activatePlugin(this: RequestUtils, slug: string): Promise<void>;
20
+ /**
21
+ * Deactivates an active plugin.
22
+ *
23
+ * @param this RequestUtils.
24
+ * @param slug Plugin slug.
25
+ */
26
+ declare function deactivatePlugin(this: RequestUtils, slug: string): Promise<void>;
27
+ export { getPluginsMap, activatePlugin, deactivatePlugin };
28
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/request-utils/plugins.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;GAMG;AACH,iBAAe,aAAa,CAAE,IAAI,EAAE,YAAY,EAAE,YAAY,UAAQ,mCAerE;AAED;;;;;GAKG;AACH,iBAAe,cAAc,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,iBAa9D;AAED;;;;;GAKG;AACH,iBAAe,gBAAgB,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,iBAahE;AAED,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ export interface Post {
6
+ id: number;
7
+ content: string;
8
+ status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
9
+ }
10
+ export interface CreatePostPayload {
11
+ title?: string;
12
+ content?: string;
13
+ status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
14
+ date?: string;
15
+ date_gmt: string;
16
+ }
17
+ /**
18
+ * Delete all posts using REST API.
19
+ *
20
+ * @param this
21
+ */
22
+ export declare function deleteAllPosts(this: RequestUtils): Promise<void>;
23
+ /**
24
+ * Creates a new post using the REST API.
25
+ *
26
+ * @param this
27
+ * @param payload Post attributes.
28
+ */
29
+ export declare function createPost(this: RequestUtils, payload: CreatePostPayload): Promise<Post>;
30
+ //# sourceMappingURL=posts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../../src/request-utils/posts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,IAAI;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CAC/D;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAE,IAAI,EAAE,YAAY,iBA0BvD;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,iBAAiB,iBAS1B"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ /**
6
+ * Reset user preferences
7
+ *
8
+ * @param this Request utils.
9
+ */
10
+ export declare function resetPreferences(this: RequestUtils): Promise<void>;
11
+ //# sourceMappingURL=preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/request-utils/preferences.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAE,IAAI,EAAE,YAAY,iBAUzD"}
@@ -0,0 +1,24 @@
1
+ import type { APIRequestContext } from '@playwright/test';
2
+ import type { RequestUtils, StorageState } from './index';
3
+ declare function setupRest(this: RequestUtils): Promise<StorageState>;
4
+ type RequestFetchOptions = Exclude<Parameters<APIRequestContext['fetch']>[1], undefined>;
5
+ export interface RestOptions extends RequestFetchOptions {
6
+ path: string;
7
+ }
8
+ declare function rest<RestResponse = any>(this: RequestUtils, options: RestOptions): Promise<RestResponse>;
9
+ /**
10
+ * Get the maximum batch size for the REST API.
11
+ *
12
+ * @param this
13
+ * @param forceRefetch Force revalidate the cached max batch size.
14
+ */
15
+ declare function getMaxBatchSize(this: RequestUtils, forceRefetch?: boolean): Promise<number>;
16
+ export interface BatchRequest {
17
+ method?: string;
18
+ path: string;
19
+ headers?: Record<string, string | string[]>;
20
+ body?: any;
21
+ }
22
+ declare function batchRest<BatchResponse>(this: RequestUtils, requests: BatchRequest[]): Promise<BatchResponse[]>;
23
+ export { setupRest, rest, getMaxBatchSize, batchRest };
24
+ //# sourceMappingURL=rest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../src/request-utils/rest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAM1D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA6B1D,iBAAe,SAAS,CAAE,IAAI,EAAE,YAAY,GAAI,OAAO,CAAE,YAAY,CAAE,CA0BtE;AAED,KAAK,mBAAmB,GAAG,OAAO,CACjC,UAAU,CAAE,iBAAiB,CAAE,OAAO,CAAE,CAAE,CAAE,CAAC,CAAE,EAC/C,SAAS,CACT,CAAC;AACF,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACvD,IAAI,EAAE,MAAM,CAAC;CACb;AAED,iBAAe,IAAI,CAAE,YAAY,GAAG,GAAG,EACtC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,WAAW,GAClB,OAAO,CAAE,YAAY,CAAE,CA8CzB;AAED;;;;;GAKG;AACH,iBAAe,eAAe,CAAE,IAAI,EAAE,YAAY,EAAE,YAAY,UAAQ,mBAmBvE;AAED,MAAM,WAAW,YAAY;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAE,CAAC;IAC9C,IAAI,CAAC,EAAE,GAAG,CAAC;CACX;AAED,iBAAe,SAAS,CAAE,aAAa,EACtC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,YAAY,EAAE,GACtB,OAAO,CAAE,aAAa,EAAE,CAAE,CAgC5B;AAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ type SiteSettings = {
6
+ title: string;
7
+ description: string;
8
+ url: string;
9
+ email: string;
10
+ timezone: string;
11
+ date_format: string;
12
+ time_format: string;
13
+ start_of_week: number;
14
+ language: string;
15
+ use_smilies: boolean;
16
+ default_category: number;
17
+ default_post_format: string;
18
+ posts_per_page: number;
19
+ default_ping_status: 'open' | 'closed';
20
+ default_comment_status: 'open' | 'closed';
21
+ };
22
+ /**
23
+ * Get the site settings.
24
+ *
25
+ * @see https://developer.wordpress.org/rest-api/reference/settings/#retrieve-a-site-setting
26
+ *
27
+ * @param this RequestUtils.
28
+ */
29
+ export declare function getSiteSettings(this: RequestUtils): Promise<SiteSettings>;
30
+ /**
31
+ * Update the site settings.
32
+ *
33
+ * @see https://developer.wordpress.org/rest-api/reference/settings/#update-a-site-setting
34
+ *
35
+ * @param this RequestUtils.
36
+ * @param siteSettings The partial settings payload to update.
37
+ */
38
+ export declare function updateSiteSettings(this: RequestUtils, siteSettings: Partial<SiteSettings>): Promise<SiteSettings>;
39
+ export {};
40
+ //# sourceMappingURL=site-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-settings.d.ts","sourceRoot":"","sources":["../../src/request-utils/site-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,KAAK,YAAY,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,GAAG,QAAQ,CAAC;IACvC,sBAAsB,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAE,IAAI,EAAE,YAAY,yBAKxD;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,OAAO,CAAE,YAAY,CAAE,yBAOrC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ type TemplateType = 'wp_template' | 'wp_template_part';
6
+ /**
7
+ * Delete all the templates of given type.
8
+ *
9
+ * @param this
10
+ * @param type - Template type to delete.
11
+ */
12
+ declare function deleteAllTemplates(this: RequestUtils, type: TemplateType): Promise<void>;
13
+ export { deleteAllTemplates };
14
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/request-utils/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,KAAK,YAAY,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAYvD;;;;;GAKG;AACH,iBAAe,kBAAkB,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,iBA6BxE;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ declare function activateTheme(this: RequestUtils, themeSlug: string): Promise<void>;
6
+ declare function getCurrentThemeGlobalStylesPostId(this: RequestUtils): Promise<string>;
7
+ /**
8
+ * Deletes all post revisions using the REST API.
9
+ *
10
+ * @param {} this RequestUtils.
11
+ * @param {string|number} parentId Post attributes.
12
+ */
13
+ declare function getThemeGlobalStylesRevisions(this: RequestUtils, parentId: number | string): Promise<Record<string, Object>[]>;
14
+ export { activateTheme, getCurrentThemeGlobalStylesPostId, getThemeGlobalStylesRevisions, };
15
+ //# sourceMappingURL=themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/request-utils/themes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C,iBAAe,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,GACf,OAAO,CAAE,IAAI,CAAE,CA0BjB;AAGD,iBAAe,iCAAiC,CAAE,IAAI,EAAE,YAAY,mBAwBnE;AAED;;;;;GAKG;AACH,iBAAe,6BAA6B,CAC3C,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,GAAG,MAAM,qCASzB;AAED,OAAO,EACN,aAAa,EACb,iCAAiC,EACjC,6BAA6B,GAC7B,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RequestUtils } from './index';
5
+ export interface User {
6
+ id: number;
7
+ email: string;
8
+ }
9
+ export interface UserData {
10
+ username: string;
11
+ email: string;
12
+ firstName?: string;
13
+ lastName?: string;
14
+ password?: string;
15
+ roles?: string[];
16
+ }
17
+ export interface UserRequestData {
18
+ username: string;
19
+ email: string;
20
+ first_name?: string;
21
+ last_name?: string;
22
+ password?: string;
23
+ roles?: string[];
24
+ }
25
+ /**
26
+ * Add a test user.
27
+ *
28
+ * @see https://developer.wordpress.org/rest-api/reference/users/#create-a-user
29
+ * @param this
30
+ * @param user User data to create.
31
+ */
32
+ declare function createUser(this: RequestUtils, user: UserData): Promise<User>;
33
+ /**
34
+ * Delete all users except main root user.
35
+ *
36
+ * @param this
37
+ */
38
+ declare function deleteAllUsers(this: RequestUtils): Promise<any[]>;
39
+ export { createUser, deleteAllUsers };
40
+ //# sourceMappingURL=users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/request-utils/users.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,IAAI;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAoBD;;;;;;GAMG;AACH,iBAAe,UAAU,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,iBA6B5D;AAmBD;;;;GAIG;AACH,iBAAe,cAAc,CAAE,IAAI,EAAE,YAAY,kBAYhD;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Delete all the widgets in the widgets screen.
3
+ *
4
+ * @this {import('./index').RequestUtils}
5
+ */
6
+ export function deleteAllWidgets(this: import("./index").RequestUtils): Promise<void>;
7
+ /**
8
+ * Add a widget block to the widget area.
9
+ *
10
+ * @this {import('./index').RequestUtils}
11
+ * @param {string} serializedBlock The serialized content of the inserted block HTML.
12
+ * @param {string} widgetAreaId The ID of the widget area.
13
+ */
14
+ export function addWidgetBlock(this: import("./index").RequestUtils, serializedBlock: string, widgetAreaId: string): Promise<void>;
15
+ //# sourceMappingURL=widgets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../../src/request-utils/widgets.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sFAuBC;AAED;;;;;;GAMG;AACH,sFAHW,MAAM,gBACN,MAAM,iBAgChB"}
@@ -0,0 +1,15 @@
1
+ import { expect } from '@playwright/test';
2
+ /**
3
+ * Internal dependencies
4
+ */
5
+ import { Admin, Editor, PageUtils, RequestUtils } from './index';
6
+ declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
7
+ admin: Admin;
8
+ editor: Editor;
9
+ pageUtils: PageUtils;
10
+ snapshotConfig: void;
11
+ }, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & {
12
+ requestUtils: RequestUtils;
13
+ }>;
14
+ export { test, expect };
15
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGxD;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAyFjE,QAAA,MAAM,IAAI;WAED,KAAK;YACJ,MAAM;eACH,SAAS;oBACJ,IAAI;;kBAGN,YAAY;EA+CzB,CAAC;AAEJ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Window {
3
+ wp: any;
4
+ }
5
+ }
6
+ export {};
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QAEf,EAAE,EAAE,GAAG,CAAC;KACR;CACD;AAED,OAAO,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@wordpress/e2e-test-utils-playwright",
3
+ "version": "0.1.0",
4
+ "description": "End-To-End (E2E) test utils for WordPress.",
5
+ "author": "The WordPress Contributors",
6
+ "license": "GPL-2.0-or-later",
7
+ "keywords": [
8
+ "wordpress",
9
+ "gutenberg",
10
+ "e2e",
11
+ "utils",
12
+ "playwright"
13
+ ],
14
+ "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils-playwright/README.md",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/WordPress/gutenberg.git",
18
+ "directory": "packages/e2e-test-utils-playwright"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/WordPress/gutenberg/issues"
22
+ },
23
+ "engines": {
24
+ "node": ">=12"
25
+ },
26
+ "files": [
27
+ "build",
28
+ "build-types"
29
+ ],
30
+ "main": "./build/index.js",
31
+ "types": "./build-types",
32
+ "dependencies": {
33
+ "@wordpress/api-fetch": "^6.30.0",
34
+ "@wordpress/keycodes": "^3.33.0",
35
+ "@wordpress/url": "^3.34.0",
36
+ "change-case": "^4.1.2",
37
+ "form-data": "^4.0.0",
38
+ "mime": "^3.0.0"
39
+ },
40
+ "peerDependencies": {
41
+ "@playwright/test": ">=1"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "gitHead": "e936127e1e13881f1a940b7bd1593a9e500147f3"
47
+ }