spana-test 0.8.0 → 0.10.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/agent/index.d.ts +2 -2
- package/dist/agent/index.js +7 -7
- package/dist/{allure-RAEK4SIH.js → allure-FGVR5LND.js} +5 -1
- package/dist/allure-FGVR5LND.js.map +1 -0
- package/dist/app-xIYd2jde.d.ts +1309 -0
- package/dist/{chunk-3FXDOTFI.js → chunk-66D3C7NB.js} +326 -61
- package/dist/chunk-66D3C7NB.js.map +1 -0
- package/dist/{chunk-WKVU24B6.js → chunk-6GBAPW6K.js} +12 -8
- package/dist/chunk-6GBAPW6K.js.map +1 -0
- package/dist/{chunk-2T4K7BJ3.js → chunk-7QFJ7MDH.js} +4 -2
- package/dist/chunk-7QFJ7MDH.js.map +1 -0
- package/dist/{chunk-AJCSETN6.js → chunk-B35G77DN.js} +1122 -387
- package/dist/chunk-B35G77DN.js.map +1 -0
- package/dist/{chunk-SNL4X67N.js → chunk-B473XZOM.js} +441 -123
- package/dist/chunk-B473XZOM.js.map +1 -0
- package/dist/{chunk-Y2RZNOKU.js → chunk-C2HBFEMQ.js} +2 -2
- package/dist/{chunk-PLE7RFQE.js → chunk-DP7MGXHN.js} +26 -1
- package/dist/chunk-DP7MGXHN.js.map +1 -0
- package/dist/{chunk-PMXSU5MS.js → chunk-IXON7DMB.js} +2 -2
- package/dist/{chunk-QP4MDUBY.js → chunk-VP6V4XEJ.js} +2 -2
- package/dist/{chunk-NS2HLJO4.js → chunk-Y6KMJJ2T.js} +3 -3
- package/dist/{chunk-RKYKRGHB.js → chunk-Z6K4QQAR.js} +128 -6
- package/dist/chunk-Z6K4QQAR.js.map +1 -0
- package/dist/cli.js +17 -12
- package/dist/cli.js.map +1 -1
- package/dist/config-loader-WLPQ5WVH.js +9 -0
- package/dist/{console-BGAK7Z2L.js → console-DIYEJSSP.js} +9 -2
- package/dist/console-DIYEJSSP.js.map +1 -0
- package/dist/{daemon-manager-DDYQITPD.js → daemon-manager-2EQDVUVM.js} +8 -2
- package/dist/{doctor-command-HEQQOYUR.js → doctor-command-QIYBI7ZF.js} +4 -4
- package/dist/{flow-Md5xLwbX.d.ts → flow-CI5parw2.d.ts} +24 -3
- package/dist/gherkin/steps.d.ts +2 -2
- package/dist/{html-JO2YNRWX.js → html-FLMWPFQD.js} +2 -1
- package/dist/html-FLMWPFQD.js.map +1 -0
- package/dist/index.d.ts +50 -8
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/dist/{installer-IYGMG7LS.js → installer-5UHTYQTB.js} +3 -3
- package/dist/{junit-HLC62MK6.js → junit-CGB3LKHD.js} +3 -2
- package/dist/junit-CGB3LKHD.js.map +1 -0
- package/dist/{runner-TF4OKPYP.js → runner-JID2YWRE.js} +6 -2
- package/dist/{server-JPNH33MX.js → server-6KQSTQIG.js} +13 -13
- package/dist/{server-4PEREPHY.js → server-UIRGHUYM.js} +2 -2
- package/dist/{session-V4PYJXNB.js → session-BE6U34DA.js} +6 -6
- package/dist/{session-D9e30RVS.d.ts → session-Bt_mbUWg.d.ts} +3 -1
- package/dist/{studio-command-JOIFCOHC.js → studio-command-TXQTIWRS.js} +2 -2
- package/dist/{test-command-JCO2HPYI.js → test-command-CCSQPKWU.js} +110 -29
- package/dist/test-command-CCSQPKWU.js.map +1 -0
- package/dist/{validator-BLOLIHUY.js → validator-YWNHCU2S.js} +3 -3
- package/native/win32-x64/spana_native.dll +0 -0
- package/package.json +1 -1
- package/dist/allure-RAEK4SIH.js.map +0 -1
- package/dist/app-CgbLADmF.d.ts +0 -1191
- package/dist/chunk-2T4K7BJ3.js.map +0 -1
- package/dist/chunk-3FXDOTFI.js.map +0 -1
- package/dist/chunk-AJCSETN6.js.map +0 -1
- package/dist/chunk-PLE7RFQE.js.map +0 -1
- package/dist/chunk-RKYKRGHB.js.map +0 -1
- package/dist/chunk-SNL4X67N.js.map +0 -1
- package/dist/chunk-WKVU24B6.js.map +0 -1
- package/dist/config-loader-5FU45FXK.js +0 -9
- package/dist/console-BGAK7Z2L.js.map +0 -1
- package/dist/html-JO2YNRWX.js.map +0 -1
- package/dist/junit-HLC62MK6.js.map +0 -1
- package/dist/test-command-JCO2HPYI.js.map +0 -1
- /package/dist/{chunk-Y2RZNOKU.js.map → chunk-C2HBFEMQ.js.map} +0 -0
- /package/dist/{chunk-PMXSU5MS.js.map → chunk-IXON7DMB.js.map} +0 -0
- /package/dist/{chunk-QP4MDUBY.js.map → chunk-VP6V4XEJ.js.map} +0 -0
- /package/dist/{chunk-NS2HLJO4.js.map → chunk-Y6KMJJ2T.js.map} +0 -0
- /package/dist/{config-loader-5FU45FXK.js.map → config-loader-WLPQ5WVH.js.map} +0 -0
- /package/dist/{daemon-manager-DDYQITPD.js.map → daemon-manager-2EQDVUVM.js.map} +0 -0
- /package/dist/{doctor-command-HEQQOYUR.js.map → doctor-command-QIYBI7ZF.js.map} +0 -0
- /package/dist/{installer-IYGMG7LS.js.map → installer-5UHTYQTB.js.map} +0 -0
- /package/dist/{runner-TF4OKPYP.js.map → runner-JID2YWRE.js.map} +0 -0
- /package/dist/{server-JPNH33MX.js.map → server-6KQSTQIG.js.map} +0 -0
- /package/dist/{server-4PEREPHY.js.map → server-UIRGHUYM.js.map} +0 -0
- /package/dist/{session-V4PYJXNB.js.map → session-BE6U34DA.js.map} +0 -0
- /package/dist/{studio-command-JOIFCOHC.js.map → studio-command-TXQTIWRS.js.map} +0 -0
- /package/dist/{validator-BLOLIHUY.js.map → validator-YWNHCU2S.js.map} +0 -0
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ElementNotFoundError,
|
|
4
4
|
TextMismatchError,
|
|
5
5
|
WaitTimeoutError,
|
|
6
|
+
buildDomActionabilityDiagScript,
|
|
6
7
|
buildDomFillScript,
|
|
7
8
|
buildDomQueryScript,
|
|
8
9
|
buildDomScrollIntoViewScript,
|
|
@@ -14,11 +15,7 @@ import {
|
|
|
14
15
|
createCompositeDomChannel,
|
|
15
16
|
createWebKitInspectorChannel,
|
|
16
17
|
domMatchToElement
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import {
|
|
19
|
-
getHealthyWarmDaemon,
|
|
20
|
-
registerWarmDaemon
|
|
21
|
-
} from "./chunk-RKYKRGHB.js";
|
|
18
|
+
} from "./chunk-B473XZOM.js";
|
|
22
19
|
import {
|
|
23
20
|
installedUrlSchemesOnSimulator,
|
|
24
21
|
launchOnSimulator,
|
|
@@ -29,6 +26,10 @@ import {
|
|
|
29
26
|
resetSimulatorKeychain,
|
|
30
27
|
terminateOnSimulator
|
|
31
28
|
} from "./chunk-WV3ALL3H.js";
|
|
29
|
+
import {
|
|
30
|
+
getHealthyWarmDaemon,
|
|
31
|
+
registerWarmDaemon
|
|
32
|
+
} from "./chunk-Z6K4QQAR.js";
|
|
32
33
|
import {
|
|
33
34
|
allocateFreePort,
|
|
34
35
|
allocatePort,
|
|
@@ -65,7 +66,9 @@ var _AccessibilityLabelSelectorSchema = Schema.Struct({
|
|
|
65
66
|
var _RoleSelectorSchema = Schema.Struct({
|
|
66
67
|
role: Schema.String,
|
|
67
68
|
name: Schema.optional(Schema.String),
|
|
68
|
-
exact: Schema.optional(Schema.Boolean)
|
|
69
|
+
exact: Schema.optional(Schema.Boolean),
|
|
70
|
+
level: Schema.optional(Schema.Number),
|
|
71
|
+
includeHidden: Schema.optional(Schema.Boolean)
|
|
69
72
|
});
|
|
70
73
|
var _CssSelectorSchema = Schema.Struct({
|
|
71
74
|
css: Schema.String
|
|
@@ -100,6 +103,17 @@ function byRole(role, nameOrOpts, opts) {
|
|
|
100
103
|
function byCss(css, opts) {
|
|
101
104
|
return { css, ...opts };
|
|
102
105
|
}
|
|
106
|
+
function or(...selectors) {
|
|
107
|
+
const flat = [];
|
|
108
|
+
for (const s of selectors) {
|
|
109
|
+
if (typeof s === "object" && s !== null && "anyOf" in s && Array.isArray(s.anyOf) && !("within" in s && s.within) && !("frame" in s && s.frame) && !("hasText" in s && s.hasText !== void 0) && !("hasNotText" in s && s.hasNotText !== void 0) && !("has" in s && s.has !== void 0) && !("hasNot" in s && s.hasNot !== void 0) && !("first" in s && s.first) && !("last" in s && s.last) && !("nth" in s && s.nth !== void 0)) {
|
|
110
|
+
flat.push(...s.anyOf);
|
|
111
|
+
} else {
|
|
112
|
+
flat.push(s);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return { anyOf: flat };
|
|
116
|
+
}
|
|
103
117
|
function within(parent, child) {
|
|
104
118
|
const obj = toObjectSelector(child);
|
|
105
119
|
if ("point" in obj) return obj;
|
|
@@ -146,7 +160,7 @@ function isTestIDSelector(sel) {
|
|
|
146
160
|
}
|
|
147
161
|
function isComposableDomSelector(sel) {
|
|
148
162
|
if (typeof sel !== "object" || sel === null || isRelativeSelector(sel)) return false;
|
|
149
|
-
return "role" in sel || "css" in sel || "within" in sel || "frame" in sel || "hasText" in sel || "hasNotText" in sel || "nth" in sel || "first" in sel || "last" in sel;
|
|
163
|
+
return "role" in sel || "css" in sel || "anyOf" in sel || "within" in sel || "frame" in sel || "hasText" in sel || "hasNotText" in sel || "has" in sel || "hasNot" in sel || "nth" in sel || "first" in sel || "last" in sel;
|
|
150
164
|
}
|
|
151
165
|
|
|
152
166
|
// src/smart/element-matcher.ts
|
|
@@ -187,6 +201,8 @@ function matchesSelector(element, selector) {
|
|
|
187
201
|
}
|
|
188
202
|
} else if ("css" in selector) {
|
|
189
203
|
baseMatch = false;
|
|
204
|
+
} else if ("anyOf" in selector && Array.isArray(selector.anyOf)) {
|
|
205
|
+
baseMatch = selector.anyOf.some((branch) => matchesSelector(element, branch));
|
|
190
206
|
} else if ("point" in selector) {
|
|
191
207
|
const { x, y } = selector.point;
|
|
192
208
|
const b = element.bounds;
|
|
@@ -203,6 +219,14 @@ function matchesSelector(element, selector) {
|
|
|
203
219
|
const bad = selector.hasNotText instanceof RegExp ? selector.hasNotText.test(text) : text.toLowerCase().includes(selector.hasNotText.toLowerCase());
|
|
204
220
|
if (bad) return false;
|
|
205
221
|
}
|
|
222
|
+
if (selector.has !== void 0) {
|
|
223
|
+
const descendants = flattenElements(element).slice(1);
|
|
224
|
+
if (!descendants.some((d) => matchesSelector(d, selector.has))) return false;
|
|
225
|
+
}
|
|
226
|
+
if (selector.hasNot !== void 0) {
|
|
227
|
+
const descendants = flattenElements(element).slice(1);
|
|
228
|
+
if (descendants.some((d) => matchesSelector(d, selector.hasNot))) return false;
|
|
229
|
+
}
|
|
206
230
|
}
|
|
207
231
|
return true;
|
|
208
232
|
}
|
|
@@ -289,8 +313,16 @@ function formatSimpleSelector(sel) {
|
|
|
289
313
|
else if ("text" in sel) base = `text: "${sel.text}"`;
|
|
290
314
|
else if ("accessibilityLabel" in sel) base = `accessibilityLabel: "${sel.accessibilityLabel}"`;
|
|
291
315
|
else if ("role" in sel) {
|
|
292
|
-
|
|
316
|
+
const parts = [`role: "${sel.role}"`];
|
|
317
|
+
if (sel.name !== void 0) {
|
|
318
|
+
parts.push(
|
|
319
|
+
`name: ${sel.name instanceof RegExp ? sel.name.toString() : JSON.stringify(sel.name)}`
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
if (sel.level !== void 0) parts.push(`level: ${sel.level}`);
|
|
323
|
+
base = parts.join(", ");
|
|
293
324
|
} else if ("css" in sel) base = `css: "${sel.css}"`;
|
|
325
|
+
else if ("anyOf" in sel) base = `or(${sel.anyOf.map(formatSimpleSelector).join(", ")})`;
|
|
294
326
|
else if ("point" in sel) return `point: (${sel.point.x}, ${sel.point.y})`;
|
|
295
327
|
else return JSON.stringify(sel);
|
|
296
328
|
const mods = [];
|
|
@@ -306,6 +338,8 @@ function formatSimpleSelector(sel) {
|
|
|
306
338
|
`hasNotText(${sel.hasNotText instanceof RegExp ? sel.hasNotText.toString() : JSON.stringify(sel.hasNotText)})`
|
|
307
339
|
);
|
|
308
340
|
}
|
|
341
|
+
if (sel.has !== void 0) mods.push(`has(${formatSimpleSelector(sel.has)})`);
|
|
342
|
+
if (sel.hasNot !== void 0) mods.push(`hasNot(${formatSimpleSelector(sel.hasNot)})`);
|
|
309
343
|
if (sel.first) mods.push("first");
|
|
310
344
|
else if (sel.last) mods.push("last");
|
|
311
345
|
else if (sel.nth !== void 0) mods.push(`nth(${sel.nth})`);
|
|
@@ -679,7 +713,8 @@ function waitForResolvedAcrossChannels(driver, selector, parse, forAction, opts,
|
|
|
679
713
|
timeoutMs: timeout,
|
|
680
714
|
forAction,
|
|
681
715
|
failFastWhenIdle: opts?.failFastWhenIdle,
|
|
682
|
-
idleQuietMs: opts?.idleQuietMs
|
|
716
|
+
idleQuietMs: opts?.idleQuietMs,
|
|
717
|
+
...opts?.actionStableFrames !== void 0 ? { stableFrames: opts.actionStableFrames } : {}
|
|
683
718
|
}),
|
|
684
719
|
catch: () => null
|
|
685
720
|
}).pipe(Effect2.catchAll(() => Effect2.succeed(null)));
|
|
@@ -692,7 +727,27 @@ function waitForResolvedAcrossChannels(driver, selector, parse, forAction, opts,
|
|
|
692
727
|
domMatch: match
|
|
693
728
|
};
|
|
694
729
|
}
|
|
695
|
-
if (Array.isArray(reactiveMatches) && reactiveMatches.length === 0 && (opts?.failFastWhenIdle || Date.now() - start >= timeout)) {
|
|
730
|
+
if (Array.isArray(reactiveMatches) && reactiveMatches.length === 0 && (forAction || opts?.failFastWhenIdle || Date.now() - start >= timeout)) {
|
|
731
|
+
if (forAction) {
|
|
732
|
+
const actionDiag = yield* Effect2.tryPromise({
|
|
733
|
+
try: () => initialDomChannel.evaluate(buildDomActionabilityDiagScript(selector)),
|
|
734
|
+
catch: () => null
|
|
735
|
+
}).pipe(Effect2.catchAll(() => Effect2.succeed(null)));
|
|
736
|
+
if (actionDiag?.found && actionDiag.obstructedBy) {
|
|
737
|
+
return yield* new ElementNotFoundError({
|
|
738
|
+
message: `Element is covered by ${actionDiag.obstructedBy} (not actionable within ${timeout}ms) \u2014 selector: ${formatSelector(selector)}`,
|
|
739
|
+
selector,
|
|
740
|
+
timeoutMs: timeout
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
if (actionDiag?.found && actionDiag.visible && actionDiag.enabled === false) {
|
|
744
|
+
return yield* new ElementNotFoundError({
|
|
745
|
+
message: `Element is disabled (not actionable within ${timeout}ms) \u2014 selector: ${formatSelector(selector)}`,
|
|
746
|
+
selector,
|
|
747
|
+
timeoutMs: timeout
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
}
|
|
696
751
|
if (cache) cache.invalidate();
|
|
697
752
|
const diagRoot2 = yield* getHierarchy(driver, parse, cache);
|
|
698
753
|
const diagnostic2 = diagnoseElementNotFound(diagRoot2, selector);
|
|
@@ -736,7 +791,8 @@ ${diagMessage2}`,
|
|
|
736
791
|
timeoutMs: Math.min(remaining, opts?.platform === "web" ? remaining : 1e3),
|
|
737
792
|
forAction,
|
|
738
793
|
failFastWhenIdle: opts?.failFastWhenIdle,
|
|
739
|
-
idleQuietMs: opts?.idleQuietMs
|
|
794
|
+
idleQuietMs: opts?.idleQuietMs,
|
|
795
|
+
...opts?.actionStableFrames !== void 0 ? { stableFrames: opts.actionStableFrames } : {}
|
|
740
796
|
}),
|
|
741
797
|
catch: () => null
|
|
742
798
|
}).pipe(Effect2.catchAll(() => Effect2.succeed(null)));
|
|
@@ -970,7 +1026,24 @@ function createCoordinator(driver, config) {
|
|
|
970
1026
|
};
|
|
971
1027
|
return directionMap[direction];
|
|
972
1028
|
};
|
|
973
|
-
const
|
|
1029
|
+
const normalizeWhitespace = (s) => s.replaceAll(/\s+/g, " ").trim();
|
|
1030
|
+
const collectContainerText = (el) => {
|
|
1031
|
+
if (el.text) return el.text;
|
|
1032
|
+
const parts = [];
|
|
1033
|
+
const stack = [...el.children ?? []].toReversed();
|
|
1034
|
+
while (stack.length > 0) {
|
|
1035
|
+
const node = stack.pop();
|
|
1036
|
+
if (node.visible === false) continue;
|
|
1037
|
+
if (node.text) parts.push(node.text);
|
|
1038
|
+
if (node.children) {
|
|
1039
|
+
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1040
|
+
stack.push(node.children[i]);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return parts.join(" ").trim();
|
|
1045
|
+
};
|
|
1046
|
+
const pollUntilMatch = (selector, opts, check, formatError, domMatchSpec, negate = false) => Effect4.gen(function* () {
|
|
974
1047
|
const timeout = opts?.timeout ?? defaults?.timeout ?? 5e3;
|
|
975
1048
|
const pollInterval = opts?.pollInterval ?? defaults?.pollInterval ?? 200;
|
|
976
1049
|
const start = Date.now();
|
|
@@ -980,6 +1053,7 @@ function createCoordinator(driver, config) {
|
|
|
980
1053
|
const reactive = yield* Effect4.tryPromise({
|
|
981
1054
|
try: () => domChannel.waitForMatch(selector, {
|
|
982
1055
|
...domMatchSpec,
|
|
1056
|
+
...negate ? { negate: true } : {},
|
|
983
1057
|
timeoutMs: timeout
|
|
984
1058
|
}),
|
|
985
1059
|
catch: () => null
|
|
@@ -1005,7 +1079,7 @@ function createCoordinator(driver, config) {
|
|
|
1005
1079
|
const element = resolved?.element;
|
|
1006
1080
|
if (element) {
|
|
1007
1081
|
const result = check(element);
|
|
1008
|
-
if (result.matched) return;
|
|
1082
|
+
if (negate ? !result.matched : result.matched) return;
|
|
1009
1083
|
lastActual = result.actual;
|
|
1010
1084
|
}
|
|
1011
1085
|
yield* Effect4.sleep(Duration2.millis(pollInterval));
|
|
@@ -1069,32 +1143,45 @@ function createCoordinator(driver, config) {
|
|
|
1069
1143
|
const createAssertions = () => ({
|
|
1070
1144
|
assertVisible: (selector, opts) => waitForElement(driver, selector, parse, { ...defaults, ...opts }, cache),
|
|
1071
1145
|
assertHidden: (selector, opts) => waitForNotVisible(driver, selector, parse, { ...defaults, ...opts }, cache),
|
|
1072
|
-
assertText: (selector, expected, opts) =>
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1146
|
+
assertText: (selector, expected, opts, negate = false) => {
|
|
1147
|
+
const normalizedExpected = normalizeWhitespace(expected);
|
|
1148
|
+
return pollUntilMatch(
|
|
1149
|
+
selector,
|
|
1150
|
+
opts,
|
|
1151
|
+
(el) => {
|
|
1152
|
+
const raw = el.textContent ?? el.text;
|
|
1153
|
+
const actual = raw !== void 0 ? normalizeWhitespace(raw) : void 0;
|
|
1154
|
+
return { matched: actual === normalizedExpected, actual };
|
|
1155
|
+
},
|
|
1156
|
+
(actual, timeout) => ({
|
|
1157
|
+
message: negate ? `Expected text NOT to be "${expected}" after ${timeout}ms` : `Expected text "${expected}" but got "${actual ?? "(no text)"}" after ${timeout}ms`,
|
|
1158
|
+
expected: negate ? `not ${expected}` : expected
|
|
1159
|
+
}),
|
|
1160
|
+
{ kind: "text", expected },
|
|
1161
|
+
negate
|
|
1162
|
+
);
|
|
1163
|
+
},
|
|
1164
|
+
assertContainsText: (selector, expected, opts, negate = false) => {
|
|
1165
|
+
const normalizedExpected = normalizeWhitespace(expected).toLowerCase();
|
|
1166
|
+
return pollUntilMatch(
|
|
1167
|
+
selector,
|
|
1168
|
+
opts,
|
|
1169
|
+
(el) => {
|
|
1170
|
+
const raw = el.textContent ?? el.text ?? "";
|
|
1171
|
+
const actual = normalizeWhitespace(raw);
|
|
1172
|
+
return {
|
|
1173
|
+
matched: actual.toLowerCase().includes(normalizedExpected),
|
|
1174
|
+
actual
|
|
1175
|
+
};
|
|
1176
|
+
},
|
|
1177
|
+
(actual, timeout) => ({
|
|
1178
|
+
message: negate ? `Expected text NOT to contain "${expected}" but got "${actual ?? "(no text)"}" after ${timeout}ms` : `Expected text to contain "${expected}" but got "${actual ?? "(no text)"}" after ${timeout}ms`,
|
|
1179
|
+
expected: negate ? `not containing ${expected}` : expected
|
|
1180
|
+
}),
|
|
1181
|
+
{ kind: "containsText", expected },
|
|
1182
|
+
negate
|
|
1183
|
+
);
|
|
1184
|
+
},
|
|
1098
1185
|
assertEnabled: (selector, opts) => assertEnabledState(selector, true, opts),
|
|
1099
1186
|
assertDisabled: (selector, opts) => assertEnabledState(selector, false, opts),
|
|
1100
1187
|
getText: (selector, opts) => Effect4.gen(function* () {
|
|
@@ -1102,22 +1189,45 @@ function createCoordinator(driver, config) {
|
|
|
1102
1189
|
driver,
|
|
1103
1190
|
selector,
|
|
1104
1191
|
parse,
|
|
1105
|
-
{ ...defaults, ...opts },
|
|
1192
|
+
{ ...defaults, ...opts, platform: opts?.platform ?? config.platform },
|
|
1106
1193
|
cache
|
|
1107
1194
|
);
|
|
1108
|
-
return element
|
|
1195
|
+
return collectContainerText(element);
|
|
1196
|
+
}),
|
|
1197
|
+
count: (selector, opts) => Effect4.gen(function* () {
|
|
1198
|
+
cache.invalidate();
|
|
1199
|
+
const domChannel = driver.domChannel;
|
|
1200
|
+
if (!isSystemUISelector(selector) && !isRelativeSelectorLike2(selector) && domChannel?.isConnected()) {
|
|
1201
|
+
const matches = yield* Effect4.tryPromise({
|
|
1202
|
+
try: () => domChannel.query(selector),
|
|
1203
|
+
catch: () => null
|
|
1204
|
+
}).pipe(Effect4.catchAll(() => Effect4.succeed(null)));
|
|
1205
|
+
if (matches) {
|
|
1206
|
+
return matches.filter((m) => m.visible).length;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
const raw = yield* driver.dumpHierarchy();
|
|
1210
|
+
const root = parse(raw);
|
|
1211
|
+
if (isRelativeSelectorLike2(selector)) {
|
|
1212
|
+
const resolved = yield* resolveElementAcrossChannels(driver, selector, parse, cache, {
|
|
1213
|
+
forAction: false,
|
|
1214
|
+
platform: opts?.platform ?? config.platform
|
|
1215
|
+
});
|
|
1216
|
+
return resolved ? 1 : 0;
|
|
1217
|
+
}
|
|
1218
|
+
return findElements(root, selector).filter((el) => el.visible !== false).length;
|
|
1109
1219
|
}),
|
|
1110
1220
|
isElementEnabled: (selector, opts) => Effect4.gen(function* () {
|
|
1111
1221
|
const element = yield* waitForElement(
|
|
1112
1222
|
driver,
|
|
1113
1223
|
selector,
|
|
1114
1224
|
parse,
|
|
1115
|
-
{ ...defaults, ...opts },
|
|
1225
|
+
{ ...defaults, ...opts, platform: opts?.platform ?? config.platform },
|
|
1116
1226
|
cache
|
|
1117
1227
|
);
|
|
1118
1228
|
return element.enabled !== false;
|
|
1119
1229
|
}),
|
|
1120
|
-
assertValue: (selector, expected, opts) => {
|
|
1230
|
+
assertValue: (selector, expected, opts, negate = false) => {
|
|
1121
1231
|
const expectedStr = String(expected);
|
|
1122
1232
|
return pollUntilMatch(
|
|
1123
1233
|
selector,
|
|
@@ -1127,13 +1237,14 @@ function createCoordinator(driver, config) {
|
|
|
1127
1237
|
return { matched: actual === expectedStr, actual };
|
|
1128
1238
|
},
|
|
1129
1239
|
(actual, timeout) => ({
|
|
1130
|
-
message: `Expected value "${expectedStr}" but got "${actual ?? "(no value)"}" after ${timeout}ms`,
|
|
1131
|
-
expected: expectedStr
|
|
1240
|
+
message: negate ? `Expected value NOT to be "${expectedStr}" after ${timeout}ms` : `Expected value "${expectedStr}" but got "${actual ?? "(no value)"}" after ${timeout}ms`,
|
|
1241
|
+
expected: negate ? `not ${expectedStr}` : expectedStr
|
|
1132
1242
|
}),
|
|
1133
|
-
{ kind: "value", expected: expectedStr }
|
|
1243
|
+
{ kind: "value", expected: expectedStr },
|
|
1244
|
+
negate
|
|
1134
1245
|
);
|
|
1135
1246
|
},
|
|
1136
|
-
assertAttribute: (selector, name, expectedValue, opts) => pollUntilMatch(
|
|
1247
|
+
assertAttribute: (selector, name, expectedValue, opts, negate = false) => pollUntilMatch(
|
|
1137
1248
|
selector,
|
|
1138
1249
|
opts,
|
|
1139
1250
|
(el) => {
|
|
@@ -1143,34 +1254,66 @@ function createCoordinator(driver, config) {
|
|
|
1143
1254
|
}
|
|
1144
1255
|
return { matched: actual === expectedValue, actual };
|
|
1145
1256
|
},
|
|
1146
|
-
(actual, timeout) => expectedValue === void 0 ? {
|
|
1257
|
+
(actual, timeout) => negate ? expectedValue === void 0 ? {
|
|
1258
|
+
message: `Expected attribute "${name}" NOT to exist but got "${actual ?? ""}" after ${timeout}ms`,
|
|
1259
|
+
expected: `not ${name}`
|
|
1260
|
+
} : {
|
|
1261
|
+
message: `Expected attribute "${name}" NOT to be "${expectedValue}" after ${timeout}ms`,
|
|
1262
|
+
expected: `not ${expectedValue}`
|
|
1263
|
+
} : expectedValue === void 0 ? {
|
|
1147
1264
|
message: `Expected attribute "${name}" to exist but it was not found after ${timeout}ms`,
|
|
1148
1265
|
expected: name
|
|
1149
1266
|
} : {
|
|
1150
1267
|
message: `Expected attribute "${name}" to be "${expectedValue}" but got "${actual ?? "(not found)"}" after ${timeout}ms`,
|
|
1151
1268
|
expected: expectedValue
|
|
1152
1269
|
},
|
|
1153
|
-
{ kind: "attribute", attributeName: name, expected: expectedValue }
|
|
1270
|
+
{ kind: "attribute", attributeName: name, expected: expectedValue },
|
|
1271
|
+
negate
|
|
1154
1272
|
),
|
|
1155
|
-
assertMatchesText: (selector, pattern, opts) => pollUntilMatch(
|
|
1273
|
+
assertMatchesText: (selector, pattern, opts, negate = false) => pollUntilMatch(
|
|
1156
1274
|
selector,
|
|
1157
1275
|
opts,
|
|
1158
1276
|
(el) => {
|
|
1159
|
-
const actual = el.text ?? "";
|
|
1277
|
+
const actual = normalizeWhitespace(el.textContent ?? el.text ?? "");
|
|
1160
1278
|
return { matched: pattern.test(actual), actual };
|
|
1161
1279
|
},
|
|
1162
1280
|
(actual, timeout) => ({
|
|
1163
|
-
message: `Expected text to match ${pattern} but got "${actual ?? "(no text)"}" after ${timeout}ms`,
|
|
1164
|
-
expected: String(pattern)
|
|
1281
|
+
message: negate ? `Expected text NOT to match ${pattern} but got "${actual ?? "(no text)"}" after ${timeout}ms` : `Expected text to match ${pattern} but got "${actual ?? "(no text)"}" after ${timeout}ms`,
|
|
1282
|
+
expected: negate ? `not ${String(pattern)}` : String(pattern)
|
|
1165
1283
|
}),
|
|
1166
|
-
{ kind: "matchesText", patternSource: pattern.source, patternFlags: pattern.flags }
|
|
1284
|
+
{ kind: "matchesText", patternSource: pattern.source, patternFlags: pattern.flags },
|
|
1285
|
+
negate
|
|
1167
1286
|
),
|
|
1168
1287
|
getAttribute: (selector, name, opts) => Effect4.gen(function* () {
|
|
1288
|
+
const timeout = opts?.timeout ?? defaults?.timeout ?? 5e3;
|
|
1289
|
+
const pollInterval = opts?.pollInterval ?? defaults?.pollInterval ?? 100;
|
|
1290
|
+
const domChannel = driver.domChannel;
|
|
1291
|
+
if (!isSystemUISelector(selector) && !isRelativeSelectorLike2(selector) && domChannel?.isConnected()) {
|
|
1292
|
+
const start = Date.now();
|
|
1293
|
+
while (true) {
|
|
1294
|
+
const matches = yield* Effect4.tryPromise({
|
|
1295
|
+
try: () => domChannel.query(selector),
|
|
1296
|
+
catch: () => null
|
|
1297
|
+
}).pipe(Effect4.catchAll(() => Effect4.succeed(null)));
|
|
1298
|
+
if (matches && matches.length > 0) {
|
|
1299
|
+
const target = matches[matches.length - 1];
|
|
1300
|
+
return target.attributes?.[name];
|
|
1301
|
+
}
|
|
1302
|
+
if (Date.now() - start >= timeout) {
|
|
1303
|
+
return yield* new ElementNotFoundError({
|
|
1304
|
+
message: `Element not found within ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1305
|
+
selector,
|
|
1306
|
+
timeoutMs: timeout
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
yield* Effect4.sleep(Duration2.millis(Math.min(pollInterval, 100)));
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1169
1312
|
const element = yield* waitForElement(
|
|
1170
1313
|
driver,
|
|
1171
1314
|
selector,
|
|
1172
1315
|
parse,
|
|
1173
|
-
{ ...defaults, ...opts },
|
|
1316
|
+
{ ...defaults, ...opts, platform: opts?.platform ?? config.platform },
|
|
1174
1317
|
cache
|
|
1175
1318
|
);
|
|
1176
1319
|
return element.attributes?.[name];
|
|
@@ -1251,7 +1394,7 @@ function createCoordinator(driver, config) {
|
|
|
1251
1394
|
},
|
|
1252
1395
|
{ kind: "accessibilityLabel", expected }
|
|
1253
1396
|
),
|
|
1254
|
-
assertAccessibleName: (selector, expected, opts) => pollUntilMatch(
|
|
1397
|
+
assertAccessibleName: (selector, expected, opts, negate = false) => pollUntilMatch(
|
|
1255
1398
|
selector,
|
|
1256
1399
|
opts,
|
|
1257
1400
|
(el) => {
|
|
@@ -1260,16 +1403,36 @@ function createCoordinator(driver, config) {
|
|
|
1260
1403
|
return { matched, actual };
|
|
1261
1404
|
},
|
|
1262
1405
|
(actual, timeout) => ({
|
|
1263
|
-
message: `Expected accessible name ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got "${actual ?? "(none)"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1264
|
-
expected: String(expected)
|
|
1406
|
+
message: negate ? `Expected accessible name NOT to match ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got "${actual ?? "(none)"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}` : `Expected accessible name ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got "${actual ?? "(none)"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1407
|
+
expected: negate ? `not ${String(expected)}` : String(expected)
|
|
1265
1408
|
}),
|
|
1266
1409
|
expected instanceof RegExp ? {
|
|
1267
1410
|
kind: "accessibleName",
|
|
1268
1411
|
patternSource: expected.source,
|
|
1269
1412
|
patternFlags: expected.flags
|
|
1270
|
-
} : { kind: "accessibleName", expected }
|
|
1413
|
+
} : { kind: "accessibleName", expected },
|
|
1414
|
+
negate
|
|
1271
1415
|
),
|
|
1272
|
-
|
|
1416
|
+
assertAccessibleDescription: (selector, expected, opts, negate = false) => pollUntilMatch(
|
|
1417
|
+
selector,
|
|
1418
|
+
opts,
|
|
1419
|
+
(el) => {
|
|
1420
|
+
const actual = el.accessibleDescription ?? el.attributes?.["aria-description"] ?? "";
|
|
1421
|
+
const matched = expected instanceof RegExp ? expected.test(actual) : actual.trim() === expected.trim();
|
|
1422
|
+
return { matched, actual };
|
|
1423
|
+
},
|
|
1424
|
+
(actual, timeout) => ({
|
|
1425
|
+
message: negate ? `Expected accessible description NOT to match ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got "${actual ?? "(none)"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}` : `Expected accessible description ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got "${actual ?? "(none)"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1426
|
+
expected: negate ? `not ${String(expected)}` : String(expected)
|
|
1427
|
+
}),
|
|
1428
|
+
expected instanceof RegExp ? {
|
|
1429
|
+
kind: "accessibleDescription",
|
|
1430
|
+
patternSource: expected.source,
|
|
1431
|
+
patternFlags: expected.flags
|
|
1432
|
+
} : { kind: "accessibleDescription", expected },
|
|
1433
|
+
negate
|
|
1434
|
+
),
|
|
1435
|
+
assertFocused: (selector, opts, negate = false) => pollUntilMatch(
|
|
1273
1436
|
selector,
|
|
1274
1437
|
opts,
|
|
1275
1438
|
(el) => ({
|
|
@@ -1277,12 +1440,13 @@ function createCoordinator(driver, config) {
|
|
|
1277
1440
|
actual: el.focused ? "focused" : "not focused"
|
|
1278
1441
|
}),
|
|
1279
1442
|
(actual, timeout) => ({
|
|
1280
|
-
message: `Expected element to be focused but it was "${actual ?? "not focused"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1281
|
-
expected: "focused"
|
|
1443
|
+
message: negate ? `Expected element NOT to be focused but it was "${actual ?? "focused"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}` : `Expected element to be focused but it was "${actual ?? "not focused"}" after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1444
|
+
expected: negate ? "not focused" : "focused"
|
|
1282
1445
|
}),
|
|
1283
|
-
{ kind: "focused" }
|
|
1446
|
+
{ kind: "focused" },
|
|
1447
|
+
negate
|
|
1284
1448
|
),
|
|
1285
|
-
assertCount: (selector, expectedCount, opts) => Effect4.gen(function* () {
|
|
1449
|
+
assertCount: (selector, expectedCount, opts, negate = false) => Effect4.gen(function* () {
|
|
1286
1450
|
const timeout = opts?.timeout ?? defaults?.timeout ?? 5e3;
|
|
1287
1451
|
const pollInterval = opts?.pollInterval ?? defaults?.pollInterval ?? 200;
|
|
1288
1452
|
const start = Date.now();
|
|
@@ -1293,6 +1457,7 @@ function createCoordinator(driver, config) {
|
|
|
1293
1457
|
try: () => domChannel.waitForMatch(selector, {
|
|
1294
1458
|
kind: "count",
|
|
1295
1459
|
expectedCount,
|
|
1460
|
+
...negate ? { negate: true } : {},
|
|
1296
1461
|
timeoutMs: timeout
|
|
1297
1462
|
}),
|
|
1298
1463
|
catch: () => null
|
|
@@ -1300,8 +1465,8 @@ function createCoordinator(driver, config) {
|
|
|
1300
1465
|
if (reactive) {
|
|
1301
1466
|
if (reactive.matched) return;
|
|
1302
1467
|
return yield* new TextMismatchError({
|
|
1303
|
-
message: `Expected count ${expectedCount} but got ${reactive.actual ?? "0"} after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1304
|
-
expected: String(expectedCount),
|
|
1468
|
+
message: negate ? `Expected count NOT to be ${expectedCount} after ${timeout}ms \u2014 selector: ${formatSelector(selector)}` : `Expected count ${expectedCount} but got ${reactive.actual ?? "0"} after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1469
|
+
expected: negate ? `not ${expectedCount}` : String(expectedCount),
|
|
1305
1470
|
actual: reactive.actual ?? "0",
|
|
1306
1471
|
selector
|
|
1307
1472
|
});
|
|
@@ -1317,7 +1482,7 @@ function createCoordinator(driver, config) {
|
|
|
1317
1482
|
if (matches) {
|
|
1318
1483
|
const count2 = matches.filter((m) => m.visible).length;
|
|
1319
1484
|
lastCount = count2;
|
|
1320
|
-
if (count2 === expectedCount) return;
|
|
1485
|
+
if (negate ? count2 !== expectedCount : count2 === expectedCount) return;
|
|
1321
1486
|
yield* Effect4.sleep(Duration2.millis(pollInterval));
|
|
1322
1487
|
continue;
|
|
1323
1488
|
}
|
|
@@ -1328,17 +1493,17 @@ function createCoordinator(driver, config) {
|
|
|
1328
1493
|
(el) => el.visible !== false
|
|
1329
1494
|
).length;
|
|
1330
1495
|
lastCount = count;
|
|
1331
|
-
if (count === expectedCount) return;
|
|
1496
|
+
if (negate ? count !== expectedCount : count === expectedCount) return;
|
|
1332
1497
|
yield* Effect4.sleep(Duration2.millis(pollInterval));
|
|
1333
1498
|
}
|
|
1334
1499
|
return yield* new TextMismatchError({
|
|
1335
|
-
message: `Expected count ${expectedCount} but got ${lastCount >= 0 ? lastCount : 0} after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1336
|
-
expected: String(expectedCount),
|
|
1500
|
+
message: negate ? `Expected count NOT to be ${expectedCount} after ${timeout}ms \u2014 selector: ${formatSelector(selector)}` : `Expected count ${expectedCount} but got ${lastCount >= 0 ? lastCount : 0} after ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1501
|
+
expected: negate ? `not ${expectedCount}` : String(expectedCount),
|
|
1337
1502
|
actual: String(lastCount >= 0 ? lastCount : 0),
|
|
1338
1503
|
selector
|
|
1339
1504
|
});
|
|
1340
1505
|
}),
|
|
1341
|
-
waitForURL: (expected, opts) => Effect4.gen(function* () {
|
|
1506
|
+
waitForURL: (expected, opts, negate = false) => Effect4.gen(function* () {
|
|
1342
1507
|
const timeout = opts?.timeout ?? defaults?.timeout ?? 5e3;
|
|
1343
1508
|
const pollInterval = opts?.pollInterval ?? defaults?.pollInterval ?? 100;
|
|
1344
1509
|
const start = Date.now();
|
|
@@ -1350,6 +1515,7 @@ function createCoordinator(driver, config) {
|
|
|
1350
1515
|
try: () => domChannel.waitForMatch("", {
|
|
1351
1516
|
kind: "url",
|
|
1352
1517
|
...expected instanceof RegExp ? { patternSource: expected.source, patternFlags: expected.flags } : { expected },
|
|
1518
|
+
...negate ? { negate: true } : {},
|
|
1353
1519
|
timeoutMs: timeout
|
|
1354
1520
|
}),
|
|
1355
1521
|
catch: () => null
|
|
@@ -1357,8 +1523,8 @@ function createCoordinator(driver, config) {
|
|
|
1357
1523
|
if (reactive) {
|
|
1358
1524
|
if (reactive.matched) return;
|
|
1359
1525
|
return yield* new TextMismatchError({
|
|
1360
|
-
message: `Expected URL ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got ${JSON.stringify(reactive.actual ?? "")} after ${timeout}ms`,
|
|
1361
|
-
expected: String(expected),
|
|
1526
|
+
message: negate ? `Expected URL NOT to match ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got ${JSON.stringify(reactive.actual ?? "")} after ${timeout}ms` : `Expected URL ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got ${JSON.stringify(reactive.actual ?? "")} after ${timeout}ms`,
|
|
1527
|
+
expected: negate ? `not ${String(expected)}` : String(expected),
|
|
1362
1528
|
actual: reactive.actual ?? "",
|
|
1363
1529
|
selector: "url"
|
|
1364
1530
|
});
|
|
@@ -1369,12 +1535,12 @@ function createCoordinator(driver, config) {
|
|
|
1369
1535
|
"typeof window !== 'undefined' && window.location ? window.location.href : ''"
|
|
1370
1536
|
).pipe(Effect4.catchAll(() => Effect4.succeed("")));
|
|
1371
1537
|
lastUrl = url;
|
|
1372
|
-
if (matchesUrl(url)) return;
|
|
1538
|
+
if (negate ? !matchesUrl(url) : matchesUrl(url)) return;
|
|
1373
1539
|
yield* Effect4.sleep(Duration2.millis(pollInterval));
|
|
1374
1540
|
}
|
|
1375
1541
|
return yield* new TextMismatchError({
|
|
1376
|
-
message: `Expected URL ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got ${JSON.stringify(lastUrl)} after ${timeout}ms`,
|
|
1377
|
-
expected: String(expected),
|
|
1542
|
+
message: negate ? `Expected URL NOT to match ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got ${JSON.stringify(lastUrl)} after ${timeout}ms` : `Expected URL ${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)} but got ${JSON.stringify(lastUrl)} after ${timeout}ms`,
|
|
1543
|
+
expected: negate ? `not ${String(expected)}` : String(expected),
|
|
1378
1544
|
actual: lastUrl,
|
|
1379
1545
|
selector: "url"
|
|
1380
1546
|
});
|
|
@@ -1528,7 +1694,7 @@ function createCoordinator(driver, config) {
|
|
|
1528
1694
|
driver,
|
|
1529
1695
|
selector,
|
|
1530
1696
|
parse,
|
|
1531
|
-
{ ...defaults, ...opts },
|
|
1697
|
+
{ ...defaults, ...opts, platform: opts?.platform ?? config.platform },
|
|
1532
1698
|
cache
|
|
1533
1699
|
);
|
|
1534
1700
|
const { x, y } = centerOf(element);
|
|
@@ -1542,7 +1708,7 @@ function createCoordinator(driver, config) {
|
|
|
1542
1708
|
driver,
|
|
1543
1709
|
selector,
|
|
1544
1710
|
parse,
|
|
1545
|
-
{ ...defaults, ...opts },
|
|
1711
|
+
{ ...defaults, ...opts, platform: opts?.platform ?? config.platform },
|
|
1546
1712
|
cache
|
|
1547
1713
|
);
|
|
1548
1714
|
const { x, y } = centerOf(element);
|
|
@@ -1617,11 +1783,13 @@ function createCoordinator(driver, config) {
|
|
|
1617
1783
|
const fillStart = Date.now();
|
|
1618
1784
|
const domChannel = driver.domChannel;
|
|
1619
1785
|
if (!isSystemUISelector(selector) && !isRelativeSelectorLike2(selector) && domChannel?.isConnected() && domChannel.fillDom) {
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1786
|
+
const fillAttempt = yield* Effect4.either(
|
|
1787
|
+
Effect4.tryPromise({
|
|
1788
|
+
try: () => domChannel.fillDom(selector, text, { timeoutMs: timeout }),
|
|
1789
|
+
catch: (e) => new DriverError({ message: `DOM fill failed: ${e}` })
|
|
1790
|
+
})
|
|
1791
|
+
);
|
|
1792
|
+
if (fillAttempt._tag === "Right" && fillAttempt.right) {
|
|
1625
1793
|
yield* afterMutation();
|
|
1626
1794
|
return;
|
|
1627
1795
|
}
|
|
@@ -1652,6 +1820,24 @@ function createCoordinator(driver, config) {
|
|
|
1652
1820
|
yield* afterMutation();
|
|
1653
1821
|
return;
|
|
1654
1822
|
}
|
|
1823
|
+
const actionDiag = yield* Effect4.tryPromise({
|
|
1824
|
+
try: () => domChannel.evaluate(buildDomActionabilityDiagScript(selector)),
|
|
1825
|
+
catch: () => null
|
|
1826
|
+
}).pipe(Effect4.catchAll(() => Effect4.succeed(null)));
|
|
1827
|
+
if (actionDiag?.found && actionDiag.obstructedBy) {
|
|
1828
|
+
return yield* new ElementNotFoundError({
|
|
1829
|
+
message: `Element is covered by ${actionDiag.obstructedBy} (not fillable within ${timeout}ms) \u2014 selector: ${formatSelector(selector)}`,
|
|
1830
|
+
selector,
|
|
1831
|
+
timeoutMs: timeout
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
if (actionDiag?.found && actionDiag.visible && actionDiag.enabled === false) {
|
|
1835
|
+
return yield* new ElementNotFoundError({
|
|
1836
|
+
message: `Element is disabled (not fillable within ${timeout}ms) \u2014 selector: ${formatSelector(selector)}`,
|
|
1837
|
+
selector,
|
|
1838
|
+
timeoutMs: timeout
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1655
1841
|
return yield* new ElementNotFoundError({
|
|
1656
1842
|
message: `Element not fillable within ${timeout}ms \u2014 selector: ${formatSelector(selector)}`,
|
|
1657
1843
|
selector,
|
|
@@ -1840,6 +2026,9 @@ function buildStorybookUrl(storyId, options, runtime) {
|
|
|
1840
2026
|
}
|
|
1841
2027
|
|
|
1842
2028
|
// src/api/expect.ts
|
|
2029
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
2030
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
2031
|
+
import { dirname, resolve as resolvePath } from "path";
|
|
1843
2032
|
import { Effect as Effect5 } from "effect";
|
|
1844
2033
|
function selectorToCss(sel) {
|
|
1845
2034
|
if (typeof sel === "string") return sel;
|
|
@@ -1850,6 +2039,84 @@ function selectorToCss(sel) {
|
|
|
1850
2039
|
return `[aria-label="${sel.accessibilityLabel}"]`;
|
|
1851
2040
|
return "";
|
|
1852
2041
|
}
|
|
2042
|
+
function deepEqual(a, b) {
|
|
2043
|
+
if (Object.is(a, b)) return true;
|
|
2044
|
+
if (a === null || b === null || typeof a !== "object" || typeof b !== "object") return false;
|
|
2045
|
+
if (a instanceof RegExp && b instanceof RegExp)
|
|
2046
|
+
return a.source === b.source && a.flags === b.flags;
|
|
2047
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
|
|
2048
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
2049
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
2050
|
+
for (let i = 0; i < a.length; i++) {
|
|
2051
|
+
if (!deepEqual(a[i], b[i])) return false;
|
|
2052
|
+
}
|
|
2053
|
+
return true;
|
|
2054
|
+
}
|
|
2055
|
+
const aKeys = Object.keys(a);
|
|
2056
|
+
const bKeys = Object.keys(b);
|
|
2057
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
2058
|
+
for (const k of aKeys) {
|
|
2059
|
+
if (!Object.prototype.hasOwnProperty.call(b, k) || !deepEqual(a[k], b[k])) {
|
|
2060
|
+
return false;
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
return true;
|
|
2064
|
+
}
|
|
2065
|
+
var retryScope = new AsyncLocalStorage();
|
|
2066
|
+
var defaultRetryIntervals = [50, 100, 250, 500];
|
|
2067
|
+
function normalizeAriaSnapshot(snapshot) {
|
|
2068
|
+
const lines = snapshot.replaceAll("\r\n", "\n").trimEnd().split("\n");
|
|
2069
|
+
while (lines[0]?.trim() === "" && lines.length > 1) lines.shift();
|
|
2070
|
+
const indentation = lines.reduce(
|
|
2071
|
+
(minimum, line) => line.trim() ? Math.min(minimum, /^ */.exec(line)[0].length) : minimum,
|
|
2072
|
+
Infinity
|
|
2073
|
+
);
|
|
2074
|
+
return lines.map((line) => line.slice(indentation)).join("\n");
|
|
2075
|
+
}
|
|
2076
|
+
async function retryAssertion(check, timeout, intervals = defaultRetryIntervals) {
|
|
2077
|
+
if (!Number.isFinite(timeout) || timeout < 0 || intervals.some((ms) => !Number.isFinite(ms) || ms < 0)) {
|
|
2078
|
+
throw new RangeError("Assertion timeout and intervals must be finite, non-negative numbers");
|
|
2079
|
+
}
|
|
2080
|
+
if (intervals.length === 0) intervals = defaultRetryIntervals;
|
|
2081
|
+
let lastFailure;
|
|
2082
|
+
let expired = false;
|
|
2083
|
+
let delayTimer;
|
|
2084
|
+
let timeoutTimer;
|
|
2085
|
+
const deadline = new Promise((_, reject) => {
|
|
2086
|
+
timeoutTimer = setTimeout(() => {
|
|
2087
|
+
expired = true;
|
|
2088
|
+
const detail = lastFailure instanceof Error ? lastFailure.message : String(lastFailure);
|
|
2089
|
+
reject(
|
|
2090
|
+
new Error(
|
|
2091
|
+
`Assertion timed out after ${timeout}ms${lastFailure === void 0 ? "" : `: ${detail}`}`,
|
|
2092
|
+
{ cause: lastFailure }
|
|
2093
|
+
)
|
|
2094
|
+
);
|
|
2095
|
+
}, timeout);
|
|
2096
|
+
});
|
|
2097
|
+
const attempts = async () => {
|
|
2098
|
+
for (let attempt = 0; ; attempt++) {
|
|
2099
|
+
if (expired) return;
|
|
2100
|
+
try {
|
|
2101
|
+
await retryScope.run(true, check);
|
|
2102
|
+
return;
|
|
2103
|
+
} catch (error) {
|
|
2104
|
+
if (expired) return;
|
|
2105
|
+
lastFailure = error;
|
|
2106
|
+
const interval = intervals[Math.min(attempt, intervals.length - 1)];
|
|
2107
|
+
await new Promise((resolve2) => {
|
|
2108
|
+
delayTimer = setTimeout(resolve2, interval);
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
try {
|
|
2114
|
+
await Promise.race([deadline, attempts()]);
|
|
2115
|
+
} finally {
|
|
2116
|
+
clearTimeout(timeoutTimer);
|
|
2117
|
+
clearTimeout(delayTimer);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
1853
2120
|
function createPromiseExpect(driver, config, recorder, flowContext, visualRegression) {
|
|
1854
2121
|
const ctx = flowContext ?? {
|
|
1855
2122
|
flowFilePath: "",
|
|
@@ -1857,58 +2124,259 @@ function createPromiseExpect(driver, config, recorder, flowContext, visualRegres
|
|
|
1857
2124
|
platform: "web"
|
|
1858
2125
|
};
|
|
1859
2126
|
const coord = createCoordinator(driver, config);
|
|
1860
|
-
const
|
|
1861
|
-
const
|
|
1862
|
-
const
|
|
2127
|
+
const defaultTimeout = config.defaults?.timeout ?? 5e3;
|
|
2128
|
+
const run2 = (effect) => Effect5.runPromise(effect);
|
|
2129
|
+
const recordSoft = async (action) => {
|
|
2130
|
+
if (!ctx.recordSoftFailure || retryScope.getStore()) return action();
|
|
2131
|
+
try {
|
|
2132
|
+
await action();
|
|
2133
|
+
} catch (error) {
|
|
2134
|
+
ctx.recordSoftFailure(error);
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
const recordStep = (command, action, selector) => recorder && !retryScope.getStore() ? recorder.runStep(command, action, { selector, captureScreenshot: false }) : action();
|
|
2138
|
+
const runSelectorStep = (command, selector, action) => recordStep(command, action, selector);
|
|
2139
|
+
const runSoftSelectorStep = (command, selector, action) => recordSoft(() => runSelectorStep(command, selector, action));
|
|
2140
|
+
const buildNegatedExpectation = (selector, runStep) => ({
|
|
2141
|
+
toBeVisible: (opts) => runStep("expect.not.toBeVisible", selector, () => run2(coord.assertHidden(selector, opts))),
|
|
2142
|
+
toBeHidden: (opts) => runStep(
|
|
2143
|
+
"expect.not.toBeHidden",
|
|
2144
|
+
selector,
|
|
2145
|
+
() => run2(coord.assertVisible(selector, opts)).then(() => {
|
|
2146
|
+
})
|
|
2147
|
+
),
|
|
2148
|
+
toHaveText: (expected, opts) => runStep(
|
|
2149
|
+
`expect.not.toHaveText(${JSON.stringify(expected)})`,
|
|
2150
|
+
selector,
|
|
2151
|
+
() => run2(coord.assertText(selector, expected, opts, true))
|
|
2152
|
+
),
|
|
2153
|
+
toMatchText: (pattern, opts) => runStep(
|
|
2154
|
+
`expect.not.toMatchText(${pattern})`,
|
|
2155
|
+
selector,
|
|
2156
|
+
() => run2(coord.assertMatchesText(selector, pattern, opts, true))
|
|
2157
|
+
),
|
|
2158
|
+
toHaveValue: (expected, opts) => runStep(
|
|
2159
|
+
`expect.not.toHaveValue(${JSON.stringify(expected)})`,
|
|
2160
|
+
selector,
|
|
2161
|
+
() => run2(coord.assertValue(selector, expected, opts, true))
|
|
2162
|
+
),
|
|
2163
|
+
toHaveAttribute: (name, value, opts) => runStep(
|
|
2164
|
+
`expect.not.toHaveAttribute(${JSON.stringify(name)})`,
|
|
2165
|
+
selector,
|
|
2166
|
+
() => run2(coord.assertAttribute(selector, name, value, opts, true))
|
|
2167
|
+
),
|
|
2168
|
+
toBeEnabled: (opts) => runStep("expect.not.toBeEnabled", selector, () => run2(coord.assertDisabled(selector, opts))),
|
|
2169
|
+
toBeDisabled: (opts) => runStep("expect.not.toBeDisabled", selector, () => run2(coord.assertEnabled(selector, opts))),
|
|
2170
|
+
toContainText: (expected, opts) => runStep(
|
|
2171
|
+
`expect.not.toContainText(${JSON.stringify(expected)})`,
|
|
2172
|
+
selector,
|
|
2173
|
+
() => run2(coord.assertContainsText(selector, expected, opts, true))
|
|
2174
|
+
),
|
|
2175
|
+
toHaveCount: (expected, opts) => runStep(
|
|
2176
|
+
`expect.not.toHaveCount(${expected})`,
|
|
2177
|
+
selector,
|
|
2178
|
+
() => run2(coord.assertCount(selector, expected, opts, true))
|
|
2179
|
+
),
|
|
2180
|
+
toBeFocused: (opts) => runStep(
|
|
2181
|
+
"expect.not.toBeFocused",
|
|
2182
|
+
selector,
|
|
2183
|
+
() => run2(coord.assertFocused(selector, opts, true))
|
|
2184
|
+
),
|
|
2185
|
+
toHaveAccessibleName: (expected, opts) => runStep(
|
|
2186
|
+
`expect.not.toHaveAccessibleName(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`,
|
|
2187
|
+
selector,
|
|
2188
|
+
() => run2(coord.assertAccessibleName(selector, expected, opts, true))
|
|
2189
|
+
),
|
|
2190
|
+
toHaveAccessibleDescription: (expected, opts) => runStep(
|
|
2191
|
+
`expect.not.toHaveAccessibleDescription(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`,
|
|
2192
|
+
selector,
|
|
2193
|
+
() => run2(coord.assertAccessibleDescription(selector, expected, opts, true))
|
|
2194
|
+
)
|
|
2195
|
+
});
|
|
2196
|
+
const buildPollMatchers = (fn, opts, negate) => {
|
|
2197
|
+
const check = (label, predicate, describeFail) => recordStep(
|
|
2198
|
+
`expect.poll.${negate ? "not." : ""}${label}`,
|
|
2199
|
+
() => retryAssertion(
|
|
2200
|
+
async () => {
|
|
2201
|
+
const val = await fn();
|
|
2202
|
+
const ok = predicate(val);
|
|
2203
|
+
if (negate ? ok : !ok) {
|
|
2204
|
+
throw new Error(describeFail(val));
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
opts?.timeout ?? defaultTimeout,
|
|
2208
|
+
opts?.intervals
|
|
2209
|
+
)
|
|
2210
|
+
);
|
|
2211
|
+
return {
|
|
2212
|
+
toBe: (expected) => check(
|
|
2213
|
+
`toBe(${JSON.stringify(expected)})`,
|
|
2214
|
+
(v) => Object.is(v, expected),
|
|
2215
|
+
(v) => negate ? `Expected polled value NOT to be ${JSON.stringify(expected)}` : `Expected polled value to be ${JSON.stringify(expected)}, received ${JSON.stringify(v)}`
|
|
2216
|
+
),
|
|
2217
|
+
toEqual: (expected) => check(
|
|
2218
|
+
`toEqual(${JSON.stringify(expected)})`,
|
|
2219
|
+
(v) => deepEqual(v, expected),
|
|
2220
|
+
(v) => negate ? `Expected polled value NOT to equal ${JSON.stringify(expected)}` : `Expected polled value to equal ${JSON.stringify(expected)}, received ${JSON.stringify(v)}`
|
|
2221
|
+
),
|
|
2222
|
+
toContain: (expected) => check(
|
|
2223
|
+
`toContain(${JSON.stringify(expected)})`,
|
|
2224
|
+
(v) => {
|
|
2225
|
+
if (typeof v === "string") return v.includes(String(expected));
|
|
2226
|
+
if (Array.isArray(v)) return v.some((item) => deepEqual(item, expected));
|
|
2227
|
+
return false;
|
|
2228
|
+
},
|
|
2229
|
+
(v) => negate ? `Expected polled value NOT to contain ${JSON.stringify(expected)}, received ${JSON.stringify(v)}` : `Expected polled value to contain ${JSON.stringify(expected)}, received ${JSON.stringify(v)}`
|
|
2230
|
+
),
|
|
2231
|
+
toMatch: (pattern) => check(
|
|
2232
|
+
`toMatch(${pattern instanceof RegExp ? String(pattern) : JSON.stringify(pattern)})`,
|
|
2233
|
+
(v) => {
|
|
2234
|
+
const str = String(v ?? "");
|
|
2235
|
+
return pattern instanceof RegExp ? pattern.test(str) : str.includes(pattern);
|
|
2236
|
+
},
|
|
2237
|
+
(v) => negate ? `Expected polled value NOT to match ${String(pattern)}, received ${JSON.stringify(v)}` : `Expected polled value to match ${String(pattern)}, received ${JSON.stringify(v)}`
|
|
2238
|
+
),
|
|
2239
|
+
toBeGreaterThan: (expected) => check(
|
|
2240
|
+
`toBeGreaterThan(${expected})`,
|
|
2241
|
+
(v) => typeof v === "number" && v > expected,
|
|
2242
|
+
(v) => negate ? `Expected polled value NOT to be > ${expected}, received ${String(v)}` : `Expected polled value > ${expected}, received ${String(v)}`
|
|
2243
|
+
),
|
|
2244
|
+
toBeLessThan: (expected) => check(
|
|
2245
|
+
`toBeLessThan(${expected})`,
|
|
2246
|
+
(v) => typeof v === "number" && v < expected,
|
|
2247
|
+
(v) => negate ? `Expected polled value NOT to be < ${expected}, received ${String(v)}` : `Expected polled value < ${expected}, received ${String(v)}`
|
|
2248
|
+
),
|
|
2249
|
+
toBeGreaterThanOrEqual: (expected) => check(
|
|
2250
|
+
`toBeGreaterThanOrEqual(${expected})`,
|
|
2251
|
+
(v) => typeof v === "number" && v >= expected,
|
|
2252
|
+
(v) => negate ? `Expected polled value NOT to be >= ${expected}, received ${String(v)}` : `Expected polled value >= ${expected}, received ${String(v)}`
|
|
2253
|
+
),
|
|
2254
|
+
toBeLessThanOrEqual: (expected) => check(
|
|
2255
|
+
`toBeLessThanOrEqual(${expected})`,
|
|
2256
|
+
(v) => typeof v === "number" && v <= expected,
|
|
2257
|
+
(v) => negate ? `Expected polled value NOT to be <= ${expected}, received ${String(v)}` : `Expected polled value <= ${expected}, received ${String(v)}`
|
|
2258
|
+
),
|
|
2259
|
+
toBeTruthy: () => check(
|
|
2260
|
+
"toBeTruthy",
|
|
2261
|
+
(v) => Boolean(v),
|
|
2262
|
+
(v) => negate ? `Expected polled value NOT to be truthy, received ${JSON.stringify(v)}` : `Expected polled value to be truthy, received ${JSON.stringify(v)}`
|
|
2263
|
+
),
|
|
2264
|
+
toBeFalsy: () => check(
|
|
2265
|
+
"toBeFalsy",
|
|
2266
|
+
(v) => !v,
|
|
2267
|
+
(v) => negate ? `Expected polled value NOT to be falsy, received ${JSON.stringify(v)}` : `Expected polled value to be falsy, received ${JSON.stringify(v)}`
|
|
2268
|
+
),
|
|
2269
|
+
toBeDefined: () => check(
|
|
2270
|
+
"toBeDefined",
|
|
2271
|
+
(v) => v !== void 0,
|
|
2272
|
+
() => negate ? `Expected polled value to be undefined` : `Expected polled value to be defined`
|
|
2273
|
+
),
|
|
2274
|
+
toBeUndefined: () => check(
|
|
2275
|
+
"toBeUndefined",
|
|
2276
|
+
(v) => v === void 0,
|
|
2277
|
+
(v) => negate ? `Expected polled value NOT to be undefined` : `Expected polled value to be undefined, received ${JSON.stringify(v)}`
|
|
2278
|
+
),
|
|
2279
|
+
toHaveLength: (expected) => check(
|
|
2280
|
+
`toHaveLength(${expected})`,
|
|
2281
|
+
(v) => v !== null && v !== void 0 && typeof v.length === "number" && v.length === expected,
|
|
2282
|
+
(v) => negate ? `Expected polled value NOT to have length ${expected}` : `Expected polled value to have length ${expected}, received ${JSON.stringify(v)}`
|
|
2283
|
+
)
|
|
2284
|
+
};
|
|
2285
|
+
};
|
|
2286
|
+
const buildSelectorExpectation = (selector, runStep) => ({
|
|
1863
2287
|
toBeVisible: (opts) => runStep(
|
|
1864
2288
|
"expect.toBeVisible",
|
|
1865
2289
|
selector,
|
|
1866
|
-
() =>
|
|
2290
|
+
() => run2(coord.assertVisible(selector, opts)).then(() => {
|
|
1867
2291
|
})
|
|
1868
2292
|
),
|
|
1869
|
-
toBeHidden: (opts) => runStep("expect.toBeHidden", selector, () =>
|
|
2293
|
+
toBeHidden: (opts) => runStep("expect.toBeHidden", selector, () => run2(coord.assertHidden(selector, opts))),
|
|
1870
2294
|
toHaveText: (expected, opts) => runStep(
|
|
1871
2295
|
`expect.toHaveText(${JSON.stringify(expected)})`,
|
|
1872
2296
|
selector,
|
|
1873
|
-
() =>
|
|
2297
|
+
() => run2(coord.assertText(selector, expected, opts))
|
|
1874
2298
|
),
|
|
1875
2299
|
toMatchText: (pattern, opts) => runStep(
|
|
1876
2300
|
`expect.toMatchText(${pattern})`,
|
|
1877
2301
|
selector,
|
|
1878
|
-
() =>
|
|
2302
|
+
() => run2(coord.assertMatchesText(selector, pattern, opts))
|
|
1879
2303
|
),
|
|
1880
2304
|
toHaveValue: (expected, opts) => runStep(
|
|
1881
2305
|
`expect.toHaveValue(${JSON.stringify(expected)})`,
|
|
1882
2306
|
selector,
|
|
1883
|
-
() =>
|
|
2307
|
+
() => run2(coord.assertValue(selector, expected, opts))
|
|
1884
2308
|
),
|
|
1885
2309
|
toHaveAttribute: (name, value, opts) => runStep(
|
|
1886
2310
|
`expect.toHaveAttribute(${JSON.stringify(name)})`,
|
|
1887
2311
|
selector,
|
|
1888
|
-
() =>
|
|
2312
|
+
() => run2(coord.assertAttribute(selector, name, value, opts))
|
|
1889
2313
|
),
|
|
1890
|
-
toBeEnabled: (opts) => runStep("expect.toBeEnabled", selector, () =>
|
|
1891
|
-
toBeDisabled: (opts) => runStep("expect.toBeDisabled", selector, () =>
|
|
2314
|
+
toBeEnabled: (opts) => runStep("expect.toBeEnabled", selector, () => run2(coord.assertEnabled(selector, opts))),
|
|
2315
|
+
toBeDisabled: (opts) => runStep("expect.toBeDisabled", selector, () => run2(coord.assertDisabled(selector, opts))),
|
|
1892
2316
|
toContainText: (expected, opts) => runStep(
|
|
1893
2317
|
`expect.toContainText(${JSON.stringify(expected)})`,
|
|
1894
2318
|
selector,
|
|
1895
|
-
() =>
|
|
2319
|
+
() => run2(coord.assertContainsText(selector, expected, opts))
|
|
1896
2320
|
),
|
|
1897
2321
|
toHaveCount: (expected, opts) => runStep(
|
|
1898
2322
|
`expect.toHaveCount(${expected})`,
|
|
1899
2323
|
selector,
|
|
1900
|
-
() =>
|
|
2324
|
+
() => run2(coord.assertCount(selector, expected, opts))
|
|
1901
2325
|
),
|
|
1902
|
-
toBeFocused: (opts) => runStep("expect.toBeFocused", selector, () =>
|
|
2326
|
+
toBeFocused: (opts) => runStep("expect.toBeFocused", selector, () => run2(coord.assertFocused(selector, opts))),
|
|
1903
2327
|
toHaveAccessibleName: (expected, opts) => runStep(
|
|
1904
2328
|
`expect.toHaveAccessibleName(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`,
|
|
1905
2329
|
selector,
|
|
1906
|
-
() =>
|
|
2330
|
+
() => run2(coord.assertAccessibleName(selector, expected, opts))
|
|
2331
|
+
),
|
|
2332
|
+
toHaveAccessibleDescription: (expected, opts) => runStep(
|
|
2333
|
+
`expect.toHaveAccessibleDescription(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`,
|
|
2334
|
+
selector,
|
|
2335
|
+
() => run2(coord.assertAccessibleDescription(selector, expected, opts))
|
|
1907
2336
|
),
|
|
2337
|
+
not: buildNegatedExpectation(selector, runStep),
|
|
2338
|
+
toMatchAriaSnapshot: (expected, opts) => runStep("expect.toMatchAriaSnapshot", selector, async () => {
|
|
2339
|
+
if (!driver.getAriaSnapshot) {
|
|
2340
|
+
throw new Error(
|
|
2341
|
+
`toMatchAriaSnapshot() is not supported on ${ctx.platform} with the current driver`
|
|
2342
|
+
);
|
|
2343
|
+
}
|
|
2344
|
+
if (isRelativeSelector(selector))
|
|
2345
|
+
throw new Error("ARIA snapshots require a locator, not a relative selector");
|
|
2346
|
+
const timeout = opts?.timeout ?? defaultTimeout;
|
|
2347
|
+
const path = typeof expected === "string" ? void 0 : resolvePath(dirname(ctx.flowFilePath), expected.path);
|
|
2348
|
+
if (path && ctx.updateBaselines) {
|
|
2349
|
+
const actual = await run2(driver.getAriaSnapshot(selector, timeout));
|
|
2350
|
+
await mkdir(dirname(path), { recursive: true });
|
|
2351
|
+
await writeFile(path, `${normalizeAriaSnapshot(actual)}
|
|
2352
|
+
`, "utf8");
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
const baseline = normalizeAriaSnapshot(
|
|
2356
|
+
typeof expected === "string" ? expected : await readFile(path, "utf8")
|
|
2357
|
+
);
|
|
2358
|
+
await retryAssertion(
|
|
2359
|
+
async () => {
|
|
2360
|
+
const actual = normalizeAriaSnapshot(
|
|
2361
|
+
await run2(driver.getAriaSnapshot(selector, timeout))
|
|
2362
|
+
);
|
|
2363
|
+
if (actual !== baseline)
|
|
2364
|
+
throw new Error(
|
|
2365
|
+
`ARIA snapshot did not match.
|
|
2366
|
+
Expected:
|
|
2367
|
+
${baseline}
|
|
2368
|
+
Received:
|
|
2369
|
+
${actual}`
|
|
2370
|
+
);
|
|
2371
|
+
},
|
|
2372
|
+
timeout,
|
|
2373
|
+
opts?.intervals
|
|
2374
|
+
);
|
|
2375
|
+
}),
|
|
1908
2376
|
toMatchScreenshot: (name, options) => runStep(
|
|
1909
2377
|
`expect.toMatchScreenshot(${JSON.stringify(name)})`,
|
|
1910
2378
|
selector,
|
|
1911
|
-
() =>
|
|
2379
|
+
() => run2(
|
|
1912
2380
|
coord.assertScreenshot(selector, name, ctx.flowFilePath, ctx.flowName, ctx.platform, {
|
|
1913
2381
|
threshold: options?.threshold ?? visualRegression?.threshold,
|
|
1914
2382
|
maxDiffPixelRatio: options?.maxDiffPixelRatio ?? visualRegression?.maxDiffPixelRatio,
|
|
@@ -1924,7 +2392,7 @@ function createPromiseExpect(driver, config, recorder, flowContext, visualRegres
|
|
|
1924
2392
|
return runStep(
|
|
1925
2393
|
"expect.toPassAccessibilityAudit",
|
|
1926
2394
|
selector,
|
|
1927
|
-
() =>
|
|
2395
|
+
() => run2(
|
|
1928
2396
|
coord.assertAccessibilityAudit(ctx.platform, {
|
|
1929
2397
|
severity: options?.severity,
|
|
1930
2398
|
rules: options?.rules,
|
|
@@ -1937,30 +2405,59 @@ function createPromiseExpect(driver, config, recorder, flowContext, visualRegres
|
|
|
1937
2405
|
toHaveAccessibilityLabel: (expected) => runStep(
|
|
1938
2406
|
`expect.toHaveAccessibilityLabel(${expected !== void 0 ? JSON.stringify(expected) : ""})`,
|
|
1939
2407
|
selector,
|
|
1940
|
-
() =>
|
|
2408
|
+
() => run2(coord.assertAccessibilityLabel(selector, expected))
|
|
1941
2409
|
),
|
|
1942
2410
|
toBeFocusable: () => runStep(
|
|
1943
2411
|
"expect.toBeFocusable",
|
|
1944
2412
|
selector,
|
|
1945
|
-
() =>
|
|
2413
|
+
() => run2(coord.assertFocusable(selector, ctx.platform))
|
|
1946
2414
|
),
|
|
1947
2415
|
toHaveRole: (expected) => runStep(
|
|
1948
2416
|
`expect.toHaveRole(${JSON.stringify(expected)})`,
|
|
1949
2417
|
selector,
|
|
1950
|
-
() =>
|
|
2418
|
+
() => run2(coord.assertRole(selector, expected, ctx.platform))
|
|
1951
2419
|
),
|
|
1952
2420
|
toHaveMinTouchTarget: (size = 44) => runStep(
|
|
1953
2421
|
`expect.toHaveMinTouchTarget(${size})`,
|
|
1954
2422
|
selector,
|
|
1955
|
-
() =>
|
|
2423
|
+
() => run2(coord.assertMinTouchTarget(selector, size))
|
|
1956
2424
|
)
|
|
1957
|
-
})
|
|
1958
|
-
expectFn
|
|
2425
|
+
});
|
|
2426
|
+
const expectFn = ((selectorOrFn) => {
|
|
2427
|
+
if (typeof selectorOrFn !== "function") {
|
|
2428
|
+
return buildSelectorExpectation(selectorOrFn, runSelectorStep);
|
|
2429
|
+
}
|
|
2430
|
+
return {
|
|
2431
|
+
toPass: (opts) => recordStep(
|
|
2432
|
+
"expect.toPass",
|
|
2433
|
+
() => retryAssertion(selectorOrFn, opts?.timeout ?? defaultTimeout, opts?.intervals)
|
|
2434
|
+
)
|
|
2435
|
+
};
|
|
2436
|
+
});
|
|
2437
|
+
const toHaveURL = (expected, opts) => {
|
|
1959
2438
|
const label = `expect.toHaveURL(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`;
|
|
1960
|
-
return
|
|
1961
|
-
captureScreenshot: false
|
|
1962
|
-
}) : run(coord.waitForURL(expected, opts));
|
|
2439
|
+
return recordStep(label, () => run2(coord.waitForURL(expected, opts)));
|
|
1963
2440
|
};
|
|
2441
|
+
expectFn.toHaveURL = toHaveURL;
|
|
2442
|
+
expectFn.soft = Object.assign(
|
|
2443
|
+
(selector) => buildSelectorExpectation(selector, runSoftSelectorStep),
|
|
2444
|
+
{
|
|
2445
|
+
toHaveURL: (expected, opts) => recordSoft(() => toHaveURL(expected, opts))
|
|
2446
|
+
}
|
|
2447
|
+
);
|
|
2448
|
+
Object.defineProperty(expectFn, "not", {
|
|
2449
|
+
enumerable: true,
|
|
2450
|
+
value: {
|
|
2451
|
+
toHaveURL: (expected, opts) => {
|
|
2452
|
+
const label = `expect.not.toHaveURL(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`;
|
|
2453
|
+
return recordStep(label, () => run2(coord.waitForURL(expected, opts, true)));
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
});
|
|
2457
|
+
expectFn.poll = (fn, opts) => ({
|
|
2458
|
+
...buildPollMatchers(fn, opts, false),
|
|
2459
|
+
not: buildPollMatchers(fn, opts, true)
|
|
2460
|
+
});
|
|
1964
2461
|
return expectFn;
|
|
1965
2462
|
}
|
|
1966
2463
|
|
|
@@ -2163,16 +2660,29 @@ function wrapRawPageWithStepRecording(rawPage, recorder) {
|
|
|
2163
2660
|
function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
2164
2661
|
const coord = createCoordinator(driver, config);
|
|
2165
2662
|
const platform = options.platform ?? (appId.startsWith("http://") || appId.startsWith("https://") ? "web" : void 0);
|
|
2166
|
-
const
|
|
2663
|
+
const run2 = (effect) => Effect6.runPromise(effect);
|
|
2167
2664
|
const unsupportedWebFeature = (feature) => Effect6.fail(new DriverError({ message: `${feature}() is only supported on the web platform` }));
|
|
2168
2665
|
const optionalMethod = (name, method) => method ?? ((..._args) => unsupportedWebFeature(name));
|
|
2666
|
+
const unsupportedNetworkFeature = async (name) => {
|
|
2667
|
+
const target = platform ?? (await run2(driver.getDeviceInfo())).platform;
|
|
2668
|
+
throw new DriverError({
|
|
2669
|
+
message: `${name}() is not supported on ${target} with the current driver`
|
|
2670
|
+
});
|
|
2671
|
+
};
|
|
2169
2672
|
const runStep = (command, action, opts) => recorder ? recorder.runStep(command, action, opts) : action();
|
|
2673
|
+
const runDeviceStep = (name, method, ...args) => runStep(name, async () => {
|
|
2674
|
+
if (!method) {
|
|
2675
|
+
const target = platform ?? (await run2(driver.getDeviceInfo())).platform;
|
|
2676
|
+
throw new DriverError({ message: `${name}() is not supported on ${target}` });
|
|
2677
|
+
}
|
|
2678
|
+
await run2(method(...args));
|
|
2679
|
+
});
|
|
2170
2680
|
const runScreenshotStep = (command, action, opts) => recorder ? recorder.runScreenshotStep(command, action, opts) : action();
|
|
2171
2681
|
const getCurrentUrl = async () => {
|
|
2172
2682
|
if (driver.getUrl) {
|
|
2173
|
-
return
|
|
2683
|
+
return run2(driver.getUrl());
|
|
2174
2684
|
}
|
|
2175
|
-
return
|
|
2685
|
+
return run2(
|
|
2176
2686
|
driver.evaluate(
|
|
2177
2687
|
"typeof window !== 'undefined' && window.location ? String(window.location.href || '') : ''"
|
|
2178
2688
|
).pipe(Effect6.catchAll(() => Effect6.succeed("")))
|
|
@@ -2196,7 +2706,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2196
2706
|
const headers = { ...init?.headers };
|
|
2197
2707
|
const hasCookieHeader = Object.keys(headers).some((k) => k.toLowerCase() === "cookie");
|
|
2198
2708
|
if (!hasCookieHeader && driver.getCookies) {
|
|
2199
|
-
const cookies = await
|
|
2709
|
+
const cookies = await run2(driver.getCookies([targetUrl.toString()])).catch(() => []);
|
|
2200
2710
|
if (cookies.length > 0) {
|
|
2201
2711
|
headers["cookie"] = cookies.map((c) => `${c.name}=${c.value}`).join("; ");
|
|
2202
2712
|
}
|
|
@@ -2222,7 +2732,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2222
2732
|
const rawSetCookies = typeof res.headers.getSetCookie === "function" ? res.headers.getSetCookie() : res.headers.get("set-cookie") ? [res.headers.get("set-cookie")] : [];
|
|
2223
2733
|
const parsedCookies = rawSetCookies.map((line) => parseSetCookieHeader(line, targetUrl)).filter((c) => c !== null);
|
|
2224
2734
|
if (parsedCookies.length > 0) {
|
|
2225
|
-
await
|
|
2735
|
+
await run2(driver.setCookies(parsedCookies)).catch(() => {
|
|
2226
2736
|
});
|
|
2227
2737
|
}
|
|
2228
2738
|
}
|
|
@@ -2284,51 +2794,59 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2284
2794
|
options.visualRegression
|
|
2285
2795
|
);
|
|
2286
2796
|
const appObj = {
|
|
2287
|
-
|
|
2288
|
-
|
|
2797
|
+
setGeolocation: (point) => runDeviceStep("setGeolocation", driver.setGeolocation, point),
|
|
2798
|
+
setSystemTime: (time) => runDeviceStep("setSystemTime", driver.setSystemTime, time),
|
|
2799
|
+
grantPermission: (permission, opts) => runDeviceStep("grantPermission", driver.setPermission, appId, permission, "grant", opts),
|
|
2800
|
+
denyPermission: (permission, opts) => runDeviceStep("denyPermission", driver.setPermission, appId, permission, "deny", opts),
|
|
2801
|
+
setOrientation: (orientation) => runDeviceStep("setOrientation", driver.setOrientation, orientation),
|
|
2802
|
+
setBiometricEnrollment: (enabled) => runDeviceStep("setBiometricEnrollment", driver.setBiometricEnrollment, enabled),
|
|
2803
|
+
simulateBiometric: (opts) => runDeviceStep("simulateBiometric", driver.simulateBiometric, opts),
|
|
2804
|
+
sendPushNotification: (payload) => runDeviceStep("sendPushNotification", driver.sendPushNotification, appId, payload),
|
|
2805
|
+
tap: (selector, opts) => runStep("tap", () => run2(coord.tap(selector, opts)), { selector, captureScreenshot: true }),
|
|
2806
|
+
tapXY: (x, y) => runStep("tapXY", () => run2(coord.tapXY(x, y)), {
|
|
2289
2807
|
selector: { point: { x, y } },
|
|
2290
2808
|
captureScreenshot: true
|
|
2291
2809
|
}),
|
|
2292
|
-
doubleTap: (selector, opts) => runStep("doubleTap", () =>
|
|
2810
|
+
doubleTap: (selector, opts) => runStep("doubleTap", () => run2(coord.doubleTap(selector, opts)), {
|
|
2293
2811
|
selector,
|
|
2294
2812
|
captureScreenshot: true
|
|
2295
2813
|
}),
|
|
2296
|
-
longPress: (selector, opts) => runStep("longPress", () =>
|
|
2814
|
+
longPress: (selector, opts) => runStep("longPress", () => run2(coord.longPress(selector, opts?.duration, opts)), {
|
|
2297
2815
|
selector,
|
|
2298
2816
|
captureScreenshot: true
|
|
2299
2817
|
}),
|
|
2300
|
-
longPressXY: (x, y, opts) => runStep("longPressXY", () =>
|
|
2818
|
+
longPressXY: (x, y, opts) => runStep("longPressXY", () => run2(coord.longPressXY(x, y, opts?.duration)), {
|
|
2301
2819
|
selector: { point: { x, y } },
|
|
2302
2820
|
captureScreenshot: true
|
|
2303
2821
|
}),
|
|
2304
|
-
hover: (selector, opts) => runStep("hover", () =>
|
|
2822
|
+
hover: (selector, opts) => runStep("hover", () => run2(coord.hover(selector, opts)), {
|
|
2305
2823
|
selector,
|
|
2306
2824
|
captureScreenshot: true
|
|
2307
2825
|
}),
|
|
2308
|
-
inputText: (text) => runStep("inputText", () =>
|
|
2309
|
-
fill: (selector, value, opts) => runStep("fill", () =>
|
|
2826
|
+
inputText: (text) => runStep("inputText", () => run2(coord.inputText(text)), { captureScreenshot: true }),
|
|
2827
|
+
fill: (selector, value, opts) => runStep("fill", () => run2(coord.fill(selector, value, opts)), {
|
|
2310
2828
|
selector,
|
|
2311
2829
|
captureScreenshot: true
|
|
2312
2830
|
}),
|
|
2313
|
-
pressKey: (key) => runStep(`pressKey(${key})`, () =>
|
|
2314
|
-
hideKeyboard: () => runStep("hideKeyboard", () =>
|
|
2831
|
+
pressKey: (key) => runStep(`pressKey(${key})`, () => run2(coord.pressKey(key)), { captureScreenshot: true }),
|
|
2832
|
+
hideKeyboard: () => runStep("hideKeyboard", () => run2(coord.hideKeyboard()), { captureScreenshot: true }),
|
|
2315
2833
|
dismissKeyboard: (opts) => runStep(
|
|
2316
2834
|
`dismissKeyboard(${opts?.strategy ?? "auto"})`,
|
|
2317
|
-
() =>
|
|
2835
|
+
() => run2(coord.dismissKeyboard(opts)),
|
|
2318
2836
|
{
|
|
2319
2837
|
selector: { strategy: opts?.strategy ?? "auto" },
|
|
2320
2838
|
captureScreenshot: true
|
|
2321
2839
|
}
|
|
2322
2840
|
),
|
|
2323
|
-
swipe: (direction, opts) => runStep(`swipe(${direction})`, () =>
|
|
2841
|
+
swipe: (direction, opts) => runStep(`swipe(${direction})`, () => run2(coord.swipe(direction, opts)), {
|
|
2324
2842
|
captureScreenshot: true
|
|
2325
2843
|
}),
|
|
2326
|
-
scroll: (direction) => runStep(`scroll(${direction})`, () =>
|
|
2844
|
+
scroll: (direction) => runStep(`scroll(${direction})`, () => run2(coord.scroll(direction)), {
|
|
2327
2845
|
captureScreenshot: true
|
|
2328
2846
|
}),
|
|
2329
2847
|
scrollUntilVisible: (selector, opts) => runStep(
|
|
2330
2848
|
`scrollUntilVisible(${opts?.direction ?? "down"})`,
|
|
2331
|
-
() =>
|
|
2849
|
+
() => run2(coord.scrollUntilVisible(selector, opts)),
|
|
2332
2850
|
{
|
|
2333
2851
|
selector: {
|
|
2334
2852
|
target: selector,
|
|
@@ -2341,7 +2859,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2341
2859
|
),
|
|
2342
2860
|
backUntilVisible: (selector, opts) => runStep(
|
|
2343
2861
|
`backUntilVisible(${opts?.maxBacks ?? 3})`,
|
|
2344
|
-
() =>
|
|
2862
|
+
() => run2(coord.backUntilVisible(selector, opts)),
|
|
2345
2863
|
{
|
|
2346
2864
|
selector: {
|
|
2347
2865
|
target: selector,
|
|
@@ -2353,15 +2871,15 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2353
2871
|
),
|
|
2354
2872
|
launch: (opts) => {
|
|
2355
2873
|
const mergedLaunchOptions = mergeLaunchOptions(options.launchOptions, opts);
|
|
2356
|
-
return runStep("launch", () =>
|
|
2874
|
+
return runStep("launch", () => run2(driver.launchApp(appId, mergedLaunchOptions)), {
|
|
2357
2875
|
selector: mergedLaunchOptions,
|
|
2358
2876
|
captureScreenshot: true
|
|
2359
2877
|
});
|
|
2360
2878
|
},
|
|
2361
|
-
stop: () => runStep("stop", () =>
|
|
2362
|
-
kill: () => runStep("kill", () =>
|
|
2363
|
-
clearState: () => runStep("clearState", () =>
|
|
2364
|
-
openLink: (url) => runStep("openLink", () =>
|
|
2879
|
+
stop: () => runStep("stop", () => run2(driver.stopApp(appId)), { captureScreenshot: true }),
|
|
2880
|
+
kill: () => runStep("kill", () => run2(driver.killApp(appId)), { captureScreenshot: true }),
|
|
2881
|
+
clearState: () => runStep("clearState", () => run2(driver.clearAppState(appId)), { captureScreenshot: true }),
|
|
2882
|
+
openLink: (url) => runStep("openLink", () => run2(driver.openLink(url)), {
|
|
2365
2883
|
selector: { url },
|
|
2366
2884
|
captureScreenshot: true
|
|
2367
2885
|
}),
|
|
@@ -2369,14 +2887,14 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2369
2887
|
`openStory(${storyId})`,
|
|
2370
2888
|
async () => {
|
|
2371
2889
|
if (platform !== "web") {
|
|
2372
|
-
await
|
|
2890
|
+
await run2(unsupportedWebFeature("openStory"));
|
|
2373
2891
|
return;
|
|
2374
2892
|
}
|
|
2375
2893
|
const url = buildStorybookUrl(storyId, opts, {
|
|
2376
2894
|
appBaseUrl: appId,
|
|
2377
2895
|
storybook: options.storybook
|
|
2378
2896
|
});
|
|
2379
|
-
await
|
|
2897
|
+
await run2(driver.openLink(url));
|
|
2380
2898
|
},
|
|
2381
2899
|
{
|
|
2382
2900
|
selector: {
|
|
@@ -2389,129 +2907,129 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2389
2907
|
captureScreenshot: true
|
|
2390
2908
|
}
|
|
2391
2909
|
),
|
|
2392
|
-
back: () => runStep("back", () =>
|
|
2910
|
+
back: () => runStep("back", () => run2(driver.back()), { captureScreenshot: true }),
|
|
2393
2911
|
reload: (opts) => runStep(
|
|
2394
2912
|
"reload",
|
|
2395
2913
|
async () => {
|
|
2396
2914
|
if (driver.reload) {
|
|
2397
|
-
await
|
|
2915
|
+
await run2(driver.reload(opts));
|
|
2398
2916
|
return;
|
|
2399
2917
|
}
|
|
2400
2918
|
if (driver.domChannel?.reload) {
|
|
2401
2919
|
await driver.domChannel.reload();
|
|
2402
2920
|
return;
|
|
2403
2921
|
}
|
|
2404
|
-
await
|
|
2922
|
+
await run2(driver.evaluate("window.location.reload()"));
|
|
2405
2923
|
},
|
|
2406
2924
|
{ captureScreenshot: true }
|
|
2407
2925
|
),
|
|
2408
2926
|
url: () => runStep("url", () => getCurrentUrl()),
|
|
2409
2927
|
waitForURL: (expected, opts) => runStep(
|
|
2410
2928
|
`waitForURL(${expected instanceof RegExp ? String(expected) : JSON.stringify(expected)})`,
|
|
2411
|
-
() =>
|
|
2929
|
+
() => run2(coord.waitForURL(expected, opts))
|
|
2412
2930
|
),
|
|
2413
2931
|
waitForResponse: (matcher, opts) => runStep(
|
|
2414
2932
|
`waitForResponse(${typeof matcher === "function" ? "<predicate>" : describeMatcher(matcher)})`,
|
|
2415
|
-
() =>
|
|
2933
|
+
() => run2(optionalMethod("waitForResponse", driver.waitForResponse)(matcher, opts))
|
|
2416
2934
|
),
|
|
2417
2935
|
takeScreenshot: (name) => runScreenshotStep(
|
|
2418
2936
|
name ? `takeScreenshot(${name})` : "takeScreenshot",
|
|
2419
|
-
() =>
|
|
2937
|
+
() => run2(driver.takeScreenshot()),
|
|
2420
2938
|
{ name }
|
|
2421
2939
|
),
|
|
2422
2940
|
evaluate: (fn, ...args) => runStep(
|
|
2423
2941
|
formatEvaluateCommand(fn),
|
|
2424
|
-
() =>
|
|
2942
|
+
() => run2(driver.evaluate(fn, ...args))
|
|
2425
2943
|
),
|
|
2426
2944
|
mockNetwork: (matcher, response) => runStep(
|
|
2427
2945
|
"mockNetwork",
|
|
2428
|
-
() =>
|
|
2946
|
+
() => driver.mockNetwork ? run2(driver.mockNetwork(matcher, response)) : unsupportedNetworkFeature("mockNetwork"),
|
|
2429
2947
|
{
|
|
2430
2948
|
selector: { matcher: describeMatcher(matcher), response }
|
|
2431
2949
|
}
|
|
2432
2950
|
),
|
|
2433
2951
|
blockNetwork: (matcher) => runStep(
|
|
2434
2952
|
"blockNetwork",
|
|
2435
|
-
() =>
|
|
2953
|
+
() => driver.blockNetwork ? run2(driver.blockNetwork(matcher)) : unsupportedNetworkFeature("blockNetwork"),
|
|
2436
2954
|
{
|
|
2437
2955
|
selector: { matcher: describeMatcher(matcher) }
|
|
2438
2956
|
}
|
|
2439
2957
|
),
|
|
2440
2958
|
clearNetworkMocks: () => runStep(
|
|
2441
2959
|
"clearNetworkMocks",
|
|
2442
|
-
() =>
|
|
2960
|
+
() => driver.clearNetworkMocks ? run2(driver.clearNetworkMocks()) : unsupportedNetworkFeature("clearNetworkMocks")
|
|
2443
2961
|
),
|
|
2444
2962
|
setNetworkConditions: (conditions) => runStep(
|
|
2445
2963
|
"setNetworkConditions",
|
|
2446
|
-
() =>
|
|
2964
|
+
() => run2(optionalMethod("setNetworkConditions", driver.setNetworkConditions)(conditions)),
|
|
2447
2965
|
{ selector: conditions }
|
|
2448
2966
|
),
|
|
2449
2967
|
setOffline: (offline) => runStep(
|
|
2450
2968
|
`setOffline(${offline})`,
|
|
2451
|
-
() =>
|
|
2969
|
+
() => run2(optionalMethod("setOffline", driver.setNetworkConditions)({ offline })),
|
|
2452
2970
|
{ selector: { offline } }
|
|
2453
2971
|
),
|
|
2454
|
-
saveCookies: (path) => runStep("saveCookies", () =>
|
|
2972
|
+
saveCookies: (path) => runStep("saveCookies", () => run2(optionalMethod("saveCookies", driver.saveCookies)(path)), {
|
|
2455
2973
|
selector: { path }
|
|
2456
2974
|
}),
|
|
2457
|
-
loadCookies: (path) => runStep("loadCookies", () =>
|
|
2975
|
+
loadCookies: (path) => runStep("loadCookies", () => run2(optionalMethod("loadCookies", driver.loadCookies)(path)), {
|
|
2458
2976
|
selector: { path }
|
|
2459
2977
|
}),
|
|
2460
|
-
getCookies: (urls) => runStep("getCookies", () =>
|
|
2461
|
-
setCookies: (cookies) => runStep("setCookies", () =>
|
|
2978
|
+
getCookies: (urls) => runStep("getCookies", () => run2(optionalMethod("getCookies", driver.getCookies)(urls))),
|
|
2979
|
+
setCookies: (cookies) => runStep("setCookies", () => run2(optionalMethod("setCookies", driver.setCookies)(cookies)), {
|
|
2462
2980
|
selector: { count: cookies.length }
|
|
2463
2981
|
}),
|
|
2464
|
-
clearCookies: () => runStep("clearCookies", () =>
|
|
2982
|
+
clearCookies: () => runStep("clearCookies", () => run2(optionalMethod("clearCookies", driver.clearCookies)())),
|
|
2465
2983
|
saveAuthState: (path) => runStep(
|
|
2466
2984
|
"saveAuthState",
|
|
2467
|
-
() =>
|
|
2985
|
+
() => run2(optionalMethod("saveAuthState", driver.saveAuthState)(path)),
|
|
2468
2986
|
{ selector: { path } }
|
|
2469
2987
|
),
|
|
2470
2988
|
loadAuthState: (path) => runStep(
|
|
2471
2989
|
"loadAuthState",
|
|
2472
|
-
() =>
|
|
2990
|
+
() => run2(optionalMethod("loadAuthState", driver.loadAuthState)(path)),
|
|
2473
2991
|
{ selector: { path } }
|
|
2474
2992
|
),
|
|
2475
2993
|
downloadFile: (path) => runStep(
|
|
2476
2994
|
"downloadFile",
|
|
2477
|
-
() =>
|
|
2995
|
+
() => run2(optionalMethod("downloadFile", driver.downloadFile)(path)),
|
|
2478
2996
|
{ selector: { path } }
|
|
2479
2997
|
),
|
|
2480
2998
|
uploadFile: (selector, path) => runStep(
|
|
2481
2999
|
"uploadFile",
|
|
2482
|
-
() =>
|
|
3000
|
+
() => run2(optionalMethod("uploadFile", driver.uploadFile)(selector, path)),
|
|
2483
3001
|
{
|
|
2484
3002
|
selector: { target: selector, path },
|
|
2485
3003
|
captureScreenshot: true
|
|
2486
3004
|
}
|
|
2487
3005
|
),
|
|
2488
|
-
newTab: (url) => runStep("newTab", () =>
|
|
3006
|
+
newTab: (url) => runStep("newTab", () => run2(optionalMethod("newTab", driver.newTab)(url)), {
|
|
2489
3007
|
selector: url ? { url } : void 0,
|
|
2490
3008
|
captureScreenshot: true
|
|
2491
3009
|
}),
|
|
2492
3010
|
switchToTab: (index) => runStep(
|
|
2493
3011
|
`switchToTab(${index})`,
|
|
2494
|
-
() =>
|
|
3012
|
+
() => run2(optionalMethod("switchToTab", driver.switchToTab)(index)),
|
|
2495
3013
|
{
|
|
2496
3014
|
selector: { index },
|
|
2497
3015
|
captureScreenshot: true
|
|
2498
3016
|
}
|
|
2499
3017
|
),
|
|
2500
|
-
closeTab: () => runStep("closeTab", () =>
|
|
3018
|
+
closeTab: () => runStep("closeTab", () => run2(optionalMethod("closeTab", driver.closeTab)()), {
|
|
2501
3019
|
captureScreenshot: true
|
|
2502
3020
|
}),
|
|
2503
|
-
getTabIds: () => runStep("getTabIds", () =>
|
|
3021
|
+
getTabIds: () => runStep("getTabIds", () => run2(optionalMethod("getTabIds", driver.getTabIds)())),
|
|
2504
3022
|
getConsoleLogs: () => runStep(
|
|
2505
3023
|
"getConsoleLogs",
|
|
2506
|
-
() =>
|
|
3024
|
+
() => run2(optionalMethod("getConsoleLogs", driver.getConsoleLogs)())
|
|
2507
3025
|
),
|
|
2508
|
-
getJSErrors: () => runStep("getJSErrors", () =>
|
|
2509
|
-
getHAR: () => runStep("getHAR", () =>
|
|
3026
|
+
getJSErrors: () => runStep("getJSErrors", () => run2(optionalMethod("getJSErrors", driver.getJSErrors)())),
|
|
3027
|
+
getHAR: () => runStep("getHAR", () => run2(optionalMethod("getHAR", driver.getHAR)())),
|
|
2510
3028
|
request: requestClient,
|
|
2511
3029
|
newContext: (ctxOpts) => runStep(
|
|
2512
3030
|
"newContext",
|
|
2513
3031
|
async () => {
|
|
2514
|
-
const created = await
|
|
3032
|
+
const created = await run2(
|
|
2515
3033
|
optionalMethod("newContext", driver.createIsolatedContext)(ctxOpts)
|
|
2516
3034
|
);
|
|
2517
3035
|
let closed = false;
|
|
@@ -2547,6 +3065,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2547
3065
|
getAttribute: (sel, name, opts) => appObj.getAttribute(scoped(sel), name, opts),
|
|
2548
3066
|
isVisible: (sel, opts) => appObj.isVisible(scoped(sel), opts),
|
|
2549
3067
|
isEnabled: (sel, opts) => appObj.isEnabled(scoped(sel), opts),
|
|
3068
|
+
count: (sel, opts) => appObj.count(scoped(sel), opts),
|
|
2550
3069
|
expect: (sel) => appExpect(scoped(sel))
|
|
2551
3070
|
};
|
|
2552
3071
|
},
|
|
@@ -2580,14 +3099,14 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2580
3099
|
},
|
|
2581
3100
|
enableVirtualAuthenticator: (opts) => runStep(
|
|
2582
3101
|
"enableVirtualAuthenticator",
|
|
2583
|
-
() =>
|
|
3102
|
+
() => run2(
|
|
2584
3103
|
optionalMethod("enableVirtualAuthenticator", driver.enableVirtualAuthenticator)(opts)
|
|
2585
3104
|
),
|
|
2586
3105
|
{ selector: opts }
|
|
2587
3106
|
),
|
|
2588
3107
|
removeVirtualAuthenticator: (authenticatorId) => runStep(
|
|
2589
3108
|
"removeVirtualAuthenticator",
|
|
2590
|
-
() =>
|
|
3109
|
+
() => run2(
|
|
2591
3110
|
optionalMethod(
|
|
2592
3111
|
"removeVirtualAuthenticator",
|
|
2593
3112
|
driver.removeVirtualAuthenticator
|
|
@@ -2596,11 +3115,11 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2596
3115
|
),
|
|
2597
3116
|
getVirtualCredentials: (authenticatorId) => runStep(
|
|
2598
3117
|
"getVirtualCredentials",
|
|
2599
|
-
() =>
|
|
3118
|
+
() => run2(optionalMethod("getVirtualCredentials", driver.getVirtualCredentials)(authenticatorId))
|
|
2600
3119
|
),
|
|
2601
3120
|
addVirtualCredential: (credential, authenticatorId) => runStep(
|
|
2602
3121
|
"addVirtualCredential",
|
|
2603
|
-
() =>
|
|
3122
|
+
() => run2(
|
|
2604
3123
|
optionalMethod("addVirtualCredential", driver.addVirtualCredential)(
|
|
2605
3124
|
credential,
|
|
2606
3125
|
authenticatorId
|
|
@@ -2610,29 +3129,29 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2610
3129
|
),
|
|
2611
3130
|
clearVirtualCredentials: (authenticatorId) => runStep(
|
|
2612
3131
|
"clearVirtualCredentials",
|
|
2613
|
-
() =>
|
|
3132
|
+
() => run2(
|
|
2614
3133
|
optionalMethod(
|
|
2615
3134
|
"clearVirtualCredentials",
|
|
2616
3135
|
driver.clearVirtualCredentials
|
|
2617
3136
|
)(authenticatorId)
|
|
2618
3137
|
)
|
|
2619
3138
|
),
|
|
2620
|
-
pinch: (selector, opts) => runStep("pinch", () =>
|
|
3139
|
+
pinch: (selector, opts) => runStep("pinch", () => run2(coord.pinch(selector, opts)), {
|
|
2621
3140
|
selector,
|
|
2622
3141
|
captureScreenshot: true
|
|
2623
3142
|
}),
|
|
2624
|
-
zoom: (selector, opts) => runStep("zoom", () =>
|
|
3143
|
+
zoom: (selector, opts) => runStep("zoom", () => run2(coord.zoom(selector, opts)), {
|
|
2625
3144
|
selector,
|
|
2626
3145
|
captureScreenshot: true
|
|
2627
3146
|
}),
|
|
2628
|
-
multiTouch: (sequences) => runStep("multiTouch", () =>
|
|
2629
|
-
getText: (selector, opts) => runStep("getText", () =>
|
|
2630
|
-
getAttribute: (selector, name, opts) => runStep(`getAttribute(${name})`, () =>
|
|
3147
|
+
multiTouch: (sequences) => runStep("multiTouch", () => run2(coord.multiTouch(sequences)), { captureScreenshot: true }),
|
|
3148
|
+
getText: (selector, opts) => runStep("getText", () => run2(coord.getText(selector, opts)), { selector }),
|
|
3149
|
+
getAttribute: (selector, name, opts) => runStep(`getAttribute(${name})`, () => run2(coord.getAttribute(selector, name, opts)), {
|
|
2631
3150
|
selector
|
|
2632
3151
|
}),
|
|
2633
3152
|
isVisible: (selector, opts) => {
|
|
2634
3153
|
const timeout = opts?.timeout ?? 1e3;
|
|
2635
|
-
return
|
|
3154
|
+
return run2(
|
|
2636
3155
|
Effect6.gen(function* () {
|
|
2637
3156
|
const result = yield* Effect6.either(
|
|
2638
3157
|
waitForElement(
|
|
@@ -2647,7 +3166,8 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2647
3166
|
})
|
|
2648
3167
|
);
|
|
2649
3168
|
},
|
|
2650
|
-
isEnabled: (selector, opts) => runStep("isEnabled", () =>
|
|
3169
|
+
isEnabled: (selector, opts) => runStep("isEnabled", () => run2(coord.isElementEnabled(selector, opts)), { selector }),
|
|
3170
|
+
count: (selector, opts) => runStep("count", () => run2(coord.count(selector, opts)), { selector }),
|
|
2651
3171
|
// Web-first bridge & fast state helpers
|
|
2652
3172
|
waitForIdle: (opts) => runStep("waitForIdle", async () => {
|
|
2653
3173
|
if (driver.domChannel?.waitForIdle) {
|
|
@@ -2660,7 +3180,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2660
3180
|
return;
|
|
2661
3181
|
}
|
|
2662
3182
|
const serialized = JSON.stringify(entries);
|
|
2663
|
-
await
|
|
3183
|
+
await run2(
|
|
2664
3184
|
driver.evaluate(
|
|
2665
3185
|
`((payload) => {
|
|
2666
3186
|
if (payload.localStorage) {
|
|
@@ -2690,7 +3210,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2690
3210
|
return;
|
|
2691
3211
|
}
|
|
2692
3212
|
const serialized = JSON.stringify(opts ?? {});
|
|
2693
|
-
await
|
|
3213
|
+
await run2(
|
|
2694
3214
|
driver.evaluate(
|
|
2695
3215
|
`((clearOpts) => {
|
|
2696
3216
|
if (clearOpts.localStorage !== false) {
|
|
@@ -2705,7 +3225,7 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2705
3225
|
}),
|
|
2706
3226
|
resetFast: () => runStep("resetFast", async () => {
|
|
2707
3227
|
if (driver.resetFast) {
|
|
2708
|
-
await
|
|
3228
|
+
await run2(driver.resetFast());
|
|
2709
3229
|
return;
|
|
2710
3230
|
}
|
|
2711
3231
|
if (driver.domChannel?.clearStorage) {
|
|
@@ -2721,23 +3241,23 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2721
3241
|
}
|
|
2722
3242
|
return;
|
|
2723
3243
|
}
|
|
2724
|
-
await
|
|
3244
|
+
await run2(driver.clearAppState(appId));
|
|
2725
3245
|
}),
|
|
2726
3246
|
// WebView / hybrid context switching (low-level escape hatches)
|
|
2727
3247
|
getContexts: () => runStep(
|
|
2728
3248
|
"getContexts",
|
|
2729
|
-
() =>
|
|
3249
|
+
() => run2((driver.getContexts ?? (() => Effect6.succeed(["NATIVE_APP"])))())
|
|
2730
3250
|
),
|
|
2731
3251
|
getCurrentContext: () => runStep(
|
|
2732
3252
|
"getCurrentContext",
|
|
2733
|
-
() =>
|
|
3253
|
+
() => run2((driver.getCurrentContext ?? (() => Effect6.succeed("NATIVE_APP")))())
|
|
2734
3254
|
),
|
|
2735
3255
|
switchToContext: (contextId) => runStep(
|
|
2736
3256
|
`switchToContext(${contextId})`,
|
|
2737
|
-
() =>
|
|
3257
|
+
() => run2((driver.setContext ?? ((_id) => Effect6.void))(contextId))
|
|
2738
3258
|
),
|
|
2739
3259
|
switchToWebView: () => runStep("switchToWebView", async () => {
|
|
2740
|
-
const contexts = await
|
|
3260
|
+
const contexts = await run2(
|
|
2741
3261
|
(driver.getContexts ?? (() => Effect6.succeed(["NATIVE_APP"])))()
|
|
2742
3262
|
);
|
|
2743
3263
|
const webview = contexts.find((c) => c.startsWith("WEBVIEW_"));
|
|
@@ -2746,11 +3266,11 @@ function createPromiseApp(driver, appId, config, recorder, options = {}) {
|
|
|
2746
3266
|
message: `No WebView context found. Available contexts: ${contexts.join(", ")}`
|
|
2747
3267
|
});
|
|
2748
3268
|
}
|
|
2749
|
-
await
|
|
3269
|
+
await run2((driver.setContext ?? ((_id) => Effect6.void))(webview));
|
|
2750
3270
|
}),
|
|
2751
3271
|
switchToNativeApp: () => runStep(
|
|
2752
3272
|
"switchToNativeApp",
|
|
2753
|
-
() =>
|
|
3273
|
+
() => run2((driver.setContext ?? ((_id) => Effect6.void))("NATIVE_APP"))
|
|
2754
3274
|
)
|
|
2755
3275
|
};
|
|
2756
3276
|
return appObj;
|
|
@@ -2793,16 +3313,108 @@ var RawDriver = class extends Context.Tag("RawDriver")() {
|
|
|
2793
3313
|
import { spawn } from "child_process";
|
|
2794
3314
|
import { createHash } from "crypto";
|
|
2795
3315
|
import { mkdtempSync, rmSync } from "fs";
|
|
2796
|
-
import { readFile, writeFile } from "fs/promises";
|
|
3316
|
+
import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
2797
3317
|
import { tmpdir } from "os";
|
|
2798
3318
|
import { join } from "path";
|
|
2799
|
-
import { Effect as
|
|
3319
|
+
import { Effect as Effect9, Layer } from "effect";
|
|
2800
3320
|
import {
|
|
2801
3321
|
chromium,
|
|
2802
3322
|
firefox,
|
|
2803
3323
|
webkit
|
|
2804
3324
|
} from "playwright-core";
|
|
2805
3325
|
|
|
3326
|
+
// src/drivers/device-controls.ts
|
|
3327
|
+
import { execFileSync } from "child_process";
|
|
3328
|
+
import { Effect as Effect8 } from "effect";
|
|
3329
|
+
function deviceEffect(operation, action) {
|
|
3330
|
+
return Effect8.tryPromise({
|
|
3331
|
+
try: async () => action(),
|
|
3332
|
+
catch: (error) => new DriverError({
|
|
3333
|
+
message: `${operation} failed: ${error instanceof Error ? error.message : String(error)}`
|
|
3334
|
+
})
|
|
3335
|
+
});
|
|
3336
|
+
}
|
|
3337
|
+
var run = (file, args, input) => execFileSync(file, args, { encoding: "utf8", input, timeout: 15e3 });
|
|
3338
|
+
function androidIdentifier(name) {
|
|
3339
|
+
if (!/^[A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)+$/.test(name)) {
|
|
3340
|
+
throw new Error(`Invalid Android package or permission: ${name}`);
|
|
3341
|
+
}
|
|
3342
|
+
return name;
|
|
3343
|
+
}
|
|
3344
|
+
function androidDeviceControls(serial, command = run, adbPath = findADB) {
|
|
3345
|
+
const adb = (...args) => {
|
|
3346
|
+
const file = adbPath();
|
|
3347
|
+
if (!file) throw new Error("adb not found");
|
|
3348
|
+
return command(file, ["-s", serial, ...args]);
|
|
3349
|
+
};
|
|
3350
|
+
const emulator = (operation, ...args) => {
|
|
3351
|
+
if (!serial.startsWith("emulator-")) {
|
|
3352
|
+
throw new Error(`${operation} is not supported on physical Android devices`);
|
|
3353
|
+
}
|
|
3354
|
+
const result = adb("emu", ...args);
|
|
3355
|
+
if (/^KO:/m.test(result)) throw new Error(result.trim());
|
|
3356
|
+
};
|
|
3357
|
+
return {
|
|
3358
|
+
setGeolocation: (point) => deviceEffect(
|
|
3359
|
+
"setGeolocation",
|
|
3360
|
+
() => emulator(
|
|
3361
|
+
"Geolocation emulation",
|
|
3362
|
+
"geo",
|
|
3363
|
+
"fix",
|
|
3364
|
+
String(point.longitude),
|
|
3365
|
+
String(point.latitude)
|
|
3366
|
+
)
|
|
3367
|
+
),
|
|
3368
|
+
setPermission: (appId, permission, state) => deviceEffect("setPermission", () => {
|
|
3369
|
+
adb(
|
|
3370
|
+
"shell",
|
|
3371
|
+
"pm",
|
|
3372
|
+
state === "grant" ? "grant" : "revoke",
|
|
3373
|
+
androidIdentifier(appId),
|
|
3374
|
+
androidIdentifier(permission)
|
|
3375
|
+
);
|
|
3376
|
+
}),
|
|
3377
|
+
simulateBiometric: (opts) => deviceEffect("simulateBiometric", () => {
|
|
3378
|
+
if (opts.type !== "fingerprint")
|
|
3379
|
+
throw new Error("Only fingerprint simulation is supported on Android");
|
|
3380
|
+
if (!Number.isInteger(opts.fingerId) || opts.fingerId < 1)
|
|
3381
|
+
throw new Error("fingerId must be a positive integer");
|
|
3382
|
+
emulator("Fingerprint simulation", "finger", "touch", String(opts.fingerId));
|
|
3383
|
+
})
|
|
3384
|
+
};
|
|
3385
|
+
}
|
|
3386
|
+
function iosSimulatorControls(udid, command = run) {
|
|
3387
|
+
const simctl = (subcommand, args, input) => {
|
|
3388
|
+
if (!udid) throw new Error(`${subcommand} is not supported on physical iOS devices`);
|
|
3389
|
+
return command("xcrun", ["simctl", subcommand, udid, ...args], input);
|
|
3390
|
+
};
|
|
3391
|
+
const notify = (args) => simctl("spawn", ["notifyutil", ...args]);
|
|
3392
|
+
return {
|
|
3393
|
+
setGeolocation: (point) => deviceEffect("setGeolocation", () => {
|
|
3394
|
+
simctl("location", ["set", `${point.latitude.toFixed(7)},${point.longitude.toFixed(7)}`]);
|
|
3395
|
+
}),
|
|
3396
|
+
setPermission: (appId, permission, state) => deviceEffect("setPermission", () => {
|
|
3397
|
+
simctl("privacy", [state === "grant" ? "grant" : "revoke", permission, appId]);
|
|
3398
|
+
}),
|
|
3399
|
+
setBiometricEnrollment: (enabled) => deviceEffect("setBiometricEnrollment", () => {
|
|
3400
|
+
const event = "com.apple.BiometricKit.enrollmentChanged";
|
|
3401
|
+
notify(["-s", event, enabled ? "1" : "0"]);
|
|
3402
|
+
notify(["-p", event]);
|
|
3403
|
+
}),
|
|
3404
|
+
simulateBiometric: (opts) => deviceEffect("simulateBiometric", () => {
|
|
3405
|
+
if (opts.type === "fingerprint") throw new Error("Use touchId or faceId on iOS");
|
|
3406
|
+
const sensor = opts.type === "faceId" ? "pearl" : "fingerTouch";
|
|
3407
|
+
notify([
|
|
3408
|
+
"-p",
|
|
3409
|
+
`com.apple.BiometricKit_Sim.${sensor}.${opts.match === false ? "nomatch" : "match"}`
|
|
3410
|
+
]);
|
|
3411
|
+
}),
|
|
3412
|
+
sendPushNotification: (appId, payload) => deviceEffect("sendPushNotification", () => {
|
|
3413
|
+
simctl("push", [appId, "-"], JSON.stringify(payload));
|
|
3414
|
+
})
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3417
|
+
|
|
2806
3418
|
// src/drivers/network-profiles.ts
|
|
2807
3419
|
var PROFILES = {
|
|
2808
3420
|
wifi: {
|
|
@@ -3065,12 +3677,17 @@ function resolvePlaywrightLocator(root, selector) {
|
|
|
3065
3677
|
scope = resolvePlaywrightLocator(scope, selector.within);
|
|
3066
3678
|
}
|
|
3067
3679
|
let locator;
|
|
3068
|
-
if ("
|
|
3680
|
+
if ("anyOf" in selector) {
|
|
3681
|
+
const branches = selector.anyOf.map((branch) => resolvePlaywrightLocator(scope, branch));
|
|
3682
|
+
locator = branches.reduce((acc, next) => acc.or(next));
|
|
3683
|
+
} else if ("css" in selector) {
|
|
3069
3684
|
locator = scope.locator(selector.css);
|
|
3070
3685
|
} else if ("role" in selector) {
|
|
3071
3686
|
locator = scope.getByRole(selector.role, {
|
|
3072
3687
|
...selector.name !== void 0 ? { name: selector.name } : {},
|
|
3073
|
-
...selector.exact !== void 0 ? { exact: selector.exact } : {}
|
|
3688
|
+
...selector.exact !== void 0 ? { exact: selector.exact } : {},
|
|
3689
|
+
...selector.level !== void 0 ? { level: selector.level } : {},
|
|
3690
|
+
...selector.includeHidden !== void 0 ? { includeHidden: selector.includeHidden } : {}
|
|
3074
3691
|
});
|
|
3075
3692
|
} else if ("testID" in selector) {
|
|
3076
3693
|
locator = scope.getByTestId(selector.testID);
|
|
@@ -3085,6 +3702,12 @@ function resolvePlaywrightLocator(root, selector) {
|
|
|
3085
3702
|
if (selector.hasNotText !== void 0) {
|
|
3086
3703
|
locator = locator.filter({ hasNotText: selector.hasNotText });
|
|
3087
3704
|
}
|
|
3705
|
+
if (selector.has !== void 0) {
|
|
3706
|
+
locator = locator.filter({ has: resolvePlaywrightLocator(scope, selector.has) });
|
|
3707
|
+
}
|
|
3708
|
+
if (selector.hasNot !== void 0) {
|
|
3709
|
+
locator = locator.filter({ hasNot: resolvePlaywrightLocator(scope, selector.hasNot) });
|
|
3710
|
+
}
|
|
3088
3711
|
if (selector.first) {
|
|
3089
3712
|
locator = locator.first();
|
|
3090
3713
|
} else if (selector.last) {
|
|
@@ -3095,23 +3718,23 @@ function resolvePlaywrightLocator(root, selector) {
|
|
|
3095
3718
|
return locator;
|
|
3096
3719
|
}
|
|
3097
3720
|
function makePlaywrightDriver(config) {
|
|
3098
|
-
return
|
|
3721
|
+
return Effect9.gen(function* () {
|
|
3099
3722
|
const browserName = config.browser ?? "chromium";
|
|
3100
3723
|
const ownsBrowser = !config.sharedBrowser && !config.cdpEndpoint && !config.wsEndpoint && !config.warmBrowser;
|
|
3101
|
-
const browser = config.sharedBrowser ? config.sharedBrowser : config.wsEndpoint ? yield*
|
|
3724
|
+
const browser = config.sharedBrowser ? config.sharedBrowser : config.wsEndpoint ? yield* Effect9.tryPromise({
|
|
3102
3725
|
try: () => browserLaunchers[browserName].connect(config.wsEndpoint),
|
|
3103
3726
|
catch: (e) => new DriverError({
|
|
3104
3727
|
message: `Failed to connect to remote Playwright server (${config.wsEndpoint}): ${e}`
|
|
3105
3728
|
})
|
|
3106
|
-
}) : config.cdpEndpoint ? yield*
|
|
3729
|
+
}) : config.cdpEndpoint ? yield* Effect9.tryPromise({
|
|
3107
3730
|
try: () => chromium.connectOverCDP(config.cdpEndpoint),
|
|
3108
3731
|
catch: (e) => new DriverError({
|
|
3109
3732
|
message: `Failed to connect to browser over CDP (${config.cdpEndpoint}): ${e}`
|
|
3110
3733
|
})
|
|
3111
|
-
}) : config.warmBrowser && browserName === "chromium" ? yield*
|
|
3734
|
+
}) : config.warmBrowser && browserName === "chromium" ? yield* Effect9.tryPromise({
|
|
3112
3735
|
try: async () => (await ensureWarmBrowserDaemon(config)).browser,
|
|
3113
3736
|
catch: (e) => new DriverError({ message: `Failed to connect to warm Chromium daemon: ${e}` })
|
|
3114
|
-
}) : yield*
|
|
3737
|
+
}) : yield* Effect9.tryPromise({
|
|
3115
3738
|
try: () => browserLaunchers[browserName].launch({
|
|
3116
3739
|
headless: config.headless ?? true,
|
|
3117
3740
|
...config.channel ? { channel: config.channel } : {},
|
|
@@ -3588,7 +4211,7 @@ function makePlaywrightDriver(config) {
|
|
|
3588
4211
|
updateHarPage(page);
|
|
3589
4212
|
debugLog("beginFlow", flowName);
|
|
3590
4213
|
};
|
|
3591
|
-
yield*
|
|
4214
|
+
yield* Effect9.tryPromise({
|
|
3592
4215
|
try: () => createContextAndPage(config.storageState),
|
|
3593
4216
|
catch: (e) => new DriverError({ message: `Failed to create page: ${e}` })
|
|
3594
4217
|
});
|
|
@@ -3629,13 +4252,14 @@ function makePlaywrightDriver(config) {
|
|
|
3629
4252
|
return Boolean(res);
|
|
3630
4253
|
}
|
|
3631
4254
|
};
|
|
4255
|
+
let coveragePage;
|
|
3632
4256
|
const service = {
|
|
3633
4257
|
...domChannel ? { domChannel } : {},
|
|
3634
|
-
beginFlow: (flowName) =>
|
|
4258
|
+
beginFlow: (flowName) => Effect9.tryPromise({
|
|
3635
4259
|
try: () => beginFlow(flowName),
|
|
3636
4260
|
catch: (e) => new DriverError({ message: `Failed to prepare flow ${flowName}: ${e}` })
|
|
3637
4261
|
}),
|
|
3638
|
-
dumpHierarchy: () =>
|
|
4262
|
+
dumpHierarchy: () => Effect9.tryPromise({
|
|
3639
4263
|
try: async () => {
|
|
3640
4264
|
const tree = await page.evaluate(`
|
|
3641
4265
|
(function() {
|
|
@@ -3670,17 +4294,17 @@ function makePlaywrightDriver(config) {
|
|
|
3670
4294
|
},
|
|
3671
4295
|
catch: (e) => new DriverError({ message: `Failed to dump hierarchy: ${e}` })
|
|
3672
4296
|
}),
|
|
3673
|
-
tapAtCoordinate: (x, y) =>
|
|
4297
|
+
tapAtCoordinate: (x, y) => Effect9.tryPromise({
|
|
3674
4298
|
try: async () => {
|
|
3675
4299
|
await page.mouse.click(x, y);
|
|
3676
4300
|
},
|
|
3677
4301
|
catch: (e) => new DriverError({ message: `Failed to tap at (${x}, ${y}): ${e}` })
|
|
3678
4302
|
}),
|
|
3679
|
-
doubleTapAtCoordinate: (x, y) =>
|
|
4303
|
+
doubleTapAtCoordinate: (x, y) => Effect9.tryPromise({
|
|
3680
4304
|
try: () => page.mouse.dblclick(x, y),
|
|
3681
4305
|
catch: (e) => new DriverError({ message: `Failed to double tap at (${x}, ${y}): ${e}` })
|
|
3682
4306
|
}),
|
|
3683
|
-
longPressAtCoordinate: (x, y, duration) =>
|
|
4307
|
+
longPressAtCoordinate: (x, y, duration) => Effect9.tryPromise({
|
|
3684
4308
|
try: async () => {
|
|
3685
4309
|
await page.mouse.move(x, y);
|
|
3686
4310
|
await page.mouse.down();
|
|
@@ -3689,7 +4313,7 @@ function makePlaywrightDriver(config) {
|
|
|
3689
4313
|
},
|
|
3690
4314
|
catch: (e) => new DriverError({ message: `Failed to long press at (${x}, ${y}): ${e}` })
|
|
3691
4315
|
}),
|
|
3692
|
-
swipe: (startX, startY, endX, endY, duration) =>
|
|
4316
|
+
swipe: (startX, startY, endX, endY, duration) => Effect9.tryPromise({
|
|
3693
4317
|
try: async () => {
|
|
3694
4318
|
await page.evaluate(`
|
|
3695
4319
|
(function() {
|
|
@@ -3726,23 +4350,23 @@ function makePlaywrightDriver(config) {
|
|
|
3726
4350
|
},
|
|
3727
4351
|
catch: (e) => new DriverError({ message: `Failed to swipe: ${e}` })
|
|
3728
4352
|
}),
|
|
3729
|
-
inputText: (text) =>
|
|
4353
|
+
inputText: (text) => Effect9.tryPromise({
|
|
3730
4354
|
try: () => page.keyboard.insertText(text),
|
|
3731
4355
|
catch: (e) => new DriverError({ message: `Failed to input text: ${e}` })
|
|
3732
4356
|
}),
|
|
3733
|
-
pressKey: (key) =>
|
|
4357
|
+
pressKey: (key) => Effect9.tryPromise({
|
|
3734
4358
|
try: () => page.keyboard.press(key),
|
|
3735
4359
|
catch: (e) => new DriverError({ message: `Failed to press key ${key}: ${e}` })
|
|
3736
4360
|
}),
|
|
3737
|
-
hideKeyboard: () =>
|
|
3738
|
-
takeScreenshot: () =>
|
|
4361
|
+
hideKeyboard: () => Effect9.void,
|
|
4362
|
+
takeScreenshot: () => Effect9.tryPromise({
|
|
3739
4363
|
try: async () => {
|
|
3740
4364
|
const buffer = await page.screenshot();
|
|
3741
4365
|
return new Uint8Array(buffer);
|
|
3742
4366
|
},
|
|
3743
4367
|
catch: (e) => new DriverError({ message: `Failed to take screenshot: ${e}` })
|
|
3744
4368
|
}),
|
|
3745
|
-
getDeviceInfo: () =>
|
|
4369
|
+
getDeviceInfo: () => Effect9.tryPromise({
|
|
3746
4370
|
try: async () => {
|
|
3747
4371
|
const viewport = page.viewportSize() ?? { width: 1280, height: 720 };
|
|
3748
4372
|
return {
|
|
@@ -3757,7 +4381,7 @@ function makePlaywrightDriver(config) {
|
|
|
3757
4381
|
},
|
|
3758
4382
|
catch: (e) => new DriverError({ message: `Failed to get device info: ${e}` })
|
|
3759
4383
|
}),
|
|
3760
|
-
launchApp: (url, opts) =>
|
|
4384
|
+
launchApp: (url, opts) => Effect9.tryPromise({
|
|
3761
4385
|
try: async () => {
|
|
3762
4386
|
const targetUrl = opts?.deepLink || url || config.baseUrl || "about:blank";
|
|
3763
4387
|
if (opts?.clearState) {
|
|
@@ -3778,7 +4402,7 @@ function makePlaywrightDriver(config) {
|
|
|
3778
4402
|
},
|
|
3779
4403
|
catch: (e) => new DriverError({ message: `Failed to navigate to ${url}: ${e}` })
|
|
3780
4404
|
}),
|
|
3781
|
-
stopApp: (_id) =>
|
|
4405
|
+
stopApp: (_id) => Effect9.tryPromise({
|
|
3782
4406
|
try: async () => {
|
|
3783
4407
|
await page.goto("about:blank");
|
|
3784
4408
|
updateHarPage(page);
|
|
@@ -3786,7 +4410,7 @@ function makePlaywrightDriver(config) {
|
|
|
3786
4410
|
},
|
|
3787
4411
|
catch: (e) => new DriverError({ message: `Failed to stop app: ${e}` })
|
|
3788
4412
|
}),
|
|
3789
|
-
killApp: (_id) =>
|
|
4413
|
+
killApp: (_id) => Effect9.tryPromise({
|
|
3790
4414
|
try: async () => {
|
|
3791
4415
|
const prefetched = prefetchedSlotPromise;
|
|
3792
4416
|
prefetchedSlotPromise = void 0;
|
|
@@ -3809,14 +4433,14 @@ function makePlaywrightDriver(config) {
|
|
|
3809
4433
|
},
|
|
3810
4434
|
catch: (e) => new DriverError({ message: `Failed to kill app: ${e}` })
|
|
3811
4435
|
}),
|
|
3812
|
-
clearAppState: (_id) =>
|
|
4436
|
+
clearAppState: (_id) => Effect9.tryPromise({
|
|
3813
4437
|
try: async () => {
|
|
3814
4438
|
await clearStorage();
|
|
3815
4439
|
debugLog("clearAppState");
|
|
3816
4440
|
},
|
|
3817
4441
|
catch: (e) => new DriverError({ message: `Failed to clear app state: ${e}` })
|
|
3818
4442
|
}),
|
|
3819
|
-
openLink: (url) =>
|
|
4443
|
+
openLink: (url) => Effect9.tryPromise({
|
|
3820
4444
|
try: async () => {
|
|
3821
4445
|
await page.goto(url, config.waitUntil ? { waitUntil: config.waitUntil } : void 0);
|
|
3822
4446
|
updateHarPage(page);
|
|
@@ -3825,7 +4449,7 @@ function makePlaywrightDriver(config) {
|
|
|
3825
4449
|
},
|
|
3826
4450
|
catch: (e) => new DriverError({ message: `Failed to open link ${url}: ${e}` })
|
|
3827
4451
|
}),
|
|
3828
|
-
back: () =>
|
|
4452
|
+
back: () => Effect9.tryPromise({
|
|
3829
4453
|
try: async () => {
|
|
3830
4454
|
await page.goBack();
|
|
3831
4455
|
updateHarPage(page);
|
|
@@ -3833,7 +4457,7 @@ function makePlaywrightDriver(config) {
|
|
|
3833
4457
|
},
|
|
3834
4458
|
catch: (e) => new DriverError({ message: `Failed to go back: ${e}` })
|
|
3835
4459
|
}),
|
|
3836
|
-
reload: (reloadOpts) =>
|
|
4460
|
+
reload: (reloadOpts) => Effect9.tryPromise({
|
|
3837
4461
|
try: async () => {
|
|
3838
4462
|
const waitUntil = reloadOpts?.waitUntil ?? config.waitUntil;
|
|
3839
4463
|
await page.reload(waitUntil ? { waitUntil } : void 0);
|
|
@@ -3842,18 +4466,73 @@ function makePlaywrightDriver(config) {
|
|
|
3842
4466
|
},
|
|
3843
4467
|
catch: (e) => new DriverError({ message: `Failed to reload page: ${e}` })
|
|
3844
4468
|
}),
|
|
3845
|
-
hoverAtCoordinate: (x, y) =>
|
|
4469
|
+
hoverAtCoordinate: (x, y) => Effect9.tryPromise({
|
|
3846
4470
|
try: async () => {
|
|
3847
4471
|
await page.mouse.move(x, y);
|
|
3848
4472
|
},
|
|
3849
4473
|
catch: (e) => new DriverError({ message: `Failed to hover at (${x}, ${y}): ${e}` })
|
|
3850
4474
|
}),
|
|
3851
|
-
getUrl: () =>
|
|
3852
|
-
evaluate: (script, ...args) =>
|
|
4475
|
+
getUrl: () => Effect9.sync(() => currentPageUrl(page)),
|
|
4476
|
+
evaluate: (script, ...args) => Effect9.tryPromise({
|
|
3853
4477
|
try: () => evaluateOnPage(page, script, args),
|
|
3854
4478
|
catch: (e) => new DriverError({ message: `Evaluate failed: ${e}` })
|
|
3855
4479
|
}),
|
|
3856
4480
|
getRawPage: () => page,
|
|
4481
|
+
getAriaSnapshot: (selector, timeout) => deviceEffect("getAriaSnapshot", () => {
|
|
4482
|
+
if (typeof selector === "string") {
|
|
4483
|
+
return page.getByLabel(selector, { exact: true }).or(page.getByText(selector, { exact: true })).ariaSnapshot({ timeout });
|
|
4484
|
+
}
|
|
4485
|
+
if ("point" in selector) throw new Error("ARIA snapshots require a locator, not a point");
|
|
4486
|
+
return resolvePlaywrightLocator(
|
|
4487
|
+
page,
|
|
4488
|
+
"text" in selector ? { ...selector, css: `text=${JSON.stringify(selector.text)}` } : selector
|
|
4489
|
+
).ariaSnapshot({ timeout });
|
|
4490
|
+
}),
|
|
4491
|
+
...browserName === "chromium" ? {
|
|
4492
|
+
startJSCoverage: () => deviceEffect("startJSCoverage", async () => {
|
|
4493
|
+
const target = page;
|
|
4494
|
+
await target.coverage.startJSCoverage({ resetOnNavigation: false });
|
|
4495
|
+
coveragePage = target;
|
|
4496
|
+
}),
|
|
4497
|
+
stopJSCoverage: () => deviceEffect("stopJSCoverage", async () => {
|
|
4498
|
+
const target = coveragePage;
|
|
4499
|
+
coveragePage = void 0;
|
|
4500
|
+
if (!target) throw new Error("JavaScript coverage was not started");
|
|
4501
|
+
return target.coverage.stopJSCoverage();
|
|
4502
|
+
})
|
|
4503
|
+
} : {},
|
|
4504
|
+
setGeolocation: (point) => deviceEffect("setGeolocation", () => context.setGeolocation(point)),
|
|
4505
|
+
setSystemTime: (time) => deviceEffect("setSystemTime", () => page.clock.setSystemTime(time)),
|
|
4506
|
+
setPermission: (_appId, permission, state, options) => deviceEffect("setPermission", async () => {
|
|
4507
|
+
if (state === "grant") {
|
|
4508
|
+
await context.grantPermissions([permission], options);
|
|
4509
|
+
return;
|
|
4510
|
+
}
|
|
4511
|
+
if (browserName !== "chromium")
|
|
4512
|
+
throw new Error(`Permission denial is not supported on ${browserName} (web)`);
|
|
4513
|
+
const session = await ensureCdpSession();
|
|
4514
|
+
const {
|
|
4515
|
+
targetInfo: { browserContextId }
|
|
4516
|
+
} = await session.send("Target.getTargetInfo");
|
|
4517
|
+
if (!browserContextId)
|
|
4518
|
+
throw new Error("Could not resolve Chromium's browser context for permission denial");
|
|
4519
|
+
const name = permission === "midi-sysex" ? "midi" : permission;
|
|
4520
|
+
await session.send("Browser.setPermission", {
|
|
4521
|
+
permission: { name, ...permission === "midi-sysex" ? { sysex: true } : {} },
|
|
4522
|
+
setting: "denied",
|
|
4523
|
+
...options?.origin ? { origin: options.origin } : {},
|
|
4524
|
+
browserContextId
|
|
4525
|
+
});
|
|
4526
|
+
}),
|
|
4527
|
+
setOrientation: (orientation) => deviceEffect("setOrientation", async () => {
|
|
4528
|
+
const viewport = page.viewportSize() ?? await page.evaluate(
|
|
4529
|
+
"({ width: window.innerWidth, height: window.innerHeight })"
|
|
4530
|
+
);
|
|
4531
|
+
const { width, height } = viewport;
|
|
4532
|
+
if (orientation === "portrait" && width > height || orientation === "landscape" && height > width) {
|
|
4533
|
+
await page.setViewportSize({ width: height, height: width });
|
|
4534
|
+
}
|
|
4535
|
+
}),
|
|
3857
4536
|
getCdpSession: () => {
|
|
3858
4537
|
if (browserName !== "chromium") return void 0;
|
|
3859
4538
|
return {
|
|
@@ -3882,7 +4561,7 @@ function makePlaywrightDriver(config) {
|
|
|
3882
4561
|
}
|
|
3883
4562
|
};
|
|
3884
4563
|
},
|
|
3885
|
-
enableVirtualAuthenticator: (opts) =>
|
|
4564
|
+
enableVirtualAuthenticator: (opts) => Effect9.tryPromise({
|
|
3886
4565
|
try: async () => {
|
|
3887
4566
|
const attached = await attachVirtualAuthenticatorOn(context, page, opts);
|
|
3888
4567
|
activeAuthenticatorId = attached.authenticatorId;
|
|
@@ -3891,7 +4570,7 @@ function makePlaywrightDriver(config) {
|
|
|
3891
4570
|
},
|
|
3892
4571
|
catch: (e) => e instanceof DriverError ? e : new DriverError({ message: `Failed to enable virtual authenticator: ${e}` })
|
|
3893
4572
|
}),
|
|
3894
|
-
removeVirtualAuthenticator: (authenticatorId) =>
|
|
4573
|
+
removeVirtualAuthenticator: (authenticatorId) => Effect9.tryPromise({
|
|
3895
4574
|
try: async () => {
|
|
3896
4575
|
const id = authenticatorId ?? activeAuthenticatorId;
|
|
3897
4576
|
if (!id) return;
|
|
@@ -3902,7 +4581,7 @@ function makePlaywrightDriver(config) {
|
|
|
3902
4581
|
},
|
|
3903
4582
|
catch: (e) => new DriverError({ message: `Failed to remove virtual authenticator: ${e}` })
|
|
3904
4583
|
}),
|
|
3905
|
-
getVirtualCredentials: (authenticatorId) =>
|
|
4584
|
+
getVirtualCredentials: (authenticatorId) => Effect9.tryPromise({
|
|
3906
4585
|
try: async () => {
|
|
3907
4586
|
const id = authenticatorId ?? activeAuthenticatorId;
|
|
3908
4587
|
if (!id) return [];
|
|
@@ -3914,7 +4593,7 @@ function makePlaywrightDriver(config) {
|
|
|
3914
4593
|
},
|
|
3915
4594
|
catch: (e) => new DriverError({ message: `Failed to read virtual credentials: ${e}` })
|
|
3916
4595
|
}),
|
|
3917
|
-
addVirtualCredential: (credential, authenticatorId) =>
|
|
4596
|
+
addVirtualCredential: (credential, authenticatorId) => Effect9.tryPromise({
|
|
3918
4597
|
try: async () => {
|
|
3919
4598
|
if (browserName !== "chromium") {
|
|
3920
4599
|
throw new DriverError({
|
|
@@ -3944,7 +4623,7 @@ function makePlaywrightDriver(config) {
|
|
|
3944
4623
|
},
|
|
3945
4624
|
catch: (e) => e instanceof DriverError ? e : new DriverError({ message: `Failed to import virtual credential: ${e}` })
|
|
3946
4625
|
}),
|
|
3947
|
-
clearVirtualCredentials: (authenticatorId) =>
|
|
4626
|
+
clearVirtualCredentials: (authenticatorId) => Effect9.tryPromise({
|
|
3948
4627
|
try: async () => {
|
|
3949
4628
|
const id = authenticatorId ?? activeAuthenticatorId;
|
|
3950
4629
|
if (!id) return;
|
|
@@ -3954,7 +4633,7 @@ function makePlaywrightDriver(config) {
|
|
|
3954
4633
|
},
|
|
3955
4634
|
catch: (e) => new DriverError({ message: `Failed to clear virtual credentials: ${e}` })
|
|
3956
4635
|
}),
|
|
3957
|
-
mockNetwork: (matcher, response) =>
|
|
4636
|
+
mockNetwork: (matcher, response) => Effect9.tryPromise({
|
|
3958
4637
|
try: async () => {
|
|
3959
4638
|
buildMockResponse(response);
|
|
3960
4639
|
const definition = { kind: "mock", matcher, response };
|
|
@@ -3964,7 +4643,7 @@ function makePlaywrightDriver(config) {
|
|
|
3964
4643
|
},
|
|
3965
4644
|
catch: (e) => new DriverError({ message: `Failed to mock network route: ${e}` })
|
|
3966
4645
|
}),
|
|
3967
|
-
blockNetwork: (matcher) =>
|
|
4646
|
+
blockNetwork: (matcher) => Effect9.tryPromise({
|
|
3968
4647
|
try: async () => {
|
|
3969
4648
|
const definition = { kind: "block", matcher };
|
|
3970
4649
|
routeDefinitions.push(definition);
|
|
@@ -3973,7 +4652,7 @@ function makePlaywrightDriver(config) {
|
|
|
3973
4652
|
},
|
|
3974
4653
|
catch: (e) => new DriverError({ message: `Failed to block network route: ${e}` })
|
|
3975
4654
|
}),
|
|
3976
|
-
clearNetworkMocks: () =>
|
|
4655
|
+
clearNetworkMocks: () => Effect9.tryPromise({
|
|
3977
4656
|
try: async () => {
|
|
3978
4657
|
for (const appliedRoute of appliedRoutes) {
|
|
3979
4658
|
await context.unroute(appliedRoute.matcher, appliedRoute.handler);
|
|
@@ -3984,7 +4663,7 @@ function makePlaywrightDriver(config) {
|
|
|
3984
4663
|
},
|
|
3985
4664
|
catch: (e) => new DriverError({ message: `Failed to clear network mocks: ${e}` })
|
|
3986
4665
|
}),
|
|
3987
|
-
setNetworkConditions: (conditions) =>
|
|
4666
|
+
setNetworkConditions: (conditions) => Effect9.tryPromise({
|
|
3988
4667
|
try: async () => {
|
|
3989
4668
|
currentNetworkConditions = { ...conditions };
|
|
3990
4669
|
await applyNetworkConditions();
|
|
@@ -3992,17 +4671,17 @@ function makePlaywrightDriver(config) {
|
|
|
3992
4671
|
},
|
|
3993
4672
|
catch: (e) => new DriverError({ message: `Failed to set network conditions: ${e}` })
|
|
3994
4673
|
}),
|
|
3995
|
-
saveCookies: (path) =>
|
|
4674
|
+
saveCookies: (path) => Effect9.tryPromise({
|
|
3996
4675
|
try: async () => {
|
|
3997
4676
|
const cookies = await context.cookies();
|
|
3998
|
-
await
|
|
4677
|
+
await writeFile2(path, JSON.stringify(cookies, null, 2), "utf8");
|
|
3999
4678
|
debugLog("saveCookies", path);
|
|
4000
4679
|
},
|
|
4001
4680
|
catch: (e) => new DriverError({ message: `Failed to save cookies to ${path}: ${e}` })
|
|
4002
4681
|
}),
|
|
4003
|
-
loadCookies: (path) =>
|
|
4682
|
+
loadCookies: (path) => Effect9.tryPromise({
|
|
4004
4683
|
try: async () => {
|
|
4005
|
-
const contents = await
|
|
4684
|
+
const contents = await readFile2(path, "utf8");
|
|
4006
4685
|
const cookies = JSON.parse(contents);
|
|
4007
4686
|
if (!Array.isArray(cookies)) {
|
|
4008
4687
|
throw new Error("Cookie file must contain an array of cookies.");
|
|
@@ -4012,59 +4691,87 @@ function makePlaywrightDriver(config) {
|
|
|
4012
4691
|
},
|
|
4013
4692
|
catch: (e) => new DriverError({ message: `Failed to load cookies from ${path}: ${e}` })
|
|
4014
4693
|
}),
|
|
4015
|
-
getCookies: (urls) =>
|
|
4694
|
+
getCookies: (urls) => Effect9.tryPromise({
|
|
4016
4695
|
try: async () => {
|
|
4017
4696
|
const cookies = await (urls && urls.length > 0 ? context.cookies(urls) : context.cookies());
|
|
4018
4697
|
return cookies;
|
|
4019
4698
|
},
|
|
4020
4699
|
catch: (e) => new DriverError({ message: `Failed to read cookies: ${e}` })
|
|
4021
4700
|
}),
|
|
4022
|
-
setCookies: (cookies) =>
|
|
4701
|
+
setCookies: (cookies) => Effect9.tryPromise({
|
|
4023
4702
|
try: async () => {
|
|
4024
4703
|
if (cookies.length === 0) return;
|
|
4025
4704
|
await context.addCookies(cookies);
|
|
4026
4705
|
},
|
|
4027
4706
|
catch: (e) => new DriverError({ message: `Failed to set cookies: ${e}` })
|
|
4028
4707
|
}),
|
|
4029
|
-
clearCookies: () =>
|
|
4708
|
+
clearCookies: () => Effect9.tryPromise({
|
|
4030
4709
|
try: async () => {
|
|
4031
4710
|
await context.clearCookies();
|
|
4032
4711
|
},
|
|
4033
4712
|
catch: (e) => new DriverError({ message: `Failed to clear cookies: ${e}` })
|
|
4034
4713
|
}),
|
|
4035
|
-
waitForResponse: (matcher, waitOpts) =>
|
|
4714
|
+
waitForResponse: (matcher, waitOpts) => Effect9.tryPromise({
|
|
4036
4715
|
try: async () => {
|
|
4037
4716
|
const timeout = waitOpts?.timeout ?? 15e3;
|
|
4038
|
-
const
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
},
|
|
4051
|
-
{ timeout }
|
|
4052
|
-
);
|
|
4053
|
-
return {
|
|
4054
|
-
url: response.url(),
|
|
4055
|
-
status: response.status(),
|
|
4056
|
-
statusText: response.statusText(),
|
|
4057
|
-
headers: response.headers(),
|
|
4058
|
-
method: response.request().method(),
|
|
4059
|
-
body: () => response.text(),
|
|
4060
|
-
json: () => response.json()
|
|
4717
|
+
const matches = (res) => {
|
|
4718
|
+
const info = {
|
|
4719
|
+
url: res.url(),
|
|
4720
|
+
status: res.status(),
|
|
4721
|
+
statusText: res.statusText(),
|
|
4722
|
+
headers: res.headers(),
|
|
4723
|
+
method: res.request().method(),
|
|
4724
|
+
body: () => res.text(),
|
|
4725
|
+
json: () => res.json()
|
|
4726
|
+
};
|
|
4727
|
+
const ok = typeof matcher === "function" ? matcher(info) : matcher instanceof RegExp ? matcher.test(info.url) : info.url.includes(matcher);
|
|
4728
|
+
return ok ? info : null;
|
|
4061
4729
|
};
|
|
4730
|
+
return await new Promise((resolve2, reject) => {
|
|
4731
|
+
const watchedPages = /* @__PURE__ */ new Set();
|
|
4732
|
+
let settled = false;
|
|
4733
|
+
const onResponse = (res) => {
|
|
4734
|
+
if (settled) return;
|
|
4735
|
+
const hit = matches(res);
|
|
4736
|
+
if (hit) {
|
|
4737
|
+
cleanup();
|
|
4738
|
+
resolve2(hit);
|
|
4739
|
+
}
|
|
4740
|
+
};
|
|
4741
|
+
const attachPage = (p) => {
|
|
4742
|
+
if (watchedPages.has(p)) return;
|
|
4743
|
+
watchedPages.add(p);
|
|
4744
|
+
p.on("response", onResponse);
|
|
4745
|
+
};
|
|
4746
|
+
const onNewPage = (p) => {
|
|
4747
|
+
if (!settled) attachPage(p);
|
|
4748
|
+
};
|
|
4749
|
+
const cleanup = () => {
|
|
4750
|
+
if (settled) return;
|
|
4751
|
+
settled = true;
|
|
4752
|
+
clearTimeout(timer);
|
|
4753
|
+
context.off("page", onNewPage);
|
|
4754
|
+
for (const p of watchedPages) {
|
|
4755
|
+
p.off("response", onResponse);
|
|
4756
|
+
}
|
|
4757
|
+
watchedPages.clear();
|
|
4758
|
+
};
|
|
4759
|
+
const timer = setTimeout(() => {
|
|
4760
|
+
cleanup();
|
|
4761
|
+
reject(new Error(`Timed out waiting for response after ${timeout}ms`));
|
|
4762
|
+
}, timeout);
|
|
4763
|
+
for (const existingPage of context.pages()) {
|
|
4764
|
+
attachPage(existingPage);
|
|
4765
|
+
}
|
|
4766
|
+
attachPage(page);
|
|
4767
|
+
context.on("page", onNewPage);
|
|
4768
|
+
});
|
|
4062
4769
|
},
|
|
4063
4770
|
catch: (e) => new DriverError({ message: `waitForResponse() failed: ${e}` })
|
|
4064
4771
|
}),
|
|
4065
|
-
createIsolatedContext: (ctxOpts) =>
|
|
4772
|
+
createIsolatedContext: (ctxOpts) => Effect9.tryPromise({
|
|
4066
4773
|
try: async () => {
|
|
4067
|
-
const childDriver = await
|
|
4774
|
+
const childDriver = await Effect9.runPromise(
|
|
4068
4775
|
makePlaywrightDriver({
|
|
4069
4776
|
...config,
|
|
4070
4777
|
sharedBrowser: browser,
|
|
@@ -4075,26 +4782,26 @@ function makePlaywrightDriver(config) {
|
|
|
4075
4782
|
})
|
|
4076
4783
|
);
|
|
4077
4784
|
if (ctxOpts?.url) {
|
|
4078
|
-
await
|
|
4785
|
+
await Effect9.runPromise(childDriver.openLink(ctxOpts.url));
|
|
4079
4786
|
}
|
|
4080
4787
|
return {
|
|
4081
4788
|
driver: childDriver,
|
|
4082
4789
|
close: async () => {
|
|
4083
|
-
await
|
|
4790
|
+
await Effect9.runPromise(childDriver.killApp("isolated-context")).catch(() => {
|
|
4084
4791
|
});
|
|
4085
4792
|
}
|
|
4086
4793
|
};
|
|
4087
4794
|
},
|
|
4088
4795
|
catch: (e) => new DriverError({ message: `createIsolatedContext() failed: ${e}` })
|
|
4089
4796
|
}),
|
|
4090
|
-
saveAuthState: (path) =>
|
|
4797
|
+
saveAuthState: (path) => Effect9.tryPromise({
|
|
4091
4798
|
try: async () => {
|
|
4092
4799
|
await context.storageState({ path });
|
|
4093
4800
|
debugLog("saveAuthState", path);
|
|
4094
4801
|
},
|
|
4095
4802
|
catch: (e) => new DriverError({ message: `Failed to save auth state to ${path}: ${e}` })
|
|
4096
4803
|
}),
|
|
4097
|
-
loadAuthState: (path) =>
|
|
4804
|
+
loadAuthState: (path) => Effect9.tryPromise({
|
|
4098
4805
|
try: async () => {
|
|
4099
4806
|
await replaceContext(path);
|
|
4100
4807
|
updateHarPage(page);
|
|
@@ -4102,7 +4809,7 @@ function makePlaywrightDriver(config) {
|
|
|
4102
4809
|
},
|
|
4103
4810
|
catch: (e) => new DriverError({ message: `Failed to load auth state from ${path}: ${e}` })
|
|
4104
4811
|
}),
|
|
4105
|
-
downloadFile: (path) =>
|
|
4812
|
+
downloadFile: (path) => Effect9.tryPromise({
|
|
4106
4813
|
try: async () => {
|
|
4107
4814
|
const download = await nextDownload();
|
|
4108
4815
|
await download.saveAs(path);
|
|
@@ -4110,7 +4817,7 @@ function makePlaywrightDriver(config) {
|
|
|
4110
4817
|
},
|
|
4111
4818
|
catch: (e) => new DriverError({ message: `Failed to download file to ${path}: ${e}` })
|
|
4112
4819
|
}),
|
|
4113
|
-
uploadFile: (selector, path) =>
|
|
4820
|
+
uploadFile: (selector, path) => Effect9.tryPromise({
|
|
4114
4821
|
try: async () => {
|
|
4115
4822
|
await setInputFiles(selector, path);
|
|
4116
4823
|
debugLog("uploadFile", Array.isArray(path) ? path.join(", ") : path);
|
|
@@ -4119,7 +4826,7 @@ function makePlaywrightDriver(config) {
|
|
|
4119
4826
|
message: `Failed to upload file ${Array.isArray(path) ? path.join(", ") : path}: ${e}`
|
|
4120
4827
|
})
|
|
4121
4828
|
}),
|
|
4122
|
-
newTab: (url) =>
|
|
4829
|
+
newTab: (url) => Effect9.tryPromise({
|
|
4123
4830
|
try: async () => {
|
|
4124
4831
|
const nextPage = await context.newPage();
|
|
4125
4832
|
attachPageDiagnostics(nextPage);
|
|
@@ -4134,7 +4841,7 @@ function makePlaywrightDriver(config) {
|
|
|
4134
4841
|
},
|
|
4135
4842
|
catch: (e) => new DriverError({ message: `Failed to open a new tab: ${e}` })
|
|
4136
4843
|
}),
|
|
4137
|
-
switchToTab: (index) =>
|
|
4844
|
+
switchToTab: (index) => Effect9.tryPromise({
|
|
4138
4845
|
try: async () => {
|
|
4139
4846
|
const openPages = context.pages();
|
|
4140
4847
|
const nextPage = openPages[index];
|
|
@@ -4150,7 +4857,7 @@ function makePlaywrightDriver(config) {
|
|
|
4150
4857
|
},
|
|
4151
4858
|
catch: (e) => new DriverError({ message: `Failed to switch tabs: ${e}` })
|
|
4152
4859
|
}),
|
|
4153
|
-
closeTab: () =>
|
|
4860
|
+
closeTab: () => Effect9.tryPromise({
|
|
4154
4861
|
try: async () => {
|
|
4155
4862
|
const openPages = context.pages();
|
|
4156
4863
|
if (openPages.length <= 1) {
|
|
@@ -4170,14 +4877,14 @@ function makePlaywrightDriver(config) {
|
|
|
4170
4877
|
},
|
|
4171
4878
|
catch: (e) => new DriverError({ message: `Failed to close the current tab: ${e}` })
|
|
4172
4879
|
}),
|
|
4173
|
-
getTabIds: () =>
|
|
4880
|
+
getTabIds: () => Effect9.sync(() => {
|
|
4174
4881
|
const ids = context.pages().map((openPage) => getTabId(openPage));
|
|
4175
4882
|
debugLog("getTabIds", ids.join(", "));
|
|
4176
4883
|
return ids;
|
|
4177
4884
|
}),
|
|
4178
|
-
getConsoleLogs: () =>
|
|
4179
|
-
getJSErrors: () =>
|
|
4180
|
-
getHAR: () =>
|
|
4885
|
+
getConsoleLogs: () => Effect9.succeed([...consoleLogs]),
|
|
4886
|
+
getJSErrors: () => Effect9.succeed([...jsErrors]),
|
|
4887
|
+
getHAR: () => Effect9.sync(() => ({
|
|
4181
4888
|
log: {
|
|
4182
4889
|
version: "1.2",
|
|
4183
4890
|
creator: {
|
|
@@ -4197,7 +4904,7 @@ function makePlaywrightDriver(config) {
|
|
|
4197
4904
|
}
|
|
4198
4905
|
|
|
4199
4906
|
// src/drivers/uiautomator2/driver.ts
|
|
4200
|
-
import { Effect as
|
|
4907
|
+
import { Effect as Effect10 } from "effect";
|
|
4201
4908
|
|
|
4202
4909
|
// src/drivers/uiautomator2/client.ts
|
|
4203
4910
|
var UiAutomator2Client = class {
|
|
@@ -4311,6 +5018,9 @@ var UiAutomator2Client = class {
|
|
|
4311
5018
|
}
|
|
4312
5019
|
}
|
|
4313
5020
|
}
|
|
5021
|
+
async setOrientation(orientation) {
|
|
5022
|
+
await this.request("POST", this.sessionPath("/orientation"), { orientation });
|
|
5023
|
+
}
|
|
4314
5024
|
// ---------------------------------------------------------------------------
|
|
4315
5025
|
// Gestures — Appium gesture extensions
|
|
4316
5026
|
// These match the endpoints used by maestro-runner's uiautomator2 client.
|
|
@@ -4541,7 +5251,7 @@ var UiAutomator2Client = class {
|
|
|
4541
5251
|
|
|
4542
5252
|
// src/drivers/uiautomator2/driver.ts
|
|
4543
5253
|
function createUiAutomator2Driver(host, port, serial, packageName, driverOptions) {
|
|
4544
|
-
return
|
|
5254
|
+
return Effect10.gen(function* () {
|
|
4545
5255
|
const client = new UiAutomator2Client(host, port);
|
|
4546
5256
|
let currentContext = "NATIVE_APP";
|
|
4547
5257
|
let hasLaunchedOnce = false;
|
|
@@ -4565,7 +5275,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4565
5275
|
if (driverOptions?.domChannel) channels.push(driverOptions.domChannel);
|
|
4566
5276
|
if (cdpChannel) channels.push(cdpChannel);
|
|
4567
5277
|
const domChannel = channels.length === 0 ? void 0 : channels.length === 1 ? channels[0] : createCompositeDomChannel(channels);
|
|
4568
|
-
yield*
|
|
5278
|
+
yield* Effect10.tryPromise({
|
|
4569
5279
|
try: () => client.createSession(packageName),
|
|
4570
5280
|
catch: (e) => new DriverError({
|
|
4571
5281
|
message: `Failed to create UiAutomator2 session: ${e}`
|
|
@@ -4573,73 +5283,78 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4573
5283
|
});
|
|
4574
5284
|
const service = {
|
|
4575
5285
|
domChannel,
|
|
5286
|
+
...androidDeviceControls(serial),
|
|
5287
|
+
setOrientation: (orientation) => deviceEffect(
|
|
5288
|
+
"setOrientation",
|
|
5289
|
+
() => client.setOrientation(orientation === "portrait" ? "PORTRAIT" : "LANDSCAPE")
|
|
5290
|
+
),
|
|
4576
5291
|
// -----------------------------------------------------------------------
|
|
4577
5292
|
// Hierarchy
|
|
4578
5293
|
// -----------------------------------------------------------------------
|
|
4579
|
-
dumpHierarchy: () =>
|
|
5294
|
+
dumpHierarchy: () => Effect10.tryPromise({
|
|
4580
5295
|
try: () => client.getSource(),
|
|
4581
5296
|
catch: (e) => new DriverError({ message: `Failed to get page source: ${e}` })
|
|
4582
5297
|
}),
|
|
4583
5298
|
// -----------------------------------------------------------------------
|
|
4584
5299
|
// Coordinate-level actions
|
|
4585
5300
|
// -----------------------------------------------------------------------
|
|
4586
|
-
tapAtCoordinate: (x, y) =>
|
|
5301
|
+
tapAtCoordinate: (x, y) => Effect10.tryPromise({
|
|
4587
5302
|
try: () => client.performTap(x, y),
|
|
4588
5303
|
catch: (e) => new DriverError({ message: `Tap failed: ${e}` })
|
|
4589
5304
|
}),
|
|
4590
|
-
doubleTapAtCoordinate: (x, y) =>
|
|
5305
|
+
doubleTapAtCoordinate: (x, y) => Effect10.tryPromise({
|
|
4591
5306
|
try: async () => {
|
|
4592
5307
|
await client.performTap(x, y);
|
|
4593
5308
|
await client.performTap(x, y);
|
|
4594
5309
|
},
|
|
4595
5310
|
catch: (e) => new DriverError({ message: `Double tap failed: ${e}` })
|
|
4596
5311
|
}),
|
|
4597
|
-
longPressAtCoordinate: (x, y, duration) =>
|
|
5312
|
+
longPressAtCoordinate: (x, y, duration) => Effect10.tryPromise({
|
|
4598
5313
|
try: () => client.performLongPress(x, y, duration),
|
|
4599
5314
|
catch: (e) => new DriverError({ message: `Long press failed: ${e}` })
|
|
4600
5315
|
}),
|
|
4601
|
-
swipe: (sx, sy, ex, ey, dur) =>
|
|
5316
|
+
swipe: (sx, sy, ex, ey, dur) => Effect10.tryPromise({
|
|
4602
5317
|
try: () => client.performSwipe(sx, sy, ex, ey, dur),
|
|
4603
5318
|
catch: (e) => new DriverError({ message: `Swipe failed: ${e}` })
|
|
4604
5319
|
}),
|
|
4605
|
-
pinch: (cx, cy, scale, duration) =>
|
|
5320
|
+
pinch: (cx, cy, scale, duration) => Effect10.tryPromise({
|
|
4606
5321
|
try: () => client.performPinch(cx, cy, scale, duration),
|
|
4607
5322
|
catch: (e) => new DriverError({ message: `Pinch failed: ${e}` })
|
|
4608
5323
|
}),
|
|
4609
|
-
zoom: (cx, cy, scale, duration) =>
|
|
5324
|
+
zoom: (cx, cy, scale, duration) => Effect10.tryPromise({
|
|
4610
5325
|
try: () => client.performZoom(cx, cy, scale, duration),
|
|
4611
5326
|
catch: (e) => new DriverError({ message: `Zoom failed: ${e}` })
|
|
4612
5327
|
}),
|
|
4613
|
-
multiTouch: (sequences) =>
|
|
5328
|
+
multiTouch: (sequences) => Effect10.tryPromise({
|
|
4614
5329
|
try: () => client.performMultiTouch(sequences),
|
|
4615
5330
|
catch: (e) => new DriverError({ message: `Multi-touch failed: ${e}` })
|
|
4616
5331
|
}),
|
|
4617
5332
|
// -----------------------------------------------------------------------
|
|
4618
5333
|
// Text input
|
|
4619
5334
|
// -----------------------------------------------------------------------
|
|
4620
|
-
inputText: (text) =>
|
|
5335
|
+
inputText: (text) => Effect10.tryPromise({
|
|
4621
5336
|
try: () => client.sendKeys(text),
|
|
4622
5337
|
catch: (e) => new DriverError({ message: `Input text failed: ${e}` })
|
|
4623
5338
|
}),
|
|
4624
|
-
pressKey: (key) =>
|
|
5339
|
+
pressKey: (key) => Effect10.tryPromise({
|
|
4625
5340
|
try: () => client.pressKeyCode(parseInt(key, 10) || 0),
|
|
4626
5341
|
catch: (e) => new DriverError({ message: `Press key failed: ${e}` })
|
|
4627
5342
|
}),
|
|
4628
|
-
hideKeyboard: () =>
|
|
5343
|
+
hideKeyboard: () => Effect10.tryPromise({
|
|
4629
5344
|
try: () => client.hideKeyboard(),
|
|
4630
5345
|
catch: (e) => new DriverError({ message: `Hide keyboard failed: ${e}` })
|
|
4631
5346
|
}),
|
|
4632
5347
|
// -----------------------------------------------------------------------
|
|
4633
5348
|
// Queries
|
|
4634
5349
|
// -----------------------------------------------------------------------
|
|
4635
|
-
takeScreenshot: () =>
|
|
5350
|
+
takeScreenshot: () => Effect10.tryPromise({
|
|
4636
5351
|
try: async () => {
|
|
4637
5352
|
const base64 = await client.getScreenshot();
|
|
4638
5353
|
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
4639
5354
|
},
|
|
4640
5355
|
catch: (e) => new DriverError({ message: `Screenshot failed: ${e}` })
|
|
4641
5356
|
}),
|
|
4642
|
-
getDeviceInfo: () =>
|
|
5357
|
+
getDeviceInfo: () => Effect10.tryPromise({
|
|
4643
5358
|
try: async () => {
|
|
4644
5359
|
const size = await client.getWindowSize();
|
|
4645
5360
|
return {
|
|
@@ -4657,7 +5372,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4657
5372
|
// -----------------------------------------------------------------------
|
|
4658
5373
|
// App lifecycle
|
|
4659
5374
|
// -----------------------------------------------------------------------
|
|
4660
|
-
launchApp: (bundleId, opts) =>
|
|
5375
|
+
launchApp: (bundleId, opts) => Effect10.tryPromise({
|
|
4661
5376
|
try: async () => {
|
|
4662
5377
|
const canFastReset = hasLaunchedOnce && driverOptions?.fastWebViewReset !== false && domChannel?.isConnected() && !opts?.deepLink && !opts?.clearKeychain && !hasLaunchDeviceState(opts?.deviceState) && !(opts?.launchArguments && Object.keys(opts.launchArguments).length > 0);
|
|
4663
5378
|
if (canFastReset) {
|
|
@@ -4697,7 +5412,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4697
5412
|
} else {
|
|
4698
5413
|
adbForceStop(serial, bundleId);
|
|
4699
5414
|
if (opts?.launchArguments && Object.keys(opts.launchArguments).length > 0) {
|
|
4700
|
-
const { execFileSync:
|
|
5415
|
+
const { execFileSync: execFileSync3 } = await import("child_process");
|
|
4701
5416
|
const { findADB: findADB2 } = await import("./android-6BOQTMM3.js");
|
|
4702
5417
|
const adb = findADB2();
|
|
4703
5418
|
if (!adb) throw new Error("adb not found");
|
|
@@ -4716,7 +5431,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4716
5431
|
for (const [k, v] of Object.entries(opts.launchArguments)) {
|
|
4717
5432
|
startArgs.push("--es", k, String(v));
|
|
4718
5433
|
}
|
|
4719
|
-
|
|
5434
|
+
execFileSync3(adb, startArgs, { stdio: "ignore" });
|
|
4720
5435
|
} else {
|
|
4721
5436
|
adbLaunchApp(serial, bundleId);
|
|
4722
5437
|
}
|
|
@@ -4726,13 +5441,13 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4726
5441
|
},
|
|
4727
5442
|
catch: (e) => new DriverError({ message: `Launch app failed: ${e}` })
|
|
4728
5443
|
}),
|
|
4729
|
-
stopApp: (bundleId) =>
|
|
5444
|
+
stopApp: (bundleId) => Effect10.tryPromise({
|
|
4730
5445
|
try: async () => {
|
|
4731
5446
|
adbForceStop(serial, bundleId);
|
|
4732
5447
|
},
|
|
4733
5448
|
catch: (e) => new DriverError({ message: `Stop app failed: ${e}` })
|
|
4734
5449
|
}),
|
|
4735
|
-
killApp: (bundleId) =>
|
|
5450
|
+
killApp: (bundleId) => Effect10.tryPromise({
|
|
4736
5451
|
try: async () => {
|
|
4737
5452
|
await domChannel?.disconnect().catch(() => {
|
|
4738
5453
|
});
|
|
@@ -4741,7 +5456,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4741
5456
|
},
|
|
4742
5457
|
catch: (e) => new DriverError({ message: `Kill app failed: ${e}` })
|
|
4743
5458
|
}),
|
|
4744
|
-
clearAppState: (bundleId) =>
|
|
5459
|
+
clearAppState: (bundleId) => Effect10.tryPromise({
|
|
4745
5460
|
try: async () => {
|
|
4746
5461
|
if (domChannel?.isConnected() && domChannel.clearStorage) {
|
|
4747
5462
|
await domChannel.clearStorage({
|
|
@@ -4761,7 +5476,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4761
5476
|
},
|
|
4762
5477
|
catch: (e) => new DriverError({ message: `Clear app state failed: ${e}` })
|
|
4763
5478
|
}),
|
|
4764
|
-
resetFast: () =>
|
|
5479
|
+
resetFast: () => Effect10.tryPromise({
|
|
4765
5480
|
try: async () => {
|
|
4766
5481
|
if (!domChannel) {
|
|
4767
5482
|
throw new Error("resetFast() requires a connected DOM channel (spana-bridge or CDP)");
|
|
@@ -4791,14 +5506,14 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4791
5506
|
// -----------------------------------------------------------------------
|
|
4792
5507
|
// Navigation
|
|
4793
5508
|
// -----------------------------------------------------------------------
|
|
4794
|
-
openLink: (url) =>
|
|
5509
|
+
openLink: (url) => Effect10.tryPromise({
|
|
4795
5510
|
try: async () => {
|
|
4796
5511
|
adbOpenLink(serial, url, packageName);
|
|
4797
5512
|
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
4798
5513
|
},
|
|
4799
5514
|
catch: (e) => new DriverError({ message: `Open link failed: ${e}` })
|
|
4800
5515
|
}),
|
|
4801
|
-
back: () =>
|
|
5516
|
+
back: () => Effect10.tryPromise({
|
|
4802
5517
|
// KEYCODE_BACK = 4
|
|
4803
5518
|
try: () => client.pressKeyCode(4),
|
|
4804
5519
|
catch: (e) => new DriverError({ message: `Back failed: ${e}` })
|
|
@@ -4807,7 +5522,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4807
5522
|
// Direct DOM evaluation via spana-bridge or Android WebView CDP,
|
|
4808
5523
|
// falling back to UiAutomator2 /execute/sync when no DOM channel attaches.
|
|
4809
5524
|
// -----------------------------------------------------------------------
|
|
4810
|
-
evaluate: (script, ...args) =>
|
|
5525
|
+
evaluate: (script, ...args) => Effect10.tryPromise({
|
|
4811
5526
|
try: async () => {
|
|
4812
5527
|
if (domChannel) {
|
|
4813
5528
|
try {
|
|
@@ -4833,7 +5548,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4833
5548
|
},
|
|
4834
5549
|
catch: (e) => new DriverError({ message: `evaluate() failed: ${e}` })
|
|
4835
5550
|
}),
|
|
4836
|
-
getContexts: () =>
|
|
5551
|
+
getContexts: () => Effect10.tryPromise({
|
|
4837
5552
|
try: async () => {
|
|
4838
5553
|
const contexts = /* @__PURE__ */ new Set(["NATIVE_APP"]);
|
|
4839
5554
|
if (domChannel?.listTargets) {
|
|
@@ -4856,7 +5571,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4856
5571
|
},
|
|
4857
5572
|
catch: (e) => new DriverError({ message: `getContexts failed: ${e}` })
|
|
4858
5573
|
}),
|
|
4859
|
-
getCurrentContext: () =>
|
|
5574
|
+
getCurrentContext: () => Effect10.tryPromise({
|
|
4860
5575
|
try: async () => {
|
|
4861
5576
|
if (currentContext !== "NATIVE_APP") return currentContext;
|
|
4862
5577
|
if (typeof client.getCurrentContext === "function") {
|
|
@@ -4870,7 +5585,7 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4870
5585
|
},
|
|
4871
5586
|
catch: (e) => new DriverError({ message: `getCurrentContext failed: ${e}` })
|
|
4872
5587
|
}),
|
|
4873
|
-
setContext: (contextId) =>
|
|
5588
|
+
setContext: (contextId) => Effect10.tryPromise({
|
|
4874
5589
|
try: async () => {
|
|
4875
5590
|
if (contextId === "NATIVE_APP") {
|
|
4876
5591
|
currentContext = "NATIVE_APP";
|
|
@@ -4896,25 +5611,29 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4896
5611
|
},
|
|
4897
5612
|
catch: (e) => new DriverError({ message: `setContext failed: ${e}` })
|
|
4898
5613
|
}),
|
|
4899
|
-
mockNetwork: (matcher, response) =>
|
|
5614
|
+
mockNetwork: (matcher, response) => Effect10.tryPromise({
|
|
4900
5615
|
try: async () => {
|
|
4901
5616
|
if (!domChannel?.mockNetwork) {
|
|
4902
|
-
throw new Error(
|
|
5617
|
+
throw new Error(
|
|
5618
|
+
"mockNetwork() is not supported on native Android traffic; enable WebView debugging or install spana-bridge for WebView requests"
|
|
5619
|
+
);
|
|
4903
5620
|
}
|
|
4904
5621
|
await domChannel.mockNetwork(matcher, response);
|
|
4905
5622
|
},
|
|
4906
5623
|
catch: (e) => new DriverError({ message: `mockNetwork failed: ${e}` })
|
|
4907
5624
|
}),
|
|
4908
|
-
blockNetwork: (matcher) =>
|
|
5625
|
+
blockNetwork: (matcher) => Effect10.tryPromise({
|
|
4909
5626
|
try: async () => {
|
|
4910
5627
|
if (!domChannel?.blockNetwork) {
|
|
4911
|
-
throw new Error(
|
|
5628
|
+
throw new Error(
|
|
5629
|
+
"blockNetwork() is not supported on native Android traffic; enable WebView debugging or install spana-bridge for WebView requests"
|
|
5630
|
+
);
|
|
4912
5631
|
}
|
|
4913
5632
|
await domChannel.blockNetwork(matcher);
|
|
4914
5633
|
},
|
|
4915
5634
|
catch: (e) => new DriverError({ message: `blockNetwork failed: ${e}` })
|
|
4916
5635
|
}),
|
|
4917
|
-
clearNetworkMocks: () =>
|
|
5636
|
+
clearNetworkMocks: () => Effect10.tryPromise({
|
|
4918
5637
|
try: async () => {
|
|
4919
5638
|
if (domChannel?.clearNetworkMocks) {
|
|
4920
5639
|
await domChannel.clearNetworkMocks();
|
|
@@ -4922,18 +5641,18 @@ function createUiAutomator2Driver(host, port, serial, packageName, driverOptions
|
|
|
4922
5641
|
},
|
|
4923
5642
|
catch: (e) => new DriverError({ message: `clearNetworkMocks failed: ${e}` })
|
|
4924
5643
|
}),
|
|
4925
|
-
getConsoleLogs: () =>
|
|
5644
|
+
getConsoleLogs: () => Effect10.tryPromise({
|
|
4926
5645
|
try: async () => domChannel?.getConsoleLogs ? domChannel.getConsoleLogs() : [],
|
|
4927
5646
|
catch: (e) => new DriverError({ message: `getConsoleLogs failed: ${e}` })
|
|
4928
5647
|
}),
|
|
4929
|
-
getJSErrors: () =>
|
|
5648
|
+
getJSErrors: () => Effect10.tryPromise({
|
|
4930
5649
|
try: async () => domChannel?.getJSErrors ? domChannel.getJSErrors() : [],
|
|
4931
5650
|
catch: (e) => new DriverError({ message: `getJSErrors failed: ${e}` })
|
|
4932
5651
|
}),
|
|
4933
5652
|
// -----------------------------------------------------------------------
|
|
4934
5653
|
// Network conditions
|
|
4935
5654
|
// -----------------------------------------------------------------------
|
|
4936
|
-
setNetworkConditions: (conditions) =>
|
|
5655
|
+
setNetworkConditions: (conditions) => Effect10.tryPromise({
|
|
4937
5656
|
try: async () => {
|
|
4938
5657
|
const isEmulator = serial.startsWith("emulator-");
|
|
4939
5658
|
const resolved = resolveNetworkConditions(conditions);
|
|
@@ -5180,7 +5899,7 @@ function parseAndroidHierarchy(xml) {
|
|
|
5180
5899
|
}
|
|
5181
5900
|
|
|
5182
5901
|
// src/drivers/wda/driver.ts
|
|
5183
|
-
import { Effect as
|
|
5902
|
+
import { Effect as Effect11 } from "effect";
|
|
5184
5903
|
|
|
5185
5904
|
// src/drivers/wda/client.ts
|
|
5186
5905
|
var WDAClient = class {
|
|
@@ -5349,6 +6068,9 @@ var WDAClient = class {
|
|
|
5349
6068
|
);
|
|
5350
6069
|
return value;
|
|
5351
6070
|
}
|
|
6071
|
+
async setOrientation(orientation) {
|
|
6072
|
+
await this.request("POST", this.sessionPath("/orientation"), { orientation });
|
|
6073
|
+
}
|
|
5352
6074
|
// ---------------------------------------------------------------------------
|
|
5353
6075
|
// Touch actions — WDA-specific endpoints
|
|
5354
6076
|
// ---------------------------------------------------------------------------
|
|
@@ -5615,7 +6337,7 @@ function isSessionError(error) {
|
|
|
5615
6337
|
return msg.includes("session does not exist") || msg.includes("unable to connect") || msg.includes("no active session") || msg.includes("invalid session") || /status[:\s]*404/.test(msg);
|
|
5616
6338
|
}
|
|
5617
6339
|
function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth = 100, driverOptions) {
|
|
5618
|
-
return
|
|
6340
|
+
return Effect11.gen(function* () {
|
|
5619
6341
|
const client = new WDAClient(host, port);
|
|
5620
6342
|
let currentContext = "NATIVE_APP";
|
|
5621
6343
|
let hasLaunchedOnce = false;
|
|
@@ -5736,53 +6458,60 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5736
6458
|
let reusedWarmSession = false;
|
|
5737
6459
|
if (driverOptions?.warmSessionId && typeof client.attachSession === "function") {
|
|
5738
6460
|
client.attachSession(driverOptions.warmSessionId);
|
|
5739
|
-
const alive = yield*
|
|
6461
|
+
const alive = yield* Effect11.tryPromise({
|
|
5740
6462
|
try: () => client.isSessionAlive(),
|
|
5741
6463
|
catch: () => false
|
|
5742
|
-
}).pipe(
|
|
6464
|
+
}).pipe(Effect11.catchAll(() => Effect11.succeed(false)));
|
|
5743
6465
|
reusedWarmSession = alive;
|
|
5744
6466
|
}
|
|
5745
6467
|
if (!reusedWarmSession) {
|
|
5746
|
-
const createdId = yield*
|
|
6468
|
+
const createdId = yield* Effect11.tryPromise({
|
|
5747
6469
|
try: () => createSessionWithRetry(bundleId || void 0),
|
|
5748
6470
|
catch: (e) => new DriverError({ message: `Failed to create WDA session: ${e}` })
|
|
5749
6471
|
});
|
|
5750
6472
|
driverOptions?.onSessionCreated?.(createdId);
|
|
5751
|
-
yield*
|
|
6473
|
+
yield* Effect11.tryPromise({
|
|
5752
6474
|
try: () => client.disableQuiescence(),
|
|
5753
6475
|
catch: (e) => new DriverError({ message: `Failed to disable quiescence: ${e}` })
|
|
5754
6476
|
});
|
|
5755
|
-
yield*
|
|
6477
|
+
yield* Effect11.tryPromise({
|
|
5756
6478
|
try: () => client.setSnapshotMaxDepth(snapshotMaxDepth),
|
|
5757
6479
|
catch: (e) => new DriverError({ message: `Failed to set snapshot depth: ${e}` })
|
|
5758
6480
|
});
|
|
5759
6481
|
}
|
|
5760
6482
|
const service = {
|
|
6483
|
+
...iosSimulatorControls(simulatorUdid),
|
|
6484
|
+
setOrientation: (orientation) => deviceEffect(
|
|
6485
|
+
"setOrientation",
|
|
6486
|
+
() => withSessionRecovery(
|
|
6487
|
+
() => client.setOrientation(orientation === "portrait" ? "PORTRAIT" : "LANDSCAPE")
|
|
6488
|
+
)
|
|
6489
|
+
),
|
|
5761
6490
|
domChannel,
|
|
5762
6491
|
// -----------------------------------------------------------------------
|
|
5763
6492
|
// Hierarchy
|
|
5764
6493
|
// -----------------------------------------------------------------------
|
|
5765
|
-
dumpHierarchy: () =>
|
|
6494
|
+
dumpHierarchy: () => Effect11.tryPromise({
|
|
5766
6495
|
try: () => withSessionRecovery(() => client.getSource()),
|
|
5767
6496
|
catch: (e) => new DriverError({ message: `Failed to get page source: ${e}` })
|
|
5768
6497
|
}),
|
|
5769
6498
|
// -----------------------------------------------------------------------
|
|
5770
6499
|
// Coordinate-level actions
|
|
5771
6500
|
// -----------------------------------------------------------------------
|
|
5772
|
-
tapAtCoordinate: (x, y) =>
|
|
6501
|
+
tapAtCoordinate: (x, y) => Effect11.tryPromise({
|
|
5773
6502
|
try: () => withSessionRecovery(() => client.tap(x, y)),
|
|
5774
6503
|
catch: (e) => new DriverError({ message: `Tap failed: ${e}` })
|
|
5775
6504
|
}),
|
|
5776
|
-
doubleTapAtCoordinate: (x, y) =>
|
|
6505
|
+
doubleTapAtCoordinate: (x, y) => Effect11.tryPromise({
|
|
5777
6506
|
try: () => withSessionRecovery(() => client.doubleTap(x, y)),
|
|
5778
6507
|
catch: (e) => new DriverError({ message: `Double tap failed: ${e}` })
|
|
5779
6508
|
}),
|
|
5780
|
-
longPressAtCoordinate: (x, y, duration) =>
|
|
6509
|
+
longPressAtCoordinate: (x, y, duration) => Effect11.tryPromise({
|
|
5781
6510
|
// duration arrives in ms (spana convention) → convert to seconds for WDA
|
|
5782
6511
|
try: () => withSessionRecovery(() => client.longPress(x, y, msToSec(duration))),
|
|
5783
6512
|
catch: (e) => new DriverError({ message: `Long press failed: ${e}` })
|
|
5784
6513
|
}),
|
|
5785
|
-
swipe: (sx, sy, ex, ey, dur) =>
|
|
6514
|
+
swipe: (sx, sy, ex, ey, dur) => Effect11.tryPromise({
|
|
5786
6515
|
// dur arrives in ms → convert to seconds for WDA.
|
|
5787
6516
|
// Clamp Y to avoid iOS system gesture zones (home indicator / App Switcher).
|
|
5788
6517
|
try: async () => {
|
|
@@ -5800,26 +6529,26 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5800
6529
|
},
|
|
5801
6530
|
catch: (e) => new DriverError({ message: `Swipe failed: ${e}` })
|
|
5802
6531
|
}),
|
|
5803
|
-
pinch: (cx, cy, scale, duration) =>
|
|
6532
|
+
pinch: (cx, cy, scale, duration) => Effect11.tryPromise({
|
|
5804
6533
|
try: () => withSessionRecovery(() => client.pinch(cx, cy, scale, msToSec(duration))),
|
|
5805
6534
|
catch: (e) => new DriverError({ message: `Pinch failed: ${e}` })
|
|
5806
6535
|
}),
|
|
5807
|
-
zoom: (cx, cy, scale, duration) =>
|
|
6536
|
+
zoom: (cx, cy, scale, duration) => Effect11.tryPromise({
|
|
5808
6537
|
try: () => withSessionRecovery(() => client.zoom(cx, cy, scale, msToSec(duration))),
|
|
5809
6538
|
catch: (e) => new DriverError({ message: `Zoom failed: ${e}` })
|
|
5810
6539
|
}),
|
|
5811
|
-
multiTouch: (sequences) =>
|
|
6540
|
+
multiTouch: (sequences) => Effect11.tryPromise({
|
|
5812
6541
|
try: () => withSessionRecovery(() => client.multiTouch(sequences)),
|
|
5813
6542
|
catch: (e) => new DriverError({ message: `Multi-touch failed: ${e}` })
|
|
5814
6543
|
}),
|
|
5815
6544
|
// -----------------------------------------------------------------------
|
|
5816
6545
|
// Text input
|
|
5817
6546
|
// -----------------------------------------------------------------------
|
|
5818
|
-
inputText: (text) =>
|
|
6547
|
+
inputText: (text) => Effect11.tryPromise({
|
|
5819
6548
|
try: () => withSessionRecovery(() => client.sendKeys(text)),
|
|
5820
6549
|
catch: (e) => new DriverError({ message: `Input text failed: ${e}` })
|
|
5821
6550
|
}),
|
|
5822
|
-
pressKey: (key) =>
|
|
6551
|
+
pressKey: (key) => Effect11.tryPromise({
|
|
5823
6552
|
// WDA uses named hardware buttons; map common names, fall back to home
|
|
5824
6553
|
try: async () => {
|
|
5825
6554
|
const buttonMap = {
|
|
@@ -5834,7 +6563,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5834
6563
|
},
|
|
5835
6564
|
catch: (e) => new DriverError({ message: `Press key failed: ${e}` })
|
|
5836
6565
|
}),
|
|
5837
|
-
hideKeyboard: () =>
|
|
6566
|
+
hideKeyboard: () => Effect11.tryPromise({
|
|
5838
6567
|
// Dismiss keyboard by tapping above the keyboard area.
|
|
5839
6568
|
// The previous approach (pressHome) backgrounds the app on iOS.
|
|
5840
6569
|
try: async () => {
|
|
@@ -5847,11 +6576,11 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5847
6576
|
// -----------------------------------------------------------------------
|
|
5848
6577
|
// Queries
|
|
5849
6578
|
// -----------------------------------------------------------------------
|
|
5850
|
-
takeScreenshot: () =>
|
|
6579
|
+
takeScreenshot: () => Effect11.tryPromise({
|
|
5851
6580
|
try: () => withSessionRecovery(() => client.getScreenshot()),
|
|
5852
6581
|
catch: (e) => new DriverError({ message: `Screenshot failed: ${e}` })
|
|
5853
6582
|
}),
|
|
5854
|
-
getDeviceInfo: () =>
|
|
6583
|
+
getDeviceInfo: () => Effect11.tryPromise({
|
|
5855
6584
|
try: async () => {
|
|
5856
6585
|
const size = await withSessionRecovery(() => client.getWindowSize());
|
|
5857
6586
|
return {
|
|
@@ -5869,7 +6598,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5869
6598
|
// -----------------------------------------------------------------------
|
|
5870
6599
|
// App lifecycle
|
|
5871
6600
|
// -----------------------------------------------------------------------
|
|
5872
|
-
launchApp: (appBundleId, opts) =>
|
|
6601
|
+
launchApp: (appBundleId, opts) => Effect11.tryPromise({
|
|
5873
6602
|
try: async () => {
|
|
5874
6603
|
const canFastReset = hasLaunchedOnce && driverOptions?.fastWebViewReset !== false && domChannel.isConnected() && !opts?.deepLink && !opts?.clearKeychain && !hasLaunchDeviceState(opts?.deviceState) && !(opts?.launchArguments && Object.keys(opts.launchArguments).length > 0);
|
|
5875
6604
|
if (canFastReset) {
|
|
@@ -5895,8 +6624,8 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5895
6624
|
if (opts?.clearState && simulatorUdid) {
|
|
5896
6625
|
terminateOnSimulator(simulatorUdid, appBundleId);
|
|
5897
6626
|
try {
|
|
5898
|
-
const { execFileSync:
|
|
5899
|
-
|
|
6627
|
+
const { execFileSync: execFileSync3 } = await import("child_process");
|
|
6628
|
+
execFileSync3(
|
|
5900
6629
|
"xcrun",
|
|
5901
6630
|
["simctl", "privacy", simulatorUdid, "reset", "all", appBundleId],
|
|
5902
6631
|
{
|
|
@@ -5953,7 +6682,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5953
6682
|
},
|
|
5954
6683
|
catch: (e) => new DriverError({ message: `Launch app failed: ${e}` })
|
|
5955
6684
|
}),
|
|
5956
|
-
stopApp: (appBundleId) =>
|
|
6685
|
+
stopApp: (appBundleId) => Effect11.tryPromise({
|
|
5957
6686
|
try: () => {
|
|
5958
6687
|
if (simulatorUdid) {
|
|
5959
6688
|
terminateOnSimulator(simulatorUdid, appBundleId);
|
|
@@ -5963,7 +6692,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5963
6692
|
},
|
|
5964
6693
|
catch: (e) => new DriverError({ message: `Stop app failed: ${e}` })
|
|
5965
6694
|
}),
|
|
5966
|
-
killApp: (appBundleId) =>
|
|
6695
|
+
killApp: (appBundleId) => Effect11.tryPromise({
|
|
5967
6696
|
try: async () => {
|
|
5968
6697
|
await domChannel.disconnect().catch(() => {
|
|
5969
6698
|
});
|
|
@@ -5976,7 +6705,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5976
6705
|
},
|
|
5977
6706
|
catch: (e) => new DriverError({ message: `Kill app failed: ${e}` })
|
|
5978
6707
|
}),
|
|
5979
|
-
clearAppState: (appBundleId) =>
|
|
6708
|
+
clearAppState: (appBundleId) => Effect11.tryPromise({
|
|
5980
6709
|
try: async () => {
|
|
5981
6710
|
if (domChannel.isConnected() && domChannel.clearStorage) {
|
|
5982
6711
|
await domChannel.clearStorage({
|
|
@@ -5999,7 +6728,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
5999
6728
|
},
|
|
6000
6729
|
catch: (e) => new DriverError({ message: `Clear app state failed: ${e}` })
|
|
6001
6730
|
}),
|
|
6002
|
-
resetFast: () =>
|
|
6731
|
+
resetFast: () => Effect11.tryPromise({
|
|
6003
6732
|
try: async () => {
|
|
6004
6733
|
if (domChannel.clearStorage) {
|
|
6005
6734
|
await domChannel.clearStorage({
|
|
@@ -6026,7 +6755,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
6026
6755
|
// -----------------------------------------------------------------------
|
|
6027
6756
|
// Navigation
|
|
6028
6757
|
// -----------------------------------------------------------------------
|
|
6029
|
-
openLink: (url) =>
|
|
6758
|
+
openLink: (url) => Effect11.tryPromise({
|
|
6030
6759
|
try: async () => {
|
|
6031
6760
|
if (simulatorUdid) {
|
|
6032
6761
|
await openSimulatorUrl(url);
|
|
@@ -6036,7 +6765,7 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
6036
6765
|
},
|
|
6037
6766
|
catch: (e) => new DriverError({ message: `Open link failed: ${e}` })
|
|
6038
6767
|
}),
|
|
6039
|
-
back: () =>
|
|
6768
|
+
back: () => Effect11.tryPromise({
|
|
6040
6769
|
// iOS has no hardware back button; pressing home is the closest
|
|
6041
6770
|
// equivalent for dismissing the current context.
|
|
6042
6771
|
try: () => client.pressHome(),
|
|
@@ -6046,13 +6775,13 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
6046
6775
|
// Direct DOM evaluation via spana-bridge or WebKit Remote Inspector
|
|
6047
6776
|
// (no Appium required)
|
|
6048
6777
|
// -----------------------------------------------------------------------
|
|
6049
|
-
evaluate: (script, ...args) =>
|
|
6778
|
+
evaluate: (script, ...args) => Effect11.tryPromise({
|
|
6050
6779
|
try: () => domChannel.evaluate(script, ...args),
|
|
6051
6780
|
catch: (e) => new DriverError({
|
|
6052
6781
|
message: `iOS direct WDA evaluate() failed via ${domChannel.kind}: ${e instanceof Error ? e.message : e}. Ensure WKWebView.isInspectable = true (iOS 16.4+) with ios_webkit_debug_proxy running, or include spana-bridge in test builds.`
|
|
6053
6782
|
})
|
|
6054
6783
|
}),
|
|
6055
|
-
getContexts: () =>
|
|
6784
|
+
getContexts: () => Effect11.tryPromise({
|
|
6056
6785
|
try: async () => {
|
|
6057
6786
|
const contexts = ["NATIVE_APP"];
|
|
6058
6787
|
if (domChannel.listTargets) {
|
|
@@ -6071,8 +6800,8 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
6071
6800
|
},
|
|
6072
6801
|
catch: (e) => new DriverError({ message: `getContexts failed: ${e}` })
|
|
6073
6802
|
}),
|
|
6074
|
-
getCurrentContext: () =>
|
|
6075
|
-
setContext: (contextId) =>
|
|
6803
|
+
getCurrentContext: () => Effect11.succeed(currentContext),
|
|
6804
|
+
setContext: (contextId) => Effect11.tryPromise({
|
|
6076
6805
|
try: async () => {
|
|
6077
6806
|
if (contextId === "NATIVE_APP") {
|
|
6078
6807
|
currentContext = "NATIVE_APP";
|
|
@@ -6092,25 +6821,29 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
6092
6821
|
},
|
|
6093
6822
|
catch: (e) => new DriverError({ message: `setContext failed: ${e}` })
|
|
6094
6823
|
}),
|
|
6095
|
-
mockNetwork: (matcher, response) =>
|
|
6824
|
+
mockNetwork: (matcher, response) => Effect11.tryPromise({
|
|
6096
6825
|
try: async () => {
|
|
6097
6826
|
if (!domChannel.mockNetwork) {
|
|
6098
|
-
throw new Error(
|
|
6827
|
+
throw new Error(
|
|
6828
|
+
"mockNetwork() is not supported on native iOS traffic; install spana-bridge in your WebView to intercept JavaScript requests"
|
|
6829
|
+
);
|
|
6099
6830
|
}
|
|
6100
6831
|
await domChannel.mockNetwork(matcher, response);
|
|
6101
6832
|
},
|
|
6102
6833
|
catch: (e) => new DriverError({ message: `mockNetwork failed: ${e}` })
|
|
6103
6834
|
}),
|
|
6104
|
-
blockNetwork: (matcher) =>
|
|
6835
|
+
blockNetwork: (matcher) => Effect11.tryPromise({
|
|
6105
6836
|
try: async () => {
|
|
6106
6837
|
if (!domChannel.blockNetwork) {
|
|
6107
|
-
throw new Error(
|
|
6838
|
+
throw new Error(
|
|
6839
|
+
"blockNetwork() is not supported on native iOS traffic; install spana-bridge in your WebView to intercept JavaScript requests"
|
|
6840
|
+
);
|
|
6108
6841
|
}
|
|
6109
6842
|
await domChannel.blockNetwork(matcher);
|
|
6110
6843
|
},
|
|
6111
6844
|
catch: (e) => new DriverError({ message: `blockNetwork failed: ${e}` })
|
|
6112
6845
|
}),
|
|
6113
|
-
clearNetworkMocks: () =>
|
|
6846
|
+
clearNetworkMocks: () => Effect11.tryPromise({
|
|
6114
6847
|
try: async () => {
|
|
6115
6848
|
if (domChannel.clearNetworkMocks) {
|
|
6116
6849
|
await domChannel.clearNetworkMocks();
|
|
@@ -6118,18 +6851,18 @@ function createWDADriver(host, port, bundleId, simulatorUdid, snapshotMaxDepth =
|
|
|
6118
6851
|
},
|
|
6119
6852
|
catch: (e) => new DriverError({ message: `clearNetworkMocks failed: ${e}` })
|
|
6120
6853
|
}),
|
|
6121
|
-
getConsoleLogs: () =>
|
|
6854
|
+
getConsoleLogs: () => Effect11.tryPromise({
|
|
6122
6855
|
try: async () => domChannel.getConsoleLogs ? domChannel.getConsoleLogs() : [],
|
|
6123
6856
|
catch: (e) => new DriverError({ message: `getConsoleLogs failed: ${e}` })
|
|
6124
6857
|
}),
|
|
6125
|
-
getJSErrors: () =>
|
|
6858
|
+
getJSErrors: () => Effect11.tryPromise({
|
|
6126
6859
|
try: async () => domChannel.getJSErrors ? domChannel.getJSErrors() : [],
|
|
6127
6860
|
catch: (e) => new DriverError({ message: `getJSErrors failed: ${e}` })
|
|
6128
6861
|
}),
|
|
6129
6862
|
// -----------------------------------------------------------------------
|
|
6130
6863
|
// Network simulation
|
|
6131
6864
|
// -----------------------------------------------------------------------
|
|
6132
|
-
setNetworkConditions: (conditions) =>
|
|
6865
|
+
setNetworkConditions: (conditions) => Effect11.tryPromise({
|
|
6133
6866
|
try: async () => {
|
|
6134
6867
|
if (!simulatorUdid) {
|
|
6135
6868
|
throw new DriverError({
|
|
@@ -6252,7 +6985,7 @@ function parseIOSHierarchy(xml) {
|
|
|
6252
6985
|
}
|
|
6253
6986
|
|
|
6254
6987
|
// src/drivers/electron.ts
|
|
6255
|
-
import { Effect as
|
|
6988
|
+
import { Effect as Effect12 } from "effect";
|
|
6256
6989
|
import {
|
|
6257
6990
|
_electron,
|
|
6258
6991
|
chromium as chromium2
|
|
@@ -6296,7 +7029,7 @@ var CLEAR_STORAGE_SCRIPT2 = `
|
|
|
6296
7029
|
})();
|
|
6297
7030
|
`;
|
|
6298
7031
|
function makeElectronDriver(options) {
|
|
6299
|
-
return
|
|
7032
|
+
return Effect12.gen(function* () {
|
|
6300
7033
|
let electronApp;
|
|
6301
7034
|
let cdpBrowser;
|
|
6302
7035
|
let context;
|
|
@@ -6320,13 +7053,13 @@ function makeElectronDriver(options) {
|
|
|
6320
7053
|
const resolvedCdpUrl = options.cdpUrl ?? (options.cdpPort && !options.entry && !options.executablePath ? `http://127.0.0.1:${options.cdpPort}` : void 0);
|
|
6321
7054
|
if (resolvedCdpUrl) {
|
|
6322
7055
|
const connect = options.connectOverCDP ?? chromium2.connectOverCDP.bind(chromium2);
|
|
6323
|
-
cdpBrowser = yield*
|
|
7056
|
+
cdpBrowser = yield* Effect12.tryPromise({
|
|
6324
7057
|
try: () => connect(resolvedCdpUrl),
|
|
6325
7058
|
catch: (e) => new DriverError({
|
|
6326
7059
|
message: `Failed to connect to Electron over CDP (${resolvedCdpUrl}): ${e}`
|
|
6327
7060
|
})
|
|
6328
7061
|
});
|
|
6329
|
-
page = yield*
|
|
7062
|
+
page = yield* Effect12.tryPromise({
|
|
6330
7063
|
try: async () => {
|
|
6331
7064
|
const contexts = cdpBrowser.contexts();
|
|
6332
7065
|
context = contexts[0];
|
|
@@ -6351,7 +7084,7 @@ function makeElectronDriver(options) {
|
|
|
6351
7084
|
});
|
|
6352
7085
|
}
|
|
6353
7086
|
const launcher = options.launchElectron ?? _electron.launch.bind(_electron);
|
|
6354
|
-
electronApp = yield*
|
|
7087
|
+
electronApp = yield* Effect12.tryPromise({
|
|
6355
7088
|
try: () => launcher({
|
|
6356
7089
|
...options.executablePath ? { executablePath: options.executablePath } : {},
|
|
6357
7090
|
...launchArgs.length > 0 ? { args: launchArgs } : {},
|
|
@@ -6360,7 +7093,7 @@ function makeElectronDriver(options) {
|
|
|
6360
7093
|
}),
|
|
6361
7094
|
catch: (e) => new DriverError({ message: `Failed to launch Electron app: ${e}` })
|
|
6362
7095
|
});
|
|
6363
|
-
page = yield*
|
|
7096
|
+
page = yield* Effect12.tryPromise({
|
|
6364
7097
|
try: async () => {
|
|
6365
7098
|
const win = await electronApp.firstWindow();
|
|
6366
7099
|
context = electronApp.context();
|
|
@@ -6390,26 +7123,26 @@ function makeElectronDriver(options) {
|
|
|
6390
7123
|
};
|
|
6391
7124
|
const service = {
|
|
6392
7125
|
domChannel,
|
|
6393
|
-
beginFlow: () =>
|
|
7126
|
+
beginFlow: () => Effect12.sync(() => {
|
|
6394
7127
|
consoleLogs.length = 0;
|
|
6395
7128
|
jsErrors.length = 0;
|
|
6396
7129
|
}),
|
|
6397
|
-
dumpHierarchy: () =>
|
|
7130
|
+
dumpHierarchy: () => Effect12.tryPromise({
|
|
6398
7131
|
try: async () => {
|
|
6399
7132
|
const tree = await page.evaluate(DOM_HIERARCHY_WALK_SCRIPT);
|
|
6400
7133
|
return JSON.stringify(tree);
|
|
6401
7134
|
},
|
|
6402
7135
|
catch: (e) => new DriverError({ message: `Electron dumpHierarchy failed: ${e}` })
|
|
6403
7136
|
}),
|
|
6404
|
-
tapAtCoordinate: (x, y) =>
|
|
7137
|
+
tapAtCoordinate: (x, y) => Effect12.tryPromise({
|
|
6405
7138
|
try: () => page.mouse.click(x, y),
|
|
6406
7139
|
catch: (e) => new DriverError({ message: `Electron tap failed at (${x}, ${y}): ${e}` })
|
|
6407
7140
|
}),
|
|
6408
|
-
doubleTapAtCoordinate: (x, y) =>
|
|
7141
|
+
doubleTapAtCoordinate: (x, y) => Effect12.tryPromise({
|
|
6409
7142
|
try: () => page.mouse.dblclick(x, y),
|
|
6410
7143
|
catch: (e) => new DriverError({ message: `Electron doubleTap failed at (${x}, ${y}): ${e}` })
|
|
6411
7144
|
}),
|
|
6412
|
-
longPressAtCoordinate: (x, y, duration) =>
|
|
7145
|
+
longPressAtCoordinate: (x, y, duration) => Effect12.tryPromise({
|
|
6413
7146
|
try: async () => {
|
|
6414
7147
|
await page.mouse.move(x, y);
|
|
6415
7148
|
await page.mouse.down();
|
|
@@ -6418,7 +7151,7 @@ function makeElectronDriver(options) {
|
|
|
6418
7151
|
},
|
|
6419
7152
|
catch: (e) => new DriverError({ message: `Electron longPress failed: ${e}` })
|
|
6420
7153
|
}),
|
|
6421
|
-
swipe: (startX, startY, endX, endY, duration) =>
|
|
7154
|
+
swipe: (startX, startY, endX, endY, duration) => Effect12.tryPromise({
|
|
6422
7155
|
try: async () => {
|
|
6423
7156
|
await page.mouse.move(startX, startY);
|
|
6424
7157
|
await page.mouse.wheel(startX - endX, startY - endY);
|
|
@@ -6426,20 +7159,20 @@ function makeElectronDriver(options) {
|
|
|
6426
7159
|
},
|
|
6427
7160
|
catch: (e) => new DriverError({ message: `Electron swipe failed: ${e}` })
|
|
6428
7161
|
}),
|
|
6429
|
-
inputText: (text) =>
|
|
7162
|
+
inputText: (text) => Effect12.tryPromise({
|
|
6430
7163
|
try: () => page.keyboard.insertText(text),
|
|
6431
7164
|
catch: (e) => new DriverError({ message: `Electron inputText failed: ${e}` })
|
|
6432
7165
|
}),
|
|
6433
|
-
pressKey: (key) =>
|
|
7166
|
+
pressKey: (key) => Effect12.tryPromise({
|
|
6434
7167
|
try: () => page.keyboard.press(key),
|
|
6435
7168
|
catch: (e) => new DriverError({ message: `Electron pressKey failed: ${e}` })
|
|
6436
7169
|
}),
|
|
6437
|
-
hideKeyboard: () =>
|
|
6438
|
-
takeScreenshot: () =>
|
|
7170
|
+
hideKeyboard: () => Effect12.void,
|
|
7171
|
+
takeScreenshot: () => Effect12.tryPromise({
|
|
6439
7172
|
try: async () => new Uint8Array(await page.screenshot()),
|
|
6440
7173
|
catch: (e) => new DriverError({ message: `Electron screenshot failed: ${e}` })
|
|
6441
7174
|
}),
|
|
6442
|
-
getDeviceInfo: () =>
|
|
7175
|
+
getDeviceInfo: () => Effect12.tryPromise({
|
|
6443
7176
|
try: async () => {
|
|
6444
7177
|
const viewport = page.viewportSize() ?? { width: 1280, height: 800 };
|
|
6445
7178
|
return {
|
|
@@ -6454,7 +7187,7 @@ function makeElectronDriver(options) {
|
|
|
6454
7187
|
},
|
|
6455
7188
|
catch: (e) => new DriverError({ message: `Electron getDeviceInfo failed: ${e}` })
|
|
6456
7189
|
}),
|
|
6457
|
-
launchApp: (appRef, opts) =>
|
|
7190
|
+
launchApp: (appRef, opts) => Effect12.tryPromise({
|
|
6458
7191
|
try: async () => {
|
|
6459
7192
|
if (opts?.clearState) {
|
|
6460
7193
|
await clearStorageAndCookies();
|
|
@@ -6466,8 +7199,8 @@ function makeElectronDriver(options) {
|
|
|
6466
7199
|
},
|
|
6467
7200
|
catch: (e) => new DriverError({ message: `Electron launchApp failed: ${e}` })
|
|
6468
7201
|
}),
|
|
6469
|
-
stopApp: () =>
|
|
6470
|
-
killApp: () =>
|
|
7202
|
+
stopApp: () => Effect12.void,
|
|
7203
|
+
killApp: () => Effect12.tryPromise({
|
|
6471
7204
|
try: async () => {
|
|
6472
7205
|
await domChannel?.disconnect().catch(() => {
|
|
6473
7206
|
});
|
|
@@ -6479,32 +7212,32 @@ function makeElectronDriver(options) {
|
|
|
6479
7212
|
},
|
|
6480
7213
|
catch: (e) => new DriverError({ message: `Electron killApp failed: ${e}` })
|
|
6481
7214
|
}),
|
|
6482
|
-
clearAppState: () =>
|
|
7215
|
+
clearAppState: () => Effect12.tryPromise({
|
|
6483
7216
|
try: async () => {
|
|
6484
7217
|
await clearStorageAndCookies();
|
|
6485
7218
|
},
|
|
6486
7219
|
catch: (e) => new DriverError({ message: `Electron clearAppState failed: ${e}` })
|
|
6487
7220
|
}),
|
|
6488
|
-
resetFast: () =>
|
|
7221
|
+
resetFast: () => Effect12.tryPromise({
|
|
6489
7222
|
try: async () => {
|
|
6490
7223
|
await clearStorageAndCookies();
|
|
6491
7224
|
await page.reload();
|
|
6492
7225
|
},
|
|
6493
7226
|
catch: (e) => new DriverError({ message: `Electron resetFast failed: ${e}` })
|
|
6494
7227
|
}),
|
|
6495
|
-
openLink: (url) =>
|
|
7228
|
+
openLink: (url) => Effect12.tryPromise({
|
|
6496
7229
|
try: async () => {
|
|
6497
7230
|
await page.goto(url);
|
|
6498
7231
|
},
|
|
6499
7232
|
catch: (e) => new DriverError({ message: `Electron openLink failed: ${e}` })
|
|
6500
7233
|
}),
|
|
6501
|
-
back: () =>
|
|
7234
|
+
back: () => Effect12.tryPromise({
|
|
6502
7235
|
try: async () => {
|
|
6503
7236
|
await page.goBack();
|
|
6504
7237
|
},
|
|
6505
7238
|
catch: (e) => new DriverError({ message: `Electron back failed: ${e}` })
|
|
6506
7239
|
}),
|
|
6507
|
-
evaluate: (script, ...args) =>
|
|
7240
|
+
evaluate: (script, ...args) => Effect12.tryPromise({
|
|
6508
7241
|
try: async () => {
|
|
6509
7242
|
if (domChannel?.isConnected()) {
|
|
6510
7243
|
return await domChannel.evaluate(script, ...args);
|
|
@@ -6522,7 +7255,7 @@ function makeElectronDriver(options) {
|
|
|
6522
7255
|
},
|
|
6523
7256
|
catch: (e) => new DriverError({ message: `Electron evaluate failed: ${e}` })
|
|
6524
7257
|
}),
|
|
6525
|
-
mockNetwork: (matcher, response) =>
|
|
7258
|
+
mockNetwork: (matcher, response) => Effect12.tryPromise({
|
|
6526
7259
|
try: async () => {
|
|
6527
7260
|
if (!context) throw new Error("No Electron BrowserContext available");
|
|
6528
7261
|
await context.route(matcher, async (route) => {
|
|
@@ -6537,7 +7270,7 @@ function makeElectronDriver(options) {
|
|
|
6537
7270
|
},
|
|
6538
7271
|
catch: (e) => new DriverError({ message: `Electron mockNetwork failed: ${e}` })
|
|
6539
7272
|
}),
|
|
6540
|
-
blockNetwork: (matcher) =>
|
|
7273
|
+
blockNetwork: (matcher) => Effect12.tryPromise({
|
|
6541
7274
|
try: async () => {
|
|
6542
7275
|
if (!context) throw new Error("No Electron BrowserContext available");
|
|
6543
7276
|
await context.route(matcher, async (route) => {
|
|
@@ -6547,7 +7280,7 @@ function makeElectronDriver(options) {
|
|
|
6547
7280
|
},
|
|
6548
7281
|
catch: (e) => new DriverError({ message: `Electron blockNetwork failed: ${e}` })
|
|
6549
7282
|
}),
|
|
6550
|
-
clearNetworkMocks: () =>
|
|
7283
|
+
clearNetworkMocks: () => Effect12.tryPromise({
|
|
6551
7284
|
try: async () => {
|
|
6552
7285
|
if (!context) return;
|
|
6553
7286
|
for (const entry of appliedRoutes) {
|
|
@@ -6558,25 +7291,25 @@ function makeElectronDriver(options) {
|
|
|
6558
7291
|
},
|
|
6559
7292
|
catch: (e) => new DriverError({ message: `Electron clearNetworkMocks failed: ${e}` })
|
|
6560
7293
|
}),
|
|
6561
|
-
getConsoleLogs: () =>
|
|
6562
|
-
getJSErrors: () =>
|
|
7294
|
+
getConsoleLogs: () => Effect12.succeed([...consoleLogs]),
|
|
7295
|
+
getJSErrors: () => Effect12.succeed([...jsErrors])
|
|
6563
7296
|
};
|
|
6564
7297
|
return service;
|
|
6565
7298
|
});
|
|
6566
7299
|
}
|
|
6567
7300
|
|
|
6568
7301
|
// src/drivers/uiautomator2/installer.ts
|
|
6569
|
-
import { execFileSync, spawn as spawn2 } from "child_process";
|
|
7302
|
+
import { execFileSync as execFileSync2, spawn as spawn2 } from "child_process";
|
|
6570
7303
|
import { existsSync, readdirSync } from "fs";
|
|
6571
7304
|
import { createRequire } from "module";
|
|
6572
|
-
import { dirname, resolve, join as join2 } from "path";
|
|
7305
|
+
import { dirname as dirname2, resolve, join as join2 } from "path";
|
|
6573
7306
|
import { fileURLToPath } from "url";
|
|
6574
7307
|
var __dirname2 = fileURLToPath(new URL(".", import.meta.url));
|
|
6575
7308
|
var require2 = createRequire(import.meta.url);
|
|
6576
7309
|
function resolveOptionalPackageDir(packageName, subpath) {
|
|
6577
7310
|
try {
|
|
6578
7311
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
6579
|
-
return resolve(
|
|
7312
|
+
return resolve(dirname2(packageJsonPath), subpath);
|
|
6580
7313
|
} catch {
|
|
6581
7314
|
return null;
|
|
6582
7315
|
}
|
|
@@ -6671,7 +7404,7 @@ async function setupUiAutomator2(serial, hostPort, options = {}) {
|
|
|
6671
7404
|
const adb = findADB();
|
|
6672
7405
|
if (adb) {
|
|
6673
7406
|
try {
|
|
6674
|
-
|
|
7407
|
+
execFileSync2(adb, ["-s", serial, "forward", "--remove", `tcp:${port}`], { stdio: "ignore" });
|
|
6675
7408
|
} catch {
|
|
6676
7409
|
}
|
|
6677
7410
|
}
|
|
@@ -6701,7 +7434,7 @@ async function setupUiAutomator2(serial, hostPort, options = {}) {
|
|
|
6701
7434
|
if (warm) return;
|
|
6702
7435
|
try {
|
|
6703
7436
|
if (adb)
|
|
6704
|
-
|
|
7437
|
+
execFileSync2(adb, ["-s", serial, "forward", "--remove", `tcp:${port}`], {
|
|
6705
7438
|
stdio: "ignore"
|
|
6706
7439
|
});
|
|
6707
7440
|
} catch {
|
|
@@ -6725,6 +7458,7 @@ export {
|
|
|
6725
7458
|
buildIOSLaunchConfiguration,
|
|
6726
7459
|
byRole,
|
|
6727
7460
|
byCss,
|
|
7461
|
+
or,
|
|
6728
7462
|
within,
|
|
6729
7463
|
inFrame,
|
|
6730
7464
|
nth,
|
|
@@ -6747,6 +7481,7 @@ export {
|
|
|
6747
7481
|
createPromiseExpect,
|
|
6748
7482
|
createPromiseApp,
|
|
6749
7483
|
parseWebHierarchy,
|
|
7484
|
+
deviceEffect,
|
|
6750
7485
|
resolveNetworkConditions,
|
|
6751
7486
|
ensureWarmBrowserDaemon,
|
|
6752
7487
|
connectPlaywrightOverCDP,
|
|
@@ -6760,4 +7495,4 @@ export {
|
|
|
6760
7495
|
makeElectronDriver,
|
|
6761
7496
|
setupUiAutomator2
|
|
6762
7497
|
};
|
|
6763
|
-
//# sourceMappingURL=chunk-
|
|
7498
|
+
//# sourceMappingURL=chunk-B35G77DN.js.map
|