@specific.dev/spectest 0.24.0 → 0.27.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 (74) hide show
  1. package/dist/aws-sigv4.d.ts +42 -0
  2. package/dist/aws-sigv4.js +166 -0
  3. package/dist/browser.d.ts +314 -0
  4. package/dist/browser.js +1320 -0
  5. package/dist/components/email.d.ts +135 -0
  6. package/dist/components/email.js +271 -0
  7. package/dist/components/expo.d.ts +69 -0
  8. package/dist/components/expo.js +125 -0
  9. package/dist/components/index.d.ts +8 -0
  10. package/dist/components/index.js +18 -0
  11. package/dist/components/k3s.d.ts +143 -0
  12. package/dist/components/k3s.js +1067 -0
  13. package/dist/components/postgres.d.ts +93 -0
  14. package/dist/components/postgres.js +58 -0
  15. package/dist/components/replayFake.d.ts +169 -0
  16. package/dist/components/replayFake.js +738 -0
  17. package/dist/components/s3.d.ts +99 -0
  18. package/dist/components/s3.js +81 -0
  19. package/dist/components/supabase.d.ts +197 -0
  20. package/dist/components/supabase.js +1003 -0
  21. package/dist/daemon.d.ts +1 -0
  22. package/dist/daemon.js +4223 -0
  23. package/dist/ids.d.ts +2 -0
  24. package/{src/ids.ts → dist/ids.js} +46 -50
  25. package/dist/index.d.ts +1183 -0
  26. package/dist/index.js +769 -0
  27. package/dist/ingress.d.ts +114 -0
  28. package/dist/ingress.js +210 -0
  29. package/dist/inspect.d.ts +228 -0
  30. package/dist/inspect.js +429 -0
  31. package/dist/locator.d.ts +260 -0
  32. package/dist/locator.js +293 -0
  33. package/dist/mobile.d.ts +71 -0
  34. package/dist/mobile.js +65 -0
  35. package/dist/record-secrets.d.ts +9 -0
  36. package/{src/record-secrets.ts → dist/record-secrets.js} +13 -15
  37. package/dist/recorder.d.ts +516 -0
  38. package/dist/recorder.js +219 -0
  39. package/dist/redis.d.ts +54 -0
  40. package/dist/redis.js +126 -0
  41. package/dist/replay-bundle.d.ts +38 -0
  42. package/{src/replay-bundle.ts → dist/replay-bundle.js} +29 -47
  43. package/dist/resolver.d.ts +1 -0
  44. package/dist/resolver.js +309 -0
  45. package/dist/s3.d.ts +89 -0
  46. package/dist/s3.js +198 -0
  47. package/dist/sql.d.ts +74 -0
  48. package/dist/sql.js +151 -0
  49. package/dist/terminal.d.ts +161 -0
  50. package/dist/terminal.js +538 -0
  51. package/package.json +24 -9
  52. package/src/browser.ts +0 -1807
  53. package/src/components/email.ts +0 -398
  54. package/src/components/expo.ts +0 -167
  55. package/src/components/index.ts +0 -63
  56. package/src/components/k3s.ts +0 -1312
  57. package/src/components/postgres.ts +0 -105
  58. package/src/components/replayFake.ts +0 -848
  59. package/src/components/s3.ts +0 -132
  60. package/src/components/supabase.ts +0 -1299
  61. package/src/daemon.ts +0 -4969
  62. package/src/index.ts +0 -2350
  63. package/src/ingress.ts +0 -288
  64. package/src/inspect.ts +0 -673
  65. package/src/locator.ts +0 -594
  66. package/src/mobile.ts +0 -133
  67. package/src/recorder.ts +0 -817
  68. package/src/redis.ts +0 -202
  69. package/src/resolver.ts +0 -351
  70. package/src/s3.ts +0 -333
  71. package/src/sql.ts +0 -243
  72. package/src/terminal.ts +0 -740
  73. package/src/vendor/rrweb-plugin-console-record.umd.js +0 -521
  74. package/src/vendor/rrweb-record.min.js +0 -5061
