test: add playwright e2e tests for chat, auth, model selector, and api (#1355)

This commit is contained in:
josh 2025-12-15 14:43:39 +00:00 committed by GitHub
parent b1da86062e
commit 5f9e231788
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 260 additions and 416 deletions

View file

@ -1,24 +1,15 @@
import { expect as baseExpect, test as baseTest } from "@playwright/test";
import { getUnixTime } from "date-fns";
import { createAuthenticatedContext, type UserContext } from "./helpers";
import { ChatPage } from "./pages/chat";
type Fixtures = {
authenticatedContext: UserContext;
chatPage: ChatPage;
};
export const test = baseTest.extend<object, Fixtures>({
authenticatedContext: [
async ({ browser }, use, workerInfo) => {
const userContext = await createAuthenticatedContext({
browser,
name: `user-${workerInfo.workerIndex}-${getUnixTime(new Date())}`,
});
await use(userContext);
await userContext.context.close();
},
{ scope: "worker" },
],
export const test = baseTest.extend<Fixtures>({
chatPage: async ({ page }, use) => {
const chatPage = new ChatPage(page);
await use(chatPage);
},
});
export const expect = baseExpect;