import { test, expect } from "@playwright/test"; import { login, readEnv } from "./helpers"; /** * Production smoke test โ€” runs against E2E_BASE_URL (https://www.polyllm.io) with an existing, * verified account (E2E_EMAIL / E2E_PASSWORD). Adds a real Anthropic key, sends a message and * checks that tokens stream back through ngrok. Skipped unless PROD_SMOKE=1. */ test.skip(process.env.PROD_SMOKE !== "1", "set PROD_SMOKE=1 to run against production"); test("production: login โ†’ key โ†’ real streamed answer", async ({ page }) => { const email = process.env.E2E_EMAIL!; const password = process.env.E2E_PASSWORD!; const key = readEnv("ANTHROPIC_API_KEY")!; const errors: string[] = []; page.on("pageerror", (e) => errors.push(e.message)); await login(page, email, password); await page.goto("/app/settings/providers"); const item = page.locator("li", { has: page.getByRole("heading", { level: 3, name: /^Anthropic$/ }) }).first(); await item.getByRole("button", { name: /add key|replace key/i }).click(); await page.locator("#provider-api-key").fill(key); await page.getByRole("button", { name: /^connect$|^replace key$/i }).last().click(); await expect(item).toContainText(/connected/i, { timeout: 60_000 }); await page.goto("/app/chat"); await page.getByRole("button", { name: /select model/i }).click(); await page.getByLabel(/search models/i).fill("haiku 4.5"); await page.getByRole("option").first().click(); await page.getByLabel(/^message$/i).fill("Reply with exactly the word PONG and nothing else."); await page.getByRole("button", { name: /^send$/i }).click(); await expect(page.getByText(/PONG/).first()).toBeVisible({ timeout: 90_000 }); await page.waitForURL(/\/app\/chat\/cnv_/, { timeout: 30_000 }); await expect(page.getByText(/tok\/s|\bin ยท/).first()).toBeVisible({ timeout: 30_000 }); await page.screenshot({ path: "qa/out/prod-chat.png" }); expect(errors).toEqual([]); });