@react-native-harness/runtime 1.0.0-alpha.19 → 1.0.0-alpha.20

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 (218) hide show
  1. package/assets/harness-module-system.js +73 -0
  2. package/dist/bundler/evaluate.js +1 -1
  3. package/dist/client/getWSServer.d.ts.map +1 -1
  4. package/dist/client/getWSServer.js +2 -1
  5. package/dist/client/store.d.ts +4 -0
  6. package/dist/client/store.d.ts.map +1 -0
  7. package/dist/client/store.js +10 -0
  8. package/dist/disableHMRWhenReady.d.ts +2 -0
  9. package/dist/disableHMRWhenReady.d.ts.map +1 -0
  10. package/dist/disableHMRWhenReady.js +20 -0
  11. package/dist/expect/expect.d.ts +9 -0
  12. package/dist/expect/expect.d.ts.map +1 -0
  13. package/dist/expect/expect.js +77 -0
  14. package/dist/expect/matchers/toMatchImageSnapshot.d.ts +12 -0
  15. package/dist/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
  16. package/dist/expect/matchers/toMatchImageSnapshot.js +11 -0
  17. package/dist/globals.d.ts +1 -0
  18. package/dist/globals.d.ts.map +1 -1
  19. package/dist/initialize.js +2 -3
  20. package/dist/mocker/index.d.ts +1 -1
  21. package/dist/mocker/index.d.ts.map +1 -1
  22. package/dist/mocker/index.js +1 -1
  23. package/dist/mocker/registry.d.ts +0 -1
  24. package/dist/mocker/registry.d.ts.map +1 -1
  25. package/dist/mocker/registry.js +19 -16
  26. package/dist/render/queries.d.ts +7 -0
  27. package/dist/render/queries.d.ts.map +1 -0
  28. package/dist/render/queries.js +99 -0
  29. package/dist/runner/context.d.ts +10 -0
  30. package/dist/runner/context.d.ts.map +1 -0
  31. package/dist/runner/context.js +6 -0
  32. package/dist/screen/index.d.ts +8 -0
  33. package/dist/screen/index.d.ts.map +1 -0
  34. package/dist/screen/index.js +18 -0
  35. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  36. package/dist/userEvent/index.d.ts +6 -0
  37. package/dist/userEvent/index.d.ts.map +1 -0
  38. package/dist/userEvent/index.js +10 -0
  39. package/out-tsc/vitest/src/__tests__/collector.test.d.ts +2 -0
  40. package/out-tsc/vitest/src/__tests__/collector.test.d.ts.map +1 -0
  41. package/out-tsc/vitest/src/__tests__/error-handling.test.d.ts +2 -0
  42. package/out-tsc/vitest/src/__tests__/error-handling.test.d.ts.map +1 -0
  43. package/out-tsc/vitest/src/__tests__/expect.test.d.ts +2 -0
  44. package/out-tsc/vitest/src/__tests__/expect.test.d.ts.map +1 -0
  45. package/out-tsc/vitest/src/__tests__/spy.test.d.ts +2 -0
  46. package/out-tsc/vitest/src/__tests__/spy.test.d.ts.map +1 -0
  47. package/out-tsc/vitest/src/bundler/bundle.d.ts +2 -0
  48. package/out-tsc/vitest/src/bundler/bundle.d.ts.map +1 -0
  49. package/out-tsc/vitest/src/bundler/errors.d.ts +15 -0
  50. package/out-tsc/vitest/src/bundler/errors.d.ts.map +1 -0
  51. package/out-tsc/vitest/src/bundler/evaluate.d.ts +2 -0
  52. package/out-tsc/vitest/src/bundler/evaluate.d.ts.map +1 -0
  53. package/out-tsc/vitest/src/bundler/factory.d.ts +3 -0
  54. package/out-tsc/vitest/src/bundler/factory.d.ts.map +1 -0
  55. package/out-tsc/vitest/src/bundler/index.d.ts +4 -0
  56. package/out-tsc/vitest/src/bundler/index.d.ts.map +1 -0
  57. package/out-tsc/vitest/src/bundler/types.d.ts +7 -0
  58. package/out-tsc/vitest/src/bundler/types.d.ts.map +1 -0
  59. package/{dist/runtime.d.ts → out-tsc/vitest/src/client/factory.d.ts} +1 -1
  60. package/out-tsc/vitest/src/client/factory.d.ts.map +1 -0
  61. package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts +8 -0
  62. package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts.map +1 -0
  63. package/out-tsc/vitest/src/client/getWSServer.d.ts +2 -0
  64. package/out-tsc/vitest/src/client/getWSServer.d.ts.map +1 -0
  65. package/out-tsc/vitest/src/client/index.d.ts +2 -0
  66. package/out-tsc/vitest/src/client/index.d.ts.map +1 -0
  67. package/out-tsc/vitest/src/client/setup-files.d.ts +12 -0
  68. package/out-tsc/vitest/src/client/setup-files.d.ts.map +1 -0
  69. package/out-tsc/vitest/src/client/store.d.ts +4 -0
  70. package/out-tsc/vitest/src/client/store.d.ts.map +1 -0
  71. package/out-tsc/vitest/src/collector/errors.d.ts +8 -0
  72. package/out-tsc/vitest/src/collector/errors.d.ts.map +1 -0
  73. package/out-tsc/vitest/src/collector/factory.d.ts +3 -0
  74. package/out-tsc/vitest/src/collector/factory.d.ts.map +1 -0
  75. package/{dist/rntl/describe.d.ts → out-tsc/vitest/src/collector/functions.d.ts} +4 -21
  76. package/out-tsc/vitest/src/collector/functions.d.ts.map +1 -0
  77. package/out-tsc/vitest/src/collector/index.d.ts +5 -0
  78. package/out-tsc/vitest/src/collector/index.d.ts.map +1 -0
  79. package/out-tsc/vitest/src/collector/types.d.ts +10 -0
  80. package/out-tsc/vitest/src/collector/types.d.ts.map +1 -0
  81. package/out-tsc/vitest/src/collector/validation.d.ts +4 -0
  82. package/out-tsc/vitest/src/collector/validation.d.ts.map +1 -0
  83. package/out-tsc/vitest/src/constants.d.ts +2 -0
  84. package/out-tsc/vitest/src/constants.d.ts.map +1 -0
  85. package/out-tsc/vitest/src/entry-point.d.ts +2 -0
  86. package/out-tsc/vitest/src/entry-point.d.ts.map +1 -0
  87. package/out-tsc/vitest/src/errors.d.ts +6 -0
  88. package/out-tsc/vitest/src/errors.d.ts.map +1 -0
  89. package/out-tsc/vitest/src/expect/index.d.ts +14 -0
  90. package/out-tsc/vitest/src/expect/index.d.ts.map +1 -0
  91. package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts +7 -0
  92. package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
  93. package/out-tsc/vitest/src/expect/setup.d.ts +2 -0
  94. package/out-tsc/vitest/src/expect/setup.d.ts.map +1 -0
  95. package/out-tsc/vitest/src/filtering/index.d.ts +2 -0
  96. package/out-tsc/vitest/src/filtering/index.d.ts.map +1 -0
  97. package/out-tsc/vitest/src/filtering/testNameFilter.d.ts +12 -0
  98. package/out-tsc/vitest/src/filtering/testNameFilter.d.ts.map +1 -0
  99. package/out-tsc/vitest/src/globals.d.ts +8 -0
  100. package/out-tsc/vitest/src/globals.d.ts.map +1 -0
  101. package/out-tsc/vitest/src/index.d.ts +13 -0
  102. package/out-tsc/vitest/src/index.d.ts.map +1 -0
  103. package/out-tsc/vitest/src/initialize.d.ts +2 -0
  104. package/out-tsc/vitest/src/initialize.d.ts.map +1 -0
  105. package/out-tsc/vitest/src/jest-mock.d.ts +2 -0
  106. package/out-tsc/vitest/src/jest-mock.d.ts.map +1 -0
  107. package/out-tsc/vitest/src/mocker/index.d.ts +2 -0
  108. package/out-tsc/vitest/src/mocker/index.d.ts.map +1 -0
  109. package/out-tsc/vitest/src/mocker/registry.d.ts +7 -0
  110. package/out-tsc/vitest/src/mocker/registry.d.ts.map +1 -0
  111. package/out-tsc/vitest/src/mocker/types.d.ts +6 -0
  112. package/out-tsc/vitest/src/mocker/types.d.ts.map +1 -0
  113. package/out-tsc/vitest/src/namespace.d.ts +18 -0
  114. package/out-tsc/vitest/src/namespace.d.ts.map +1 -0
  115. package/out-tsc/vitest/src/render/ErrorBoundary.d.ts +17 -0
  116. package/out-tsc/vitest/src/render/ErrorBoundary.d.ts.map +1 -0
  117. package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts +3 -0
  118. package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts.map +1 -0
  119. package/out-tsc/vitest/src/render/cleanup.d.ts +2 -0
  120. package/out-tsc/vitest/src/render/cleanup.d.ts.map +1 -0
  121. package/out-tsc/vitest/src/render/index.d.ts +6 -0
  122. package/out-tsc/vitest/src/render/index.d.ts.map +1 -0
  123. package/out-tsc/vitest/src/render/setup.d.ts +2 -0
  124. package/out-tsc/vitest/src/render/setup.d.ts.map +1 -0
  125. package/out-tsc/vitest/src/render/types.d.ts +12 -0
  126. package/out-tsc/vitest/src/render/types.d.ts.map +1 -0
  127. package/out-tsc/vitest/src/runner/errors.d.ts +11 -0
  128. package/out-tsc/vitest/src/runner/errors.d.ts.map +1 -0
  129. package/out-tsc/vitest/src/runner/factory.d.ts +3 -0
  130. package/out-tsc/vitest/src/runner/factory.d.ts.map +1 -0
  131. package/out-tsc/vitest/src/runner/hooks.d.ts +4 -0
  132. package/out-tsc/vitest/src/runner/hooks.d.ts.map +1 -0
  133. package/out-tsc/vitest/src/runner/index.d.ts +4 -0
  134. package/out-tsc/vitest/src/runner/index.d.ts.map +1 -0
  135. package/out-tsc/vitest/src/runner/runSuite.d.ts +4 -0
  136. package/out-tsc/vitest/src/runner/runSuite.d.ts.map +1 -0
  137. package/out-tsc/vitest/src/runner/types.d.ts +13 -0
  138. package/out-tsc/vitest/src/runner/types.d.ts.map +1 -0
  139. package/out-tsc/vitest/src/screen/index.d.ts +8 -0
  140. package/out-tsc/vitest/src/screen/index.d.ts.map +1 -0
  141. package/out-tsc/vitest/src/spy/index.d.ts +2 -0
  142. package/out-tsc/vitest/src/spy/index.d.ts.map +1 -0
  143. package/out-tsc/vitest/src/symbolicate.d.ts +3 -0
  144. package/out-tsc/vitest/src/symbolicate.d.ts.map +1 -0
  145. package/out-tsc/vitest/src/ui/ReadyScreen.d.ts +2 -0
  146. package/out-tsc/vitest/src/ui/ReadyScreen.d.ts.map +1 -0
  147. package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts +2 -0
  148. package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts.map +1 -0
  149. package/out-tsc/vitest/src/ui/index.d.ts +2 -0
  150. package/out-tsc/vitest/src/ui/index.d.ts.map +1 -0
  151. package/out-tsc/vitest/src/ui/state.d.ts +20 -0
  152. package/out-tsc/vitest/src/ui/state.d.ts.map +1 -0
  153. package/out-tsc/vitest/src/userEvent/index.d.ts +6 -0
  154. package/out-tsc/vitest/src/userEvent/index.d.ts.map +1 -0
  155. package/out-tsc/vitest/src/utils/dev-server.d.ts +2 -0
  156. package/out-tsc/vitest/src/utils/dev-server.d.ts.map +1 -0
  157. package/out-tsc/vitest/src/utils/emitter.d.ts +16 -0
  158. package/out-tsc/vitest/src/utils/emitter.d.ts.map +1 -0
  159. package/out-tsc/vitest/src/waitFor.d.ts +21 -0
  160. package/out-tsc/vitest/src/waitFor.d.ts.map +1 -0
  161. package/out-tsc/vitest/tsconfig.spec.tsbuildinfo +1 -0
  162. package/out-tsc/vitest/vite.config.d.ts +3 -0
  163. package/out-tsc/vitest/vite.config.d.ts.map +1 -0
  164. package/package.json +9 -6
  165. package/src/__tests__/initialize.test.ts +24 -0
  166. package/src/bundler/evaluate.ts +1 -1
  167. package/src/client/getWSServer.ts +2 -1
  168. package/src/disableHMRWhenReady.ts +27 -0
  169. package/src/globals.ts +1 -0
  170. package/src/initialize.ts +5 -5
  171. package/src/mocker/index.ts +0 -1
  172. package/src/mocker/metro-require.d.ts +1 -1
  173. package/src/mocker/registry.ts +21 -18
  174. package/assets/moduleSystem.flow.js +0 -1082
  175. package/dist/collection.d.ts +0 -39
  176. package/dist/collection.d.ts.map +0 -1
  177. package/dist/collection.js +0 -224
  178. package/dist/getEntryComponent.d.ts +0 -6
  179. package/dist/getEntryComponent.d.ts.map +0 -1
  180. package/dist/getEntryComponent.js +0 -6
  181. package/dist/module.d.ts +0 -3
  182. package/dist/module.d.ts.map +0 -1
  183. package/dist/module.js +0 -26
  184. package/dist/module.web.d.ts +0 -2
  185. package/dist/module.web.d.ts.map +0 -1
  186. package/dist/module.web.js +0 -12
  187. package/dist/package.json +0 -37
  188. package/dist/rntl/client.d.ts +0 -3
  189. package/dist/rntl/client.d.ts.map +0 -1
  190. package/dist/rntl/client.js +0 -8
  191. package/dist/rntl/describe.d.ts.map +0 -1
  192. package/dist/rntl/describe.js +0 -216
  193. package/dist/rntl/expect.d.ts +0 -11
  194. package/dist/rntl/expect.d.ts.map +0 -1
  195. package/dist/rntl/expect.js +0 -19
  196. package/dist/rntl/fn.d.ts +0 -2
  197. package/dist/rntl/fn.d.ts.map +0 -1
  198. package/dist/rntl/fn.js +0 -1
  199. package/dist/rntl/render.d.ts +0 -4
  200. package/dist/rntl/render.d.ts.map +0 -1
  201. package/dist/rntl/render.js +0 -11
  202. package/dist/rntl/screen.d.ts +0 -45
  203. package/dist/rntl/screen.d.ts.map +0 -1
  204. package/dist/rntl/screen.js +0 -31
  205. package/dist/rntl/userEvent.d.ts +0 -22
  206. package/dist/rntl/userEvent.d.ts.map +0 -1
  207. package/dist/rntl/userEvent.js +0 -19
  208. package/dist/runner.d.ts +0 -4
  209. package/dist/runner.d.ts.map +0 -1
  210. package/dist/runner.js +0 -115
  211. package/dist/runtime.d.ts.map +0 -1
  212. package/dist/runtime.js +0 -39
  213. package/dist/state.d.ts +0 -25
  214. package/dist/state.d.ts.map +0 -1
  215. package/dist/state.js +0 -37
  216. package/dist/ui/UI.d.ts +0 -13
  217. package/dist/ui/UI.d.ts.map +0 -1
  218. package/dist/ui/UI.js +0 -121
