Files
star-map/e2e/support/wait-for-back-button.ts
T
Senrokai d7e8ea1d4d @
Add star-map Angular app, ETL pipeline, and caveman plugin

Angular 3D star map (galaxy/system/body views, Three.js rendering,
navigation store) plus the NASA ETL tooling that builds the star,
exoplanet and solar-system datasets, Playwright e2e suite, and the
cs:caveman Claude Code plugin (command, agent, skill).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@
2026-08-03 16:50:10 +02:00

28 lines
1022 B
TypeScript

import { expect, Locator, Page } from '@playwright/test';
/**
* The "Galaxy" back button is only rendered while `NavigationStore.viewLevel() === 'system'`,
* which becomes true only once a full galaxy-to-system camera-flight transition has settled.
* Bootstrap (data fetch + raycaster wiring) finishes asynchronously after `page.goto()`, so
* this repeatedly clicks the canvas (re-checking first, so it never clicks a system-view body
* marker by accident once the transition has already completed) until the button appears.
*/
export function backButtonLocator(page: Page): Locator {
return page.getByRole('button', { name: 'Galaxy' });
}
export async function clickCanvasUntilSystemEntered(page: Page, canvas: Locator, backButton: Locator): Promise<void> {
await expect
.poll(
async () => {
if (await backButton.isVisible()) {
return true;
}
await canvas.click();
return false;
},
{ timeout: 15_000, intervals: [300] }
)
.toBe(true);
}