@delacour/warden-e2e 0.5.0 → 0.7.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/{chunk-j9b17ade.mjs → chunk-empqr9n0.mjs} +1366 -55
- package/index.mjs +34 -4
- package/package.json +2 -2
- package/preload.mjs +4008 -335
- package/types/core/src/affected/affected.schema.d.ts +93 -0
- package/types/core/src/allocate.d.ts +2 -1
- package/types/core/src/android-keyguard.d.ts +34 -0
- package/types/core/src/batch/preset.schema.d.ts +1 -0
- package/types/core/src/biometrics.d.ts +15 -0
- package/types/core/src/builds/builds.defaults.d.ts +15 -0
- package/types/core/src/builds/config.d.ts +5 -1
- package/types/core/src/builds/config.schema.d.ts +182 -0
- package/types/core/src/builds/define-config.d.ts +104 -0
- package/types/core/src/builds/install-device.d.ts +37 -0
- package/types/core/src/builds/install.d.ts +17 -3
- package/types/core/src/builds/kinds.d.ts +21 -3
- package/types/core/src/builds/lock.d.ts +38 -0
- package/types/core/src/builds/resolve.d.ts +12 -2
- package/types/core/src/conditions/conditions.config.d.ts +117 -0
- package/types/core/src/conditions/conditions.d.ts +22 -0
- package/types/core/src/conditions/conditions.types.d.ts +141 -0
- package/types/core/src/conditions/inject-state.d.ts +13 -0
- package/types/core/src/conditions/launch-settings.d.ts +14 -0
- package/types/core/src/conditions/network.presets.d.ts +42 -0
- package/types/core/src/conditions/text-size.d.ts +19 -0
- package/types/core/src/golden/android-biometrics.d.ts +35 -0
- package/types/core/src/ios-runner/classify.d.ts +7 -0
- package/types/core/src/ios-runner/runner-build.types.d.ts +76 -0
- package/types/core/src/netproxy/control.d.ts +75 -0
- package/types/core/src/netproxy/decide.d.ts +22 -0
- package/types/core/src/netproxy/handle-file.d.ts +12 -0
- package/types/core/src/netproxy/lease-proxy.d.ts +53 -0
- package/types/core/src/netproxy/netproxy.main.d.ts +40 -0
- package/types/core/src/netproxy/pipe.d.ts +37 -0
- package/types/core/src/netproxy/proxy.d.ts +48 -0
- package/types/core/src/netproxy/shaping.d.ts +43 -0
- package/types/core/src/providers/android.d.ts +36 -1
- package/types/core/src/types.d.ts +47 -0
- package/types/e2e/src/alert-buttons.d.ts +9 -0
- package/types/e2e/src/app.d.ts +3 -1
- package/types/e2e/src/conditions/condition-events.d.ts +63 -0
- package/types/e2e/src/conditions/device-conditions.d.ts +170 -0
- package/types/e2e/src/conditions/geo.d.ts +15 -0
- package/types/e2e/src/conditions/gpx.d.ts +8 -0
- package/types/e2e/src/conditions/lease-recorder.d.ts +27 -0
- package/types/e2e/src/conditions/lease-store.d.ts +9 -0
- package/types/e2e/src/conditions/location-plan.d.ts +17 -0
- package/types/e2e/src/conditions/location-scenarios.data.d.ts +17 -0
- package/types/e2e/src/conditions/route-ticker.d.ts +53 -0
- package/types/e2e/src/conditions/scheduler.d.ts +83 -0
- package/types/e2e/src/device.d.ts +57 -3
- package/types/e2e/src/driver/android/android-app.d.ts +4 -0
- package/types/e2e/src/driver/android/android-argv.d.ts +19 -0
- package/types/e2e/src/driver/android/android-clock.d.ts +28 -0
- package/types/e2e/src/driver/android/android-device.d.ts +8 -0
- package/types/e2e/src/driver/android/android-driver.d.ts +17 -0
- package/types/e2e/src/driver/android/android-network.d.ts +66 -0
- package/types/e2e/src/driver/android/android-phone.d.ts +47 -0
- package/types/e2e/src/driver/android/android-settings.d.ts +34 -0
- package/types/e2e/src/driver/android/android-state.d.ts +10 -0
- package/types/e2e/src/driver/clock-recorder.d.ts +9 -0
- package/types/e2e/src/driver/device-settings.d.ts +10 -0
- package/types/e2e/src/driver/driver.types.d.ts +176 -1
- package/types/e2e/src/driver/ios/device/capabilities.d.ts +3 -0
- package/types/e2e/src/driver/ios/device/device-driver.d.ts +49 -0
- package/types/e2e/src/driver/ios/device/devicectl.d.ts +38 -0
- package/types/e2e/src/driver/ios/device/runner-protocol.d.ts +21 -0
- package/types/e2e/src/driver/ios/hid-recovery.d.ts +15 -0
- package/types/e2e/src/driver/ios/inject.d.ts +110 -0
- package/types/e2e/src/driver/ios/ios-driver.d.ts +29 -0
- package/types/e2e/src/driver/ios/ios-network.d.ts +46 -0
- package/types/e2e/src/driver/ios/ios-settings.d.ts +44 -0
- package/types/e2e/src/driver/ios/simctl.d.ts +41 -1
- package/types/e2e/src/driver/ios/type-budget.d.ts +6 -1
- package/types/e2e/src/driver/network-proxy.d.ts +52 -0
- package/types/e2e/src/driver/open.d.ts +20 -0
- package/types/e2e/src/driver/physical-conditions.d.ts +11 -0
- package/types/e2e/src/driver/requirements.d.ts +14 -0
- package/types/e2e/src/driver/typing.d.ts +1 -1
- package/types/e2e/src/env.d.ts +32 -0
- package/types/e2e/src/fixture-session.d.ts +4 -0
- package/types/e2e/src/fixtures.d.ts +6 -1
- package/types/e2e/src/index.d.ts +2 -0
- package/types/e2e/src/runner/scope.d.ts +1 -0
- package/types/e2e/src/runner/test.d.ts +6 -0
- package/types/e2e/src/screen/field.d.ts +5 -3
- package/types/e2e/src/screen/locator.d.ts +3 -2
- package/types/e2e/src/traced-device.d.ts +2 -1
package/index.mjs
CHANGED
|
@@ -11,10 +11,12 @@ import {
|
|
|
11
11
|
isLocator,
|
|
12
12
|
pickOne,
|
|
13
13
|
textOf,
|
|
14
|
-
|
|
14
|
+
isRecoverableLoss,
|
|
15
15
|
runStep,
|
|
16
16
|
attemptSession,
|
|
17
17
|
getSession,
|
|
18
|
+
IOS_DEVICE_CAPABILITIES,
|
|
19
|
+
conditionsOf,
|
|
18
20
|
perfStartFor,
|
|
19
21
|
hash6,
|
|
20
22
|
attemptDir,
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
registrationDefaults,
|
|
32
34
|
markOnly,
|
|
33
35
|
WARDEN_E2E_VERSION2
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-empqr9n0.mjs";
|
|
35
37
|
// ../../packages/e2e/src/expect/expect.ts
|
|
36
38
|
import { expect as bunExpect } from "bun:test";
|
|
37
39
|
|
|
@@ -371,6 +373,25 @@ var expect = createExpect({ softSink: currentSoftSink });
|
|
|
371
373
|
// ../../packages/e2e/src/runner/test.ts
|
|
372
374
|
import { afterAll as bunAfterAll, beforeAll as bunBeforeAll, describe as bunDescribe, test as bunTest } from "bun:test";
|
|
373
375
|
|
|
376
|
+
// ../../packages/e2e/src/driver/requirements.ts
|
|
377
|
+
function staticCapabilities(target) {
|
|
378
|
+
return target.platform === "ios" && target.deviceKind === "physical" ? IOS_DEVICE_CAPABILITIES : undefined;
|
|
379
|
+
}
|
|
380
|
+
var met = (capabilities, requirement) => {
|
|
381
|
+
switch (requirement) {
|
|
382
|
+
case "pinch":
|
|
383
|
+
return capabilities.pinch;
|
|
384
|
+
case "multiTouch":
|
|
385
|
+
return capabilities.maxPointers >= 2;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
function missingRequirements(target, requires) {
|
|
389
|
+
const capabilities = staticCapabilities(target);
|
|
390
|
+
if (capabilities === undefined || requires === undefined)
|
|
391
|
+
return [];
|
|
392
|
+
return requires.filter((requirement) => !met(capabilities, requirement));
|
|
393
|
+
}
|
|
394
|
+
|
|
374
395
|
// ../../packages/e2e/src/runner/attempt.ts
|
|
375
396
|
import { readdirSync } from "fs";
|
|
376
397
|
import { join as join2 } from "path";
|
|
@@ -789,7 +810,7 @@ async function concludeAttempt(session, spec, ctx, run, outcome, print, clock) {
|
|
|
789
810
|
ctx.files.add(shot);
|
|
790
811
|
const result = buildResult(spec, ctx, run, outcome.failed ? { failed: true, error: outcome.failure, timedOut: outcome.deadlineHit } : { failed: false });
|
|
791
812
|
print(formatConsoleLine({ type: "test-end", result }, { clock }));
|
|
792
|
-
if (outcome.failed && session.recoverHid !== undefined &&
|
|
813
|
+
if (outcome.failed && session.recoverHid !== undefined && isRecoverableLoss(outcome.failure, session.env.deviceKind) && await session.recoverHid()) {
|
|
793
814
|
return "again";
|
|
794
815
|
}
|
|
795
816
|
if (!outcome.failed || spec.final)
|
|
@@ -838,6 +859,12 @@ async function setUpAndRun(session, spec, use, signal, state, teardowns) {
|
|
|
838
859
|
}
|
|
839
860
|
});
|
|
840
861
|
}
|
|
862
|
+
const conditions = conditionsOf(base.device);
|
|
863
|
+
if (conditions !== undefined) {
|
|
864
|
+
teardowns.push({ name: "conditions", run: () => conditions.teardown(), when: () => conditions.dirty() });
|
|
865
|
+
if (conditions.declared)
|
|
866
|
+
await session.step("conditions", "conditions.baseline", () => conditions.applyBaseline());
|
|
867
|
+
}
|
|
841
868
|
if (use.launch === "fresh")
|
|
842
869
|
await session.step("app", "app.open", () => base.app.open());
|
|
843
870
|
for (const entry of spec.fixtures) {
|
|
@@ -892,6 +919,8 @@ async function runCleanup(session, spec, ctx, built, teardowns, budget, bind) {
|
|
|
892
919
|
}
|
|
893
920
|
}
|
|
894
921
|
for (const fixture of [...teardowns].reverse()) {
|
|
922
|
+
if (fixture.when?.() === false)
|
|
923
|
+
continue;
|
|
895
924
|
await attempt(`fixture ${fixture.name} teardown`, () => step("fixture", `${fixture.name} teardown`, fixture.run));
|
|
896
925
|
}
|
|
897
926
|
cleanup.abort(new E2eError2("SESSION", "attempt finished"));
|
|
@@ -921,6 +950,7 @@ function registerTest(fixtures, mode, title, second, third) {
|
|
|
921
950
|
const use = resolveUse(scope, defaults, options.timeout);
|
|
922
951
|
const retry = options.retry ?? 0;
|
|
923
952
|
const wrongPlatform = options.platforms !== undefined && defaults.platform !== undefined && !options.platforms.includes(defaults.platform);
|
|
953
|
+
const lacking = missingRequirements({ platform: defaults.platform, deviceKind: defaults.deviceKind }, options.requires).length > 0;
|
|
924
954
|
const only = mode === "only" || options.only === true;
|
|
925
955
|
if (only)
|
|
926
956
|
markOnly();
|
|
@@ -942,7 +972,7 @@ function registerTest(fixtures, mode, title, second, third) {
|
|
|
942
972
|
});
|
|
943
973
|
};
|
|
944
974
|
const bunOptions = { timeout: bunTimeoutMs, retry };
|
|
945
|
-
if (mode === "skip" || options.skip === true || wrongPlatform)
|
|
975
|
+
if (mode === "skip" || options.skip === true || wrongPlatform || lacking)
|
|
946
976
|
bunTest.skip(title, run, bunOptions);
|
|
947
977
|
else if (only)
|
|
948
978
|
bunTest.only(title, run, bunOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delacour/warden-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "TypeScript spec API for `warden e2e`: test, expect, screen, device, app",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"LICENSE"
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@delacour/warden": "0.
|
|
40
|
+
"@delacour/warden": "0.7.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"zod": "^4.4.3"
|