import { test, expect } from '@playwright/test'; import { loginAs, REQUIRE_SEEDED_AUTH, TEST_USER } from './helpers/auth.js'; test.describe('Chat page', () => { test.beforeEach(async ({ page }) => { await loginAs(page, TEST_USER.email, TEST_USER.password); // If login failed (no seeded user in env) we may be on /login — skip const url = page.url(); test.skip( !REQUIRE_SEEDED_AUTH && !url.includes('/chat'), 'No seeded test user — skipping authenticated tests', ); }); test('chat page loads and shows the conversation area', async ({ page }) => { await page.goto('/chat'); await expect(page.getByRole('heading', { level: 1, name: /chat/i })).toBeVisible({ timeout: 10_000, }); await expect(page.getByRole('log', { name: /conversation/i })).toBeVisible(); }); test('message composer input is visible', async ({ page }) => { await page.goto('/chat'); await expect(page.getByLabel('Message')).toBeVisible({ timeout: 10_000 }); }); test('command panel lists /new and exposes the run controls', async ({ page }) => { await page.goto('/chat'); // Conversations are command-driven: /new starts one via the commands panel. const commandList = page.getByRole('list', { name: /available commands/i }); await expect(commandList).toBeVisible({ timeout: 10_000 }); await expect(commandList.getByText('/new', { exact: true })).toBeVisible(); await expect(page.getByLabel('Command name')).toBeVisible(); await expect(page.getByRole('button', { name: /run command/i })).toBeVisible(); }); test('sidebar navigation is present on chat page', async ({ page }) => { await page.goto('/chat'); // The app-shell sidebar should be visible await expect(page.getByRole('link', { name: /chat/i }).first()).toBeVisible(); }); });