@@ -0,0 +1,73 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+
4
+ // This file is a polyfill that monkey-patches the Metro module system
5
+ // to allow capturing nested require calls.
6
+
7
+ (function (globalObject) {
8
+ const myRequire = function (id) {
9
+ return globalObject.__r(id);
10
+ };
11
+
12
+ const myImportDefault = function (id) {
13
+ return globalObject.__r.importDefault(id);
14
+ };
15
+
16
+ const myImportAll = function (id) {
17
+ return globalObject.__r.importAll(id);
18
+ };
19
+
20
+ // Monkey-patch define
21
+ const originalDefine = globalObject.__d;
22
+ globalObject.__d = function (factory, moduleId, dependencyMap) {
23
+ const wrappedFactory = function (...args) {
24
+ // Standard Metro with import support (7 arguments)
25
+ // args: global, require, importDefault, importAll, module, exports, dependencyMap
26
+ const global = args[0];
27
+ const moduleObject = args[4];
28
+ const exports = args[5];
29
+ const depMap = args[6];
30
+
31
+ return factory(
32
+ global,
33
+ myRequire,
34
+ myImportDefault,
35
+ myImportAll,
36
+ moduleObject,
37
+ exports,
38
+ depMap
39
+ );
40
+ };
41
+
42
+ // Call the original define with the wrapped factory
43
+ return originalDefine.call(this, wrappedFactory, moduleId, dependencyMap);
44
+ };
45
+
46
+ globalObject.__resetModule = function (moduleId) {
47
+ const module = globalObject.__r.getModules().get(moduleId);
48
+
49
+ if (!module) {
50
+ return;
51
+ }
52
+
53
+ module.hasError = false;
54
+ module.error = undefined;
55
+ module.isInitialized = false;
56
+ };
57
+
58
+ globalObject.__resetModules = function () {
59
+ const modules = globalObject.__r.getModules();
60
+
61
+ modules.forEach(function (mod, moduleId) {
62
+ globalObject.__resetModule(moduleId);
63
+ });
64
+ };
65
+ })(
66
+ typeof globalThis !== 'undefined'
67
+ ? globalThis
68
+ : typeof global !== 'undefined'
69
+ ? global
70
+ : typeof window !== 'undefined'
71
+ ? window
72
+ : this
73
+ );
@@ -12,7 +12,7 @@ export const evaluateModule = (moduleJs, modulePath) => {
12
12
  }
