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>
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { Page, expect } from '@playwright/test';
|
|
|
|
export class ChatHelper {
|
|
constructor(private page: Page) {}
|
|
|
|
async sendMessage(message: string) {
|
|
const input = this.page.locator('textarea[placeholder*="Type"], input[placeholder*="Type"]');
|
|
await input.fill(message);
|
|
await input.press('Enter');
|
|
}
|
|
|
|
async waitForAIResponse() {
|
|
// Wait for typing indicator to appear then disappear
|
|
const typingIndicator = this.page.locator('[data-testid="typing-indicator"]').first();
|
|
|
|
try {
|
|
await typingIndicator.waitFor({ state: 'visible', timeout: 2000 });
|
|
await typingIndicator.waitFor({ state: 'hidden', timeout: 30000 });
|
|
} catch {
|
|
// Typing indicator might not appear for fast responses
|
|
await this.page.waitForTimeout(1000);
|
|
}
|
|
}
|
|
|
|
async getLastMessage() {
|
|
const messages = this.page.locator('[data-testid="chat-message"]');
|
|
const count = await messages.count();
|
|
return count > 0 ? messages.nth(count - 1) : null;
|
|
}
|
|
|
|
async getMessageCount() {
|
|
const messages = this.page.locator('[data-testid="chat-message"]');
|
|
return await messages.count();
|
|
}
|
|
}
|