Files
doona/e2e/getting-started.ts
Zakk a5ae0689b0 fix(api): align honk v2.2 behavior and demo contracts
Report source read-only reasons and remove the obsolete destination policy error. Keep port zero invalid and describe independent recorder demand and grace.

Align demo recording, group identity, URL display and error precedence with honk df4801cc8. Vendor its native API fixture and regenerate types; retain the release binary pin because contract checks do not use it.
2026-10-02 00:07:03 +10:00

30 lines
1.3 KiB
TypeScript

import type {Page} from '@playwright/test';
import {fulfillStream, mockBackend} from './fixtures';
import {templates} from '../src/dae/templates';
export async function freshBackend(page: Page) {
const backend = await mockBackend(page);
const runtime = await backend.api.runtime();
await page.route(/\/api\/v1\/logs(?:\?|$)/, route =>
fulfillStream(route, [{id: 'ready:0', event: 'stream.ready', data: {instance_id: runtime.instance_id, observed_at: runtime.observed_at}}])
);
backend.handlers['POST nodes'] = request => backend.api.createNode(request.postDataJSON());
const sources = (await backend.api.config()).sources;
const main = sources.find(source => source.kind === 'main')!;
const content = [
'global { log_level: info }',
'subscription {\n}',
'node {\n}',
"group { proxy { filter: !name('direct', 'block') policy: min_moving_avg } }",
'routing {',
...templates.global.rules,
'fallback: direct',
'}'
].join('\n');
const accepted = await backend.api.replaceConfigSource(main.id, content, `"${main.content_sha256}"`);
await backend.api.pollOperation(accepted);
for (const include of sources.filter(source => source.kind === 'include' && source.writable))
await backend.api.pollOperation(await backend.api.replaceConfigSource(include.id, '', `"${include.content_sha256}"`));
return backend;
}