@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.
Files changed (88) hide show
  1. package/{chunk-j9b17ade.mjs → chunk-empqr9n0.mjs} +1366 -55
  2. package/index.mjs +34 -4
  3. package/package.json +2 -2
  4. package/preload.mjs +4008 -335
  5. package/types/core/src/affected/affected.schema.d.ts +93 -0
  6. package/types/core/src/allocate.d.ts +2 -1
  7. package/types/core/src/android-keyguard.d.ts +34 -0
  8. package/types/core/src/batch/preset.schema.d.ts +1 -0
  9. package/types/core/src/biometrics.d.ts +15 -0
  10. package/types/core/src/builds/builds.defaults.d.ts +15 -0
  11. package/types/core/src/builds/config.d.ts +5 -1
  12. package/types/core/src/builds/config.schema.d.ts +182 -0
  13. package/types/core/src/builds/define-config.d.ts +104 -0
  14. package/types/core/src/builds/install-device.d.ts +37 -0
  15. package/types/core/src/builds/install.d.ts +17 -3
  16. package/types/core/src/builds/kinds.d.ts +21 -3
  17. package/types/core/src/builds/lock.d.ts +38 -0
  18. package/types/core/src/builds/resolve.d.ts +12 -2
  19. package/types/core/src/conditions/conditions.config.d.ts +117 -0
  20. package/types/core/src/conditions/conditions.d.ts +22 -0
  21. package/types/core/src/conditions/conditions.types.d.ts +141 -0
  22. package/types/core/src/conditions/inject-state.d.ts +13 -0
  23. package/types/core/src/conditions/launch-settings.d.ts +14 -0
  24. package/types/core/src/conditions/network.presets.d.ts +42 -0
  25. package/types/core/src/conditions/text-size.d.ts +19 -0
  26. package/types/core/src/golden/android-biometrics.d.ts +35 -0
  27. package/types/core/src/ios-runner/classify.d.ts +7 -0
  28. package/types/core/src/ios-runner/runner-build.types.d.ts +76 -0
  29. package/types/core/src/netproxy/control.d.ts +75 -0
  30. package/types/core/src/netproxy/decide.d.ts +22 -0
  31. package/types/core/src/netproxy/handle-file.d.ts +12 -0
  32. package/types/core/src/netproxy/lease-proxy.d.ts +53 -0
  33. package/types/core/src/netproxy/netproxy.main.d.ts +40 -0
  34. package/types/core/src/netproxy/pipe.d.ts +37 -0
  35. package/types/core/src/netproxy/proxy.d.ts +48 -0
  36. package/types/core/src/netproxy/shaping.d.ts +43 -0
  37. package/types/core/src/providers/android.d.ts +36 -1
  38. package/types/core/src/types.d.ts +47 -0
  39. package/types/e2e/src/alert-buttons.d.ts +9 -0
  40. package/types/e2e/src/app.d.ts +3 -1
  41. package/types/e2e/src/conditions/condition-events.d.ts +63 -0
  42. package/types/e2e/src/conditions/device-conditions.d.ts +170 -0
  43. package/types/e2e/src/conditions/geo.d.ts +15 -0
  44. package/types/e2e/src/conditions/gpx.d.ts +8 -0
  45. package/types/e2e/src/conditions/lease-recorder.d.ts +27 -0
  46. package/types/e2e/src/conditions/lease-store.d.ts +9 -0
  47. package/types/e2e/src/conditions/location-plan.d.ts +17 -0
  48. package/types/e2e/src/conditions/location-scenarios.data.d.ts +17 -0
  49. package/types/e2e/src/conditions/route-ticker.d.ts +53 -0
  50. package/types/e2e/src/conditions/scheduler.d.ts +83 -0
  51. package/types/e2e/src/device.d.ts +57 -3
  52. package/types/e2e/src/driver/android/android-app.d.ts +4 -0
  53. package/types/e2e/src/driver/android/android-argv.d.ts +19 -0
  54. package/types/e2e/src/driver/android/android-clock.d.ts +28 -0
  55. package/types/e2e/src/driver/android/android-device.d.ts +8 -0
  56. package/types/e2e/src/driver/android/android-driver.d.ts +17 -0
  57. package/types/e2e/src/driver/android/android-network.d.ts +66 -0
  58. package/types/e2e/src/driver/android/android-phone.d.ts +47 -0
  59. package/types/e2e/src/driver/android/android-settings.d.ts +34 -0
  60. package/types/e2e/src/driver/android/android-state.d.ts +10 -0
  61. package/types/e2e/src/driver/clock-recorder.d.ts +9 -0
  62. package/types/e2e/src/driver/device-settings.d.ts +10 -0
  63. package/types/e2e/src/driver/driver.types.d.ts +176 -1
  64. package/types/e2e/src/driver/ios/device/capabilities.d.ts +3 -0
  65. package/types/e2e/src/driver/ios/device/device-driver.d.ts +49 -0
  66. package/types/e2e/src/driver/ios/device/devicectl.d.ts +38 -0
  67. package/types/e2e/src/driver/ios/device/runner-protocol.d.ts +21 -0
  68. package/types/e2e/src/driver/ios/hid-recovery.d.ts +15 -0
  69. package/types/e2e/src/driver/ios/inject.d.ts +110 -0
  70. package/types/e2e/src/driver/ios/ios-driver.d.ts +29 -0
  71. package/types/e2e/src/driver/ios/ios-network.d.ts +46 -0
  72. package/types/e2e/src/driver/ios/ios-settings.d.ts +44 -0
  73. package/types/e2e/src/driver/ios/simctl.d.ts +41 -1
  74. package/types/e2e/src/driver/ios/type-budget.d.ts +6 -1
  75. package/types/e2e/src/driver/network-proxy.d.ts +52 -0
  76. package/types/e2e/src/driver/open.d.ts +20 -0
  77. package/types/e2e/src/driver/physical-conditions.d.ts +11 -0
  78. package/types/e2e/src/driver/requirements.d.ts +14 -0
  79. package/types/e2e/src/driver/typing.d.ts +1 -1
  80. package/types/e2e/src/env.d.ts +32 -0
  81. package/types/e2e/src/fixture-session.d.ts +4 -0
  82. package/types/e2e/src/fixtures.d.ts +6 -1
  83. package/types/e2e/src/index.d.ts +2 -0
  84. package/types/e2e/src/runner/scope.d.ts +1 -0
  85. package/types/e2e/src/runner/test.d.ts +6 -0
  86. package/types/e2e/src/screen/field.d.ts +5 -3
  87. package/types/e2e/src/screen/locator.d.ts +3 -2
  88. 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
- isHidLost,
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-j9b17ade.mjs";
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 && isHidLost(outcome.failure) && await session.recoverHid()) {
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.5.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.5.0"
40
+ "@delacour/warden": "0.7.0"
41
41
  },
42
42
  "dependencies": {
43
43
  "zod": "^4.4.3"