diff --git a/packages/cli-rs/docs/H.2.md b/packages/cli-rs/docs/H.2.md index 326ffe8c1fa..a0547f0d5dc 100644 --- a/packages/cli-rs/docs/H.2.md +++ b/packages/cli-rs/docs/H.2.md @@ -123,7 +123,9 @@ selects one. Each case: three polls in a row read the same cells, not only the same characters. Highlighting changes colors after the text shows. A poll that meets a frame in progress (`OutputBusy`) is skipped. The process runs with `TZ=UTC`, so dates in the cells are the same on every machine; -4. writes the cell files and the recording. +4. stays open until 1.5 s after `ready`, so the migration status poll, which starts 1 s after mount + (`packages/tui/src/component/migration-overlay.tsx:19`), is recorded in every scenario; +5. writes the cell files and the recording. Replaying a scenario twice must give byte-identical files. That is the step's TS-against-TS proof. diff --git a/packages/cli-rs/parity/app/scenarios.test.tsx b/packages/cli-rs/parity/app/scenarios.test.tsx index 8c637eae5f4..5e0b0029a2d 100644 --- a/packages/cli-rs/parity/app/scenarios.test.tsx +++ b/packages/cli-rs/parity/app/scenarios.test.tsx @@ -15,6 +15,8 @@ const files = Array.from(new Bun.Glob("scenarios/*/*.app.ts").scanSync({ cwd: pa .sort() .filter((file) => !only || file === `scenarios/${only}.app.ts`) +const STARTUP_READS_MS = 1_500 + type Setup = Awaited> type Logged = { method: string @@ -67,6 +69,7 @@ async function record(name: string, file: string) { }, }) await setup.ready + const started = Date.now() const steps: (Step & { fixture?: string })[] = [] for (const step of scenario.steps) { if ("keys" in step) step.keys.forEach((key) => press(setup, key)) @@ -81,6 +84,9 @@ async function record(name: string, file: string) { await writeFixture(`${parity}fixtures/${fixture}.json`, cells) steps.push({ ...step, fixture }) } + // The migration status poll starts 1 s after mount (src/component/migration-overlay.tsx:19). Staying open + // past it records it in every scenario, however fast the steps ran. + await Bun.sleep(Math.max(0, STARTUP_READS_MS - (Date.now() - started))) const unmatched = log.filter((entry) => entry.unmatched) if (unmatched.length > 0) throw new Error( diff --git a/packages/cli-rs/parity/fixtures/H.2/home-sessions.app.json b/packages/cli-rs/parity/fixtures/H.2/home-sessions.app.json index 3db2a97f0bb..e935ee8a645 100644 --- a/packages/cli-rs/parity/fixtures/H.2/home-sessions.app.json +++ b/packages/cli-rs/parity/fixtures/H.2/home-sessions.app.json @@ -136,7 +136,7 @@ "until": "Ask anything", "masks": [ { - "line": "Ask anything… \".*\"", + "line": "Ask anything….*", "reason": "the prompt placeholder is picked at random" } ], diff --git a/packages/cli-rs/parity/fixtures/H.2/home-sessions/home.json b/packages/cli-rs/parity/fixtures/H.2/home-sessions/home.json index 2942daef52e..cf865f7f42e 100644 --- a/packages/cli-rs/parity/fixtures/H.2/home-sessions/home.json +++ b/packages/cli-rs/parity/fixtures/H.2/home-sessions/home.json @@ -63,7 +63,7 @@ [[0,100]], [[0,100]], [[0,13],[6,1],[7,74],[0,12]], - [[0,13],[6,1],[7,2],[8,32],[7,40],[0,12]], + [[0,13],[6,1],[7,2],[8,84]], [[0,13],[6,1],[7,74],[0,12]], [[0,13],[6,1],[7,74],[0,12]], [[0,13],[6,1],[9,74],[0,12]], diff --git a/packages/cli-rs/parity/fixtures/H.2/session-open.app.json b/packages/cli-rs/parity/fixtures/H.2/session-open.app.json index 082059c947e..385ba6d4e2d 100644 --- a/packages/cli-rs/parity/fixtures/H.2/session-open.app.json +++ b/packages/cli-rs/parity/fixtures/H.2/session-open.app.json @@ -176,6 +176,15 @@ "status": 200, "json": [] }, + { + "method": "GET", + "path": "/api/experimental/migration/v1", + "query": {}, + "status": 200, + "json": { + "status": "completed" + } + }, { "method": "GET", "path": "/api/experimental/session/ses_b/terminal", diff --git a/packages/cli-rs/parity/scenarios/H.2/home-sessions.app.ts b/packages/cli-rs/parity/scenarios/H.2/home-sessions.app.ts index 00c6e2a4e0a..a5ebd08355b 100644 --- a/packages/cli-rs/parity/scenarios/H.2/home-sessions.app.ts +++ b/packages/cli-rs/parity/scenarios/H.2/home-sessions.app.ts @@ -1,7 +1,8 @@ // Home with two sessions, the session list, and opening the newest session from it (T01, DLG14). import { assistant, defineApp, session, user } from "../../lib/app" -const placeholder = { line: 'Ask anything… ".*"', reason: "the prompt placeholder is picked at random" } +// To the end of the row: the placeholders differ in length. +const placeholder = { line: "Ask anything….*", reason: "the prompt placeholder is picked at random" } export default defineApp({ routes: [