Files
app/tests/playwright/helpers/galaxy.ts
Albert 4967ce3cd1 feat: Add Playwright testing scaffolding infrastructure
Implements complete Playwright testing infrastructure for manual MCP testing and
as foundation for Magnitude tests.

Created:
- playwright.config.ts - Main configuration with setup project
- tests/playwright/auth.setup.ts - Authentication setup (placeholder)
- tests/playwright/fixtures.ts - Custom fixtures for authenticated/page contexts
- tests/playwright/helpers/chat.ts - Chat interaction helpers
- tests/playwright/helpers/galaxy.ts - Galaxy visualization helpers
- tests/playwright/helpers/node.ts - Node creation/management helpers
- tests/playwright/smoke.spec.ts - Basic smoke tests
- .env.test - Environment variables template

Updated:
- package.json - Added test:playwright scripts
- .gitignore - Added tests/playwright/.auth/ exclusion

Ready for manual Playwright MCP testing and Magnitude test creation.

Resolves plan: 01-playwright-scaffolding.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 21:14:35 +00:00

29 lines
778 B
TypeScript

import { Page } from '@playwright/test';
export class GalaxyHelper {
constructor(private page: Page) {}
async waitForGalaxyLoad() {
// Wait for canvas to be visible
await this.page.waitForSelector('canvas', { timeout: 10000 });
// Give R3F time to render
await this.page.waitForTimeout(2000);
}
async clickNode(nodeId: string) {
// Simulate node click via JavaScript event
await this.page.evaluate((id) => {
const event = new CustomEvent('node-click', { detail: { nodeId: id } });
window.dispatchEvent(event);
}, nodeId);
}
async getNodeCount() {
return await this.page.evaluate(() => {
// Access window globals set by galaxy component
return (window as any).__galaxyNodes?.length || 0;
});
}
}