test: stabilize assistant e2e

This commit is contained in:
ginnoir
2026-07-08 17:48:06 -05:00
parent 4c82d551ea
commit 1092941c45
2 changed files with 20 additions and 2 deletions
+8 -1
View File
@@ -178,7 +178,14 @@ const nextConfig: NextConfig = {
output: "standalone", output: "standalone",
// Keep pino and pino-pretty as native Node.js requires so their worker-thread // Keep pino and pino-pretty as native Node.js requires so their worker-thread
// transport and stream internals work correctly inside the standalone bundle. // transport and stream internals work correctly inside the standalone bundle.
serverExternalPackages: ["pino", "pino-pretty", "drizzle-orm", "postgres"], serverExternalPackages: [
"pino",
"pino-pretty",
"drizzle-orm",
"postgres",
"isomorphic-dompurify",
"jsdom",
],
}; };
export default nextConfig; export default nextConfig;
+12 -1
View File
@@ -1,4 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test, type Page } from "@playwright/test";
async function ensureSignedIn(page: Page) {
await page.goto("/");
const devLogin = page.getByRole("button", { name: "Dev login" });
if (await devLogin.isVisible().catch(() => false)) {
await devLogin.click();
await page.waitForURL((url) => !url.pathname.startsWith("/login"));
}
}
test("assistant bubble is hidden until opted in", async ({ page }) => { test("assistant bubble is hidden until opted in", async ({ page }) => {
await page.goto("/"); await page.goto("/");
@@ -6,11 +15,13 @@ test("assistant bubble is hidden until opted in", async ({ page }) => {
}); });
test("assistant chat smoke after opt-in", async ({ page }) => { test("assistant chat smoke after opt-in", async ({ page }) => {
await ensureSignedIn(page);
await page.goto("/settings?s=appearance"); await page.goto("/settings?s=appearance");
const assistantSwitch = page.getByRole("switch", { name: "AI assistant" }); const assistantSwitch = page.getByRole("switch", { name: "AI assistant" });
if (!(await assistantSwitch.isChecked())) { if (!(await assistantSwitch.isChecked())) {
await assistantSwitch.click(); await assistantSwitch.click();
} }
await expect(assistantSwitch).toBeChecked();
await page.goto("/"); await page.goto("/");
await page.getByRole("button", { name: "Open assistant" }).click(); await page.getByRole("button", { name: "Open assistant" }).click();