@kraken-e2e/contracts 0.1.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/LICENSE +674 -0
- package/dist/driver.d.ts +106 -0
- package/dist/driver.d.ts.map +1 -0
- package/dist/driver.js +28 -0
- package/dist/driver.js.map +1 -0
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +73 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +109 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/host.d.ts +36 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +37 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/reporter.d.ts +15 -0
- package/dist/reporter.d.ts.map +1 -0
- package/dist/reporter.js +5 -0
- package/dist/reporter.js.map +1 -0
- package/dist/session.d.ts +78 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +21 -0
- package/dist/session.js.map +1 -0
- package/dist/version.d.ts +22 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +20 -0
- package/dist/version.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core session surface (ADR-0001 §5.4 Option C, exact list fixed by
|
|
3
|
+
* ADR-0002 D1): locator-driven, stateless operations every platform can offer,
|
|
4
|
+
* plus a typed native escape hatch. This surface grows ONLY through the parity
|
|
5
|
+
* gate (RFC + CTK case + passing Android AND iOS implementations).
|
|
6
|
+
*/
|
|
7
|
+
/** Portable locator strategies; `native` is explicitly non-portable and CTK-exempt. */
|
|
8
|
+
export type TargetLocator = {
|
|
9
|
+
readonly by: 'testId';
|
|
10
|
+
readonly value: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly by: 'text';
|
|
13
|
+
readonly value: string;
|
|
14
|
+
readonly exact?: boolean;
|
|
15
|
+
} | {
|
|
16
|
+
readonly by: 'a11y';
|
|
17
|
+
readonly value: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly by: 'native';
|
|
20
|
+
readonly value: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Cross-platform semantic keys — FAITHFUL on both mobile platforms (contract
|
|
24
|
+
* 2.0, ratified 2026-07-04): Android via system keycodes, iOS via HID
|
|
25
|
+
* keyboard events (live-verified). Android's BACK is deliberately NOT here:
|
|
26
|
+
* it is an Android platform concept, not a key anywhere else (live-tested:
|
|
27
|
+
* iOS ignores even the HID 'AC Back' consumer event) — reach it via native()
|
|
28
|
+
* or a future Android-specific capability.
|
|
29
|
+
*/
|
|
30
|
+
export type SemanticKey = 'enter' | 'escape' | 'tab';
|
|
31
|
+
export type WaitState = 'visible' | 'hidden' | 'attached';
|
|
32
|
+
export interface SessionWaitOptions {
|
|
33
|
+
readonly timeoutMs?: number;
|
|
34
|
+
readonly pollMs?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ArtifactRef {
|
|
37
|
+
readonly kind: 'screenshot' | 'log' | 'video' | 'source';
|
|
38
|
+
readonly path: string;
|
|
39
|
+
}
|
|
40
|
+
/** The operations the parity report is generated over (ADR-0002 D1). */
|
|
41
|
+
export declare const CORE_OPERATIONS: readonly ["tap", "typeText", "readText", "waitFor", "isDisplayed", "scrollIntoView", "pressKey", "navigate", "screenshot", "source", "dispose"];
|
|
42
|
+
export type CoreOperation = (typeof CORE_OPERATIONS)[number];
|
|
43
|
+
/**
|
|
44
|
+
* Typed escape hatch registry. Driver packages augment it via declaration
|
|
45
|
+
* merging (zero core→driver imports — ADR-0001 §5.4):
|
|
46
|
+
*
|
|
47
|
+
* declare module '@kraken-e2e/contracts' {
|
|
48
|
+
* interface KrakenNativeSessions { web: WebdriverIO.Browser }
|
|
49
|
+
* }
|
|
50
|
+
*/
|
|
51
|
+
export interface KrakenNativeSessions {
|
|
52
|
+
}
|
|
53
|
+
export interface UserSession {
|
|
54
|
+
readonly actorId: string;
|
|
55
|
+
readonly driverId: string;
|
|
56
|
+
readonly platform: string;
|
|
57
|
+
/** Feeds the parity report; an unsupported op throws KRK-SESSION-OP-UNSUPPORTED. */
|
|
58
|
+
readonly capabilities: Readonly<Record<CoreOperation, 'supported' | 'unsupported'>>;
|
|
59
|
+
tap(target: TargetLocator): Promise<void>;
|
|
60
|
+
typeText(target: TargetLocator, text: string): Promise<void>;
|
|
61
|
+
readText(target: TargetLocator): Promise<string>;
|
|
62
|
+
waitFor(target: TargetLocator, state: WaitState, opts?: SessionWaitOptions): Promise<void>;
|
|
63
|
+
isDisplayed(target: TargetLocator): Promise<boolean>;
|
|
64
|
+
/** Intent-level (bring element into view) — not a raw gesture (ADR-0002 D1). */
|
|
65
|
+
scrollIntoView(target: TargetLocator): Promise<void>;
|
|
66
|
+
pressKey(key: SemanticKey): Promise<void>;
|
|
67
|
+
/** URL (web) or deep link (mobile). */
|
|
68
|
+
navigate(destination: string): Promise<void>;
|
|
69
|
+
/** Path ref, never bytes. */
|
|
70
|
+
screenshot(): Promise<ArtifactRef>;
|
|
71
|
+
/** DOM / view-hierarchy dump. */
|
|
72
|
+
source(): Promise<string>;
|
|
73
|
+
/** Idempotent — SIGINT teardown may call it more than once. */
|
|
74
|
+
dispose(): Promise<void>;
|
|
75
|
+
/** Typed platform-native session (declaration merging; throws if kind mismatches). */
|
|
76
|
+
native<K extends keyof KrakenNativeSessions>(kind: K): KrakenNativeSessions[K];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uFAAuF;AACvF,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IA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driven, stateless operations every platform can offer,
|
|
4
|
+
* plus a typed native escape hatch. This surface grows ONLY through the parity
|
|
5
|
+
* gate (RFC + CTK case + passing Android AND iOS implementations).
|
|
6
|
+
*/
|
|
7
|
+
/** The operations the parity report is generated over (ADR-0002 D1). */
|
|
8
|
+
export const CORE_OPERATIONS = [
|
|
9
|
+
'tap',
|
|
10
|
+
'typeText',
|
|
11
|
+
'readText',
|
|
12
|
+
'waitFor',
|
|
13
|
+
'isDisplayed',
|
|
14
|
+
'scrollIntoView',
|
|
15
|
+
'pressKey',
|
|
16
|
+
'navigate',
|
|
17
|
+
'screenshot',
|
|
18
|
+
'source',
|
|
19
|
+
'dispose',
|
|
20
|
+
];
|
|
21
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+BH,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,UAAU;IACV,UAAU;IACV,SAAS;IACT,aAAa;IACb,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,SAAS;CACD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ContractVersion {
|
|
2
|
+
readonly major: number;
|
|
3
|
+
readonly minor: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Version of the driver/reporter SPI this package describes. Baked into every
|
|
7
|
+
* plugin by defineDriver() and checked by core's registry at load time.
|
|
8
|
+
* 1.0 froze with ADR-0002's acceptance (2026-07-03). 2.0 (2026-07-04):
|
|
9
|
+
* BREAKING — SemanticKey narrowed to enter|escape|tab ('back' removed: an
|
|
10
|
+
* Android-only concept, proven not-a-key on iOS by live HID probing; see the
|
|
11
|
+
* ADR-0002 amendment). Breaking SPI change = major bump, addition = minor
|
|
12
|
+
* bump; the API-surface snapshot test enforces the discipline.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CONTRACT_VERSION: ContractVersion;
|
|
15
|
+
/**
|
|
16
|
+
* The load-time compatibility rule (ADR-0001 §5.10): same major, and the
|
|
17
|
+
* plugin must not have been compiled against a NEWER minor than the host
|
|
18
|
+
* supports (it may call capabilities the host lacks). Older plugin on newer
|
|
19
|
+
* host is fine.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isContractCompatible(plugin: ContractVersion, host: ContractVersion): boolean;
|
|
22
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAAwC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAE5F"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version of the driver/reporter SPI this package describes. Baked into every
|
|
3
|
+
* plugin by defineDriver() and checked by core's registry at load time.
|
|
4
|
+
* 1.0 froze with ADR-0002's acceptance (2026-07-03). 2.0 (2026-07-04):
|
|
5
|
+
* BREAKING — SemanticKey narrowed to enter|escape|tab ('back' removed: an
|
|
6
|
+
* Android-only concept, proven not-a-key on iOS by live HID probing; see the
|
|
7
|
+
* ADR-0002 amendment). Breaking SPI change = major bump, addition = minor
|
|
8
|
+
* bump; the API-surface snapshot test enforces the discipline.
|
|
9
|
+
*/
|
|
10
|
+
export const CONTRACT_VERSION = { major: 2, minor: 0 };
|
|
11
|
+
/**
|
|
12
|
+
* The load-time compatibility rule (ADR-0001 §5.10): same major, and the
|
|
13
|
+
* plugin must not have been compiled against a NEWER minor than the host
|
|
14
|
+
* supports (it may call capabilities the host lacks). Older plugin on newer
|
|
15
|
+
* host is fine.
|
|
16
|
+
*/
|
|
17
|
+
export function isContractCompatible(plugin, host) {
|
|
18
|
+
return plugin.major === host.major && plugin.minor <= host.minor;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAuB,EAAE,IAAqB;IACjF,OAAO,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;AACnE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kraken-e2e/contracts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Zero-runtime-dependency SPI: driver/reporter interfaces, event types, error codes, defineDriver/defineReporter, CONTRACT_VERSION",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.13.0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@kraken-e2e/signaling": "0.1.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.15.0",
|
|
26
|
+
"typescript": "~6.0.3",
|
|
27
|
+
"vitest": "^4.1.9"
|
|
28
|
+
},
|
|
29
|
+
"license": "GPL-3.0-only",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.build.json",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"test": "vitest run"
|
|
34
|
+
}
|
|
35
|
+
}
|