Files
archy/packages/app/e2e/global-setup.ts
T
Dorian 43ca3a7837 feat(playwright): integrate Playwright for end-to-end testing and update .gitignore
- Added Playwright as a development dependency for end-to-end testing.
- Updated package.json to include test scripts for Playwright.
- Enhanced .gitignore to exclude Playwright test results and cache files.
- Improved content extraction logic in various components to handle new content types.

Made-with: Cursor
2026-03-02 22:02:19 +00:00

28 lines
906 B
TypeScript

import { mkdirSync, writeFileSync, existsSync, readFileSync } from 'fs'
import { resolve } from 'path'
import { allTestConversations } from './fixtures/test-chats'
const CHATS_PATH = resolve(process.cwd(), '.dev', 'chats.json')
export default async function globalSetup() {
const dir = resolve(process.cwd(), '.dev')
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
// Backup existing chats if present (for local dev)
let backup: string | null = null
if (existsSync(CHATS_PATH)) {
backup = readFileSync(CHATS_PATH, 'utf-8')
}
const payload = {
conversations: allTestConversations,
activeConversationId: 'e2e-films',
}
writeFileSync(CHATS_PATH, JSON.stringify(payload, null, 2), 'utf-8')
// Store backup path for teardown (we pass via env since globalSetup/Teardown don't share scope easily)
if (backup) {
process.env.AIUI_E2E_CHATS_BACKUP = backup
}
}