import { Page } from '@playwright/test'; export class NodeHelper { constructor(private page: Page) {} async createNode(title: string, body: string) { // This will vary based on actual implementation // For now, placeholder that navigates to chat await this.page.goto('/chat'); // TODO: Implement actual node creation flow // This depends on how nodes are created in the UI } async waitForUMAPCalculation(timeoutMs: number = 60000) { // Poll /api/galaxy until nodes have coords_3d const startTime = Date.now(); while (Date.now() - startTime < timeoutMs) { try { const response = await this.page.request.get('/api/galaxy'); const data = await response.json(); if (data.nodes && data.nodes.every((n: any) => n.coords_3d !== null)) { return true; } } catch { // Continue polling } await this.page.waitForTimeout(2000); } return false; } }