Optional ReadonlyonFlow
onFlow?: (
file: string,
flow:
| {
app?: | { connect: { pid?: number } }
| {
launch: {
allowEval?: boolean;
allowPackaged?: boolean;
args?: string[];
cwd?: string;
env?: Record<string, string>;
executable: string;
strategy?: "node-options" | "inspector" | "auto";
timeoutMs?: number;
};
};
description?: string;
name: string;
steps: (
| {
act: | {
button?: "left"
| "right"
| "middle";
clickCount?: number;
locator: {
css?: (...) | (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
modifiers?: (...)[];
type: "click";
}
| {
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "hover";
}
| {
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "fill";
value: string;
}
| { fields: { locator: ...; value: ... }[]; type: "fillForm" }
| {
locator?: {
css?: ...;
exact?: ...;
name?: ...;
nth?: ...;
ref?: ...;
role?: ...;
text?: ...;
};
text: string;
type: "type";
}
| {
key: string;
locator?: {
css?: ...;
exact?: ...;
name?: ...;
nth?: ...;
ref?: ...;
role?: ...;
text?: ...;
};
type: "press";
}
| {
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "check";
}
| {
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "uncheck";
}
| {
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "select";
values: string[];
}
| {
deltaX?: number;
deltaY?: number;
locator?: {
css?: ...;
exact?: ...;
name?: ...;
nth?: ...;
ref?: ...;
role?: ...;
text?: ...;
};
type: "scroll";
}
| {
files: string[];
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "upload";
}
| {
from: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
to: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
type: "drag";
}
| (
| {
button?: ...;
clickCount?: ...;
locator: ...;
modifiers?: ...;
type: ...;
}
| { locator: ...; type: ... }
| { locator: ...; type: ...; value: ... }
| { fields: ...; type: ... }
| { locator?: ...; text: ...; type: ... }
| { key: ...; locator?: ...; type: ... }
| { locator: ...; type: ... }
| { locator: ...; type: ... }
| { locator: ...; type: ...; values: ... }
| { deltaX?: ...; deltaY?: ...; locator?: ...; type: ... }
| { files: ...; locator: ...; type: ... }
| { from: ...; to: ...; type: ... }
)[];
continueOnError?: boolean;
name?: string;
target?: string;
timeoutMs?: number;
}
| {
continueOnError?: boolean;
name?: string;
target?: string;
timeoutMs?: number;
wait: | {
kind: "element";
locator: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
state?: "visible"
| "detached"
| "enabled"
| "attached"
| "hidden";
}
| { kind: "text"; present?: boolean; text: string }
| { contains: string; kind: "url" }
| { channel: string; kind: "ipc" }
| { idleMs?: number; kind: "networkIdle" }
| { equals: {} | null; kind: "state"; path: string; store?: string };
}
| {
continueOnError?: boolean;
expect: | {
element: {
css?: (...)
| (...);
exact?: (...) | (...) | (...);
name?: (...) | (...);
nth?: (...) | (...);
ref?: (...) | (...);
role?: (...) | (...);
text?: (...) | (...);
};
state?: "visible"
| "detached"
| "enabled"
| "attached"
| "hidden";
}
| { present?: boolean; text: string }
| { url: { contains: string } }
| {
state: {
equals: (...) | (...);
path: string;
store?: (...) | (...);
};
}
| { ipc: { channel: string; min?: (...)
| (...) } }
| { noConsoleErrors: true };
name?: string;
target?: string;
timeoutMs?: number;
}
| {
continueOnError?: boolean;
name?: string;
stub: {
method: "showOpenDialog"
| "showSaveDialog"
| "showMessageBox";
response: Record<string, unknown>;
times?: number;
};
target?: string;
timeoutMs?: number;
}
| {
continueOnError?: boolean;
menu: string[]
| { id: string };
name?: string;
target?: string;
timeoutMs?: number;
}
| {
continueOnError?: boolean;
name?: string;
target?: string;
timeoutMs?: number;
window: {
action: | "focus"
| "show"
| "hide"
| "minimize"
| "maximize"
| "restore"
| "close"
| "setBounds";
bounds?: {
height?: (...)
| (...);
width?: (...) | (...);
x?: (...) | (...);
y?: (...) | (...);
};
id?: number;
};
}
| {
continueOnError?: boolean;
name?: string;
reset: true;
target?: string;
timeoutMs?: number;
}
| {
continueOnError?: boolean;
name?: string;
screenshot: { file?: string };
target?: string;
timeoutMs?: number;
}
)[];
target?: string;
timeoutMs?: number;
}
| undefined,
) => void
For
${env.NAME}in flows. Defaultprocess.env.