package/src/mobile.ts DELETED
@@ -1,133 +0,0 @@
1
- // Mobile app handle for tests — drives an Expo/React-Native-Web app rendered
2
- // in a phone-emulated headless Chromium and recorded as an rrweb session that
3
- // the dashboard replays inside a phone bezel.
4
- //
5
- // `ctx.mobile(ctx.svc.app)` opens one of these already pointed at the app. The
6
- // surface is the SAME Playwright-native one as `ctx.browser()` (the shared
7
- // `Browser` session + `Locator`s from browser.ts/locator.ts) plus two mobile
8
- // extensions: a `touchscreen` and `swipe`. There is no mobile-specific locator
9
- // type — `getByTestId`/`getByRole`/`getByText`/… return the same `Locator`,
10
- // and on a mobile session a locator's `tap()` dispatches a real CDP touch with
11
- // the press dwell RN Pressables need (the `mobileStrategy` in locator.ts;
12
- // desktop `tap()` throws and steers you to `click()`).
13
- //
14
- // This file is now just the `MobileApp` handle (`ctx.mobile` accepts it) and
15
- // the `Mobile` public view of the shared backend. React Native Web renders
16
- // `testID="x"` to `data-testid="x"` and `accessibilityLabel` to `aria-label`,
17
- // so `getByTestId`/`getByLabel` map straight onto Playwright's built-ins.
18
-
19
- import { acquirePersistentMobileBackend, openMobileBackend } from "./browser.js";
20
- import type {
21
- Browser,
22
- BrowserSessionRecorder,
23
- SafeAreaInsets,
24
- Touchscreen,
25
- } from "./browser.js";
26
-
27
- /** Branded handle a mobile-app component (e.g. `expo()`) exposes on
28
- * `ctx.svc.<name>`. The brand is a `Symbol.for` key so `JSON.stringify`
29
- * drops it (wire-invisible) while `ctx.mobile(...)` can still type-check
30
- * against it. */
31
- export const MOBILE_APP: unique symbol = Symbol.for("spectest.mobileApp");
32
-
33
- /** What `ctx.mobile(...)` accepts — produced by a mobile-app component's
34
- * `helpers` factory. Carries the in-VM URL the session auto-navigates to. */
35
- export interface MobileApp {
36
- readonly [MOBILE_APP]: true;
37
- /** Resolved in-VM URL of the app's web build (e.g. `http://app.internal:8081`). */
38
- readonly url: string;
39
- /** Optional script installed before the session's first navigation, so it
40
- * runs ahead of the app bundle on the very first document (no relaunch) —
41
- * the place to plant reduced-motion / `Notification` shims once for every
42
- * `ctx.mobile(app)` call. Set via `expo({ initScript })`. */
43
- readonly initScript?: string;
44
- }
45
-
46
- /** True if `x` is a {@link MobileApp} handle. */
47
- export function isMobileApp(x: unknown): x is MobileApp {
48
- return (
49
- typeof x === "object" &&
50
- x !== null &&
51
- (x as Record<symbol, unknown>)[MOBILE_APP] === true &&
52
- typeof (x as { url?: unknown }).url === "string"
53
- );
54
- }
55
-
56
- /** Build a {@link MobileApp} handle from a resolved URL (and an optional
57
- * init script installed before the session's first navigation). */
58
- export function mobileApp(url: string, initScript?: string): MobileApp {
59
- return { [MOBILE_APP]: true, url, initScript };
60
- }
61
-
62
- // ────────────────────────────────────────────────────────────────────────
63
- // Mobile session
64
- // ────────────────────────────────────────────────────────────────────────
65
-
66
- /**
67
- * A phone-emulated app session. The full {@link Browser} surface (locators,
68
- * `keyboard`/`mouse`, `evaluate`, …) plus a `touchscreen` and `swipe`. Opened
69
- * via `ctx.mobile(app)` already on the app.
70
- *
71
- * The device is fixed (latest iPhone: viewport, DPR, mobile UA, touch). A
72
- * locator's `tap()` on this session uses a real CDP touch with the RN press
73
- * dwell; `getByTestId` targets `testID`, `getByLabel` targets
74
- * `accessibilityLabel`.
75
- */
76
- export interface Mobile extends Browser {
77
- /** Coordinate touch taps (mobile escape hatch — prefer locator `tap()`). */
78
- readonly touchscreen: Touchscreen;
79
- /** Swipe the screen in a direction (a touch drag from the center). */
80
- swipe(direction: "up" | "down" | "left" | "right", opts?: { distance?: number }): Promise<void>;
81
- }
82
-
83
- /**
84
- * Open an EPHEMERAL phone-emulated session pointed at `url` (`close()`
85
- * destroys it). Library callers only — the daemon's `ctx.mobile(app)` goes
86
- * through {@link openPersistentMobile} so sessions survive across tests.
87
- */
88
- export async function openMobile(opts: {
89
- url?: string;
90
- recorder: BrowserSessionRecorder | null;
91
- }): Promise<Mobile> {
92
- const backend = await openMobileBackend({
93
- frame: "mobile",
94
- url: opts.url,
95
- recorder: opts.recorder,
96
- });
97
- // MobileBackend is a superset of Mobile (adds the low-level primitives).
98
- return backend;
99
- }
100
-
101
- /**
102
- * Acquire the persistent phone-emulated session for an app (one per app URL,
103
- * created on first use). The daemon calls this from `ctx.mobile(app)` with a
104
- * per-test rrweb recorder; the resulting record carries `frame: "mobile"` so
105
- * the dashboard renders a phone bezel. `detach` is the test-end hook;
106
- * `mobile.close()` destroys the session for real.
107
- */
108
- export async function openPersistentMobile(opts: {
109
- url: string;
110
- recorder: BrowserSessionRecorder | null;
111
- /** Installed before the fresh session's first navigation (ignored on an
112
- * attached session, which already carries it on the forked holder). */
113
- initScript?: string;
114
- }): Promise<{
115
- mobile: Mobile;
116
- attached: boolean;
117
- detach(): Promise<void>;
118
- /** Safe-area insets emulated on the view (`null` when the CDP override
119
- * is unavailable) — the daemon stamps them onto the session record. */
120
- safeAreaInsets: SafeAreaInsets | null;
121
- }> {
122
- const { browser, attached, detach } = await acquirePersistentMobileBackend(
123
- opts.url,
124
- opts.recorder,
125
- opts.initScript,
126
- );
127
- return {
128
- mobile: browser,
129
- attached,
130
- detach,
131
- safeAreaInsets: browser.safeAreaInsets,
132
- };
133
- }