plugins/aai-stack-playwright/skills/playwright-fixtures/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/the-answerai/alphaagent-team/blob/main/plugins/aai-stack-playwright/skills/playwright-fixtures/SKILL.md -a claude-code --skill playwright-fixturesInstallation paths:
.claude/skills/playwright-fixtures/# Playwright Fixtures Skill
Patterns for using fixtures and test setup in Playwright.
## Built-in Fixtures
### Page and Context
```typescript
import { test, expect } from '@playwright/test'
test('basic test', async ({ page }) => {
// page is auto-created and cleaned up
await page.goto('/')
await expect(page).toHaveTitle(/Welcome/)
})
test('with context', async ({ context }) => {
// Full browser context (cookies, storage)
const page1 = await context.newPage()
const page2 = await context.newPage()
await page1.goto('/page1')
await page2.goto('/page2')
})
test('with browser', async ({ browser }) => {
// Create isolated context
const context = await browser.newContext()
const page = await context.newPage()
await page.goto('/')
await context.close()
})
```
### Request Fixture
```typescript
test('API test', async ({ request }) => {
// Make API requests
const response = await request.get('/api/users')
expect(response.ok()).toBeTruthy()
const users = await response.json()
expect(users).toHaveLength(10)
})
test('create then verify', async ({ request, page }) => {
// Create via API
await request.post('/api/users', {
data: { name: 'John', email: 'john@test.com' },
})
// Verify in UI
await page.goto('/users')
await expect(page.getByText('John')).toBeVisible()
})
```
## Custom Fixtures
### Basic Custom Fixture
```typescript
// fixtures.ts
import { test as base } from '@playwright/test'
type MyFixtures = {
adminPage: Page
userEmail: string
}
export const test = base.extend<MyFixtures>({
// Simple fixture
userEmail: async ({}, use) => {
await use(`user-${Date.now()}@test.com`)
},
// Fixture with setup/teardown
adminPage: async ({ browser }, use) => {
// Setup
const context = await browser.newContext()
const page = await context.newPage()
await page.goto('/admin/login')
await page.fill('[name="email"]', 'admin@test.com')
await page.fill('[name="password"]', 'admin123')