test(app): add E2E tests and improve form state with test coverage

This commit is contained in:
Mohamed Boudra
2026-01-20 12:12:29 +07:00
parent d9c487dd54
commit 687ea706b1
7 changed files with 255 additions and 10 deletions
+33
View File
@@ -0,0 +1,33 @@
import { test, expect } from './fixtures';
import { ensureHostSelected, gotoHome } from './helpers/app';
test('new agent auto-selects the previous host', async ({ page }) => {
await gotoHome(page);
await ensureHostSelected(page);
// Ensure preference is persisted so a full reload can restore it.
await page.waitForFunction(() => {
const stored = localStorage.getItem('@paseo:create-agent-preferences');
if (!stored) return false;
try {
const parsed = JSON.parse(stored);
return parsed?.serverId === 'e2e-test-daemon';
} catch {
return false;
}
});
await gotoHome(page);
const input = page.getByRole('textbox', { name: 'Message agent...' });
await expect(input).toBeEditable();
});
test('new agent respects serverId in the URL', async ({ page }) => {
await page.goto('/?serverId=e2e-test-daemon&serverId=e2e-test-daemon');
await expect(page.getByText('New Agent', { exact: true }).first()).toBeVisible();
const input = page.getByRole('textbox', { name: 'Message agent...' });
await expect(input).toBeEditable();
});