@testra-studio/kit 0.1.0 → 0.2.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/CHANGELOG.md +24 -0
- package/README.md +25 -2
- package/dist/actions.d.ts +109 -0
- package/dist/actions.js +117 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/plain.d.ts +14 -1
- package/dist/plain.js +41 -3
- package/package.json +3 -3
- package/schemas/steps.schema.json +366 -16
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,30 @@ A major version (or, before 1.0, a minor one) changes a format or a
|
|
|
5
5
|
variable e2e Studio and the project share; the Studio's project check names
|
|
6
6
|
the oldest kit it works with.
|
|
7
7
|
|
|
8
|
+
## 0.2.1
|
|
9
|
+
|
|
10
|
+
- Works with the e2e framework 0.22 and 0.23 (and `@e2e-dev/mobile` 0.12.6)
|
|
11
|
+
as well as 0.21: the peer range is `^0.21.3 || ^0.22.0 || ^0.23.0`.
|
|
12
|
+
|
|
13
|
+
What a project does: nothing, unless it upgrades the framework; then it can
|
|
14
|
+
take this version with it.
|
|
15
|
+
|
|
16
|
+
## 0.2.0
|
|
17
|
+
|
|
18
|
+
- A Do step may keep the `actions` it was recorded with in e2e Studio:
|
|
19
|
+
tap, doubleTap, fill, type, select, check, uncheck, press and key, each
|
|
20
|
+
on an element as a structured target (a role and name, a test id, a
|
|
21
|
+
placeholder, an id or a text, inside its frame, dialog and row).
|
|
22
|
+
`runSteps()` does them on the exact elements, with no model call, and
|
|
23
|
+
falls back to the agent and the step's sentence when one is not there.
|
|
24
|
+
- `runSteps()` takes `{ agent, screen, browser }`, which the actions need;
|
|
25
|
+
given the agent alone, as before, every Do step is the agent's.
|
|
26
|
+
- The steps schema has `actions` on Do steps.
|
|
27
|
+
|
|
28
|
+
What a project does: pass `{ agent, screen, browser }` to `runSteps()` in a
|
|
29
|
+
web project's `support/plain.ts`. Nothing else changes; steps files without
|
|
30
|
+
actions run as they did.
|
|
31
|
+
|
|
8
32
|
## 0.1.0
|
|
9
33
|
|
|
10
34
|
The first version, moved out of a project's own test kit so any project on
|
package/README.md
CHANGED
|
@@ -55,9 +55,10 @@ const options: PlainOptions = {
|
|
|
55
55
|
export function plainTest(testFile: string): void {
|
|
56
56
|
const plain = loadPlainTest(testFile, options);
|
|
57
57
|
const missing = missingFeatures(plain, options);
|
|
58
|
-
test(plain.title, missing.length ? { skip: `lacks ${missing.join(', ')}` } : {}, async ({ app, agent }) => {
|
|
58
|
+
test(plain.title, missing.length ? { skip: `lacks ${missing.join(', ')}` } : {}, async ({ app, agent, screen, browser }) => {
|
|
59
59
|
await app.open();
|
|
60
|
-
|
|
60
|
+
// screen and browser let recorded steps run on their exact elements; a mobile project passes the agent alone.
|
|
61
|
+
await runSteps({ agent, screen, browser }, plain, options);
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
```
|
|
@@ -72,6 +73,28 @@ plainTest(import.meta.url);
|
|
|
72
73
|
Building blocks and checks are listed in `e2e-studio.blocks.json`, beside
|
|
73
74
|
`e2e.config.ts`.
|
|
74
75
|
|
|
76
|
+
### Recorded steps
|
|
77
|
+
|
|
78
|
+
A Do step recorded in e2e Studio keeps what it did, on the exact elements:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"do": "Search for pump",
|
|
83
|
+
"actions": [
|
|
84
|
+
{ "fill": { "role": "searchbox", "name": "Search" }, "value": "pump" },
|
|
85
|
+
{ "press": { "role": "searchbox", "name": "Search" }, "key": "Enter" }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`runSteps()` does the actions through the web engine's `screen` and
|
|
91
|
+
`browser`, with no model call. When one of them is not found within 15
|
|
92
|
+
seconds (the screen changed since it was recorded), the step falls back to
|
|
93
|
+
the agent and its sentence, and the run log says which step did. An element
|
|
94
|
+
is structured, never code: a role with its name (or `nameStarts`), else a
|
|
95
|
+
`testId`, `placeholder`, `id` or `text`, with the `frame`, `dialog` and
|
|
96
|
+
`row` it is in.
|
|
97
|
+
|
|
75
98
|
## Basic data
|
|
76
99
|
|
|
77
100
|
`readBasicData({ dir, instance, fromEnv })` takes each item, listed in
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recorded actions: what a Do step recorded in e2e Studio did, kept in the
|
|
3
|
+
* steps file so a run does it on the exact elements (`StepAction`), with the
|
|
4
|
+
* element as a structured target (`StepTarget`) the kit builds the web
|
|
5
|
+
* engine's locator from. Nothing here evaluates code from the file.
|
|
6
|
+
*
|
|
7
|
+
* { "do": "Search for pump", "actions": [
|
|
8
|
+
* { "fill": { "role": "searchbox", "name": "Search" }, "value": "pump" },
|
|
9
|
+
* { "press": { "role": "searchbox", "name": "Search" }, "key": "Enter" } ] }
|
|
10
|
+
*/
|
|
11
|
+
/** An element, as the web engine finds it: one way, inside its frame, dialog and row. */
|
|
12
|
+
export interface StepTarget {
|
|
13
|
+
readonly role?: string;
|
|
14
|
+
readonly name?: string;
|
|
15
|
+
/** How a long name starts. */
|
|
16
|
+
readonly nameStarts?: string;
|
|
17
|
+
readonly testId?: string;
|
|
18
|
+
readonly placeholder?: string;
|
|
19
|
+
readonly id?: string;
|
|
20
|
+
readonly text?: string;
|
|
21
|
+
readonly dialog?: string;
|
|
22
|
+
readonly row?: string;
|
|
23
|
+
/** The iframe it is in, as a CSS selector. */
|
|
24
|
+
readonly frame?: string;
|
|
25
|
+
}
|
|
26
|
+
export type StepAction = {
|
|
27
|
+
readonly tap: StepTarget;
|
|
28
|
+
} | {
|
|
29
|
+
readonly doubleTap: StepTarget;
|
|
30
|
+
} | {
|
|
31
|
+
readonly fill: StepTarget;
|
|
32
|
+
readonly value: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: StepTarget;
|
|
35
|
+
readonly value: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly select: StepTarget;
|
|
38
|
+
readonly value: string;
|
|
39
|
+
} | {
|
|
40
|
+
readonly check: StepTarget;
|
|
41
|
+
} | {
|
|
42
|
+
readonly uncheck: StepTarget;
|
|
43
|
+
} | {
|
|
44
|
+
readonly press: StepTarget;
|
|
45
|
+
readonly key: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly key: string;
|
|
48
|
+
};
|
|
49
|
+
/** The parts of the web engine's locator the actions use. */
|
|
50
|
+
export interface LocatorLike {
|
|
51
|
+
tap(options?: {
|
|
52
|
+
timeout?: number;
|
|
53
|
+
}): Promise<unknown>;
|
|
54
|
+
doubleTap(options?: {
|
|
55
|
+
timeout?: number;
|
|
56
|
+
}): Promise<unknown>;
|
|
57
|
+
fill(value: string, options?: {
|
|
58
|
+
timeout?: number;
|
|
59
|
+
}): Promise<unknown>;
|
|
60
|
+
pressSequentially(text: string, options?: {
|
|
61
|
+
timeout?: number;
|
|
62
|
+
}): Promise<unknown>;
|
|
63
|
+
selectOption(value: string, options?: {
|
|
64
|
+
timeout?: number;
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
check(options?: {
|
|
67
|
+
timeout?: number;
|
|
68
|
+
}): Promise<unknown>;
|
|
69
|
+
uncheck(options?: {
|
|
70
|
+
timeout?: number;
|
|
71
|
+
}): Promise<unknown>;
|
|
72
|
+
press(key: string, options?: {
|
|
73
|
+
timeout?: number;
|
|
74
|
+
}): Promise<unknown>;
|
|
75
|
+
getByRole(role: never, name?: string | RegExp): LocatorLike;
|
|
76
|
+
getByTestId(id: string): LocatorLike;
|
|
77
|
+
getByPlaceholder(text: string): LocatorLike;
|
|
78
|
+
getByText(text: string): LocatorLike;
|
|
79
|
+
filter(options: {
|
|
80
|
+
hasText: string;
|
|
81
|
+
}): LocatorLike;
|
|
82
|
+
}
|
|
83
|
+
/** The web engine's `screen`, or a frame's. */
|
|
84
|
+
export interface ScreenLike {
|
|
85
|
+
getByRole(role: never, name?: string | RegExp): LocatorLike;
|
|
86
|
+
getByTestId(id: string): LocatorLike;
|
|
87
|
+
getByPlaceholder(text: string): LocatorLike;
|
|
88
|
+
getByText(text: string): LocatorLike;
|
|
89
|
+
}
|
|
90
|
+
/** The web engine's `browser`, for an id, a frame and a key on whatever has focus. */
|
|
91
|
+
export interface BrowserLike {
|
|
92
|
+
locator(selector: string): LocatorLike;
|
|
93
|
+
frameLocator(selector: string): ScreenLike & {
|
|
94
|
+
locator(selector: string): LocatorLike;
|
|
95
|
+
};
|
|
96
|
+
readonly keyboard: {
|
|
97
|
+
press(key: string): Promise<unknown>;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Why `value` is no recorded action, or nothing when it is one. */
|
|
101
|
+
export declare function actionProblem(value: unknown): string | undefined;
|
|
102
|
+
/** The values an action types, fills or chooses, for its `{…}` tokens. */
|
|
103
|
+
export declare function actionValue(action: StepAction): string | undefined;
|
|
104
|
+
/** The web engine's locator for a target, inside its frame, dialog and row. */
|
|
105
|
+
export declare function locate(target: StepTarget, screen: ScreenLike, browser: BrowserLike | undefined): LocatorLike;
|
|
106
|
+
/** How long one recorded action waits for its element before the step falls back to its sentence. */
|
|
107
|
+
export declare const ACTION_TIMEOUT = 15000;
|
|
108
|
+
/** Does one recorded action, its value with the run's values in place of `{…}` (`value`). */
|
|
109
|
+
export declare function perform(action: StepAction, screen: ScreenLike, browser: BrowserLike | undefined, value: (text: string) => string): Promise<void>;
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recorded actions: what a Do step recorded in e2e Studio did, kept in the
|
|
3
|
+
* steps file so a run does it on the exact elements (`StepAction`), with the
|
|
4
|
+
* element as a structured target (`StepTarget`) the kit builds the web
|
|
5
|
+
* engine's locator from. Nothing here evaluates code from the file.
|
|
6
|
+
*
|
|
7
|
+
* { "do": "Search for pump", "actions": [
|
|
8
|
+
* { "fill": { "role": "searchbox", "name": "Search" }, "value": "pump" },
|
|
9
|
+
* { "press": { "role": "searchbox", "name": "Search" }, "key": "Enter" } ] }
|
|
10
|
+
*/
|
|
11
|
+
const TARGET_KEYS = ['role', 'name', 'nameStarts', 'testId', 'placeholder', 'id', 'text', 'dialog', 'row', 'frame'];
|
|
12
|
+
const WITH_VALUE = ['fill', 'type', 'select'];
|
|
13
|
+
const ON_TARGET = ['tap', 'doubleTap', 'check', 'uncheck'];
|
|
14
|
+
/** Why `value` is no recorded action, or nothing when it is one. */
|
|
15
|
+
export function actionProblem(value) {
|
|
16
|
+
if (!isObject(value))
|
|
17
|
+
return 'an action is an object such as { "tap": { "role": "button", "name": "Save" } }';
|
|
18
|
+
const keys = Object.keys(value);
|
|
19
|
+
const kind = keys.find((k) => [...ON_TARGET, ...WITH_VALUE, 'press'].includes(k)) ?? (keys.includes('key') ? 'key' : '');
|
|
20
|
+
const allowed = WITH_VALUE.includes(kind)
|
|
21
|
+
? [kind, 'value']
|
|
22
|
+
: kind === 'press'
|
|
23
|
+
? ['press', 'key']
|
|
24
|
+
: [kind];
|
|
25
|
+
if (!kind)
|
|
26
|
+
return `${JSON.stringify(value)} is no action: tap, doubleTap, fill, type, select, check, uncheck, press or key`;
|
|
27
|
+
const extra = keys.filter((k) => !allowed.includes(k));
|
|
28
|
+
if (extra.length)
|
|
29
|
+
return `${kind}: unknown key ${extra.join(', ')}`;
|
|
30
|
+
if (WITH_VALUE.includes(kind) && typeof value.value !== 'string')
|
|
31
|
+
return `${kind} needs a "value"`;
|
|
32
|
+
if ((kind === 'press' || kind === 'key') &&
|
|
33
|
+
(typeof value.key !== 'string' || !/^[A-Za-z0-9+]{1,40}$/.test(value.key))) {
|
|
34
|
+
return `${kind} needs a "key" such as Enter or Tab`;
|
|
35
|
+
}
|
|
36
|
+
if (kind === 'key')
|
|
37
|
+
return undefined;
|
|
38
|
+
return targetProblem(value[kind]);
|
|
39
|
+
}
|
|
40
|
+
function targetProblem(target) {
|
|
41
|
+
if (!isObject(target))
|
|
42
|
+
return 'an element is an object such as { "role": "button", "name": "Save" }';
|
|
43
|
+
const extra = Object.keys(target).filter((k) => !TARGET_KEYS.includes(k));
|
|
44
|
+
if (extra.length)
|
|
45
|
+
return `an element has no ${extra.join(', ')}`;
|
|
46
|
+
if (Object.values(target).some((v) => typeof v !== 'string' || !v))
|
|
47
|
+
return "an element's values are text";
|
|
48
|
+
const ways = [
|
|
49
|
+
target.role !== undefined && (target.name !== undefined) !== (target.nameStarts !== undefined),
|
|
50
|
+
target.testId !== undefined,
|
|
51
|
+
target.placeholder !== undefined,
|
|
52
|
+
target.id !== undefined,
|
|
53
|
+
target.text !== undefined,
|
|
54
|
+
].filter(Boolean).length;
|
|
55
|
+
if (ways !== 1 || (target.role !== undefined && target.name === undefined && target.nameStarts === undefined)) {
|
|
56
|
+
return 'an element is found one way: a role with a name (or how it starts), a test id, a placeholder, an id or a text';
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
/** The values an action types, fills or chooses, for its `{…}` tokens. */
|
|
61
|
+
export function actionValue(action) {
|
|
62
|
+
return 'value' in action ? action.value : undefined;
|
|
63
|
+
}
|
|
64
|
+
/** The web engine's locator for a target, inside its frame, dialog and row. */
|
|
65
|
+
export function locate(target, screen, browser) {
|
|
66
|
+
const frame = target.frame ? need(browser, 'an element in a frame').frameLocator(target.frame) : undefined;
|
|
67
|
+
if (target.id !== undefined)
|
|
68
|
+
return (frame ?? need(browser, 'an element by its id')).locator(`#${target.id}`);
|
|
69
|
+
let scope = frame ?? screen;
|
|
70
|
+
if (target.dialog)
|
|
71
|
+
scope = scope.getByRole('dialog', target.dialog);
|
|
72
|
+
if (target.row)
|
|
73
|
+
scope = scope.getByRole('row').filter({ hasText: target.row });
|
|
74
|
+
if (target.role && target.name !== undefined)
|
|
75
|
+
return scope.getByRole(target.role, target.name);
|
|
76
|
+
if (target.role && target.nameStarts !== undefined) {
|
|
77
|
+
return scope.getByRole(target.role, new RegExp(`^${target.nameStarts.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`));
|
|
78
|
+
}
|
|
79
|
+
if (target.testId !== undefined)
|
|
80
|
+
return scope.getByTestId(target.testId);
|
|
81
|
+
if (target.placeholder !== undefined)
|
|
82
|
+
return scope.getByPlaceholder(target.placeholder);
|
|
83
|
+
return scope.getByText(target.text ?? '');
|
|
84
|
+
}
|
|
85
|
+
/** How long one recorded action waits for its element before the step falls back to its sentence. */
|
|
86
|
+
export const ACTION_TIMEOUT = 15_000;
|
|
87
|
+
/** Does one recorded action, its value with the run's values in place of `{…}` (`value`). */
|
|
88
|
+
export async function perform(action, screen, browser, value) {
|
|
89
|
+
const timeout = { timeout: ACTION_TIMEOUT };
|
|
90
|
+
if ('tap' in action)
|
|
91
|
+
return void (await locate(action.tap, screen, browser).tap(timeout));
|
|
92
|
+
if ('doubleTap' in action)
|
|
93
|
+
return void (await locate(action.doubleTap, screen, browser).doubleTap(timeout));
|
|
94
|
+
if ('fill' in action)
|
|
95
|
+
return void (await locate(action.fill, screen, browser).fill(value(action.value), timeout));
|
|
96
|
+
if ('type' in action) {
|
|
97
|
+
return void (await locate(action.type, screen, browser).pressSequentially(value(action.value), timeout));
|
|
98
|
+
}
|
|
99
|
+
if ('select' in action) {
|
|
100
|
+
return void (await locate(action.select, screen, browser).selectOption(value(action.value), timeout));
|
|
101
|
+
}
|
|
102
|
+
if ('check' in action)
|
|
103
|
+
return void (await locate(action.check, screen, browser).check(timeout));
|
|
104
|
+
if ('uncheck' in action)
|
|
105
|
+
return void (await locate(action.uncheck, screen, browser).uncheck(timeout));
|
|
106
|
+
if ('press' in action)
|
|
107
|
+
return void (await locate(action.press, screen, browser).press(action.key, timeout));
|
|
108
|
+
await need(browser, 'a key on whatever has focus').keyboard.press(action.key);
|
|
109
|
+
}
|
|
110
|
+
function need(value, what) {
|
|
111
|
+
if (value === undefined)
|
|
112
|
+
throw new Error(`${what} needs the browser fixture, which the runner did not pass`);
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
function isObject(value) {
|
|
116
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
117
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - `studioBrowser()` and `studioDevice()`: drive the browser or device the
|
|
6
6
|
* Studio gives a run, so it can be watched live there.
|
|
7
|
-
* - `loadPlainTest()` and `runSteps()`: plain-English tests, as steps files
|
|
7
|
+
* - `loadPlainTest()` and `runSteps()`: plain-English tests, as steps files,
|
|
8
|
+
* whose recorded Do steps run on the exact elements they were recorded on.
|
|
8
9
|
* - `readBasicData()`: an instance's basic data, as the Studio edits it.
|
|
9
10
|
* - `schemas/`: the JSON Schemas of the files the Studio and a project share.
|
|
10
11
|
*/
|
|
12
|
+
export { ACTION_TIMEOUT, type BrowserLike, type LocatorLike, locate, type ScreenLike, type StepAction, type StepTarget, } from './actions.ts';
|
|
11
13
|
export { BASIC_DATA_ITEMS_FILE, type BasicDataOptions, basicDataItems, type CodeAndName, readBasicData, SHARED_BASIC_DATA_FILE, } from './basic-data.ts';
|
|
12
|
-
export { type Agent, BLOCKS_FILE, type BlockDefinition, type Catalog, type Condition, loadPlainTest, missingFeatures, type PlainOptions, type PlainStep, type PlainTest, parsePlainTest, readCatalog, runSteps, STEPS_FILE_SUFFIX, } from './plain.ts';
|
|
14
|
+
export { type Agent, BLOCKS_FILE, type BlockDefinition, type Catalog, type Condition, loadPlainTest, missingFeatures, type PlainFixtures, type PlainOptions, type PlainStep, type PlainTest, parsePlainTest, readCatalog, runSteps, STEPS_FILE_SUFFIX, } from './plain.ts';
|
|
13
15
|
export { type ShellResult, STUDIO_BROWSER_ENV, STUDIO_DEVICE_ENV, type StudioDeviceLease, studioAdbShell, studioBrowser, studioDevice, studioLease, } from './studio.ts';
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - `studioBrowser()` and `studioDevice()`: drive the browser or device the
|
|
6
6
|
* Studio gives a run, so it can be watched live there.
|
|
7
|
-
* - `loadPlainTest()` and `runSteps()`: plain-English tests, as steps files
|
|
7
|
+
* - `loadPlainTest()` and `runSteps()`: plain-English tests, as steps files,
|
|
8
|
+
* whose recorded Do steps run on the exact elements they were recorded on.
|
|
8
9
|
* - `readBasicData()`: an instance's basic data, as the Studio edits it.
|
|
9
10
|
* - `schemas/`: the JSON Schemas of the files the Studio and a project share.
|
|
10
11
|
*/
|
|
12
|
+
export { ACTION_TIMEOUT, locate, } from './actions.js';
|
|
11
13
|
export { BASIC_DATA_ITEMS_FILE, basicDataItems, readBasicData, SHARED_BASIC_DATA_FILE, } from './basic-data.js';
|
|
12
14
|
export { BLOCKS_FILE, loadPlainTest, missingFeatures, parsePlainTest, readCatalog, runSteps, STEPS_FILE_SUFFIX, } from './plain.js';
|
|
13
15
|
export { STUDIO_BROWSER_ENV, STUDIO_DEVICE_ENV, studioAdbShell, studioBrowser, studioDevice, studioLease, } from './studio.js';
|
package/dist/plain.d.ts
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
* }
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
+
import { type BrowserLike, type ScreenLike, type StepAction } from './actions.ts';
|
|
54
55
|
/** The agent the steps run on: the e2e framework's, as a test gets it. */
|
|
55
56
|
export interface Agent {
|
|
56
57
|
act(instruction: string, options?: {
|
|
@@ -61,6 +62,16 @@ export interface Agent {
|
|
|
61
62
|
}): Promise<unknown>;
|
|
62
63
|
waitFor(condition: string): Promise<unknown>;
|
|
63
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* What a test gets to run steps on: the agent, and for a web test the
|
|
67
|
+
* engine's `screen` and `browser`, which a Do step's recorded actions need.
|
|
68
|
+
* Without them, every Do step is the agent's, from its sentence.
|
|
69
|
+
*/
|
|
70
|
+
export interface PlainFixtures {
|
|
71
|
+
readonly agent: Agent;
|
|
72
|
+
readonly screen?: ScreenLike;
|
|
73
|
+
readonly browser?: BrowserLike;
|
|
74
|
+
}
|
|
64
75
|
/** What a project tells the runner about itself. */
|
|
65
76
|
export interface PlainOptions {
|
|
66
77
|
/**
|
|
@@ -83,6 +94,8 @@ export interface Condition {
|
|
|
83
94
|
export type PlainStep = {
|
|
84
95
|
readonly kind: 'do' | 'check' | 'waitUntil';
|
|
85
96
|
readonly text: string;
|
|
97
|
+
/** For a Do step recorded in e2e Studio: what it did, on the exact elements; the sentence is the fallback. */
|
|
98
|
+
readonly actions?: readonly StepAction[];
|
|
86
99
|
readonly when?: Condition;
|
|
87
100
|
} | {
|
|
88
101
|
/** A building block, or a check. */
|
|
@@ -155,4 +168,4 @@ export declare function missingFeatures(test: PlainTest, options?: PlainOptions)
|
|
|
155
168
|
* cache replays the steps on the next run with that run's values. A `check`
|
|
156
169
|
* and a `waitUntil`, judged anew on every run, get the values in their text.
|
|
157
170
|
*/
|
|
158
|
-
export declare function runSteps(
|
|
171
|
+
export declare function runSteps(fixtures: Agent | PlainFixtures, test: PlainTest, options?: PlainOptions): Promise<void>;
|
package/dist/plain.js
CHANGED
|
@@ -63,6 +63,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
63
63
|
import path from 'node:path';
|
|
64
64
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
65
65
|
import { unique } from 'e2e';
|
|
66
|
+
import { actionProblem, actionValue, perform } from './actions.js';
|
|
66
67
|
export const STEPS_FILE_SUFFIX = '.steps.json';
|
|
67
68
|
/** The app's building blocks, the catalog e2e Studio offers too. */
|
|
68
69
|
export const BLOCKS_FILE = 'e2e-studio.blocks.json';
|
|
@@ -148,7 +149,13 @@ export function parsePlainTest(json, context, options = {}) {
|
|
|
148
149
|
throw fail(where, 'must have exactly one of "do", "check", "waitUntil", "block" or "verify"');
|
|
149
150
|
}
|
|
150
151
|
const kind = kinds[0];
|
|
151
|
-
const allowed = kind === 'block'
|
|
152
|
+
const allowed = kind === 'block'
|
|
153
|
+
? ['block', 'as', 'with', 'when']
|
|
154
|
+
: kind === 'verify'
|
|
155
|
+
? [kind, 'with', 'when']
|
|
156
|
+
: kind === 'do'
|
|
157
|
+
? [kind, 'actions', 'when']
|
|
158
|
+
: [kind, 'when'];
|
|
152
159
|
const extra = Object.keys(raw).filter((k) => !allowed.includes(k));
|
|
153
160
|
if (extra.length)
|
|
154
161
|
throw fail(where, `unknown key ${extra.join(', ')}`);
|
|
@@ -159,7 +166,25 @@ export function parsePlainTest(json, context, options = {}) {
|
|
|
159
166
|
throw fail(where, `"${kind}" must be one sentence of up to 500 characters`);
|
|
160
167
|
}
|
|
161
168
|
checkTokens(where, text, false);
|
|
162
|
-
|
|
169
|
+
const actions = raw.actions;
|
|
170
|
+
if (actions !== undefined) {
|
|
171
|
+
if (!Array.isArray(actions) || actions.length === 0)
|
|
172
|
+
throw fail(where, '"actions" must list what the step does');
|
|
173
|
+
actions.forEach((action, at) => {
|
|
174
|
+
const problem = actionProblem(action);
|
|
175
|
+
if (problem)
|
|
176
|
+
throw fail(`${where} action ${at + 1}`, problem);
|
|
177
|
+
const typed = actionValue(action);
|
|
178
|
+
if (typed)
|
|
179
|
+
checkTokens(`${where} action ${at + 1}`, typed, false);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
kind,
|
|
184
|
+
text: text.trim(),
|
|
185
|
+
...(actions !== undefined ? { actions: actions } : {}),
|
|
186
|
+
...(when ? { when } : {}),
|
|
187
|
+
};
|
|
163
188
|
}
|
|
164
189
|
const [catalog, what] = kind === 'block' ? [context.blocks, 'building block'] : [context.checks, 'check'];
|
|
165
190
|
const call = catalog.find((b) => b.id === raw[kind]);
|
|
@@ -229,7 +254,8 @@ export function missingFeatures(test, options = {}) {
|
|
|
229
254
|
* cache replays the steps on the next run with that run's values. A `check`
|
|
230
255
|
* and a `waitUntil`, judged anew on every run, get the values in their text.
|
|
231
256
|
*/
|
|
232
|
-
export async function runSteps(
|
|
257
|
+
export async function runSteps(fixtures, test, options = {}) {
|
|
258
|
+
const { agent, screen, browser } = 'agent' in fixtures ? fixtures : { agent: fixtures, screen: undefined, browser: undefined };
|
|
233
259
|
const results = new Map();
|
|
234
260
|
const has = options.features?.has ?? (() => false);
|
|
235
261
|
const lookUp = (token, name, value, field) => {
|
|
@@ -282,6 +308,18 @@ export async function runSteps(agent, test, options = {}) {
|
|
|
282
308
|
named[param] = String(lookUp(token, name, value, field) ?? '');
|
|
283
309
|
return `{${param}}`;
|
|
284
310
|
});
|
|
311
|
+
// Recorded in e2e Studio: done on the exact elements, and by the agent from the sentence when one is not there.
|
|
312
|
+
if (step.actions && screen) {
|
|
313
|
+
try {
|
|
314
|
+
for (const action of step.actions)
|
|
315
|
+
await perform(action, screen, browser, text);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
const why = error instanceof Error ? error.message.split('\n')[0] : String(error);
|
|
320
|
+
console.warn(`${test.file} step ${index + 1}: a recorded action failed (${why}); the agent does "${step.text}" instead`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
285
323
|
const params = actParams(named, results);
|
|
286
324
|
await agent.act(instruction, Object.keys(params).length ? { params } : {});
|
|
287
325
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testra-studio/kit",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "What a test project on the e2e framework needs to run under e2e Studio: its browser and devices, plain-English steps files, and basic data.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@e2e-dev/mobile": "^0.12.4",
|
|
29
|
-
"e2e": "^0.21.3"
|
|
29
|
+
"e2e": "^0.21.3 || ^0.22.0 || ^0.23.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
32
32
|
"@e2e-dev/mobile": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@e2e-dev/mobile": "0.12.
|
|
37
|
+
"@e2e-dev/mobile": "0.12.6"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
@@ -2,22 +2,41 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://testra-studio/schemas/steps.schema.json",
|
|
4
4
|
"title": "A plain-English test",
|
|
5
|
-
"description": "A test's steps, in <name>.steps.json beside the <name>.e2e.ts that runs them. An AI agent carries out each \"do\", judges each \"check\" against the screen, and waits for each \"waitUntil\"; \"block\" and \"verify\" call the project's building blocks and checks (e2e-studio.blocks.json). In a sentence, {work1.description} is a value an earlier block returned, and {basic.site.code} the instance's basic data.",
|
|
5
|
+
"description": "A test's steps, in <name>.steps.json beside the <name>.e2e.ts that runs them. An AI agent carries out each \"do\", judges each \"check\" against the screen, and waits for each \"waitUntil\"; \"block\" and \"verify\" call the project's building blocks and checks (e2e-studio.blocks.json). In a sentence, {work1.description} is a value an earlier block returned, and {basic.site.code} the instance's basic data. A Do step recorded in e2e Studio keeps its \"actions\", done on the exact elements, with its sentence as the fallback.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"required": ["title", "steps"],
|
|
8
8
|
"additionalProperties": false,
|
|
9
9
|
"properties": {
|
|
10
|
-
"$schema": {
|
|
11
|
-
|
|
10
|
+
"$schema": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"title": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "What the test proves, as a sentence."
|
|
17
|
+
},
|
|
12
18
|
"requires": {
|
|
13
19
|
"type": "array",
|
|
14
|
-
"items": {
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
15
23
|
"description": "Features the system under test must have; the project's runner skips the test without them."
|
|
16
24
|
},
|
|
17
|
-
"steps": {
|
|
25
|
+
"steps": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"minItems": 1,
|
|
28
|
+
"items": {
|
|
29
|
+
"$ref": "#/$defs/step"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
18
32
|
},
|
|
19
33
|
"$defs": {
|
|
20
|
-
"sentence": {
|
|
34
|
+
"sentence": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1,
|
|
37
|
+
"maxLength": 500,
|
|
38
|
+
"pattern": "^[^\\n]*$"
|
|
39
|
+
},
|
|
21
40
|
"when": {
|
|
22
41
|
"type": "string",
|
|
23
42
|
"pattern": "^!?[A-Za-z_][A-Za-z0-9_]*$",
|
|
@@ -25,7 +44,9 @@
|
|
|
25
44
|
},
|
|
26
45
|
"fields": {
|
|
27
46
|
"type": "object",
|
|
28
|
-
"additionalProperties": {
|
|
47
|
+
"additionalProperties": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
29
50
|
"description": "The call's fields by name; a field that takes an earlier block's result is \"{work1}\"."
|
|
30
51
|
},
|
|
31
52
|
"step": {
|
|
@@ -34,33 +55,70 @@
|
|
|
34
55
|
"type": "object",
|
|
35
56
|
"required": ["do"],
|
|
36
57
|
"additionalProperties": false,
|
|
37
|
-
"properties": {
|
|
58
|
+
"properties": {
|
|
59
|
+
"do": {
|
|
60
|
+
"$ref": "#/$defs/sentence"
|
|
61
|
+
},
|
|
62
|
+
"when": {
|
|
63
|
+
"$ref": "#/$defs/when"
|
|
64
|
+
},
|
|
65
|
+
"actions": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"minItems": 1,
|
|
68
|
+
"maxItems": 30,
|
|
69
|
+
"items": {
|
|
70
|
+
"$ref": "#/$defs/action"
|
|
71
|
+
},
|
|
72
|
+
"description": "For a Do step recorded in e2e Studio: what it did, on the exact elements. The sentence is what the agent does when one of them is not found. Needs @testra-studio/kit 0.2.0 or later."
|
|
73
|
+
}
|
|
74
|
+
}
|
|
38
75
|
},
|
|
39
76
|
{
|
|
40
77
|
"type": "object",
|
|
41
78
|
"required": ["check"],
|
|
42
79
|
"additionalProperties": false,
|
|
43
|
-
"properties": {
|
|
80
|
+
"properties": {
|
|
81
|
+
"check": {
|
|
82
|
+
"$ref": "#/$defs/sentence"
|
|
83
|
+
},
|
|
84
|
+
"when": {
|
|
85
|
+
"$ref": "#/$defs/when"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
44
88
|
},
|
|
45
89
|
{
|
|
46
90
|
"type": "object",
|
|
47
91
|
"required": ["waitUntil"],
|
|
48
92
|
"additionalProperties": false,
|
|
49
|
-
"properties": {
|
|
93
|
+
"properties": {
|
|
94
|
+
"waitUntil": {
|
|
95
|
+
"$ref": "#/$defs/sentence"
|
|
96
|
+
},
|
|
97
|
+
"when": {
|
|
98
|
+
"$ref": "#/$defs/when"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
50
101
|
},
|
|
51
102
|
{
|
|
52
103
|
"type": "object",
|
|
53
104
|
"required": ["block"],
|
|
54
105
|
"additionalProperties": false,
|
|
55
106
|
"properties": {
|
|
56
|
-
"block": {
|
|
107
|
+
"block": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"description": "A building block's id."
|
|
110
|
+
},
|
|
57
111
|
"as": {
|
|
58
112
|
"type": "string",
|
|
59
113
|
"pattern": "^[a-z][A-Za-z0-9]*$",
|
|
60
114
|
"description": "What later steps call its result: work1."
|
|
61
115
|
},
|
|
62
|
-
"with": {
|
|
63
|
-
|
|
116
|
+
"with": {
|
|
117
|
+
"$ref": "#/$defs/fields"
|
|
118
|
+
},
|
|
119
|
+
"when": {
|
|
120
|
+
"$ref": "#/$defs/when"
|
|
121
|
+
}
|
|
64
122
|
}
|
|
65
123
|
},
|
|
66
124
|
{
|
|
@@ -68,9 +126,301 @@
|
|
|
68
126
|
"required": ["verify"],
|
|
69
127
|
"additionalProperties": false,
|
|
70
128
|
"properties": {
|
|
71
|
-
"verify": {
|
|
72
|
-
|
|
73
|
-
|
|
129
|
+
"verify": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"description": "A check's id."
|
|
132
|
+
},
|
|
133
|
+
"with": {
|
|
134
|
+
"$ref": "#/$defs/fields"
|
|
135
|
+
},
|
|
136
|
+
"when": {
|
|
137
|
+
"$ref": "#/$defs/when"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"target": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"description": "An element, as the web engine finds it: a role with its name (or how a long name starts), else a test id, a placeholder, an id or a text; inside a frame, a dialog and a grid row when it was in one.",
|
|
146
|
+
"additionalProperties": false,
|
|
147
|
+
"properties": {
|
|
148
|
+
"role": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"pattern": "^[a-z]+$"
|
|
151
|
+
},
|
|
152
|
+
"name": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"minLength": 1
|
|
155
|
+
},
|
|
156
|
+
"nameStarts": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"minLength": 1
|
|
159
|
+
},
|
|
160
|
+
"testId": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"minLength": 1
|
|
163
|
+
},
|
|
164
|
+
"placeholder": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"minLength": 1
|
|
167
|
+
},
|
|
168
|
+
"id": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"minLength": 1
|
|
171
|
+
},
|
|
172
|
+
"text": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"minLength": 1
|
|
175
|
+
},
|
|
176
|
+
"dialog": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"minLength": 1
|
|
179
|
+
},
|
|
180
|
+
"row": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"minLength": 1
|
|
183
|
+
},
|
|
184
|
+
"frame": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"minLength": 1
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"oneOf": [
|
|
190
|
+
{
|
|
191
|
+
"required": ["role", "name"],
|
|
192
|
+
"not": {
|
|
193
|
+
"anyOf": [
|
|
194
|
+
{
|
|
195
|
+
"required": ["nameStarts"]
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"required": ["testId"]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"required": ["placeholder"]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"required": ["id"]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"required": ["text"]
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"required": ["role", "nameStarts"],
|
|
214
|
+
"not": {
|
|
215
|
+
"anyOf": [
|
|
216
|
+
{
|
|
217
|
+
"required": ["name"]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"required": ["testId"]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"required": ["placeholder"]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"required": ["id"]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"required": ["text"]
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"required": ["testId"],
|
|
236
|
+
"not": {
|
|
237
|
+
"anyOf": [
|
|
238
|
+
{
|
|
239
|
+
"required": ["role"]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"required": ["placeholder"]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"required": ["id"]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"required": ["text"]
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"required": ["placeholder"],
|
|
255
|
+
"not": {
|
|
256
|
+
"anyOf": [
|
|
257
|
+
{
|
|
258
|
+
"required": ["role"]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"required": ["testId"]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"required": ["id"]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"required": ["text"]
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"required": ["id"],
|
|
274
|
+
"not": {
|
|
275
|
+
"anyOf": [
|
|
276
|
+
{
|
|
277
|
+
"required": ["role"]
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"required": ["testId"]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"required": ["placeholder"]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"required": ["text"]
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"required": ["text"],
|
|
293
|
+
"not": {
|
|
294
|
+
"anyOf": [
|
|
295
|
+
{
|
|
296
|
+
"required": ["role"]
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"required": ["testId"]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"required": ["placeholder"]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"required": ["id"]
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
"action": {
|
|
313
|
+
"description": "One thing a recorded Do step did, on the exact element.",
|
|
314
|
+
"oneOf": [
|
|
315
|
+
{
|
|
316
|
+
"type": "object",
|
|
317
|
+
"required": ["tap"],
|
|
318
|
+
"additionalProperties": false,
|
|
319
|
+
"properties": {
|
|
320
|
+
"tap": {
|
|
321
|
+
"$ref": "#/$defs/target"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"type": "object",
|
|
327
|
+
"required": ["doubleTap"],
|
|
328
|
+
"additionalProperties": false,
|
|
329
|
+
"properties": {
|
|
330
|
+
"doubleTap": {
|
|
331
|
+
"$ref": "#/$defs/target"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"type": "object",
|
|
337
|
+
"required": ["fill", "value"],
|
|
338
|
+
"additionalProperties": false,
|
|
339
|
+
"properties": {
|
|
340
|
+
"fill": {
|
|
341
|
+
"$ref": "#/$defs/target"
|
|
342
|
+
},
|
|
343
|
+
"value": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"maxLength": 500
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"type": "object",
|
|
351
|
+
"required": ["type", "value"],
|
|
352
|
+
"additionalProperties": false,
|
|
353
|
+
"properties": {
|
|
354
|
+
"type": {
|
|
355
|
+
"$ref": "#/$defs/target"
|
|
356
|
+
},
|
|
357
|
+
"value": {
|
|
358
|
+
"type": "string",
|
|
359
|
+
"maxLength": 500,
|
|
360
|
+
"minLength": 1
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"type": "object",
|
|
366
|
+
"required": ["select", "value"],
|
|
367
|
+
"additionalProperties": false,
|
|
368
|
+
"properties": {
|
|
369
|
+
"select": {
|
|
370
|
+
"$ref": "#/$defs/target"
|
|
371
|
+
},
|
|
372
|
+
"value": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"maxLength": 500,
|
|
375
|
+
"minLength": 1
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"type": "object",
|
|
381
|
+
"required": ["check"],
|
|
382
|
+
"additionalProperties": false,
|
|
383
|
+
"properties": {
|
|
384
|
+
"check": {
|
|
385
|
+
"$ref": "#/$defs/target"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"type": "object",
|
|
391
|
+
"required": ["uncheck"],
|
|
392
|
+
"additionalProperties": false,
|
|
393
|
+
"properties": {
|
|
394
|
+
"uncheck": {
|
|
395
|
+
"$ref": "#/$defs/target"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"type": "object",
|
|
401
|
+
"required": ["press", "key"],
|
|
402
|
+
"additionalProperties": false,
|
|
403
|
+
"properties": {
|
|
404
|
+
"press": {
|
|
405
|
+
"$ref": "#/$defs/target"
|
|
406
|
+
},
|
|
407
|
+
"key": {
|
|
408
|
+
"type": "string",
|
|
409
|
+
"pattern": "^[A-Za-z0-9+]{1,40}$",
|
|
410
|
+
"description": "A key, such as Enter or Tab."
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"type": "object",
|
|
416
|
+
"required": ["key"],
|
|
417
|
+
"additionalProperties": false,
|
|
418
|
+
"properties": {
|
|
419
|
+
"key": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"pattern": "^[A-Za-z0-9+]{1,40}$",
|
|
422
|
+
"description": "A key, such as Enter or Tab."
|
|
423
|
+
}
|
|
74
424
|
}
|
|
75
425
|
}
|
|
76
426
|
]
|