-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshared-spec-context.model.ts
32 lines (28 loc) · 1.06 KB
/
shared-spec-context.model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import type { emulateKey as emulateKeyType } from 'emulate-key-in-browser';
import { AppHarness } from './app.harness';
export interface AsyncEmulateKey {
tab: {
backwards: () => Promise<boolean>;
forwards: () => Promise<boolean>;
findSelectableElements: () => Promise<{ id?: string, tagName: string, className?: string }[]>;
};
shiftTab: () => Promise<boolean>;
arrow: {
[key in keyof typeof emulateKeyType.arrow]: () => Promise<void>;
};
shiftArrow: {
[key in keyof typeof emulateKeyType.shiftArrow]: () => Promise<void>;
};
backspace: () => Promise<void>;
delete: () => Promise<void>;
writeText: (keys: string) => Promise<void>;
}
export interface SharedSpecContext {
app: AppHarness;
setSelectionRange: (start: number, end: number, direction: 'forward' | 'backward' | 'none') => Promise<void>;
setCursor: (position: number) => Promise<void>;
setValue: (value: string) => Promise<void>;
emulateKey: AsyncEmulateKey;
takeScreenshot: (ident: string) => Promise<number>;
getActiveElementId: () => Promise<string | undefined>;
}