@quiesco/core 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/artifacts.d.ts +66 -0
  4. package/dist/artifacts.d.ts.map +1 -0
  5. package/dist/artifacts.js +176 -0
  6. package/dist/artifacts.js.map +1 -0
  7. package/dist/attach.d.ts +28 -0
  8. package/dist/attach.d.ts.map +1 -0
  9. package/dist/attach.js +36 -0
  10. package/dist/attach.js.map +1 -0
  11. package/dist/config.d.ts +217 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +88 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/device.d.ts +238 -0
  16. package/dist/device.d.ts.map +1 -0
  17. package/dist/device.js +628 -0
  18. package/dist/device.js.map +1 -0
  19. package/dist/devices/android.d.ts +285 -0
  20. package/dist/devices/android.d.ts.map +1 -0
  21. package/dist/devices/android.js +1067 -0
  22. package/dist/devices/android.js.map +1 -0
  23. package/dist/devices/exec.d.ts +15 -0
  24. package/dist/devices/exec.d.ts.map +1 -0
  25. package/dist/devices/exec.js +20 -0
  26. package/dist/devices/exec.js.map +1 -0
  27. package/dist/devices/ios-runner.d.ts +74 -0
  28. package/dist/devices/ios-runner.d.ts.map +1 -0
  29. package/dist/devices/ios-runner.js +202 -0
  30. package/dist/devices/ios-runner.js.map +1 -0
  31. package/dist/devices/ios.d.ts +231 -0
  32. package/dist/devices/ios.d.ts.map +1 -0
  33. package/dist/devices/ios.js +855 -0
  34. package/dist/devices/ios.js.map +1 -0
  35. package/dist/devices/permissions.d.ts +3 -0
  36. package/dist/devices/permissions.d.ts.map +1 -0
  37. package/dist/devices/permissions.js +2 -0
  38. package/dist/devices/permissions.js.map +1 -0
  39. package/dist/devices/provider.d.ts +217 -0
  40. package/dist/devices/provider.d.ts.map +1 -0
  41. package/dist/devices/provider.js +2 -0
  42. package/dist/devices/provider.js.map +1 -0
  43. package/dist/devices/streams.d.ts +43 -0
  44. package/dist/devices/streams.d.ts.map +1 -0
  45. package/dist/devices/streams.js +79 -0
  46. package/dist/devices/streams.js.map +1 -0
  47. package/dist/driver.d.ts +238 -0
  48. package/dist/driver.d.ts.map +1 -0
  49. package/dist/driver.js +628 -0
  50. package/dist/driver.js.map +1 -0
  51. package/dist/errors.d.ts +26 -0
  52. package/dist/errors.d.ts.map +1 -0
  53. package/dist/errors.js +23 -0
  54. package/dist/errors.js.map +1 -0
  55. package/dist/expect.d.ts +41 -0
  56. package/dist/expect.d.ts.map +1 -0
  57. package/dist/expect.js +72 -0
  58. package/dist/expect.js.map +1 -0
  59. package/dist/index.d.ts +49 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +28 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/json.d.ts +6 -0
  64. package/dist/json.d.ts.map +1 -0
  65. package/dist/json.js +46 -0
  66. package/dist/json.js.map +1 -0
  67. package/dist/launch-args.d.ts +12 -0
  68. package/dist/launch-args.d.ts.map +1 -0
  69. package/dist/launch-args.js +18 -0
  70. package/dist/launch-args.js.map +1 -0
  71. package/dist/lifecycle.d.ts +66 -0
  72. package/dist/lifecycle.d.ts.map +1 -0
  73. package/dist/lifecycle.js +86 -0
  74. package/dist/lifecycle.js.map +1 -0
  75. package/dist/logger.d.ts +9 -0
  76. package/dist/logger.d.ts.map +1 -0
  77. package/dist/logger.js +8 -0
  78. package/dist/logger.js.map +1 -0
  79. package/dist/matcher.d.ts +33 -0
  80. package/dist/matcher.d.ts.map +1 -0
  81. package/dist/matcher.js +28 -0
  82. package/dist/matcher.js.map +1 -0
  83. package/dist/options.d.ts +12 -0
  84. package/dist/options.d.ts.map +1 -0
  85. package/dist/options.js +2 -0
  86. package/dist/options.js.map +1 -0
  87. package/dist/png.d.ts +40 -0
  88. package/dist/png.d.ts.map +1 -0
  89. package/dist/png.js +220 -0
  90. package/dist/png.js.map +1 -0
  91. package/dist/screenshots.d.ts +42 -0
  92. package/dist/screenshots.d.ts.map +1 -0
  93. package/dist/screenshots.js +104 -0
  94. package/dist/screenshots.js.map +1 -0
  95. package/dist/server/ws-server.d.ts +91 -0
  96. package/dist/server/ws-server.d.ts.map +1 -0
  97. package/dist/server/ws-server.js +228 -0
  98. package/dist/server/ws-server.js.map +1 -0
  99. package/dist/session.d.ts +108 -0
  100. package/dist/session.d.ts.map +1 -0
  101. package/dist/session.js +379 -0
  102. package/dist/session.js.map +1 -0
  103. package/dist/sync-api.d.ts +41 -0
  104. package/dist/sync-api.d.ts.map +1 -0
  105. package/dist/sync-api.js +135 -0
  106. package/dist/sync-api.js.map +1 -0
  107. package/dist/system-ui.d.ts +21 -0
  108. package/dist/system-ui.d.ts.map +1 -0
  109. package/dist/system-ui.js +39 -0
  110. package/dist/system-ui.js.map +1 -0
  111. package/dist/tags.d.ts +31 -0
  112. package/dist/tags.d.ts.map +1 -0
  113. package/dist/tags.js +40 -0
  114. package/dist/tags.js.map +1 -0
  115. package/dist/timeline.d.ts +33 -0
  116. package/dist/timeline.d.ts.map +1 -0
  117. package/dist/timeline.js +78 -0
  118. package/dist/timeline.js.map +1 -0
  119. package/dist/webview-page.d.ts +81 -0
  120. package/dist/webview-page.d.ts.map +1 -0
  121. package/dist/webview-page.js +123 -0
  122. package/dist/webview-page.js.map +1 -0
  123. package/dist/webview.d.ts +106 -0
  124. package/dist/webview.d.ts.map +1 -0
  125. package/dist/webview.js +256 -0
  126. package/dist/webview.js.map +1 -0
  127. package/ios-runner/Host/main.swift +8 -0
  128. package/ios-runner/QuiescoSystemUI.xcodeproj/project.pbxproj +405 -0
  129. package/ios-runner/QuiescoSystemUI.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +82 -0
  130. package/ios-runner/Runner/SystemUIServer.swift +93 -0
  131. package/package.json +56 -3
  132. package/src/artifacts.ts +231 -0
  133. package/src/attach.ts +70 -0
  134. package/src/config.ts +286 -0
  135. package/src/device.ts +695 -0
  136. package/src/devices/android.ts +1113 -0
  137. package/src/devices/exec.ts +34 -0
  138. package/src/devices/ios-runner.ts +226 -0
  139. package/src/devices/ios.ts +934 -0
  140. package/src/devices/permissions.ts +2 -0
  141. package/src/devices/provider.ts +212 -0
  142. package/src/devices/streams.ts +94 -0
  143. package/src/driver.ts +672 -0
  144. package/src/errors.ts +41 -0
  145. package/src/expect.ts +88 -0
  146. package/src/index.ts +49 -0
  147. package/src/json.ts +40 -0
  148. package/src/launch-args.ts +27 -0
  149. package/src/lifecycle.ts +126 -0
  150. package/src/logger.ts +15 -0
  151. package/src/matcher.ts +52 -0
  152. package/src/options.ts +13 -0
  153. package/src/png.ts +229 -0
  154. package/src/screenshots.ts +126 -0
  155. package/src/server/ws-server.ts +286 -0
  156. package/src/session.ts +430 -0
  157. package/src/sync-api.ts +154 -0
  158. package/src/system-ui.ts +53 -0
  159. package/src/tags.ts +63 -0
  160. package/src/timeline.ts +96 -0
  161. package/src/webview-page.ts +165 -0
  162. package/src/webview.ts +290 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quiesco contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
