Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/e2e/cost.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('a Change cell whose tone a refresh rewrites keeps its column’s alignment
const cell = rows(page).first().locator('td.change');
await expect(cell).toHaveClass(/\bnum\b.*\btrunc\b|\btrunc\b.*\bnum\b/);
// A refresh that keeps the rows drawn sets the cell's class whole, as Svelte does for `class="change {tone}"`.
await cell.evaluate((td) => (td.className = `change ${td.classList.contains('up') ? 'down' : 'up'}`));
await cell.evaluate((td) => td.setAttribute('class', `change ${td.classList.contains('up') ? 'down' : 'up'}`));
await expect(cell).toHaveClass(/\bnum\b/);
await expect(cell).toHaveClass(/\btrunc\b/);
expect(await cell.evaluate((td) => getComputedStyle(td).textAlign)).toBe('right');
Expand Down
2 changes: 1 addition & 1 deletion ui/e2e/real/group-rerun.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test('a run\'s statements read one at a time from the cursor are the same as one
for (const s of page) paged.set(s.statement_id, s.outcome);
after = page[0].cursor;
}
expect(paged, member.job_key).toEqual(new Map(whole.map((s) => [s.statement_id, s.outcome])));
expect(paged, member.job_key ?? member.run_id).toEqual(new Map(whole.map((s) => [s.statement_id, s.outcome])));
total += whole.length;
}
expect(total).toBeGreaterThan(0);
Expand Down
2 changes: 1 addition & 1 deletion ui/e2e/real/live-reads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.beforeAll(async () => {
return !!hold && (await server.nodes(hold.run_id)).some((n) => n.status === 'running');
});
names.set(group, 'group');
for (const member of await server.members(group)) names.set(member.run_id, member.job_key);
for (const member of await server.members(group)) names.set(member.run_id, member.job_key ?? member.run_id);
});

test.afterAll(async () => {
Expand Down
1 change: 1 addition & 0 deletions ui/e2e/real/node-changes.faults.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ test('node changes applied in turn over a live group run, across a server restar

// The version lives in the control database: after a restart the next read is still a change, not everything.
const before = held.version;
if (before === null) throw new Error('the held nodes have no version before the restart');
await server.killServer();
await server.restartServer();
// It answers while it connects to the control database, with 503s until then.
Expand Down
12 changes: 1 addition & 11 deletions ui/e2e/real/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,6 @@ export class RealServer {
this.start('scheduler', SQB, ['scheduler', '--config', this.serverArgs!.config], this.dir, { ...this.serverArgs!.env, SQLBUILD_CONTROL_DATABASE_URL: this.control });
}

/** Kills `sqb server` outright, as a crash would; `restartServer` brings it back under a new server ID. */
async killServer(): Promise<void> {
const server = this.serverChild!;
this.children = this.children.filter((c) => c !== server);
const exited = new Promise<void>((resolve) => server.once('exit', () => resolve()));
server.kill('SIGKILL');
await exited;
this.serverChild = null;
}

/** Starts `sqb server` again and waits until it answers. */
async restartServer(): Promise<void> {
this.startServer();
Expand Down Expand Up @@ -359,7 +349,7 @@ export class RealServer {
this.serverChild = null;
}

/** Kills `sqb server` alone, with no chance to shut down; `startServerAgain` brings it back. */
/** Kills `sqb server` alone, as a crash would, with no chance to shut down; `restartServer` or `startServerAgain` brings it back. */
async killServer(): Promise<void> {
await this.kill(this.serverChild!);
this.serverChild = null;
Expand Down
2 changes: 1 addition & 1 deletion ui/e2e/support/fake-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type FakeMemberRun = {
id: string;
jobKey: string;
cursor: number;
nodes: Record<string, 'pending' | 'running' | 'success' | 'failed' | 'skipped'>;
nodes: Record<string, 'pending' | 'running' | 'success' | 'failed' | 'skipped' | 'not_run'>;
queued?: boolean;
/** The project version it started on; the group's, 1, when unset. */
generation?: number;
Expand Down
3 changes: 2 additions & 1 deletion ui/e2e/support/main-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function covered(events: TraceEvent[]): number {
export async function interactionCost(page: Page, act: () => Promise<void>, window = 50): Promise<InteractionCost> {
const cdp = await page.context().newCDPSession(page);
const events: TraceEvent[] = [];
cdp.on('Tracing.dataCollected', ({ value }) => events.push(...(value as TraceEvent[])));
// The protocol types trace events as string maps; their timings are numbers.
cdp.on('Tracing.dataCollected', ({ value }) => events.push(...(value as unknown as TraceEvent[])));
const done = new Promise<void>((resolve) => cdp.once('Tracing.tracingComplete', () => resolve()));
await cdp.send('Tracing.start', { categories: 'devtools.timeline,disabled-by-default-devtools.timeline', transferMode: 'ReportEvents' });
await act();
Expand Down
2 changes: 2 additions & 0 deletions ui/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const config = {
// Wire types come from the client generated from the server's OpenAPI document. The logos
// and favicon are the website's approved files, so the two cannot drift apart.
alias: { $control: '../clients/typescript/src', $website: '../website' },
// `npm run check` type-checks the Playwright specs and their support code too.
typescript: { config: (tsconfig) => ({ ...tsconfig, include: [...tsconfig.include, '../e2e/**/*.ts', '../playwright.config.ts'] }) },
// `sqb server` serves the UI at the root; a build for another path, such as the static
// demo at `/demo`, sets SQB_UI_BASE and links through `$lib/paths`.
paths: { base: process.env.SQB_UI_BASE ?? '' },
Expand Down
Loading