13
13
  const moduleId = Number(__rParam);
14
14
  // This is important as if module was already initialized, it would not be re-initialized
15
- global.__clearModule(moduleId);
15
+ global.__resetModule(moduleId);
16
16
  // eslint-disable-next-line no-eval
17
17
  eval(moduleJs);
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,MAK9B,CAAC"}
1
+ {"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,MAM9B,CAAC"}
@@ -3,5 +3,6 @@ import { WS_SERVER_PORT } from '../constants.js';
3
3
  export const getWSServer = () => {
4
4
  const devServerUrl = getDevServerUrl();
5
5
  const hostname = devServerUrl.split('://')[1].split(':')[0];
6
- return `ws://${hostname}:${WS_SERVER_PORT}`;
6
+ const port = global.RN_HARNESS?.webSocketPort || WS_SERVER_PORT;
7
+ return `ws://${hostname}:${port}`;
7
8
  };
@@ -0,0 +1,4 @@
1
+ import type { BridgeClient } from '@react-native-harness/bridge/client';
2
+ export declare const setClient: (client: BridgeClient) => void;
3
+ export declare const getClientInstance: () => BridgeClient;
4
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/client/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAIxE,eAAO,MAAM,SAAS,GAAI,QAAQ,YAAY,KAAG,IAEhD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAOpC,CAAC"}
@@ -0,0 +1,10 @@
1
+ let clientInstance = null;
2
+ export const setClient = (client) => {
3
+ clientInstance = client;
4
+ };
5
+ export const getClientInstance = () => {
6
+ if (!clientInstance) {
7
+ throw new Error('Bridge client not initialized. This should not happen in normal operation.');
8
+ }
9
+ return clientInstance;
10
+ };
@@ -0,0 +1,2 @@
1
+ export declare function disableHMRWhenReady(disable: () => void, retriesLeft: number, retryDelay?: number): Promise<void>;
2
+ //# sourceMappingURL=disableHMRWhenReady.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disableHMRWhenReady.d.ts","sourceRoot":"","sources":["../src/disableHMRWhenReady.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,IAAI,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,SAAK,iBAuBhB"}
@@ -0,0 +1,20 @@
1
+ export function disableHMRWhenReady(disable, retriesLeft, retryDelay = 10) {
2
+ return new Promise((resolve, reject) => {
3
+ function attempt(remaining) {
4
+ try {
5
+ disable();
6
+ resolve();
7
+ }
8
+ catch (error) {
9
+ if (remaining > 0 &&
10
+ error instanceof Error &&
11
+ error.message.includes('Expected HMRClient.setup() call at startup.')) {
12
+ setTimeout(() => attempt(remaining - 1), retryDelay);
13
+ return;
14
+ }
15
+ reject(error);
16
+ }
17
+ }
18
+ attempt(retriesLeft);
19
+ });
20
+ }
@@ -0,0 +1,9 @@
1
+ import type { ExpectStatic } from '@vitest/expect';
2
+ import * as chai from 'chai';
3
+ import './setup.js';
4
+ export declare function createExpect(): ExpectStatic;
5
+ declare const globalExpect: ExpectStatic;
6
+ export { assert, should } from 'chai';
7
+ export { chai, globalExpect as expect };
8
+ export type { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectStatic, JestAssertion, Matchers, } from '@vitest/expect';
9
+ //# sourceMappingURL=expect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/expect/expect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAS5E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,YAAY,CAAC;AAGpB,wBAAgB,YAAY,IAAI,YAAY,CAwF3C;AAED,QAAA,MAAM,YAAY,EAAE,YAA6B,CAAC;AAQlD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,YAAY,IAAI,MAAM,EAAE,CAAC;AAExC,YAAY,EACV,SAAS,EACT,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,QAAQ,GACT,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,77 @@
1
+ // This is adapted version of https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/chai/index.ts
2
+ // Credits to Vitest team for the original implementation.
3
+ import { addCustomEqualityTesters, ASYMMETRIC_MATCHERS_OBJECT, customMatchers, getState, GLOBAL_EXPECT, setState, } from '@vitest/expect';
4
+ import * as chai from 'chai';
5
+ // Setup additional matchers
6
+ import './setup.js';
7
+ import { toMatchImageSnapshot } from './matchers/toMatchImageSnapshot.js';
8
+ export function createExpect() {
9
+ const expect = ((value, message) => {
10
+ const { assertionCalls } = getState(expect);
11
+ setState({ assertionCalls: assertionCalls + 1 }, expect);
12
+ return chai.expect(value, message);
13
+ });
14
+ Object.assign(expect, chai.expect);
15
+ Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
16
+ expect.getState = () => getState(expect);
17
+ expect.setState = (state) => setState(state, expect);
18
+ // @ts-expect-error global is not typed
19
+ const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
20
+ setState({
21
+ // this should also add "snapshotState" that is added conditionally
22
+ ...globalState,
23
+ assertionCalls: 0,
24
+ isExpectingAssertions: false,
25
+ isExpectingAssertionsError: null,
26
+ expectedAssertionsNumber: null,
27
+ expectedAssertionsNumberErrorGen: null,
28
+ }, expect);
29
+ // @ts-expect-error untyped
30
+ expect.extend = (matchers) => chai.expect.extend(expect, matchers);
31
+ // @ts-expect-error untyped
32
+ expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters);
33
+ // @ts-expect-error untyped
34
+ expect.soft = (...args) => {
35
+ // @ts-expect-error private soft access
36
+ return expect(...args).withContext({ soft: true });
37
+ };
38
+ // @ts-expect-error untyped
39
+ expect.unreachable = (message) => {
40
+ chai.assert.fail(`expected${message ? ` "${message}" ` : ' '}not to be reached`);
41
+ };
42
+ function assertions(expected) {
43
+ const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
44
+ if (Error.captureStackTrace) {
45
+ Error.captureStackTrace(errorGen(), assertions);
46
+ }
47
+ expect.setState({
48
+ expectedAssertionsNumber: expected,
49
+ expectedAssertionsNumberErrorGen: errorGen,
50
+ });
51
+ }
52
+ function hasAssertions() {
53
+ const error = new Error('expected any number of assertion, but got none');
54
+ if (Error.captureStackTrace) {
55
+ Error.captureStackTrace(error, hasAssertions);
56
+ }
57
+ expect.setState({
58
+ isExpectingAssertions: true,
59
+ isExpectingAssertionsError: error,
60
+ });
61
+ }
62
+ chai.util.addMethod(expect, 'assertions', assertions);
63
+ chai.util.addMethod(expect, 'hasAssertions', hasAssertions);
64
+ expect.extend(customMatchers);
65
+ expect.extend({
66
+ toMatchImageSnapshot,
67
+ });
68
+ return expect;
69
+ }
70
+ const globalExpect = createExpect();
71
+ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
72
+ value: globalExpect,
73
+ writable: true,
74
+ configurable: true,
75
+ });
76
+ export { assert, should } from 'chai';
77
+ export { chai, globalExpect as expect };
@@ -0,0 +1,12 @@
1
+ import type { MatcherState } from '@vitest/expect';
2
+ import type { FileReference, ImageSnapshotOptions } from '@react-native-harness/bridge';
3
+ declare module '@vitest/expect' {
4
+ interface Matchers {
5
+ toMatchImageSnapshot(options: ImageSnapshotOptions): Promise<void>;
6
+ }
7
+ }
8
+ export declare function toMatchImageSnapshot(this: MatcherState, received: FileReference, options: ImageSnapshotOptions): Promise<{
9
+ pass: boolean;
10
+ message: () => string;
11
+ }>;
12
+ //# sourceMappingURL=toMatchImageSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toMatchImageSnapshot.d.ts","sourceRoot":"","sources":["../../../src/expect/matchers/toMatchImageSnapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,QAAQ;QAChB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACpE;CACF;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,MAAM,CAAA;CAAE,CAAC,CAcnD"}
@@ -0,0 +1,11 @@
1
+ import { getClientInstance } from '../../client/store.js';
2
+ import { getHarnessContext } from '../../runner/index.js';
3
+ export async function toMatchImageSnapshot(received, options) {
4
+ const client = getClientInstance();
5
+ const context = getHarnessContext();
6
+ const result = await client.rpc['test.matchImageSnapshot'](received, context.testFilePath, options, context.runner);
7
+ return {
8
+ pass: result.pass,
9
+ message: () => result.message,
10
+ };
11
+ }
package/dist/globals.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type HarnessGlobal = {
2
2
  appRegistryComponentName: string;
3
+ webSocketPort?: number;
3
4
  };