- # Temporary Holding Version
1
+ # @quiesco/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The host side of Quiesco: WebSocket server, the `Driver` your tests call (`this.app` / `app`), sessions,
4
+ and the iOS simulator and Android emulator device providers. Independent of any test runner — the
5
+ adapters [`@quiesco/cucumber`](https://github.com/h2nology/quiesco/tree/main/packages/cucumber), [`@quiesco/vitest`](https://github.com/h2nology/quiesco/tree/main/packages/vitest)
6
+ and [`@quiesco/jest`](https://github.com/h2nology/quiesco/tree/main/packages/jest) build on it; use it directly for another runner
7
+ ([using Quiesco without Cucumber](https://shift-14cc7601.mintlify.site/api#using-quiesco-without-cucumber)).
8
+
9
+ ```sh
10
+ npm i -D @quiesco/core
11
+ ```
12
+
13
+ Driver API, matchers and configuration: [API reference](https://shift-14cc7601.mintlify.site/api). Platform notes:
14
+ [platforms](https://shift-14cc7601.mintlify.site/platforms).
15
+
16
+ Part of [Quiesco](https://github.com/h2nology/quiesco): gray-box end-to-end testing for Expo apps on iOS, Android and the web. Setup: `npx quiesco init` ([quick start](https://github.com/h2nology/quiesco#quick-start-web-about-10-minutes)).
17
+
18
+ ## License
19
+
20
+ MIT
@@ -0,0 +1,66 @@
1
+ import type { DeviceProvider, WorkerInfo } from './devices/provider.js';
2
+ import type { Logger } from './logger.js';
3
+ import { Timeline } from './timeline.js';
4
+ export type ArtifactPolicy = 'none' | 'failing' | 'all';
5
+ export interface ArtifactsConfig {
6
+ /** Where runs are written (relative to the working directory). Default `artifacts`. */
7
+ dir?: string;
8
+ video?: ArtifactPolicy;
9
+ logs?: ArtifactPolicy;
10
+ timeline?: ArtifactPolicy;
11
+ }
12
+ export interface Attachment {
13
+ data: Buffer | string;
14
+ mediaType: string;
15
+ /** Shown by reporters that name attachments. */
16
+ fileName?: string;
17
+ }
18
+ export interface ScenarioArtifacts {
19
+ /** For the report: screenshots, logs and the timeline summary inline; videos / traces by path. */
20
+ attachments: Attachment[];
21
+ /** Files written for this scenario. */
22
+ files: string[];
23
+ }
24
+ export declare function resolveArtifacts(config: ArtifactsConfig | undefined, env?: NodeJS.ProcessEnv): Required<ArtifactsConfig>;
25
+ /** A file-system-safe name. */
26
+ export declare function slug(name: string): string;
27
+ /** `-w<N>` for parallel workers, '' when running serially (the run directory keeps its old name). */
28
+ export declare function workerSuffix(worker: WorkerInfo | undefined): string;
29
+ export declare class Artifacts {
30
+ private readonly options;
31
+ readonly timeline: Timeline;
32
+ readonly config: Required<ArtifactsConfig>;
33
+ private runDir;
34
+ private count;
35
+ private current;
36
+ private logsStarted;
37
+ constructor(options: {
38
+ config?: ArtifactsConfig;
39
+ provider: DeviceProvider;
40
+ logger: Logger;
41
+ env?: NodeJS.ProcessEnv;
42
+ cwd?: string;
43
+ /** Parallel runs (Phase 6.12): each worker writes to its own run directory, `…-<platform>-w<N>`. */
44
+ worker?: WorkerInfo;
45
+ });
46
+ /** `<dir>/<date-time>-<platform>` (`-w<N>` per parallel worker), created on first use. */
47
+ private run;
48
+ /** Start a scenario: its timeline, its video, the device log (once per session). */
49
+ beginScenario(name: string): Promise<void>;
50
+ /**
51
+ * A file the test saves by name (e.g. `app.device.screenshot(t, { name })`), attached to the report. Outside a
52
+ * scenario it goes to the run directory.
53
+ */
54
+ save(name: string, data: Buffer, mediaType: string, ext: string): Promise<string>;
55
+ /**
56
+ * End the scenario: stop its video, then keep (or drop) video, logs and timeline per policy. `evidence`
57
+ * (failure screenshot, element tree, ...) is written next to them and attached first.
58
+ */
59
+ endScenario(result: {
60
+ failed: boolean;
61
+ evidence?: Attachment[];
62
+ }): Promise<ScenarioArtifacts>;
63
+ /** Session end: a scenario still open is closed as passed; device logs stop with the provider. */
64
+ disp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CAAC,QAAQ,WAAkB;IACnC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,WAAW,CAAS;gBAGT,OAAO,EAAE;QACxB,MAAM,CAAC,EAAE,eAAe,CAAC;QACzB,QAAQ,EAAE,cAAc,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;QACxB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,oGAAoG;QACpG,MAAM,CAAC,EAAE,UAAU,CAAC;KACrB;IAKH,0FAA0F;IAC1F,OAAO,CAAC,GAAG;IAUX,oFAAoF;IAC9E,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBhD;;;OAGG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYvF;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4DnG,kGAAkG;IAC5F,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Per-scenario artifacts (Phase 6.9, HU 2026-11-10): video, device logs, the timeline, screenshots the
3
+ * test saved by name, and the failure evidence — written under `<dir>/<run>/<scenario>/` and returned as
4
+ * attachments for the runner's report (small ones inline, large ones as a file path). Runner-independent:
5
+ * the Cucumber hooks call it through the session, other runners can do the same.
6
+ *
7
+ * Policies: `none`, `failing` (recorded for every scenario, kept only when it fails) or `all`.
8
+ * Defaults: video none, logs and timeline failing; `QUIESCO_ARTIFACTS=<policy>` sets all three.
9
+ */
10
+ import fs from 'node:fs/promises';
11
+ import path from 'node:path';
12
+ import { Timeline } from './timeline.js';
13
+ /** Lines of the device log put inline in the report (the whole log is in the file). */
14
+ const LOG_TAIL = 300;
15
+ const POLICIES = ['none', 'failing', 'all'];
16
+ export function resolveArtifacts(config, env = process.env) {
17
+ const all = env['QUIESCO_ARTIFACTS'];
18
+ if (all !== undefined && !POLICIES.includes(all))
19
+ throw new RangeError(`QUIESCO_ARTIFACTS must be none, failing or all, got ${all}`);
20
+ const pick = (v, def, name) => {
21
+ if (all !== undefined)
22
+ return all;
23
+ if (v !== undefined && !POLICIES.includes(v))
24
+ throw new RangeError(`artifacts.${name} must be none, failing or all, got ${String(v)}`);
25
+ return v ?? def;
26
+ };
27
+ return {
28
+ dir: config?.dir ?? 'artifacts',
29
+ video: pick(config?.video, 'none', 'video'),
30
+ logs: pick(config?.logs, 'failing', 'logs'),
31
+ timeline: pick(config?.timeline, 'failing', 'timeline'),
32
+ };
33
+ }
34
+ /** A file-system-safe name. */
35
+ export function slug(name) {
36
+ const s = name
37
+ .normalize('NFKC')
38
+ // eslint-disable-next-line no-control-regex -- control characters are not allowed in file names
39
+ .replace(/[\\/:*?"<>|\u0000-\u001f]+/g, '-')
40
+ .replace(/\s+/g, '-')
41
+ .replace(/-+/g, '-')
42
+ .replace(/^[-.]+|[-.]+$/g, '');
43
+ return (s === '' ? 'scenario' : s).slice(0, 80);
44
+ }
45
+ const keep = (policy, failed) => policy === 'all' || (policy === 'failing' && failed);
46
+ /** `-w<N>` for parallel workers, '' when running serially (the run directory keeps its old name). */
47
+ export function workerSuffix(worker) {
48
+ return worker === undefined || worker.count <= 1 ? '' : `-w${worker.index}`;
49
+ }
50
+ export class Artifacts {
51
+ options;
52
+ timeline = new Timeline();
53
+ config;
54
+ runDir = null;
55
+ count = 0;
56
+ current = null;
57
+ logsStarted = false;
58
+ constructor(options) {
59
+ this.options = options;
60
+ this.config = resolveArtifacts(options.config, options.env);
61
+ }
62
+ /** `<dir>/<date-time>-<platform>` (`-w<N>` per parallel worker), created on first use. */
63
+ run() {
64
+ if (this.runDir === null) {
65
+ const d = new Date();
66
+ const p = (n) => String(n).padStart(2, '0');
67
+ const stamp = `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
68
+ this.runDir = path.resolve(this.options.cwd ?? process.cwd(), this.config.dir, `${stamp}-${this.options.provider.platform}${workerSuffix(this.options.worker)}`);
69
+ }
70
+ return this.runDir;
71
+ }
72
+ /** Start a scenario: its timeline, its video, the device log (once per session). */
73
+ async beginScenario(name) {
74
+ if (this.current !== null)
75
+ await this.endScenario({ failed: false }).catch(() => undefined);
76
+ this.count++;
77
+ const dir = path.join(this.run(), `${String(this.count).padStart(3, '0')}-${slug(name)}`);
78
+ this.current = { name, dir, start: Date.now(), attachments: [], files: [], video: false };
79
+ this.timeline.reset(name);
80
+ const p = this.options.provider;
81
+ if (this.config.logs !== 'none' && !this.logsStarted && p.startDeviceLogs !== undefined) {
82
+ this.logsStarted = true;
83
+ await p.startDeviceLogs().catch((e) => this.options.logger.warn(`device logs are not available: ${e.message}`));
84
+ }
85
+ if (this.config.video !== 'none') {
86
+ if (p.startVideo === undefined) {
87
+ this.options.logger.warn(`artifacts.video: ${p.platform} cannot record video`);
88
+ }
89
+ else {
90
+ await fs.mkdir(dir, { recursive: true });
91
+ await p.startVideo(path.join(dir, 'video')).then(() => void (this.current !== null && (this.current.video = true)), (e) => this.options.logger.warn(`recording a video failed: ${e.message}`));
92
+ }
93
+ }
94
+ }
95
+ /**
96
+ * A file the test saves by name (e.g. `app.device.screenshot(t, { name })`), attached to the report. Outside a
97
+ * scenario it goes to the run directory.
98
+ */
99
+ async save(name, data, mediaType, ext) {
100
+ const dir = this.current?.dir ?? this.run();
101
+ await fs.mkdir(dir, { recursive: true });
102
+ const file = path.join(dir, `${slug(name)}${ext}`);
103
+ await fs.writeFile(file, data);
104
+ if (this.current !== null) {
105
+ this.current.files.push(file);
106
+ this.current.attachments.push({ data, mediaType, fileName: path.basename(file) });
107
+ }
108
+ return file;
109
+ }
110
+ /**
111
+ * End the scenario: stop its video, then keep (or drop) video, logs and timeline per policy. `evidence`
112
+ * (failure screenshot, element tree, ...) is written next to them and attached first.
113
+ */
114
+ async endScenario(result) {
115
+ const cur = this.current;
116
+ this.current = null;
117
+ if (cur === null)
118
+ return { attachments: result.evidence ?? [], files: [] };
119
+ const p = this.options.provider;
120
+ const attachments = [];
121
+ const files = [...cur.files];
122
+ const write = async (name, data) => {
123
+ await fs.mkdir(cur.dir, { recursive: true });
124
+ const file = path.join(cur.dir, name);
125
+ await fs.writeFile(file, data);
126
+ files.push(file);
127
+ return file;
128
+ };
129
+ for (const [i, e] of (result.evidence ?? []).entries()) {
130
+ const ext = e.mediaType === 'image/png' ? '.png' : e.mediaType === 'application/json' ? '.json' : '.txt';
131
+ const name = e.fileName ?? `failure-${i + 1}${ext}`;
132
+ await write(name, e.data).catch(() => undefined);
133
+ attachments.push({ ...e, fileName: name });
134
+ }
135
+ if (cur.video) {
136
+ const videos = await p.stopVideo?.().catch((e) => {
137
+ this.options.logger.warn(`stopping the video failed: ${e.message}`);
138
+ return [];
139
+ });
140
+ for (const v of videos ?? []) {
141
+ if (keep(this.config.video, result.failed)) {
142
+ files.push(v);
143
+ attachments.push({ data: `Video: ${v}`, mediaType: 'text/plain' });
144
+ }
145
+ else {
146
+ await fs.rm(v, { force: true });
147
+ }
148
+ }
149
+ }
150
+ if (keep(this.config.logs, result.failed) && p.deviceLogs !== undefined) {
151
+ const lines = p.deviceLogs(cur.start);
152
+ if (lines.length > 0) {
153
+ await write('device.log', `${lines.join('\n')}\n`);
154
+ const tail = lines.length > LOG_TAIL ? [`… ${lines.length - LOG_TAIL} earlier lines in device.log`, ...lines.slice(-LOG_TAIL)] : lines;
155
+ attachments.push({ data: tail.join('\n'), mediaType: 'text/plain', fileName: 'device.log' });
156
+ }
157
+ }
158
+ if (keep(this.config.timeline, result.failed) && this.timeline.all.length > 0) {
159
+ const trace = await write('timeline.trace.json', this.timeline.toTrace());
160
+ const html = this.timeline.toHtml();
161
+ await write('timeline.html', html);
162
+ attachments.push({ data: html, mediaType: 'text/html', fileName: 'timeline.html' });
163
+ attachments.push({ data: `Timeline trace (chrome://tracing, ui.perfetto.dev): ${trace}`, mediaType: 'text/plain' });
164
+ }
165
+ attachments.push(...cur.attachments);
166
+ // Nothing kept: no empty directory left behind.
167
+ await fs.rmdir(cur.dir).catch(() => undefined);
168
+ return { attachments, files };
169
+ }
170
+ /** Session end: a scenario still open is closed as passed; device logs stop with the provider. */
171
+ async dispose() {
172
+ if (this.current !== null)
173
+ await this.endScenario({ failed: false }).catch(() => undefined);
174
+ }
175
+ }
176
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA0BzC,uFAAuF;AACvF,MAAM,QAAQ,GAAG,GAAG,CAAC;AACrB,MAAM,QAAQ,GAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAEvE,MAAM,UAAU,gBAAgB,CAAC,MAAmC,EAAE,MAAyB,OAAO,CAAC,GAAG;IACxG,MAAM,GAAG,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACrC,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAqB,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,uDAAuD,GAAG,EAAE,CAAC,CAAC;IACvJ,MAAM,IAAI,GAAG,CAAC,CA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AC,qBAAqB,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1E,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YACnC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;YACpF,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,uDAAuD,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;QACtH,CAAC;QAED,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;QACrC,gDAAgD;QAChD,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;IAED,kGAAkG;IAClG,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;YAAE,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC9F,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Attach to an app that is already running (requirements.md §6.12 `quiesco tree`): start only the
3
+ * WebSocket server on the configured port and take the first agent that connects, whatever session
4
+ * it presents. No device is booted and nothing is installed or launched, so the app stays on the
5
+ * screen the user navigated to.
6
+ *
7
+ * The agent reconnects with backoff while the host is away (after a test run, or when the app was
8
+ * started by hand and connects to the build-time port), so it shows up within a couple of seconds.
9
+ */
10
+ import type { Platform, TreeNode } from '@quiesco/protocol';
11
+ import type { QuiescoConfig } from './config.js';
12
+ import type { Logger } from './logger.js';
13
+ export interface AttachOptions {
14
+ config: QuiescoConfig;
15
+ /** How long to wait for the app. Default: `connectTimeoutMs` from the config (30 s). */
16
+ timeoutMs?: number;
17
+ logger?: Logger;
18
+ /** Called once the server listens (e.g. to tell the user which port the app must reach). */
19
+ onListening?: (port: number) => void;
20
+ }
21
+ export interface AttachedApp {
22
+ readonly platform: Platform;
23
+ readonly port: number;
24
+ getTree(): Promise<TreeNode | null>;
25
+ close(): Promise<void>;
26
+ }
27
+ export declare function attachToRunningApp(options: AttachOptions): Promise<AttachedApp>;
28
+ //# sourceMappingURL=attach.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../src/attach.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACpC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAiCrF"}
package/dist/attach.js ADDED
@@ -0,0 +1,36 @@
1
+ import { DEFAULT_CONNECT_TIMEOUT_MS, serverPort, toAgentConfig } from './config.js';
2
+ import { silentLogger } from './logger.js';
3
+ import { QuiescoServer } from './server/ws-server.js';
4
+ const ATTACH_SESSION = 'attach';
5
+ const REQUEST_TIMEOUT_MS = 15_000;
6
+ export async function attachToRunningApp(options) {
7
+ const { config } = options;
8
+ const logger = options.logger ?? silentLogger;
9
+ const server = new QuiescoServer({
10
+ port: serverPort(config),
11
+ agentConfig: toAgentConfig(config),
12
+ logger,
13
+ ...(config.server?.host !== undefined ? { host: config.server.host } : {}),
14
+ });
15
+ const port = await server.start();
16
+ server.expectSession(ATTACH_SESSION, { acceptAny: true, acceptAnonymous: true });
17
+ options.onListening?.(port);
18
+ const timeoutMs = options.timeoutMs ?? config.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
19
+ try {
20
+ const connection = await server.waitForConnection(ATTACH_SESSION, timeoutMs, () => `No app connected to ws://localhost:${port} within ${timeoutMs}ms. Start the e2e build of the app ` +
21
+ '(EXPO_PUBLIC_QUIESCO=1) so it connects to this port, or use --launch to let Quiesco launch it.');
22
+ return {
23
+ platform: connection.platform,
24
+ port,
25
+ async getTree() {
26
+ return (await connection.request('getTree', {}, REQUEST_TIMEOUT_MS)).root;
27
+ },
28
+ close: () => server.stop(),
29
+ };
30
+ }
31
+ catch (e) {
32
+ await server.stop();
33
+ throw e;
34
+ }
35
+ }
36
+ //# sourceMappingURL=attach.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attach.js","sourceRoot":"","sources":["../src/attach.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,cAAc,GAAG,QAAQ,CA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AK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
@@ -0,0 +1,217 @@
1
+ import type { ActionMode, AgentConfig, GestureSlop, JsonValue, LogLevel, Platform, TrackerName } from '@quiesco/protocol';
2
+ import type { MatcherInput } from './matcher.js';
3
+ import type { Permission } from './devices/permissions.js';
4
+ import type { TagNames } from './tags.js';
5
+ import type { ArtifactsConfig } from './artifacts.js';
6
+ export interface AndroidAppConfig {
7
+ /** Application id, e.g. `com.example.myapp`. */
8
+ package: string;
9
+ /** APK to install. Omit when the app (e.g. a dev client) is already installed. */
10
+ binaryPath?: string;
11
+ /** Activity for standalone builds. Default `.MainActivity`. */
12
+ activity?: string;
13
+ /** Launch through an Expo dev client that loads JS from Metro. */
14
+ devClient?: {
15
+ scheme: string;
16
+ metroUrl?: string;
17
+ };
18
+ /** Extra host ports the app talks to on `localhost` (e.g. a local mock backend), forwarded with `adb reverse`. */
19
+ reversePorts?: number[];
20
+ }
21
+ export interface AndroidDeviceConfig {
22
+ type?: 'emulator' | 'device';
23
+ /** AVD to boot when no matching emulator is running. */
24
+ avd?: string;
25
+ /** Use exactly this adb serial (e.g. `emulator-5554`). */
26
+ serial?: string;
27
+ /**
28
+ * Parallel runs (Phase 6.12): worker N uses `serials[N]`. Without it, worker 0 uses the device above and
29
+ * worker N > 0 an AVD of its own, `<avd>_quiesco_N`, created from `avd` on first use and kept.
30
+ */
31
+ serials?: string[];
32
+ bootTimeoutMs?: number;
33
+ /**
34
+ * `-gpu` mode of the emulators Quiesco boots (`host`, `lavapipe`, `swiftshader_indirect`, …). Default: the
35
+ * AVD's `hw.gpu.mode`, except `auto` (or none) on macOS, which becomes `host`: there the emulator resolves
36
+ * `auto` to `lavapipe`, a CPU renderer that keeps ~4 cores busy per emulator. Emulators already running
37
+ * keep their mode (Quiesco warns when it is a CPU renderer).
38
+ */
39
+ gpu?: string;
40
+ /** Shut down an emulator Quiesco booted when the session ends. Default false (faster reruns). */
41
+ shutdown?: boolean;
42
+ }
43
+ export interface IosAppConfig {
44
+ /** Bundle identifier, e.g. `com.example.myapp`. */
45
+ bundleId: string;
46
+ /** Simulator build (`.app`) to install. Omit when the app (e.g. a dev client) is already installed. */
47
+ binaryPath?: string;
48
+ /** Launch through an Expo dev client that loads JS from Metro (passed as `--initialUrl`). */
49
+ devClient?: {
50
+ metroUrl?: string;
51
+ };
52
+ }
53
+ export interface IosDeviceConfig {
54
+ /** Simulator name, e.g. `iPhone 17`. Default: the booted simulator. */
55
+ device?: string;
56
+ /** iOS version of the simulator runtime, e.g. `27.0`, when several runtimes have that device. */
57
+ os?: string;
58
+ /** Use exactly this simulator. */
59
+ udid?: string;
60
+ /**
61
+ * Parallel runs (Phase 6.12): worker N uses `udids[N]`. Without it, worker 0 uses the simulator above and
62
+ * worker N > 0 one named "<name> (Quiesco N)" of the same device type and runtime, created on first use
63
+ * and kept.
64
+ */
65
+ udids?: string[];
66
+ bootTimeoutMs?: number;
67
+ /** Shut down a simulator Quiesco booted when the session ends. Default false (faster reruns). */
68
+ shutdown?: boolean;
69
+ /**
70
+ * Turn off password AutoFill on the simulator, so iOS never covers the app with its "Save Password?"
71
+ * sheet after a login form is submitted. Default true.
72
+ */
73
+ disablePasswordAutoFill?: boolean;
74
+ }
75
+ /** What to open in the browser: a static export served by Quiesco, or a running dev server. */
76
+ export interface WebAppConfig {
77
+ /** Output of `npx expo export --platform web`; served with SPA fallback. */
78
+ distDir?: string;
79
+ /** URL of a running server (e.g. `http://localhost:8081` for `expo start --web`). */
80
+ url?: string;
81
+ /** Path opened on launch. Default `/`. */
82
+ path?: string;
83
+ }
84
+ export interface WebViewport {
85
+ width: number;
86
+ height: number;
87
+ deviceScaleFactor?: number;
88
+ /** Touch events; taps are injected with the touchscreen instead of the mouse. */
89
+ hasTouch?: boolean;
90
+ isMobile?: boolean;
91
+ }
92
+ export interface WebDeviceConfig {
93
+ /** Default chromium (the only browser accepted in v1, requirements.md §11-6). */
94
+ browser?: 'chromium' | 'firefox' | 'webkit';
95
+ headless?: boolean;
96
+ /** Sizes come from the user's config; nothing is built in (§6.13). */
97
+ viewport?: WebViewport;
98
+ }
99
+ export interface QuiescoConfig {
100
+ apps: {
101
+ android?: AndroidAppConfig;
102
+ ios?: IosAppConfig;
103
+ web?: WebAppConfig;
104
+ };
105
+ devices?: {
106
+ android?: AndroidDeviceConfig;
107
+ ios?: IosDeviceConfig;
108
+ web?: WebDeviceConfig;
109
+ };
110
+ permissions?: Permission[];
111
+ /**
112
+ * Per-scenario artifacts (Phase 6.9): video, device logs and the timeline, each `none` / `failing` /
113
+ * `all`, written under `dir` (default `artifacts`). Default video none, logs and timeline failing;
114
+ * `QUIESCO_ARTIFACTS` overrides the three.
115
+ */
116
+ artifacts?: ArtifactsConfig;
117
+ /**
118
+ * Launch arguments every launch passes to the app (read there with `quiesco.launchArgs()`), any JSON.
119
+ * `app.device.relaunch({ args })` merges its own over these (shallow).
120
+ */
121
+ launchArgs?: Record<string, JsonValue>;
122
+ sync?: {
123
+ timeoutMs?: number;
124
+ timerThresholdMs?: number;
125
+ countIntervals?: boolean;
126
+ stableFrames?: number;
127
+ ignoreUrls?: (RegExp | string)[];
128
+ /** Disable individual trackers, e.g. `{ 'frame-stable': false }`. */
129
+ trackers?: Partial<Record<TrackerName, boolean>>;
130
+ /**
131
+ * Elements whose changes never keep the app busy for the frame-stable check (they and their
132
+ * subtrees are left out), e.g. `['logo-glow']` for a decorative animation that runs for minutes.
133
+ * Other trackers (network, timers, React) are not affected.
134
+ */
135
+ ignoreElements?: MatcherInput[];
136
+ };
137
+ /** `native` needs @quiesco/native; when omitted, `native` is used if the app has it, else `js`. */
138
+ actions?: {
139
+ mode?: ActionMode;
140
+ /**
141
+ * How far fingers move before the app's pinch / rotation recognizers activate (logical units,
142
+ * radians); pinch / rotate move this much first. Defaults per platform for the standard recognizers
143
+ * (UIKit, react-native-gesture-handler); set it for others, or 0 for no compensation.
144
+ */
145
+ gestureSlop?: Partial<GestureSlop>;
146
+ };
147
+ reset?: {
148
+ default?: 'soft' | 'hard';
149
+ };
150
+ server?: {
151
+ /** Port of the Quiesco WebSocket server. Default 7357. */
152
+ port?: number;
153
+ /** Interface to listen on. Default: all interfaces. */
154
+ host?: string;
155
+ };
156
+ /**
157
+ * How long to wait for the app to connect after launch. Default 30 s, and 90 s for the session's first
158
+ * launch (right after installing, when Android verifies the new APK; Phase 6.12). Set, it is used for all.
159
+ */
160
+ connectTimeoutMs?: number;
161
+ /** Minimum app console level forwarded to the host log. Default `warn`. */
162
+ logLevel?: LogLevel | 'off';
163
+ /** Rename the scenario tags Quiesco reacts to (defaults: @ios @android @web @native @hard-reset). */
164
+ tags?: Partial<TagNames>;
165
+ /**
166
+ * App errors that must not fail the current step (they are logged as warnings instead).
167
+ * Matched against the error message; strings match as substrings.
168
+ */
169
+ appErrors?: {
170
+ ignore?: (string | RegExp)[];
171
+ /** Also ignore the known benign framework reports in DEFAULT_IGNORED_APP_ERRORS. Default true. */
172
+ ignoreDefaults?: boolean;
173
+ };
174
+ }
175
+ /**
176
+ * Framework reports that are not real failures. Expo Router's lazy routes on the web first try a
177
+ * synchronous require of a not-yet-loaded route chunk; Metro reports that attempt to
178
+ * ErrorUtils.reportFatalError before the chunk is loaded and the navigation completes. It happens
179
+ * for real users too (silently in production), see docs/known-issues.mdx.
180
+ */
181
+ export declare const DEFAULT_IGNORED_APP_ERRORS: readonly RegExp[];
182
+ export declare function ignoredAppErrors(config: QuiescoConfig): RegExp[];
183
+ /** What a config function receives (Phase 6.12): the config is evaluated once per test worker. */
184
+ export interface ConfigContext {
185
+ /** Parallel worker index, 0-based (0 when running serially). */
186
+ workerIndex: number;
187
+ /** Number of parallel workers (1 when running serially). */
188
+ workerCount: number;
189
+ }
190
+ /** A config object, or a function computing it per worker (e.g. `reversePorts: [3001 + workerIndex]`). */
191
+ export type QuiescoConfigInput = QuiescoConfig | ((context: ConfigContext) => QuiescoConfig);
192
+ export declare function defineConfig(config: QuiescoConfig): QuiescoConfig;
193
+ export declare function defineConfig(config: (context: ConfigContext) => QuiescoConfig): (context: ConfigContext) => QuiescoConfig;
194
+ export declare function resolveConfig(input: QuiescoConfigInput, context: ConfigContext): QuiescoConfig;
195
+ export declare const DEFAULT_CONNECT_TIMEOUT_MS = 30000;
196
+ /** The Quiesco server port: worker N listens on `server.port + N` (Phase 6.12). */
197
+ export declare function serverPort(config: QuiescoConfig, workerIndex?: number): number;
198
+ /**
199
+ * The agent's settings. `gestureSlop`: the provider's recognizer thresholds (pinch / rotate compensate
200
+ * for them), overridden per field by `actions.gestureSlop`.
201
+ */
202
+ export declare function toAgentConfig(config: QuiescoConfig, gestureSlop?: GestureSlop, workerIndex?: number): AgentConfig;
203
+ /** Target platform: explicit value, else `QUIESCO_PLATFORM`. */
204
+ export declare function resolvePlatform(explicit?: string, env?: NodeJS.ProcessEnv): Platform;
205
+ /**
206
+ * Load the config file. TypeScript configs are imported directly (Node ≥ 23.6 strips types natively,
207
+ * so only erasable syntax is allowed in the config file).
208
+ */
209
+ export declare function loadConfig(options?: {
210
+ cwd?: string;
211
+ file?: string;
212
+ worker?: ConfigContext;
213
+ }): Promise<{
214
+ config: QuiescoConfig;
215
+ file: string;
216
+ }>;
217
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI1H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AA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