@react-native-harness/runtime 1.0.0-canary.1761733411323 → 1.0.0-canary.1764675030942
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.
- package/dist/client/store.d.ts +4 -0
- package/dist/client/store.d.ts.map +1 -0
- package/dist/client/store.js +10 -0
- package/dist/expect/expect.d.ts +9 -0
- package/dist/expect/expect.d.ts.map +1 -0
- package/dist/expect/expect.js +77 -0
- package/dist/expect/matchers/toMatchImageSnapshot.d.ts +12 -0
- package/dist/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
- package/dist/expect/matchers/toMatchImageSnapshot.js +11 -0
- package/dist/render/queries.d.ts +7 -0
- package/dist/render/queries.d.ts.map +1 -0
- package/dist/render/queries.js +99 -0
- package/dist/runner/context.d.ts +10 -0
- package/dist/runner/context.d.ts.map +1 -0
- package/dist/runner/context.js +6 -0
- package/dist/screen/index.d.ts +8 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/dist/screen/index.js +18 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/ui/state.d.ts +2 -2
- package/dist/userEvent/index.d.ts +6 -0
- package/dist/userEvent/index.d.ts.map +1 -0
- package/dist/userEvent/index.js +10 -0
- package/out-tsc/vitest/src/bundler/bundle.d.ts.map +1 -1
- package/out-tsc/vitest/src/bundler/evaluate.d.ts.map +1 -1
- package/out-tsc/vitest/src/client/factory.d.ts.map +1 -1
- package/out-tsc/vitest/src/client/setup-files.d.ts +12 -0
- package/out-tsc/vitest/src/client/setup-files.d.ts.map +1 -0
- package/out-tsc/vitest/src/client/store.d.ts +4 -0
- package/out-tsc/vitest/src/client/store.d.ts.map +1 -0
- package/out-tsc/vitest/src/collector/functions.d.ts +1 -1
- package/out-tsc/vitest/src/collector/functions.d.ts.map +1 -1
- package/out-tsc/vitest/src/collector/types.d.ts +1 -1
- package/out-tsc/vitest/src/collector/types.d.ts.map +1 -1
- package/out-tsc/vitest/src/constants.d.ts +0 -1
- package/out-tsc/vitest/src/constants.d.ts.map +1 -1
- package/out-tsc/vitest/src/expect/index.d.ts +5 -0
- package/out-tsc/vitest/src/expect/index.d.ts.map +1 -1
- package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts +7 -0
- package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
- package/out-tsc/vitest/src/index.d.ts +4 -0
- package/out-tsc/vitest/src/index.d.ts.map +1 -1
- package/out-tsc/vitest/src/jest-mock.d.ts +2 -0
- package/out-tsc/vitest/src/jest-mock.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/ErrorBoundary.d.ts +17 -0
- package/out-tsc/vitest/src/render/ErrorBoundary.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts +3 -0
- package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/cleanup.d.ts +2 -0
- package/out-tsc/vitest/src/render/cleanup.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/index.d.ts +6 -0
- package/out-tsc/vitest/src/render/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/setup.d.ts +2 -0
- package/out-tsc/vitest/src/render/setup.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/types.d.ts +12 -0
- package/out-tsc/vitest/src/render/types.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/factory.d.ts.map +1 -1
- package/out-tsc/vitest/src/screen/index.d.ts +8 -0
- package/out-tsc/vitest/src/screen/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/ui/ReadyScreen.d.ts.map +1 -1
- package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts.map +1 -1
- package/out-tsc/vitest/src/ui/state.d.ts +13 -0
- package/out-tsc/vitest/src/ui/state.d.ts.map +1 -1
- package/out-tsc/vitest/src/userEvent/index.d.ts +6 -0
- package/out-tsc/vitest/src/userEvent/index.d.ts.map +1 -0
- package/out-tsc/vitest/tsconfig.spec.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -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,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
|
+
}
|
|
@@ -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,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();
|