4
5
  declare global {
5
6
  var RN_HARNESS: HarnessGlobal | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;CAC3C;AAED,eAAO,MAAM,gBAAgB,QAAO,aAQnC,CAAC"}
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;CAC3C;AAED,eAAO,MAAM,gBAAgB,QAAO,aAQnC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { getDeviceDescriptor } from './client/getDeviceDescriptor.js';
2
2
  import { getClient } from './client/index.js';
3
+ import { disableHMRWhenReady } from './disableHMRWhenReady.js';
3
4
  import { setupJestMock } from './jest-mock.js';
4
5
  // Polyfill for EventTarget
5
6
  const Shim = require('event-target-shim');
@@ -15,9 +16,7 @@ const HMRClientModule = require('react-native/Libraries/Utilities/HMRClient');
15
16
  const HMRClient = 'default' in HMRClientModule ? HMRClientModule.default : HMRClientModule;
16
17
  // Wait for HMRClient to be initialized
17
18
  setTimeout(() => {
18
- HMRClient.disable();
19
- // Initialize the React Native Harness
20
- void getClient().then((client) => client.rpc.reportReady(getDeviceDescriptor()));
19
+ void disableHMRWhenReady(() => HMRClient.disable(), 50).then(() => getClient().then((client) => client.rpc.reportReady(getDeviceDescriptor())));
21
20
  });
22
21
  // Re-throw fatal errors
23
22
  ErrorUtils.setGlobalHandler((error) => {
@@ -1,2 +1,2 @@
1
- export { mock, requireActual, clearMocks, unmock, resetModules, } from './registry.js';
1
+ export { mock, requireActual, unmock, resetModules, } from './registry.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,GACb,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,aAAa,EACb,MAAM,EACN,YAAY,GACb,MAAM,eAAe,CAAC"}
@@ -1 +1 @@
1
- export { mock, requireActual, clearMocks, unmock, resetModules, } from './registry.js';
1
+ export { mock, requireActual, unmock, resetModules, } from './registry.js';
@@ -1,6 +1,5 @@
1
1
  import { ModuleFactory } from './types.js';
2
2
  export declare const mock: (moduleId: string, factory: ModuleFactory) => void;
3
- export declare const clearMocks: () => void;
4
3
  export declare const requireActual: <T = any>(moduleId: string) => T;
5
4
  export declare const unmock: (moduleId: string) => void;
6
5
  export declare const resetModules: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/mocker/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAO9D,eAAO,MAAM,IAAI,GAAI,UAAU,MAAM,EAAE,SAAS,aAAa,KAAG,IAG/D,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,IAG7B,CAAC;AAkBF,eAAO,MAAM,aAAa,GAAI,CAAC,GAAG,GAAG,EAAE,UAAU,MAAM,KAAG,CAEH,CAAC;AAExD,eAAO,MAAM,MAAM,GAAI,UAAU,MAAM,SAGtC,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,IAK/B,CAAC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/mocker/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAO9D,eAAO,MAAM,IAAI,GAAI,UAAU,MAAM,EAAE,SAAS,aAAa,KAAG,IAG/D,CAAC;AAmBF,eAAO,MAAM,aAAa,GAAI,CAAC,GAAG,GAAG,EAAE,UAAU,MAAM,KAAG,CAEH,CAAC;AAExD,eAAO,MAAM,MAAM,GAAI,UAAU,MAAM,SAGtC,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,IAG/B,CAAC"}
@@ -1,24 +1,20 @@
1
+ const modulesCache = new Map();
1
2
  const mockRegistry = new Map();
2
- const mockCache = new Map();
3
3
  const originalRequire = global.__r;
4
4
  export const mock = (moduleId, factory) => {
5
- mockCache.delete(moduleId);
5
+ modulesCache.delete(moduleId);
6
6
  mockRegistry.set(moduleId, factory);
7
7
  };
8
- export const clearMocks = () => {
9
- mockRegistry.clear();
10
- mockCache.clear();
8
+ const isModuleMocked = (moduleId) => {
9
+ return mockRegistry.has(moduleId);
11
10
  };
12
11
  const getMockImplementation = (moduleId) => {
13
- if (mockCache.has(moduleId)) {
14
- return mockCache.get(moduleId);
15
- }
16
12
  const factory = mockRegistry.get(moduleId);
17
13
  if (!factory) {
18
14
  return null;
19
15
  }
20
16
  const implementation = factory();
21
- mockCache.set(moduleId, implementation);
17
+ modulesCache.set(moduleId, implementation);
22
18
  return implementation;
23
19
  };
24
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -27,20 +23,27 @@ export const requireActual = (moduleId) =>
27
23
  originalRequire(moduleId);
28
24
  export const unmock = (moduleId) => {
29
25
  mockRegistry.delete(moduleId);
30
- mockCache.delete(moduleId);
26
+ modulesCache.delete(moduleId);
31
27
  };
32
28
  export const resetModules = () => {
33
- mockCache.clear();
34
- // Reset Metro's module cache
35
- global.__resetAllModules();
29
+ modulesCache.clear();
30
+ mockRegistry.clear();
36
31
  };
37
32
  const mockRequire = (moduleId) => {
38
33
  // babel plugin will transform 'moduleId' to a number
39
- const mockedModule = getMockImplementation(moduleId);
40
- if (mockedModule) {
34
+ const moduleIdNumber = moduleId;
35
+ const cachedModule = modulesCache.get(moduleIdNumber);
36
+ if (cachedModule) {
37
+ return cachedModule;
38
+ }
39
+ if (isModuleMocked(moduleIdNumber)) {
40
+ const mockedModule = getMockImplementation(moduleIdNumber);
41
+ modulesCache.set(moduleIdNumber, mockedModule);
41
42
  return mockedModule;
42
43
  }
43
- return originalRequire(moduleId);
44
+ const originalModule = originalRequire(moduleIdNumber);
45
+ modulesCache.set(moduleIdNumber, originalModule);
46
+ return originalModule;
44
47
  };
45
48
  Object.setPrototypeOf(mockRequire, Object.getPrototypeOf(originalRequire));
46
49
  Object.defineProperties(mockRequire, Object.getOwnPropertyDescriptors(originalRequire));
@@ -0,0 +1,7 @@
1
+ import { HostInstance } from 'react-native';
2
+ export declare const setRoot: (rootInstance: HostInstance) => void;
3
+ declare const queryByTestId: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default | null, queryAllByTestId: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default[], getByTestId: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default | null, getAllByTestId: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default[], findByTestId: (params: string) => Promise<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>, findAllByTestId: (params: string) => Promise<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default[]>;
4
+ declare const queryById: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default | null, queryAllById: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default[], getId: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default | null, getAllById: (params: string) => import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default[], findById: (params: string) => Promise<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>, findAllById: (params: string) => Promise<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default[]>;
5
+ export { queryByTestId, queryAllByTestId, getByTestId, getAllByTestId, findByTestId, findAllByTestId, };
6
+ export { queryById, queryAllById, getId, getAllById, findById, findAllById };
7
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/render/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM5C,eAAO,MAAM,OAAO,GAAI,cAAc,YAAY,SAEjD,CAAC;AA6IF,QAAA,MACW,aAAa,8HACV,gBAAgB,yHACrB,WAAW,8HACR,cAAc,yHAChB,YAAY,gIACT,eAAe,gIAG3B,CAAC;AACF,QAAA,MACW,SAAS,8HACN,YAAY,yHACjB,KAAK,8HACF,UAAU,yHACZ,QAAQ,gIACL,WAAW,gIAC+B,CAAC;AAExD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,eAAe,GAChB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,99 @@
1
+ // import { store } from '../ui/state.js';
2
+ import { waitUntil } from '../waitFor.js';
3
+ let root = null;
4
+ export const setRoot = (rootInstance) => {
5
+ root = rootInstance;
6
+ };
7
+ const getRoot = () => {
8
+ const container = root;
9
+ if (!container) {
10
+ throw new Error('You need to render a component first!');
11
+ }
12
+ const ownerDocument = container.ownerDocument;
13
+ if (!ownerDocument) {
14
+ throw new Error('This feature is supported in React Native 0.82 and later!');
15
+ }
16
+ return ownerDocument.getRootNode();
17
+ };
18
+ const findNodeByPredicate = (predicate) => {
19
+ const queue = [getRoot()];
20
+ while (queue.length > 0) {
21
+ const node = queue.shift();
22
+ if (predicate(node)) {
23
+ return node;
24
+ }
25
+ for (const child of node.children) {
26
+ queue.push(child);
27
+ }
28
+ }
29
+ return null;
30
+ };
31
+ const findNodesByPredicate = (predicate) => {
32
+ const nodes = [];
33
+ const queue = [getRoot()];
34
+ while (queue.length > 0) {
35
+ const node = queue.shift();
36
+ if (predicate(node)) {
37
+ nodes.push(node);
38
+ }
39
+ for (const child of node.children) {
40
+ queue.push(child);
41
+ }
42
+ }
43
+ return nodes;
44
+ };
45
+ const getFiberOfHostInstance = (hostInstance) => {
46
+ // This should be considered as 'reaching into the implementation details' of React Native.
47
+ // Not perfect, but it's the only way to get the props of the host instance.
48
+ return (hostInstance
49
+ .__internalInstanceHandle || null);
50
+ };
51
+ const getPropsOfHostInstance = (hostInstance) => {
52
+ return getFiberOfHostInstance(hostInstance)?.memoizedProps || {};
53
+ };
54
+ const findBy = (predicate, options) => {
55
+ return waitUntil(() => findNodeByPredicate(predicate), options);
56
+ };
57
+ const findAllBy = (predicate, options) => {
58
+ return waitUntil(() => {
59
+ const nodes = findNodesByPredicate(predicate);
60
+ if (nodes.length === 0) {
61
+ return null;
62
+ }
63
+ return nodes;
64
+ }, options);
65
+ };
66
+ const queryBy = (predicate) => {
67
+ return findNodeByPredicate(predicate);
68
+ };
69
+ const queryAllBy = (predicate) => {
70
+ return findNodesByPredicate(predicate);
71
+ };
72
+ const getBy = (predicate) => {
73
+ const node = queryBy(predicate);
74
+ if (!node) {
75
+ throw new Error(`No node found with predicate ${predicate}`);
76
+ }
77
+ return node;
78
+ };
79
+ const getAllBy = (predicate) => {
80
+ const nodes = queryAllBy(predicate);
81
+ if (nodes.length === 0) {
82
+ throw new Error(`No nodes found with predicate ${predicate}`);
83
+ }
84
+ return nodes;
85
+ };
86
+ const createQueries = (predicate) => {
87
+ return {
88
+ findBy: (params) => findBy((node) => predicate(node, params)),
89
+ findAllBy: (params) => findAllBy((node) => predicate(node, params)),
90
+ queryBy: (params) => queryBy((node) => predicate(node, params)),
91
+ queryAllBy: (params) => queryAllBy((node) => predicate(node, params)),
92
+ getBy: (params) => getBy((node) => predicate(node, params)),
93
+ getAllBy: (params) => getAllBy((node) => predicate(node, params)),
94
+ };
95
+ };
96
+ const { queryBy: queryByTestId, queryAllBy: queryAllByTestId, getBy: getByTestId, getAllBy: getAllByTestId, findBy: findByTestId, findAllBy: findAllByTestId, } = createQueries((node, testId) => getPropsOfHostInstance(node).testID === testId);
97
+ const { queryBy: queryById, queryAllBy: queryAllById, getBy: getId, getAllBy: getAllById, findBy: findById, findAllBy: findAllById, } = createQueries((node, id) => node.id === id);
98
+ export { queryByTestId, queryAllByTestId, getByTestId, getAllByTestId, findByTestId, findAllByTestId, };
99
+ export { queryById, queryAllById, getId, getAllById, findById, findAllById };
@@ -0,0 +1,10 @@
1
+ export type HarnessContext = {
2
+ testFilePath: string;
3
+ runner: string;
4
+ };
5
+ declare global {
6
+ var HARNESS_CONTEXT: HarnessContext;
7
+ }
8
+ export declare const getHarnessContext: () => HarnessContext;
9
+ export declare const setHarnessContext: (context: HarnessContext) => void;
10
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runner/context.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,eAAe,EAAE,cAAc,CAAC;CACrC;AAED,eAAO,MAAM,iBAAiB,QAAO,cAEpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,cAAc,KAAG,IAE3D,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const getHarnessContext = () => {
2
+ return globalThis['HARNESS_CONTEXT'];
3
+ };
4
+ export const setHarnessContext = (context) => {
5
+ globalThis['HARNESS_CONTEXT'] = context;
6
+ };
@@ -0,0 +1,8 @@
1
+ import type { ElementReference, FileReference } from '@react-native-harness/bridge';
2
+ export type Screen = {
3
+ findByTestId: (testId: string) => Promise<ElementReference>;
4
+ findAllByTestId: (testId: string) => Promise<ElementReference[]>;
5
+ screenshot: (name?: string) => Promise<FileReference>;
6
+ };
7
+ export declare const screen: Screen;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/screen/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAGtC,MAAM,MAAM,MAAM,GAAG;IACnB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACjE,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACvD,CAAC;AAmBF,eAAO,MAAM,MAAM,QAAiB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { getClientInstance } from '../client/store.js';
2
+ const createScreen = () => {
3
+ return {
4
+ findByTestId: async (testId) => {
5
+ const client = getClientInstance();
6
+ return await client.rpc['platform.queries.findByTestId'](testId);
7
+ },
8
+ findAllByTestId: async (testId) => {
9
+ const client = getClientInstance();
10
+ return await client.rpc['platform.queries.findAllByTestId'](testId);
11
+ },
12
+ screenshot: async () => {
13
+ const client = getClientInstance();
14
+ return await client.rpc['platform.actions.screenshot']();
15
+ },
16
+ };
17
+ };
18
+ export const screen = createScreen();