e2e-testing
FreeNo executable scriptsNot checkedGuide for writing end-to-end tests with Playwright in the DEVS platform. Use this when asked to write E2E tests, debug test failures, or set up test automation.
About this skill
End-to-End Testing with Playwright for DEVS
DEVS uses Playwright for end-to-end testing to ensure the application works correctly from a user's perspective.
Test Location
E2E tests are located in tests/e2e/ directory.
Running E2E Tests
# Run all E2E tests
npm run test:e2e
# Run with UI (interactive debugging)
npm run test:e2e:ui
# Run specific test file
npx playwright test tests/e2e/agents.spec.ts
# Run tests in headed mode (see browser)
npx playwright test --headed
# Debug specific test
npx playwright test --debug tests/e2e/agents.spec.ts
Test Structure
import { test, expect } from '@playwright/test'
test.describe('Feature Name', () => {
test.beforeEach(async ({ page }) => {
// Setup before each test
await page.goto('/')
// Wait for app to be ready
await page.waitForSelector('[data-testid="app-ready"]')
})
test('should perform expected action', async ({ page }) => {
// Arrange
await page.click('[data-testid="create-button"]')
// Act
await page.fill('[data-testid="name-input"]', 'Test Name')
await page.click('[data-testid="submit-button"]')
// Assert
await expect(page.locator('[data-testid="success-message"]')).toBeVisible()
})
})
Page Object Pattern
For complex pages, use Page Object Model:
// tests/e2e/pages/AgentsPage.ts
import { Page, Locator } from '@playwright/test'
export class AgentsPage {
readonly page: Page
readonly createButton: Locator
readonly nameInput: Locator
readonly submitButton: Locator
readonly agentList: Locator
constructor(page: Page) {
this.page = page
this.createButton = page.locator('[data-testid="create-agent-button"]')
this.nameInput = page.locator('[data-testid="agent-name-input"]')
this.submitButton = page.locator('[data-testid="submit-button"]')
this.agentList = page.locator('[data-testid="agent-list"]')
}
async goto() {
await this.page.goto('/agents')
}
async createAgent(name: string, role: string) {
await this.createButton.click()
await this.nameInput.fill(name)
await this.page.locator('[data-testid="agent-role-input"]').fill(role)
await this.submitButton.click()
}
async getAgentCount(): Promise<number> {
return await this.agentList.locator('[data-testid="agent-card"]').count()
}
}
Using Page Objects in tests:
// tests/e2e/agents.spec.ts
import { test, expect } from '@playwright/test'
import { AgentsPage } from './pages/AgentsPage'
test.describe('Agents', () => {
let agentsPage: AgentsPage
test.beforeEach(async ({ page }) => {
agentsPage = new AgentsPage(page)
await agentsPage.goto()
})
test('should create a new agent', async () => {
const initialCount = await agentsPage.getAgentCount()
await agentsPage.createAgent('Test Agent', 'Test Role')
await expect(agentsPage.agentList).toContainText('Test Agent')
expect(await agentsPage.getAgentCount()).toBe(initialCount + 1)
})
})
Common Selectors
Prefer data-testid attributes for reliable selectors:
// In component
<Button data-testid="submit-button">Submit</Button>
<Input data-testid="name-input" />
<div data-testid="agent-card">{agent.name}</div>
// In test
await page.click('[data-testid="submit-button"]')
await page.fill('[data-testid="name-input"]', 'value')
Waiting Strategies
// Wait for element to be visible
await page.waitForSelector('[data-testid="loading"]', { state: 'hidden' })
// Wait for navigation
await Promise.all([
page.waitForNavigation(),
page.click('[data-testid="navigate-button"]'),
])
// Wait for network request
await page.waitForResponse(
(response) =>
response.url().includes('/api/agents') && response.status() === 200,
)
// Wait for specific text
await expect(page.locator('body')).toContainText('Success')
// Custom wait with timeout
await page.waitForFunction(
() => {
return document.querySelectorAll('.agent-card').length > 0
},
{ timeout: 10000 },
)
Handling IndexedDB
Since DEVS uses IndexedDB, you may need to clear data between tests:
test.beforeEach(async ({ page }) => {
// Clear IndexedDB before each test
await page.evaluate(async () => {
const databases = await indexedDB.databases()
for (const db of databases) {
if (db.name) {
indexedDB.deleteDatabase(db.name)
}
}
})
await page.goto('/')
})
Testing Conversations
test('should send message and receive response', async ({ page }) => {
// Navigate to chat
await page.goto('/chat')
// Type message
await page.fill('[data-testid="message-input"]', 'Hello, agent!')
await page.click('[data-testid="send-button"]')
// Wait for response (may take time due to LLM)
await expect(page.locator('[data-testid="message-list"]')).toContainText(
'Hello, agent!',
{ timeout: 30000 },
)
// Verify response appeared
await exp
Install e2e-testing in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the e2e-testing skill do?
Guide for writing end-to-end tests with Playwright in the DEVS platform. Use this when asked to write E2E tests, debug test failures, or set up test automation.
How do I install the e2e-testing skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the e2e-testing skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
by Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
by Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
by Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
by Anthropic