@fliwright/vitest 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +14 -2
- package/dist/AttemptContext.d.ts +78 -0
- package/dist/AttemptContext.js +301 -0
- package/dist/FinalizationBudget.d.ts +15 -0
- package/dist/FinalizationBudget.js +57 -0
- package/dist/RecoveryReporter.d.ts +6 -0
- package/dist/RecoveryReporter.js +15 -0
- package/dist/TaskEndpointLease.d.ts +12 -0
- package/dist/TaskEndpointLease.js +65 -0
- package/dist/TaskManagedApp.d.ts +5 -0
- package/dist/TaskManagedApp.js +26 -0
- package/dist/TaskNativeSession.d.ts +17 -0
- package/dist/TaskNativeSession.js +140 -0
- package/dist/TaskScenarioPreparation.d.ts +14 -0
- package/dist/TaskScenarioPreparation.js +29 -0
- package/dist/TestRegistration.d.ts +8 -0
- package/dist/TestRegistration.js +52 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +791 -0
- package/dist/preset.d.ts +19 -0
- package/dist/preset.js +28 -0
- package/dist/reporter.d.ts +5 -0
- package/dist/reporter.js +20 -0
- package/dist/runner.d.ts +24 -0
- package/dist/runner.js +370 -0
- package/dist/setup.d.ts +7 -0
- package/dist/setup.js +15 -0
- package/package.json +59 -3
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { NativeError, createAndroidAppReadback, fingerprintScenario, getAndroidScenarioPermissions } from '@fliwright/core';
|
|
2
|
+
import { openNativeDevice } from '@fliwright/native';
|
|
3
|
+
import { requireAttemptContext } from './AttemptContext.js';
|
|
4
|
+
const nativeKey = Symbol.for('@fliwright/vitest/task-native-session');
|
|
5
|
+
const stateFor = (task) => task[nativeKey];
|
|
6
|
+
export function hasTaskNativeRuntime(task) { return !!stateFor(task)?.runtime; }
|
|
7
|
+
/** Called before acquiring the endpoint so separate VM URLs cannot bypass device exclusion. */
|
|
8
|
+
export async function prepareTaskNativeSession(task, config, signal, provider = openNativeDevice) {
|
|
9
|
+
if (!config?.enabled)
|
|
10
|
+
return;
|
|
11
|
+
const existing = stateFor(task);
|
|
12
|
+
if (existing) {
|
|
13
|
+
if (existing.quarantined)
|
|
14
|
+
throw new NativeError('cleanup_failed', 'Managed app cleanup was not confirmed; restore the device before starting another attempt.');
|
|
15
|
+
if (existing.config !== JSON.stringify(config))
|
|
16
|
+
throw new NativeError('device_mismatch', 'Native configuration changed while this test owns the device.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const owner = await provider(config, { signal });
|
|
20
|
+
if (signal.aborted) {
|
|
21
|
+
await owner.dispose();
|
|
22
|
+
throw new NativeError('cancelled', 'Native preparation cancelled.');
|
|
23
|
+
}
|
|
24
|
+
task[nativeKey] = { owner, config: JSON.stringify(config) };
|
|
25
|
+
}
|
|
26
|
+
export async function quarantineTaskNativeSession(task) {
|
|
27
|
+
const state = stateFor(task);
|
|
28
|
+
if (!state)
|
|
29
|
+
return;
|
|
30
|
+
state.quarantined = true;
|
|
31
|
+
if (!state.owner.quarantine)
|
|
32
|
+
throw new NativeError('cleanup_failed', 'Native device provider cannot quarantine unconfirmed app cleanup.');
|
|
33
|
+
await state.owner.quarantine('Managed app connection cleanup was not confirmed.');
|
|
34
|
+
}
|
|
35
|
+
export async function taskNativeRuntime(task, session, attemptId) {
|
|
36
|
+
const state = stateFor(task);
|
|
37
|
+
if (!state)
|
|
38
|
+
throw new NativeError('precondition_failed', 'Enable native automation and select a device/target app in the run configuration before using native or device fixtures.');
|
|
39
|
+
if (state.runtime && state.attemptId !== attemptId)
|
|
40
|
+
throw new NativeError('precondition_failed', 'The preceding native attempt was not cleaned up.');
|
|
41
|
+
if (!state.runtime) {
|
|
42
|
+
state.runtime = await state.owner.createRuntime({ signal: task.context.signal, runtime: { runSession: session } });
|
|
43
|
+
state.attemptId = attemptId;
|
|
44
|
+
}
|
|
45
|
+
return state.runtime;
|
|
46
|
+
}
|
|
47
|
+
export async function verifyTaskNativeBinding(task, driver, attemptId, scenario) {
|
|
48
|
+
const state = stateFor(task);
|
|
49
|
+
const attempt = requireAttemptContext(task), expected = attempt.managedApp?.nativeApp;
|
|
50
|
+
if (!state) {
|
|
51
|
+
if (expected)
|
|
52
|
+
throw new NativeError('precondition_failed', 'Android app readback requires the current native owner.');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (state.bindingAttemptId === attemptId)
|
|
56
|
+
return;
|
|
57
|
+
const signal = AbortSignal.any([task.context.signal, AbortSignal.timeout(expected ? 30000 : 5000)]);
|
|
58
|
+
let abort;
|
|
59
|
+
try {
|
|
60
|
+
const vm = await Promise.race([driver.sendRequest('getVM'), new Promise((_, reject) => {
|
|
61
|
+
abort = () => reject(new NativeError('device_mismatch', 'Flutter VM process identity could not be read within the binding budget.'));
|
|
62
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
63
|
+
if (signal.aborted)
|
|
64
|
+
abort();
|
|
65
|
+
})]);
|
|
66
|
+
const pid = vm && typeof vm === 'object' && 'pid' in vm ? vm.pid : undefined;
|
|
67
|
+
await state.owner.verifyAppProcess(pid, { signal });
|
|
68
|
+
if (expected) {
|
|
69
|
+
const node = attempt.recorder.startNode('step', 'Android app readback');
|
|
70
|
+
try {
|
|
71
|
+
if (!state.runtime || state.attemptId !== attemptId || !state.owner.inspectAppState || pid !== expected.pid) {
|
|
72
|
+
throw new NativeError('device_mismatch', 'Android app readback requires independent current process and native observation.');
|
|
73
|
+
}
|
|
74
|
+
const context = { attemptKey: `${attempt.runId}/${task.id}/${attemptId}`, attemptId,
|
|
75
|
+
managedAppGeneration: attempt.managedApp.generation, signal,
|
|
76
|
+
get scenarioFingerprint() { return scenario ? fingerprintScenario(scenario) : undefined; },
|
|
77
|
+
get permissionDeclaration() { return getAndroidScenarioPermissions(scenario); },
|
|
78
|
+
get identity() {
|
|
79
|
+
if (!state.runtime || state.attemptId !== attemptId)
|
|
80
|
+
throw new NativeError('device_mismatch', 'Android app readback runtime identity changed.');
|
|
81
|
+
return state.runtime.adapter.identity;
|
|
82
|
+
}, };
|
|
83
|
+
const readback = createAndroidAppReadback(expected, context, () => state.owner.inspectAppState(expected.permissions.map(item => item.permission), { signal, timeout: 30000 }));
|
|
84
|
+
attempt.androidReadback = await readback.consume(context);
|
|
85
|
+
attempt.recorder.passNode(node.id, { ...attempt.androidReadback });
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
attempt.recorder.failNode(node.id, { code: 'unknown', title: 'Android app readback', message: 'Independent Android app readback failed.', recoveryHints: [] });
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
signal.throwIfAborted();
|
|
93
|
+
state.bindingAttemptId = attemptId;
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
if (abort)
|
|
97
|
+
signal.removeEventListener('abort', abort);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export async function disposeTaskNativeAttempt(task) {
|
|
101
|
+
const state = stateFor(task);
|
|
102
|
+
if (!state?.runtime)
|
|
103
|
+
return;
|
|
104
|
+
try {
|
|
105
|
+
await state.runtime.dispose();
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
state.runtime = undefined;
|
|
109
|
+
state.attemptId = undefined;
|
|
110
|
+
state.bindingAttemptId = undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Release last, after endpoint ownership and all attempt evidence have finished. */
|
|
114
|
+
export async function releaseTaskNativeSession(task) {
|
|
115
|
+
const state = stateFor(task);
|
|
116
|
+
if (!state)
|
|
117
|
+
return;
|
|
118
|
+
const errors = [];
|
|
119
|
+
try {
|
|
120
|
+
try {
|
|
121
|
+
await disposeTaskNativeAttempt(task);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
errors.push(error);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
await state.owner.dispose();
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
errors.push(error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
delete task[nativeKey];
|
|
135
|
+
}
|
|
136
|
+
if (errors.length === 1)
|
|
137
|
+
throw errors[0];
|
|
138
|
+
if (errors.length)
|
|
139
|
+
throw new AggregateError(errors, 'Native attempt and device ownership cleanup failed.');
|
|
140
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type NativeConfig, type TestScenario, type ScenarioExecutionMode } from '@fliwright/core';
|
|
2
|
+
import type { RunnerTestCase } from 'vitest';
|
|
3
|
+
/** Worker-only declaration metadata, retained by fixture extension and omitted from JSON. */
|
|
4
|
+
export declare const taskScenarioKey: unique symbol;
|
|
5
|
+
export declare function taskScenario(task: RunnerTestCase, config: {
|
|
6
|
+
defaultScenario?: string;
|
|
7
|
+
scenarios?: Record<string, TestScenario>;
|
|
8
|
+
}): TestScenario | undefined;
|
|
9
|
+
export declare function validateTaskDeviceScenario(scenario: TestScenario | undefined, native: NativeConfig | undefined): void;
|
|
10
|
+
/** First setup runs outside the body timeout; automatic fixtures repeat this for retries. */
|
|
11
|
+
export declare function prepareTaskDeviceScenario(task: RunnerTestCase, scenario: TestScenario | undefined, config: {
|
|
12
|
+
native?: NativeConfig;
|
|
13
|
+
scenarioMode?: ScenarioExecutionMode;
|
|
14
|
+
}, signal: AbortSignal): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { prepareScenarioDevice, ScenarioPreparationError, ScenarioResolver, validateScenarioDevicePreparation } from '@fliwright/core';
|
|
2
|
+
import { requireAttemptContext } from './AttemptContext.js';
|
|
3
|
+
import { taskNativeRuntime } from './TaskNativeSession.js';
|
|
4
|
+
/** Worker-only declaration metadata, retained by fixture extension and omitted from JSON. */
|
|
5
|
+
export const taskScenarioKey = Symbol.for('@fliwright/vitest/task-scenario');
|
|
6
|
+
export function taskScenario(task, config) {
|
|
7
|
+
const explicit = task.meta[taskScenarioKey];
|
|
8
|
+
return explicit ?? (config.defaultScenario ? new ScenarioResolver(config.scenarios ?? {}).resolve(config.defaultScenario) : undefined);
|
|
9
|
+
}
|
|
10
|
+
export function validateTaskDeviceScenario(scenario, native) {
|
|
11
|
+
if (!scenario || !validateScenarioDevicePreparation(scenario))
|
|
12
|
+
return;
|
|
13
|
+
if (!native?.enabled)
|
|
14
|
+
throw new ScenarioPreparationError(`Scenario '${scenario.name}' device preparation requires enabled native automation.`);
|
|
15
|
+
}
|
|
16
|
+
/** First setup runs outside the body timeout; automatic fixtures repeat this for retries. */
|
|
17
|
+
export async function prepareTaskDeviceScenario(task, scenario, config, signal) {
|
|
18
|
+
validateTaskDeviceScenario(scenario, config.native);
|
|
19
|
+
if (!scenario || !scenario.layers.some(layer => layer.kind === 'device'))
|
|
20
|
+
return;
|
|
21
|
+
const attempt = requireAttemptContext(task);
|
|
22
|
+
if (attempt.devicePreparation)
|
|
23
|
+
return;
|
|
24
|
+
const runtime = await taskNativeRuntime(task, attempt.session, attempt.attemptId);
|
|
25
|
+
attempt.devicePreparation = await prepareScenarioDevice(scenario, runtime, {
|
|
26
|
+
mode: config.scenarioMode ?? 'attach', attemptId: attempt.attemptId, signal,
|
|
27
|
+
managedAppGeneration: attempt.managedApp?.generation,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RunnerTask, RunnerTestCase, TaskMeta, TestAPI } from 'vitest';
|
|
2
|
+
type PrepareTask = (task: RunnerTestCase, signal: AbortSignal) => Promise<void>;
|
|
3
|
+
/** Bind preparation through public test metadata without wrapping the body.
|
|
4
|
+
* Symbol keys stay within the worker and are omitted from reporter serialization.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withTaskPreparation<T extends object>(test: TestAPI<T>, prepare: PrepareTask, metadata?: Partial<TaskMeta>): TestAPI<T>;
|
|
7
|
+
export declare function prepareRegisteredTask(task: RunnerTask, signal: AbortSignal): Promise<void>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const prepareKey = Symbol.for('@fliwright/vitest/prepare-task');
|
|
2
|
+
/** Bind preparation through public test metadata without wrapping the body.
|
|
3
|
+
* Symbol keys stay within the worker and are omitted from reporter serialization.
|
|
4
|
+
*/
|
|
5
|
+
export function withTaskPreparation(test, prepare, metadata = {}) {
|
|
6
|
+
const proxies = new WeakMap();
|
|
7
|
+
const variants = new Set(['concurrent', 'skip', 'only', 'todo', 'fails']);
|
|
8
|
+
const factories = new Set(['each', 'for', 'skipIf', 'runIf', 'extend']);
|
|
9
|
+
const wrap = (target) => {
|
|
10
|
+
const existing = proxies.get(target);
|
|
11
|
+
if (existing)
|
|
12
|
+
return existing;
|
|
13
|
+
const proxy = new Proxy(target, {
|
|
14
|
+
apply(fn, receiver, args) {
|
|
15
|
+
const [name, optionsOrHandler, handlerOrTimeout] = args;
|
|
16
|
+
// Let Vitest reject removed overloads and malformed handler pairs.
|
|
17
|
+
if ((typeof handlerOrTimeout === 'object' && handlerOrTimeout !== null)
|
|
18
|
+
|| (typeof optionsOrHandler === 'function' && typeof handlerOrTimeout === 'function')) {
|
|
19
|
+
return Reflect.apply(fn, receiver, args);
|
|
20
|
+
}
|
|
21
|
+
const options = typeof optionsOrHandler === 'object' && optionsOrHandler !== null
|
|
22
|
+
? optionsOrHandler
|
|
23
|
+
: typeof handlerOrTimeout === 'number' ? { timeout: handlerOrTimeout } : {};
|
|
24
|
+
const handler = typeof optionsOrHandler === 'function' ? optionsOrHandler : handlerOrTimeout;
|
|
25
|
+
return Reflect.apply(fn, receiver, [name, {
|
|
26
|
+
...options, meta: { ...options.meta, ...metadata, [prepareKey]: prepare },
|
|
27
|
+
}, handler]);
|
|
28
|
+
},
|
|
29
|
+
get(fn, property, receiver) {
|
|
30
|
+
const value = Reflect.get(fn, property, receiver);
|
|
31
|
+
if (typeof value !== 'function')
|
|
32
|
+
return value;
|
|
33
|
+
if (typeof property === 'string' && variants.has(property))
|
|
34
|
+
return wrap(value);
|
|
35
|
+
if (typeof property === 'string' && factories.has(property)) {
|
|
36
|
+
return (...args) => {
|
|
37
|
+
const result = Reflect.apply(value, fn, args);
|
|
38
|
+
return typeof result === 'function' ? wrap(result) : result;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
proxies.set(target, proxy);
|
|
45
|
+
return proxy;
|
|
46
|
+
};
|
|
47
|
+
return wrap(test);
|
|
48
|
+
}
|
|
49
|
+
export async function prepareRegisteredTask(task, signal) {
|
|
50
|
+
if (task.type === 'test')
|
|
51
|
+
await task.meta[prepareKey]?.(task, signal);
|
|
52
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe } from 'vitest';
|
|
2
|
+
import { AgentRuntime, AssertRuntime, AiRuntime, Assertion, FliwrightDriver, FlowRuntime, MockRuntime, TimelineArtifactStore, NativeLocator, CameraTestController, BiometricTestController } from '@fliwright/core';
|
|
3
|
+
import type { NativeConfig, NativePage, DeviceController, NativeAssertion } from '@fliwright/core';
|
|
4
|
+
import type { AiRuntimeConfig, AgentPolicy, FliwrightLogger, FliwrightLogLevel, FliwrightPlugin, FliwrightRecordingConfig, Locator, Page, ScenarioExecutionMode, TestScenario, TimelineRunMode, TimelineRecorder } from '@fliwright/core';
|
|
5
|
+
import type { TestAPI } from 'vitest';
|
|
6
|
+
import { type NativeDeviceProvider } from './TaskNativeSession.js';
|
|
7
|
+
export { FliwrightRunner, createFliwrightRunner } from './runner.js';
|
|
8
|
+
export type { FliwrightRunnerOptions, FliwrightRunnerConstructor } from './runner.js';
|
|
9
|
+
export { fliwrightPreset } from './preset.js';
|
|
10
|
+
export { FliwrightRecoveryReporter } from './RecoveryReporter.js';
|
|
11
|
+
export type { FliwrightVitestPresetOptions } from './preset.js';
|
|
12
|
+
export type { NativeDeviceProvider } from './TaskNativeSession.js';
|
|
13
|
+
export type FliwrightLogFormat = 'pretty' | 'compact' | 'jsonl' | 'silent';
|
|
14
|
+
export type FliwrightLogOutput = 'stderr' | 'stdout' | 'file' | 'jsonl-file';
|
|
15
|
+
export interface FliwrightLogConfig {
|
|
16
|
+
level?: FliwrightLogLevel;
|
|
17
|
+
format?: FliwrightLogFormat;
|
|
18
|
+
outputs?: FliwrightLogOutput[];
|
|
19
|
+
filePath?: string;
|
|
20
|
+
jsonlPath?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FliwrightConfig {
|
|
23
|
+
native?: NativeConfig;
|
|
24
|
+
vmServiceUrl: string;
|
|
25
|
+
plugins?: FliwrightPlugin[];
|
|
26
|
+
timeout?: number;
|
|
27
|
+
screenshot?: 'file' | 'base64' | 'off';
|
|
28
|
+
ai?: AiRuntimeConfig;
|
|
29
|
+
mode?: TimelineRunMode;
|
|
30
|
+
requireAssertions?: boolean;
|
|
31
|
+
agentPolicy?: AgentPolicy;
|
|
32
|
+
timelineDir?: string;
|
|
33
|
+
runsRoot?: string;
|
|
34
|
+
cacheRoot?: string;
|
|
35
|
+
projectRoot?: string;
|
|
36
|
+
log?: FliwrightLogConfig;
|
|
37
|
+
/** Named, composable environment declarations used by `test.scenario(name)`. */
|
|
38
|
+
scenarios?: Record<string, TestScenario>;
|
|
39
|
+
/** Attach to an already running app, or prepare a waiting test-only app before its first frame. */
|
|
40
|
+
scenarioMode?: ScenarioExecutionMode;
|
|
41
|
+
defaultScenario?: string;
|
|
42
|
+
recording?: Partial<FliwrightRecordingConfig>;
|
|
43
|
+
}
|
|
44
|
+
export declare function defineConfig(overrides: Partial<FliwrightConfig> & {
|
|
45
|
+
vmServiceUrl: string;
|
|
46
|
+
}): FliwrightConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Decide where run artifacts go for a fliwright test run.
|
|
49
|
+
* Precedence is implemented by @fliwright/core:
|
|
50
|
+
* explicit config.runsRoot > FLIWRIGHT_RUNS_ROOT env > machine-local project partition.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveRunsRoot(config: {
|
|
53
|
+
runsRoot?: string;
|
|
54
|
+
projectRoot?: string;
|
|
55
|
+
}): string;
|
|
56
|
+
type FliwrightHookContext = {
|
|
57
|
+
page: Page;
|
|
58
|
+
};
|
|
59
|
+
type FliwrightHook = (context: FliwrightHookContext, suite: unknown) => unknown | Promise<unknown>;
|
|
60
|
+
interface FliwrightTimelineContext {
|
|
61
|
+
recorder: TimelineRecorder;
|
|
62
|
+
driver?: FliwrightDriver;
|
|
63
|
+
artifactStore: TimelineArtifactStore;
|
|
64
|
+
runId: string;
|
|
65
|
+
logger: FliwrightLogger;
|
|
66
|
+
timelinePath?: string;
|
|
67
|
+
runSession?: import('@fliwright/core').RunSession;
|
|
68
|
+
}
|
|
69
|
+
export interface FliwrightFixtures {
|
|
70
|
+
cameraTest: CameraTestController;
|
|
71
|
+
biometricTest: BiometricTestController;
|
|
72
|
+
native: NativePage;
|
|
73
|
+
device: DeviceController;
|
|
74
|
+
driver: FliwrightDriver;
|
|
75
|
+
page: Page;
|
|
76
|
+
aiRuntime: AiRuntime;
|
|
77
|
+
flow: FlowRuntime;
|
|
78
|
+
mock: MockRuntime;
|
|
79
|
+
agent: AgentRuntime;
|
|
80
|
+
assert: AssertRuntime;
|
|
81
|
+
timeline: FliwrightTimelineContext;
|
|
82
|
+
logger: FliwrightLogger;
|
|
83
|
+
}
|
|
84
|
+
export type FliwrightTest = TestAPI<FliwrightFixtures>;
|
|
85
|
+
/** Vitest registration API with a named environment selected, including for/each and modifiers. */
|
|
86
|
+
export type ScenarioTest<TFixtures extends FliwrightFixtures = FliwrightFixtures> = TestAPI<TFixtures>;
|
|
87
|
+
export interface ScenarioEnabledFliwrightTest<TFixtures extends FliwrightFixtures = FliwrightFixtures> extends TestAPI<TFixtures> {
|
|
88
|
+
scenario(name: string): ScenarioTest<TFixtures>;
|
|
89
|
+
}
|
|
90
|
+
export type FliwrightProjectFixtures = Record<string, (fixtures: FliwrightFixtures, use: (value: unknown) => Promise<void>) => Promise<void>>;
|
|
91
|
+
export interface CreateFliwrightTestOptions {
|
|
92
|
+
/** Custom platform integration; the provider must verify VM/device process binding. */
|
|
93
|
+
nativeDeviceProvider?: NativeDeviceProvider;
|
|
94
|
+
/** When set, fixtures use this driver instead of the worker's endpoint-specific cache. */
|
|
95
|
+
driverProvider?: (context: {
|
|
96
|
+
vmServiceUrl: string;
|
|
97
|
+
}) => Promise<FliwrightDriver>;
|
|
98
|
+
}
|
|
99
|
+
export declare function createFliwrightTest(config: FliwrightConfig, options?: CreateFliwrightTestOptions): ScenarioEnabledFliwrightTest;
|
|
100
|
+
export declare function extendFliwrightTest<TProjectFixtures extends Record<string, unknown>, TBaseFixtures extends FliwrightFixtures = FliwrightFixtures>(base: TestAPI<TBaseFixtures>, fixtures: {
|
|
101
|
+
[K in keyof TProjectFixtures]: (fixtures: Omit<TProjectFixtures, K> & TBaseFixtures, use: (value: TProjectFixtures[K]) => Promise<void>) => Promise<void>;
|
|
102
|
+
}): ScenarioEnabledFliwrightTest<TBaseFixtures & TProjectFixtures>;
|
|
103
|
+
export declare function createFliwrightScript(config: FliwrightConfig): ScenarioEnabledFliwrightTest<FliwrightFixtures>;
|
|
104
|
+
export declare const test: ScenarioEnabledFliwrightTest<FliwrightFixtures>;
|
|
105
|
+
export declare const script: ScenarioEnabledFliwrightTest<FliwrightFixtures>;
|
|
106
|
+
export declare function beforeEach(hook: FliwrightHook, timeout?: number): void;
|
|
107
|
+
export declare function afterEach(hook: FliwrightHook, timeout?: number): void;
|
|
108
|
+
export { afterAll, beforeAll, describe };
|
|
109
|
+
export declare function expect(locator: NativeLocator, title?: string): NativeAssertion;
|
|
110
|
+
export declare function expect(locator: Locator, title?: string): Assertion;
|