mirror of
https://github.com/nexu-io/open-design.git
synced 2026-09-20 06:15:06 +08:00
b323a28111
* test: strengthen e2e coverage and fixtures * test: allow artifact route when starting conversation * test: keep e2e count assertions stable Use the shared stable-count helper for no-request and duplicate-event windows so delayed async events cannot escape the assertions. Generated-By: looper 0.11.0 (runner=fixer, agent=codex) * fix: add e2e assertion import extension Use the explicit runtime extension required by the e2e NodeNext typecheck.\n\nGenerated-By: looper 0.11.0 (runner=fixer, agent=codex) * fix: preserve design system provenance and settle e2e assertions Keep disabled design systems available to project recovery and provenance while filtering only runtime injection. Make hover and cancellation checks observe their full settled windows. Generated-By: looper 0.11.2 (runner=fixer, agent=codex) * test(e2e): preserve unique restoration run IDs Pass the restoration fixture's run ID prefix through routeSuccessfulRuns so each mocked request receives a distinct run identity. Generated-By: looper 0.11.2 (runner=fixer, agent=codex) * test(e2e): stabilize agent and async count fixtures Route restoration agent requests through the shared JSON and SSE fixture, capture autosave baselines after a quiet period, and observe onboarding cancellation for a bounded stable window.\n\nGenerated-By: looper 0.11.2 (runner=fixer, agent=codex) * fix: honor disabled design systems in daemon runs Filter disabled persisted project selections at prompt and analytics boundaries, and keep restoration run fixtures unique.\n\nGenerated-By: looper 0.11.2 (runner=fixer, agent=codex) * test(e2e): shorten cancellation duplicate check Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
29 lines
860 B
TypeScript
29 lines
860 B
TypeScript
import { expect } from '@playwright/test';
|
|
|
|
export async function expectStableCount(
|
|
readCount: () => number | Promise<number>,
|
|
expected: number,
|
|
options: {
|
|
timeout?: number;
|
|
interval?: number;
|
|
message?: string;
|
|
} = {},
|
|
): Promise<void> {
|
|
const observationMs = options.timeout ?? 1_000;
|
|
const intervalMs = options.interval ?? 100;
|
|
const stableToken = `stable:${expected}`;
|
|
const deadline = Date.now() + observationMs;
|
|
|
|
await expect
|
|
.poll(async () => {
|
|
const current = await readCount();
|
|
if (current !== expected) return `changed:${current}`;
|
|
return Date.now() >= deadline ? stableToken : `observing:${current}`;
|
|
}, {
|
|
timeout: observationMs + intervalMs + 500,
|
|
intervals: [intervalMs],
|
|
message: options.message ?? `expected count to remain ${expected}`,
|
|
})
|
|
.toBe(stableToken);
|
|
}
|