Files
star-map/e2e/galaxy-view.spec.ts
T
SenrokaiandClaude Fable 5 8ceea02875 Wait for the boot as long as the boot takes
The specs added over this series each opened with an untimed check that the
canvas was there, which gives it Playwright's default five seconds. That is
the one wait in this suite that cannot be made faster: eight workers share a
software rasterizer, and what they are all waiting on is the same first paint.
Under a full parallel run five seconds is a coin toss, and it came up wrong on
the route-plotting spec.

Thirty, like every other wait in here that crosses a camera flight.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016jxMkwA2rbicdGxHosecYi
2026-08-21 15:20:00 +02:00

44 lines
2.5 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { backButtonLocator } from './support/wait-for-back-button';
// A reduced star field throughout: this suite runs against a software rasterizer two orders of
// magnitude slower than a GPU, and what is under test is navigation and state rather than how
// fast the field rasterizes. See `starRenderBudgetFromUrl`.
test.describe('Galaxy view', () => {
test('boots the app, initializes the 3D scene, and starts in the galaxy overview (no system controls shown)', async ({ page }) => {
await page.goto('/?stars=4000');
// Generously timed on purpose: this suite shares one software rasterizer, and the boot
// it waits on is the slowest thing in it. The default five seconds is a coin toss
// under a full parallel run.
await expect(page.getByTestId('scene-canvas')).toBeVisible({ timeout: 30_000 });
// The dock's tab strip is up before the scene finishes booting; the search is one tab in it.
await expect(page.getByRole('tab', { name: 'Search' })).toBeVisible();
await expect(backButtonLocator(page)).toHaveCount(0);
// The readout panel's own title, not just the text anywhere on screen: the selected-object
// banner across the top names the same thing, so a bare text match is ambiguous.
await expect(page.getByTestId('hud-title')).toHaveText('Local Stars');
});
test('the scale ladder flies out to the whole Galaxy and back to the solar neighbourhood', async ({ page }) => {
// Two multi-second camera flights, either side of a software-rendered scene bootstrap, add
// up to more than the default per-test budget.
test.setTimeout(90_000);
await page.goto('/?stars=4000');
await expect(page.getByTestId('scene-canvas')).toBeVisible({ timeout: 30_000 });
await page.getByRole('button', { name: 'Milky Way' }).click();
// The flight covers four orders of magnitude, and the readout only switches over once the
// camera is far enough out for the Galaxy model to have taken over from the star field.
await expect(page.getByText('Galactic Scale')).toBeVisible({ timeout: 15_000 });
await expect(page.getByText('Sagittarius A*')).toBeVisible();
// At the outermost scale there is nowhere further out to go.
await expect(page.getByRole('button', { name: 'Milky Way' })).toHaveCount(0);
await page.getByRole('button', { name: 'Solar Neighbourhood' }).click();
await expect(page.getByTestId('hud-title')).toHaveText('Local Stars', { timeout: 15_000 });
});
});