Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

fixtures.ts

25 lines706 Bytes

1import { test as base } from '@playwright/test'
2​
3const AIMOCK_PORT = 4010
4​
5type TestFixtures = { testId: string }
6type WorkerFixtures = { aimockPort: number }
7​
8// aimock is started in globalSetup and shared across all workers.
9// Tests only need testId (for sequenceIndex isolation) and aimockPort.
10export const test = base.extend<TestFixtures, WorkerFixtures>({
11 aimockPort: [
12 async ({}, use) => {
13 await use(AIMOCK_PORT)
14 },
15 { scope: 'worker' },
16 ],
17​
18 // Test-scoped: unique ID per test for sequenceIndex isolation
19 testId: async ({}, use, testInfo) => {
20 const id = `${testInfo.workerIndex}-${testInfo.testId}`
21 await use(id)
22 },
23})
24​
25export { expect } from '@playwright/test'