plugins/aai-stack-playwright/skills/playwright-assertions/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-assertions/SKILL.md -a claude-code --skill playwright-assertionsInstallation paths:
.claude/skills/playwright-assertions/# Playwright Assertions Skill
Patterns for assertions in Playwright tests.
## Auto-Retrying Assertions
### Element Visibility
```typescript
// Visible (default)
await expect(page.getByRole('button')).toBeVisible()
await expect(page.getByRole('button')).not.toBeVisible()
// Hidden
await expect(page.getByRole('dialog')).toBeHidden()
// Attached to DOM (even if not visible)
await expect(page.locator('#loading')).toBeAttached()
await expect(page.locator('#loading')).not.toBeAttached()
```
### Element State
```typescript
// Enabled/Disabled
await expect(page.getByRole('button')).toBeEnabled()
await expect(page.getByRole('button')).toBeDisabled()
// Editable
await expect(page.getByRole('textbox')).toBeEditable()
await expect(page.getByRole('textbox')).not.toBeEditable()
// Focused
await expect(page.getByRole('textbox')).toBeFocused()
// Checked (checkboxes/radio)
await expect(page.getByRole('checkbox')).toBeChecked()
await expect(page.getByRole('checkbox')).not.toBeChecked()
```
### Element Content
```typescript
// Text content
await expect(page.locator('.message')).toHaveText('Hello World')
await expect(page.locator('.message')).toHaveText(/hello/i)
await expect(page.locator('.message')).toContainText('Hello')
// Multiple elements
await expect(page.locator('.item')).toHaveText([
'First',
'Second',
'Third',
])
// Input value
await expect(page.getByRole('textbox')).toHaveValue('test@example.com')
await expect(page.getByRole('textbox')).toHaveValue(/test/)
await expect(page.getByRole('textbox')).not.toBeEmpty()
// Select value
await expect(page.getByRole('combobox')).toHaveValue('option1')
await expect(page.getByRole('combobox')).toHaveValues(['opt1', 'opt2'])
```
### Element Attributes
```typescript
// Attribute presence
await expect(page.locator('input')).toHaveAttribute('required')
// Attribute value
await expect(page.locator('a')).toHaveAttribute('href', '/home')
await expect(page.locator('a')).toHaveAttribute('href', /\/home/)
// ID
await expe