@rickcedwhat/playwright-smart-vision 0.3.0-next.e6a6e47 → 0.4.0
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/author/apply.d.ts +2 -0
- package/dist/author/apply.d.ts.map +1 -1
- package/dist/author/apply.js +47 -2
- package/dist/author/apply.js.map +1 -1
- package/dist/author/author.test.js +19 -17
- package/dist/author/author.test.js.map +1 -1
- package/dist/author/catalog.d.ts +6 -0
- package/dist/author/catalog.d.ts.map +1 -1
- package/dist/author/catalog.js +41 -4
- package/dist/author/catalog.js.map +1 -1
- package/dist/author/detect.d.ts +4 -1
- package/dist/author/detect.d.ts.map +1 -1
- package/dist/author/detect.js +55 -6
- package/dist/author/detect.js.map +1 -1
- package/dist/author/geometry.d.ts +6 -0
- package/dist/author/geometry.d.ts.map +1 -1
- package/dist/author/geometry.js.map +1 -1
- package/dist/author/index.d.ts +2 -2
- package/dist/author/index.d.ts.map +1 -1
- package/dist/author/index.js +1 -1
- package/dist/author/index.js.map +1 -1
- package/dist/author/labels.d.ts +8 -0
- package/dist/author/labels.d.ts.map +1 -1
- package/dist/author/labels.js +41 -4
- package/dist/author/labels.js.map +1 -1
- package/dist/author/options.d.ts +2 -1
- package/dist/author/options.d.ts.map +1 -1
- package/dist/author/options.js +34 -10
- package/dist/author/options.js.map +1 -1
- package/dist/configure.d.ts +10 -0
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +4 -0
- package/dist/configure.js.map +1 -1
- package/dist/element.d.ts +71 -5
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +162 -32
- package/dist/element.js.map +1 -1
- package/dist/element.test.js +122 -1
- package/dist/element.test.js.map +1 -1
- package/dist/field-extractor.d.ts.map +1 -1
- package/dist/field-extractor.js +3 -2
- package/dist/field-extractor.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/presets.d.ts +46 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +57 -0
- package/dist/presets.js.map +1 -0
- package/dist/screen-api.d.ts +1 -1
- package/dist/screen-api.d.ts.map +1 -1
- package/dist/screen-api.js.map +1 -1
- package/dist/screen-api.test.d.ts +2 -0
- package/dist/screen-api.test.d.ts.map +1 -0
- package/dist/screen-api.test.js +42 -0
- package/dist/screen-api.test.js.map +1 -0
- package/dist/screen-handler.d.ts +31 -0
- package/dist/screen-handler.d.ts.map +1 -0
- package/dist/screen-handler.js +138 -0
- package/dist/screen-handler.js.map +1 -0
- package/dist/screen-handler.test.d.ts +2 -0
- package/dist/screen-handler.test.d.ts.map +1 -0
- package/dist/screen-handler.test.js +206 -0
- package/dist/screen-handler.test.js.map +1 -0
- package/dist/screen-result.d.ts +35 -0
- package/dist/screen-result.d.ts.map +1 -1
- package/dist/screen-result.js +103 -6
- package/dist/screen-result.js.map +1 -1
- package/dist/screen-result.test.d.ts +2 -0
- package/dist/screen-result.test.d.ts.map +1 -0
- package/dist/screen-result.test.js +71 -0
- package/dist/screen-result.test.js.map +1 -0
- package/dist/screen.d.ts +41 -7
- package/dist/screen.d.ts.map +1 -1
- package/dist/screen.js +46 -11
- package/dist/screen.js.map +1 -1
- package/dist/strategies.d.ts +83 -0
- package/dist/strategies.d.ts.map +1 -0
- package/dist/strategies.js +117 -0
- package/dist/strategies.js.map +1 -0
- package/dist/strategies.test.d.ts +2 -0
- package/dist/strategies.test.d.ts.map +1 -0
- package/dist/strategies.test.js +181 -0
- package/dist/strategies.test.js.map +1 -0
- package/dist/text-element.d.ts +70 -0
- package/dist/text-element.d.ts.map +1 -0
- package/dist/text-element.js +239 -0
- package/dist/text-element.js.map +1 -0
- package/dist/text-element.test.d.ts +2 -0
- package/dist/text-element.test.d.ts.map +1 -0
- package/dist/text-element.test.js +162 -0
- package/dist/text-element.test.js.map +1 -0
- package/dist/typed-screen.d.ts +6 -13
- package/dist/typed-screen.d.ts.map +1 -1
- package/dist/typed-screen.js +5 -9
- package/dist/typed-screen.js.map +1 -1
- package/dist/unhover.d.ts +10 -2
- package/dist/unhover.d.ts.map +1 -1
- package/dist/unhover.js +11 -2
- package/dist/unhover.js.map +1 -1
- package/dist/unhover.test.js +32 -2
- package/dist/unhover.test.js.map +1 -1
- package/dist/utils/ocr.d.ts +20 -0
- package/dist/utils/ocr.d.ts.map +1 -1
- package/dist/utils/ocr.js +24 -0
- package/dist/utils/ocr.js.map +1 -1
- package/dist/utils/ocr.test.js +53 -2
- package/dist/utils/ocr.test.js.map +1 -1
- package/package.json +1 -1
package/dist/screen.d.ts
CHANGED
|
@@ -2,15 +2,30 @@ import type { Page, TestType } from '@playwright/test';
|
|
|
2
2
|
import type { ScreenConfig } from './screen-config.js';
|
|
3
3
|
import { FieldExtractor } from './field-extractor.js';
|
|
4
4
|
import { ScreenResult } from './screen-result.js';
|
|
5
|
-
import { type Charset } from './utils/ocr.js';
|
|
5
|
+
import { type Charset, type FieldRead } from './utils/ocr.js';
|
|
6
|
+
import { Strategies, type ClickStrategy, type FillStrategy, type CaptureStrategy, type OcrStrategy } from './strategies.js';
|
|
6
7
|
export interface BindOcrScreenOptions {
|
|
7
8
|
shotDir?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Show live match outlines while waiting/asserting.
|
|
11
|
+
* Default inherits `init({ overlay })`.
|
|
12
|
+
*/
|
|
8
13
|
overlay?: boolean;
|
|
9
14
|
/**
|
|
10
15
|
* Override `init({ unhoverBeforeCapture })` for this screen.
|
|
11
16
|
* Default inherits global config (true when unset).
|
|
12
17
|
*/
|
|
13
18
|
unhover?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Override `init({ read })` for this screen.
|
|
21
|
+
* Default inherits the init-level read mode.
|
|
22
|
+
*/
|
|
23
|
+
read?: FieldRead;
|
|
24
|
+
/**
|
|
25
|
+
* When false, returns the ScreenResult synchronously without waiting.
|
|
26
|
+
* Default is to wait — `await screen(name)` resolves after `waitFor()`.
|
|
27
|
+
*/
|
|
28
|
+
wait?: boolean;
|
|
14
29
|
}
|
|
15
30
|
/** Warm OCR + OpenCV (safe to call more than once). */
|
|
16
31
|
export declare function ensureOcrRuntime(): Promise<void>;
|
|
@@ -19,7 +34,12 @@ export declare function createOcrExtractor(): Promise<FieldExtractor>;
|
|
|
19
34
|
export declare function bindOcrScreen(page: Page, config: ScreenConfig, extractor: FieldExtractor, shotDir: string, options?: BindOcrScreenOptions): ScreenResult;
|
|
20
35
|
export interface Strategies {
|
|
21
36
|
charsets?: Record<string, Charset>;
|
|
37
|
+
ocr?: OcrStrategy;
|
|
38
|
+
click?: ClickStrategy;
|
|
39
|
+
fill?: FillStrategy;
|
|
40
|
+
capture?: CaptureStrategy;
|
|
22
41
|
}
|
|
42
|
+
export { Strategies, type OcrStrategy, type ClickStrategy, type FillStrategy, type CaptureStrategy };
|
|
23
43
|
interface InitOptions {
|
|
24
44
|
page: Page;
|
|
25
45
|
storage?: {
|
|
@@ -27,6 +47,18 @@ interface InitOptions {
|
|
|
27
47
|
};
|
|
28
48
|
devtools?: boolean;
|
|
29
49
|
unhoverBeforeCapture?: boolean;
|
|
50
|
+
/** Global overlay default. Per-screen `{ overlay }` still wins. */
|
|
51
|
+
overlay?: boolean;
|
|
52
|
+
/** Environment-level read override. Wins over index.json; call site wins over this. */
|
|
53
|
+
read?: FieldRead;
|
|
54
|
+
/**
|
|
55
|
+
* Override the default unhover destination (top-left corner).
|
|
56
|
+
* Useful when the top-left corner overlaps interactive content.
|
|
57
|
+
*/
|
|
58
|
+
unhoverPoint?: {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
};
|
|
30
62
|
strategies?: Strategies;
|
|
31
63
|
}
|
|
32
64
|
/**
|
|
@@ -38,13 +70,16 @@ interface InitOptions {
|
|
|
38
70
|
*/
|
|
39
71
|
export declare function init(options: InitOptions): Promise<void>;
|
|
40
72
|
/**
|
|
41
|
-
* Bind a screen to the page set by `init()
|
|
42
|
-
*
|
|
73
|
+
* Bind a screen to the page set by `init()` and wait for it to appear.
|
|
74
|
+
* Pass `{ wait: false }` to skip waiting and get the result synchronously.
|
|
43
75
|
*
|
|
44
|
-
* const customerInfo = screen('customer-info');
|
|
45
|
-
*
|
|
76
|
+
* const customerInfo = await screen('customer-info');
|
|
77
|
+
* const s = screen('service', { wait: false }); // already visible
|
|
46
78
|
*/
|
|
47
|
-
export declare function screen(nameOrConfig: string | ScreenConfig, options
|
|
79
|
+
export declare function screen(nameOrConfig: string | ScreenConfig, options: BindOcrScreenOptions & {
|
|
80
|
+
wait: false;
|
|
81
|
+
}): ScreenResult;
|
|
82
|
+
export declare function screen(nameOrConfig: string | ScreenConfig, options?: BindOcrScreenOptions): Promise<ScreenResult>;
|
|
48
83
|
/** Release shared OCR/CV resources. Optional — registered automatically by init(). */
|
|
49
84
|
export declare function release(): Promise<void>;
|
|
50
85
|
/** @deprecated Use release() */
|
|
@@ -72,5 +107,4 @@ interface ScreenWorkerFixtures {
|
|
|
72
107
|
* test.use({ ocrOverlay: true });
|
|
73
108
|
*/
|
|
74
109
|
export declare function createFixture(): TestType<ScreenFixtures, ScreenWorkerFixtures>;
|
|
75
|
-
export {};
|
|
76
110
|
//# sourceMappingURL=screen.d.ts.map
|
package/dist/screen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAA8D,KAAK,OAAO,EAAE,K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|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { loadScreen, clearConfigUnhoverPoint } from './configure.js';
|
|
5
|
+
import { clearScreenHandlers } from './screen-handler.js';
|
|
6
6
|
import { FieldExtractor } from './field-extractor.js';
|
|
7
7
|
import { ScreenResult } from './screen-result.js';
|
|
8
|
-
import { cleanupOCR, getOCRUtil, setCharsetRegistry } from './utils/ocr.js';
|
|
8
|
+
import { cleanupOCR, getOCRUtil, setCharsetRegistry, setOcrStrategy } from './utils/ocr.js';
|
|
9
|
+
import { setUnhoverPoint } from './unhover.js';
|
|
9
10
|
import { ensureCvReady } from './utils/vision.js';
|
|
11
|
+
import { Strategies, setClickStrategy, setFillStrategy, } from './strategies.js';
|
|
10
12
|
/** Warm OCR + OpenCV (safe to call more than once). */
|
|
11
13
|
export async function ensureOcrRuntime() {
|
|
12
14
|
await Promise.all([getOCRUtil(), ensureCvReady()]);
|
|
@@ -20,8 +22,10 @@ export function bindOcrScreen(page, config, extractor, shotDir, options = {}) {
|
|
|
20
22
|
return ScreenResult.bind(page, extractor, config, shotDir, {
|
|
21
23
|
...(options.overlay !== undefined && { overlay: options.overlay }),
|
|
22
24
|
...(options.unhover !== undefined && { unhover: options.unhover }),
|
|
25
|
+
...(options.read !== undefined && { initRead: options.read }),
|
|
23
26
|
});
|
|
24
27
|
}
|
|
28
|
+
export { Strategies };
|
|
25
29
|
let initState = null;
|
|
26
30
|
let exitHandlerRegistered = false;
|
|
27
31
|
function defaultShotDir() {
|
|
@@ -45,9 +49,27 @@ export async function init(options) {
|
|
|
45
49
|
else {
|
|
46
50
|
initState.config = { ...initState.config, ...options };
|
|
47
51
|
}
|
|
52
|
+
if (options.unhoverPoint !== undefined) {
|
|
53
|
+
setUnhoverPoint(options.unhoverPoint);
|
|
54
|
+
}
|
|
55
|
+
if (options.strategies?.capture !== undefined) {
|
|
56
|
+
const cap = options.strategies.capture;
|
|
57
|
+
initState.config.unhoverBeforeCapture = cap.unhover;
|
|
58
|
+
if (cap.unhoverPoint !== undefined)
|
|
59
|
+
setUnhoverPoint(cap.unhoverPoint);
|
|
60
|
+
}
|
|
61
|
+
if (options.strategies?.click !== undefined) {
|
|
62
|
+
setClickStrategy(options.strategies.click);
|
|
63
|
+
}
|
|
64
|
+
if (options.strategies?.fill !== undefined) {
|
|
65
|
+
setFillStrategy(options.strategies.fill);
|
|
66
|
+
}
|
|
48
67
|
if (options.strategies?.charsets) {
|
|
49
68
|
setCharsetRegistry(options.strategies.charsets);
|
|
50
69
|
}
|
|
70
|
+
if (options.strategies?.ocr !== undefined) {
|
|
71
|
+
setOcrStrategy(options.strategies.ocr);
|
|
72
|
+
}
|
|
51
73
|
try {
|
|
52
74
|
await options.page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
|
|
53
75
|
}
|
|
@@ -65,13 +87,6 @@ export async function init(options) {
|
|
|
65
87
|
});
|
|
66
88
|
}
|
|
67
89
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Bind a screen to the page set by `init()`.
|
|
70
|
-
* Sync after `init()` has been called.
|
|
71
|
-
*
|
|
72
|
-
* const customerInfo = screen('customer-info');
|
|
73
|
-
* await customerInfo.element('customerNumber').toHaveValue('SEA314535');
|
|
74
|
-
*/
|
|
75
90
|
export function screen(nameOrConfig, options = {}) {
|
|
76
91
|
if (!initState) {
|
|
77
92
|
const name = typeof nameOrConfig === 'string' ? nameOrConfig : nameOrConfig.name;
|
|
@@ -82,13 +97,29 @@ export function screen(nameOrConfig, options = {}) {
|
|
|
82
97
|
if (mergedOptions.unhover === undefined && initState.config.unhoverBeforeCapture !== undefined) {
|
|
83
98
|
mergedOptions.unhover = initState.config.unhoverBeforeCapture;
|
|
84
99
|
}
|
|
85
|
-
|
|
100
|
+
if (mergedOptions.overlay === undefined && initState.config.overlay !== undefined) {
|
|
101
|
+
mergedOptions.overlay = initState.config.overlay;
|
|
102
|
+
}
|
|
103
|
+
if (mergedOptions.read === undefined && initState.config.read !== undefined) {
|
|
104
|
+
mergedOptions.read = initState.config.read;
|
|
105
|
+
}
|
|
106
|
+
const result = bindOcrScreen(initState.config.page, config, initState.extractor, options.shotDir ?? initState.shotDir, mergedOptions);
|
|
107
|
+
if (options.wait === false) {
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
return result.waitFor().then(() => result);
|
|
86
111
|
}
|
|
87
112
|
/** Release shared OCR/CV resources. Optional — registered automatically by init(). */
|
|
88
113
|
export async function release() {
|
|
89
114
|
initState?.extractor.cleanup();
|
|
90
115
|
initState = null;
|
|
116
|
+
setUnhoverPoint(undefined);
|
|
117
|
+
clearConfigUnhoverPoint();
|
|
118
|
+
clearScreenHandlers();
|
|
119
|
+
setClickStrategy(undefined);
|
|
120
|
+
setFillStrategy(undefined);
|
|
91
121
|
setCharsetRegistry({});
|
|
122
|
+
setOcrStrategy(undefined);
|
|
92
123
|
await cleanupOCR();
|
|
93
124
|
}
|
|
94
125
|
/** @deprecated Use release() */
|
|
@@ -108,6 +139,10 @@ export const releaseOcrScreen = release;
|
|
|
108
139
|
* test.use({ ocrOverlay: true });
|
|
109
140
|
*/
|
|
110
141
|
export function createFixture() {
|
|
142
|
+
// Dynamic import so @playwright/test is not required at module load time
|
|
143
|
+
// (it is an optional peer — QA Wolf flows use init()/screen() without fixtures)
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
145
|
+
const { test: base } = require('@playwright/test');
|
|
111
146
|
return base.extend({
|
|
112
147
|
_ocrReady: [
|
|
113
148
|
async ({}, use) => {
|
package/dist/screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../src/screen.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AAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAErC,MAAM,EAAE,KAAK,EACX,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAwD,EACrF,GAAyC,EACzC,QAA+D,EAC/D,EAAE;YACF,KAAK,SAAS,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAC,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,CAAC;YAC/E,CAAC;YAAC,MAAM,CAAC;gBACP,WAAW;YACb,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,kBAAkB,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YACjD,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3C,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;gBACtB,MAAM,MAAM,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBACjF,OAAO,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;YAClF,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;KACF,CAA8D,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Page } from '@playwright/test';
|
|
2
|
+
import type { Rect } from './types.js';
|
|
3
|
+
import type { OcrStrategy } from './utils/ocr.js';
|
|
4
|
+
export type { OcrStrategy };
|
|
5
|
+
export interface ClickStrategy {
|
|
6
|
+
/** Returns the point to click within the element's bounding rect. */
|
|
7
|
+
getPoint(rect: Rect): {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface FillStrategy {
|
|
13
|
+
/** Full fill sequence: focus, select, type. Owns all keyboard/mouse steps. */
|
|
14
|
+
fill(page: Page, rect: Rect, text: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface CaptureStrategy {
|
|
17
|
+
unhover: boolean;
|
|
18
|
+
unhoverPoint?: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function setClickStrategy(s: ClickStrategy | undefined): void;
|
|
24
|
+
export declare function setFillStrategy(s: FillStrategy | undefined): void;
|
|
25
|
+
export declare function getClickStrategy(): ClickStrategy;
|
|
26
|
+
export declare function getFillStrategy(): FillStrategy;
|
|
27
|
+
export declare const Strategies: {
|
|
28
|
+
Ocr: {
|
|
29
|
+
/** Create an Ocr strategy with global charset defaults, name-inference, and swaps. */
|
|
30
|
+
default(options: OcrStrategy): OcrStrategy;
|
|
31
|
+
};
|
|
32
|
+
Click: {
|
|
33
|
+
/** Click the center of the element rect. Default behavior. */
|
|
34
|
+
center(): ClickStrategy;
|
|
35
|
+
/**
|
|
36
|
+
* Click at a fractional offset within the element rect.
|
|
37
|
+
* `{ x: 0, y: 0.5 }` → left-center; `{ x: 0.5, y: 0.5 }` → center.
|
|
38
|
+
*/
|
|
39
|
+
offset(pct: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}): ClickStrategy;
|
|
43
|
+
/** Click at a custom point derived from the rect. */
|
|
44
|
+
point(fn: (rect: Rect) => {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}): ClickStrategy;
|
|
48
|
+
};
|
|
49
|
+
Fill: {
|
|
50
|
+
/** Click → Ctrl/Cmd+A → Backspace → insertText. Default behavior. */
|
|
51
|
+
selectAllType(): FillStrategy;
|
|
52
|
+
/**
|
|
53
|
+
* Triple-click (selects all in remote/Guacamole envs) → insertText.
|
|
54
|
+
* Preferred over selectAllType for environments that don't relay Ctrl+A.
|
|
55
|
+
*/
|
|
56
|
+
tripleClickType(): FillStrategy;
|
|
57
|
+
/** Click → Ctrl/Cmd+A → Backspace → keyboard.type (slower, fires key events). */
|
|
58
|
+
clearAndType(): FillStrategy;
|
|
59
|
+
/** Type into the currently focused element without clicking or clearing. */
|
|
60
|
+
typeOnly(): FillStrategy;
|
|
61
|
+
/**
|
|
62
|
+
* Click to focus, then type one character at a time with a delay.
|
|
63
|
+
* Use in environments where rapid key events are dropped.
|
|
64
|
+
*/
|
|
65
|
+
charByChar(options: {
|
|
66
|
+
delay: number;
|
|
67
|
+
}): FillStrategy;
|
|
68
|
+
/** Click to focus, then use insertText without selecting/clearing first. */
|
|
69
|
+
insertText(): FillStrategy;
|
|
70
|
+
};
|
|
71
|
+
Capture: {
|
|
72
|
+
/** Move the mouse to a neutral corner before OCR screenshots. Default behavior. */
|
|
73
|
+
unhover(options?: {
|
|
74
|
+
point?: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
};
|
|
78
|
+
}): CaptureStrategy;
|
|
79
|
+
/** Skip the unhover mouse move before capture. */
|
|
80
|
+
noop(): CaptureStrategy;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=strategies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../src/strategies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,CAAC;AAI5B,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,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CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,eAAe;QAIxE,kDAAkD;gBAC1C,eAAe;;CAI1B,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// ─── Module-level state ───────────────────────────────────────────────────────
|
|
2
|
+
let globalClickStrategy;
|
|
3
|
+
let globalFillStrategy;
|
|
4
|
+
export function setClickStrategy(s) {
|
|
5
|
+
globalClickStrategy = s;
|
|
6
|
+
}
|
|
7
|
+
export function setFillStrategy(s) {
|
|
8
|
+
globalFillStrategy = s;
|
|
9
|
+
}
|
|
10
|
+
export function getClickStrategy() {
|
|
11
|
+
return globalClickStrategy ?? Strategies.Click.center();
|
|
12
|
+
}
|
|
13
|
+
export function getFillStrategy() {
|
|
14
|
+
return globalFillStrategy ?? Strategies.Fill.selectAllType();
|
|
15
|
+
}
|
|
16
|
+
// ─── Strategies namespace ─────────────────────────────────────────────────────
|
|
17
|
+
export const Strategies = {
|
|
18
|
+
Ocr: {
|
|
19
|
+
/** Create an Ocr strategy with global charset defaults, name-inference, and swaps. */
|
|
20
|
+
default(options) {
|
|
21
|
+
return options;
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
Click: {
|
|
25
|
+
/** Click the center of the element rect. Default behavior. */
|
|
26
|
+
center() {
|
|
27
|
+
return { getPoint: (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 }) };
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Click at a fractional offset within the element rect.
|
|
31
|
+
* `{ x: 0, y: 0.5 }` → left-center; `{ x: 0.5, y: 0.5 }` → center.
|
|
32
|
+
*/
|
|
33
|
+
offset(pct) {
|
|
34
|
+
return { getPoint: (r) => ({ x: r.x + r.width * pct.x, y: r.y + r.height * pct.y }) };
|
|
35
|
+
},
|
|
36
|
+
/** Click at a custom point derived from the rect. */
|
|
37
|
+
point(fn) {
|
|
38
|
+
return { getPoint: fn };
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
Fill: {
|
|
42
|
+
/** Click → Ctrl/Cmd+A → Backspace → insertText. Default behavior. */
|
|
43
|
+
selectAllType() {
|
|
44
|
+
return {
|
|
45
|
+
async fill(page, rect, text) {
|
|
46
|
+
await page.mouse.click(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
47
|
+
await page.keyboard.press('ControlOrMeta+A');
|
|
48
|
+
await page.keyboard.press('Backspace');
|
|
49
|
+
await page.keyboard.insertText(text);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Triple-click (selects all in remote/Guacamole envs) → insertText.
|
|
55
|
+
* Preferred over selectAllType for environments that don't relay Ctrl+A.
|
|
56
|
+
*/
|
|
57
|
+
tripleClickType() {
|
|
58
|
+
return {
|
|
59
|
+
async fill(page, rect, text) {
|
|
60
|
+
await page.mouse.click(rect.x + rect.width / 2, rect.y + rect.height / 2, { clickCount: 3 });
|
|
61
|
+
await page.keyboard.insertText(text);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
/** Click → Ctrl/Cmd+A → Backspace → keyboard.type (slower, fires key events). */
|
|
66
|
+
clearAndType() {
|
|
67
|
+
return {
|
|
68
|
+
async fill(page, rect, text) {
|
|
69
|
+
await page.mouse.click(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
70
|
+
await page.keyboard.press('ControlOrMeta+A');
|
|
71
|
+
await page.keyboard.press('Backspace');
|
|
72
|
+
await page.keyboard.type(text);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
/** Type into the currently focused element without clicking or clearing. */
|
|
77
|
+
typeOnly() {
|
|
78
|
+
return {
|
|
79
|
+
async fill(page, _rect, text) {
|
|
80
|
+
await page.keyboard.type(text);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Click to focus, then type one character at a time with a delay.
|
|
86
|
+
* Use in environments where rapid key events are dropped.
|
|
87
|
+
*/
|
|
88
|
+
charByChar(options) {
|
|
89
|
+
return {
|
|
90
|
+
async fill(page, rect, text) {
|
|
91
|
+
await page.mouse.click(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
92
|
+
await page.keyboard.type(text, { delay: options.delay });
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
/** Click to focus, then use insertText without selecting/clearing first. */
|
|
97
|
+
insertText() {
|
|
98
|
+
return {
|
|
99
|
+
async fill(page, rect, text) {
|
|
100
|
+
await page.mouse.click(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
101
|
+
await page.keyboard.insertText(text);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
Capture: {
|
|
107
|
+
/** Move the mouse to a neutral corner before OCR screenshots. Default behavior. */
|
|
108
|
+
unhover(options) {
|
|
109
|
+
return { unhover: true, ...(options?.point !== undefined && { unhoverPoint: options.point }) };
|
|
110
|
+
},
|
|
111
|
+
/** Skip the unhover mouse move before capture. */
|
|
112
|
+
noop() {
|
|
113
|
+
return { unhover: false };
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=strategies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategies.js","sourceRoot":"","sources":["../src/strategies.ts"],"names":[],"mappings":"AAsBA,iFAAiF;AAEjF,IAAI,mBAA8C,CAAC;AACnD,IAAI,kBAA4C,CAAC;AAEjD,MAAM,UAAU,gBAAgB,CAAC,CAA4B;IAC3D,mBAAmB,GAAG,CAAC,CAAC;AAC1B,CAAC;AACD,MAAM,UAAU,eAAe,CAAC,CAA2B;IACzD,kBAAkB,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,mBAAmB,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AAC1D,C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ClD,IAAI;YACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategies.test.d.ts","sourceRoot":"","sources":["../src/strategies.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { Strategies, setClickStrategy, setFillStrategy, getClickStrategy, getFillStrategy } from './strategies.js';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Helpers
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
const rect = { x: 100, y: 200, width: 80, height: 40 };
|
|
7
|
+
function mockPage() {
|
|
8
|
+
return {
|
|
9
|
+
mouse: { click: vi.fn(), tripleclick: vi.fn() },
|
|
10
|
+
keyboard: {
|
|
11
|
+
press: vi.fn(),
|
|
12
|
+
type: vi.fn(),
|
|
13
|
+
insertText: vi.fn(),
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Strategies.Click
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
describe('Strategies.Click.center()', () => {
|
|
21
|
+
it('returns the midpoint of the rect', () => {
|
|
22
|
+
const pt = Strategies.Click.center().getPoint(rect);
|
|
23
|
+
expect(pt).toEqual({ x: 140, y: 220 });
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('Strategies.Click.offset()', () => {
|
|
27
|
+
it('{ x: 0, y: 0.5 } → left-center', () => {
|
|
28
|
+
const pt = Strategies.Click.offset({ x: 0, y: 0.5 }).getPoint(rect);
|
|
29
|
+
expect(pt).toEqual({ x: 100, y: 220 });
|
|
30
|
+
});
|
|
31
|
+
it('{ x: 1, y: 1 } → bottom-right corner', () => {
|
|
32
|
+
const pt = Strategies.Click.offset({ x: 1, y: 1 }).getPoint(rect);
|
|
33
|
+
expect(pt).toEqual({ x: 180, y: 240 });
|
|
34
|
+
});
|
|
35
|
+
it('{ x: 0.5, y: 0.5 } → same as center', () => {
|
|
36
|
+
const pt = Strategies.Click.offset({ x: 0.5, y: 0.5 }).getPoint(rect);
|
|
37
|
+
expect(pt).toEqual(Strategies.Click.center().getPoint(rect));
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe('Strategies.Click.point(fn)', () => {
|
|
41
|
+
it('delegates to the provided function', () => {
|
|
42
|
+
const fn = vi.fn().mockReturnValue({ x: 10, y: 20 });
|
|
43
|
+
const pt = Strategies.Click.point(fn).getPoint(rect);
|
|
44
|
+
expect(fn).toHaveBeenCalledWith(rect);
|
|
45
|
+
expect(pt).toEqual({ x: 10, y: 20 });
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Strategies.Fill
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
describe('Strategies.Fill.selectAllType()', () => {
|
|
52
|
+
it('click → Ctrl+A → Backspace → insertText', async () => {
|
|
53
|
+
const page = mockPage();
|
|
54
|
+
await Strategies.Fill.selectAllType().fill(page, rect, 'hello');
|
|
55
|
+
expect(page.mouse.click).toHaveBeenCalledWith(140, 220);
|
|
56
|
+
expect(page.keyboard.press).toHaveBeenCalledWith('ControlOrMeta+A');
|
|
57
|
+
expect(page.keyboard.press).toHaveBeenCalledWith('Backspace');
|
|
58
|
+
expect(page.keyboard.insertText).toHaveBeenCalledWith('hello');
|
|
59
|
+
expect(page.keyboard.type).not.toHaveBeenCalled();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('Strategies.Fill.tripleClickType()', () => {
|
|
63
|
+
it('triple-click then insertText (no Ctrl+A)', async () => {
|
|
64
|
+
const page = mockPage();
|
|
65
|
+
await Strategies.Fill.tripleClickType().fill(page, rect, 'hello');
|
|
66
|
+
expect(page.mouse.click).toHaveBeenCalledWith(140, 220, { clickCount: 3 });
|
|
67
|
+
expect(page.keyboard.insertText).toHaveBeenCalledWith('hello');
|
|
68
|
+
expect(page.keyboard.press).not.toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('Strategies.Fill.clearAndType()', () => {
|
|
72
|
+
it('click → Ctrl+A → Backspace → keyboard.type', async () => {
|
|
73
|
+
const page = mockPage();
|
|
74
|
+
await Strategies.Fill.clearAndType().fill(page, rect, 'hello');
|
|
75
|
+
expect(page.mouse.click).toHaveBeenCalledWith(140, 220);
|
|
76
|
+
expect(page.keyboard.press).toHaveBeenCalledWith('ControlOrMeta+A');
|
|
77
|
+
expect(page.keyboard.press).toHaveBeenCalledWith('Backspace');
|
|
78
|
+
expect(page.keyboard.type).toHaveBeenCalledWith('hello');
|
|
79
|
+
expect(page.keyboard.insertText).not.toHaveBeenCalled();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('Strategies.Fill.typeOnly()', () => {
|
|
83
|
+
it('keyboard.type without any click or selection', async () => {
|
|
84
|
+
const page = mockPage();
|
|
85
|
+
await Strategies.Fill.typeOnly().fill(page, rect, 'hello');
|
|
86
|
+
expect(page.keyboard.type).toHaveBeenCalledWith('hello');
|
|
87
|
+
expect(page.mouse.click).not.toHaveBeenCalled();
|
|
88
|
+
expect(page.keyboard.press).not.toHaveBeenCalled();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe('Strategies.Fill.charByChar()', () => {
|
|
92
|
+
it('click then keyboard.type with delay', async () => {
|
|
93
|
+
const page = mockPage();
|
|
94
|
+
await Strategies.Fill.charByChar({ delay: 30 }).fill(page, rect, 'hi');
|
|
95
|
+
expect(page.mouse.click).toHaveBeenCalledWith(140, 220);
|
|
96
|
+
expect(page.keyboard.type).toHaveBeenCalledWith('hi', { delay: 30 });
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('Strategies.Fill.insertText()', () => {
|
|
100
|
+
it('click then insertText without selection', async () => {
|
|
101
|
+
const page = mockPage();
|
|
102
|
+
await Strategies.Fill.insertText().fill(page, rect, 'hello');
|
|
103
|
+
expect(page.mouse.click).toHaveBeenCalledWith(140, 220);
|
|
104
|
+
expect(page.keyboard.insertText).toHaveBeenCalledWith('hello');
|
|
105
|
+
expect(page.keyboard.press).not.toHaveBeenCalled();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Strategies.Capture
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
describe('Strategies.Capture', () => {
|
|
112
|
+
it('unhover() sets unhover:true with no point by default', () => {
|
|
113
|
+
const cap = Strategies.Capture.unhover();
|
|
114
|
+
expect(cap.unhover).toBe(true);
|
|
115
|
+
expect(cap.unhoverPoint).toBeUndefined();
|
|
116
|
+
});
|
|
117
|
+
it('unhover({ point }) stores the point', () => {
|
|
118
|
+
const cap = Strategies.Capture.unhover({ point: { x: 5, y: 10 } });
|
|
119
|
+
expect(cap.unhover).toBe(true);
|
|
120
|
+
expect(cap.unhoverPoint).toEqual({ x: 5, y: 10 });
|
|
121
|
+
});
|
|
122
|
+
it('noop() sets unhover:false', () => {
|
|
123
|
+
expect(Strategies.Capture.noop().unhover).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Module-level state: setClickStrategy / setFillStrategy
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
describe('module-level strategy state', () => {
|
|
130
|
+
afterEach(() => {
|
|
131
|
+
setClickStrategy(undefined);
|
|
132
|
+
setFillStrategy(undefined);
|
|
133
|
+
});
|
|
134
|
+
it('getClickStrategy() returns center by default', () => {
|
|
135
|
+
const pt = getClickStrategy().getPoint(rect);
|
|
136
|
+
expect(pt).toEqual({ x: 140, y: 220 });
|
|
137
|
+
});
|
|
138
|
+
it('setClickStrategy() overrides the default', () => {
|
|
139
|
+
setClickStrategy(Strategies.Click.offset({ x: 0, y: 0 }));
|
|
140
|
+
const pt = getClickStrategy().getPoint(rect);
|
|
141
|
+
expect(pt).toEqual({ x: 100, y: 200 });
|
|
142
|
+
});
|
|
143
|
+
it('setClickStrategy(undefined) restores the default', () => {
|
|
144
|
+
setClickStrategy(Strategies.Click.offset({ x: 0, y: 0 }));
|
|
145
|
+
setClickStrategy(undefined);
|
|
146
|
+
const pt = getClickStrategy().getPoint(rect);
|
|
147
|
+
expect(pt).toEqual({ x: 140, y: 220 });
|
|
148
|
+
});
|
|
149
|
+
it('getFillStrategy() uses selectAllType by default', async () => {
|
|
150
|
+
const page = mockPage();
|
|
151
|
+
await getFillStrategy().fill(page, rect, 'x');
|
|
152
|
+
expect(page.keyboard.press).toHaveBeenCalledWith('ControlOrMeta+A');
|
|
153
|
+
});
|
|
154
|
+
it('setFillStrategy() overrides the default', async () => {
|
|
155
|
+
setFillStrategy(Strategies.Fill.typeOnly());
|
|
156
|
+
const page = mockPage();
|
|
157
|
+
await getFillStrategy().fill(page, rect, 'x');
|
|
158
|
+
expect(page.keyboard.type).toHaveBeenCalledWith('x');
|
|
159
|
+
expect(page.keyboard.press).not.toHaveBeenCalled();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// presets sanity check
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
describe('presets', () => {
|
|
166
|
+
beforeEach(() => { setFillStrategy(undefined); });
|
|
167
|
+
afterEach(() => { setFillStrategy(undefined); });
|
|
168
|
+
it('presets.guacamole.strategies.fill uses tripleClickType', async () => {
|
|
169
|
+
const { presets } = await import('./presets.js');
|
|
170
|
+
const page = mockPage();
|
|
171
|
+
await presets.guacamole.strategies.fill.fill(page, rect, 'val');
|
|
172
|
+
expect(page.mouse.click).toHaveBeenCalledWith(140, 220, { clickCount: 3 });
|
|
173
|
+
});
|
|
174
|
+
it('presets.rdp.strategies.fill uses charByChar with delay 30', async () => {
|
|
175
|
+
const { presets } = await import('./presets.js');
|
|
176
|
+
const page = mockPage();
|
|
177
|
+
await presets.rdp.strategies.fill.fill(page, rect, 'val');
|
|
178
|
+
expect(page.keyboard.type).toHaveBeenCalledWith('val', { delay: 30 });
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=strategies.test.js.map
|