Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

playwright-fixtures

verified

Playwright fixtures and test setup patterns

View on GitHub

Marketplace

alphaagent-team

the-answerai/alphaagent-team

Plugin

aai-stack-playwright

stack

Repository

the-answerai/alphaagent-team

plugins/aai-stack-playwright/skills/playwright-fixtures/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
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-fixtures

Installation paths:

Claude
.claude/skills/playwright-fixtures/
Powered by add-skill CLI

Instructions

# 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')
 

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
8674 chars