Files
gh-hopeoverture-worldbuildi…/skills/playwright-flow-recorder/assets/test-template.ts
2025-11-29 18:46:35 +08:00

46 lines
1.2 KiB
TypeScript

import { test, expect } from '@playwright/test'
/**
* Template for generated Playwright E2E tests
*
* This file serves as a base template for flow-based test generation.
* Generated tests will follow this structure with proper setup, execution, and cleanup.
*/
test.describe('Flow Name', () => {
// Setup before each test
test.beforeEach(async ({ page }) => {
// Navigate to starting point
await page.goto('/')
// Setup any required state
// e.g., authentication, data seeding, etc.
})
test('flow description', async ({ page }) => {
// Test steps will be inserted here
// Each step includes:
// 1. Comment describing the action
// 2. Playwright code to execute the action
// 3. Assertions to verify expected state
// Example navigation
await page.goto('/entities')
// Example interaction
await page.getByRole('button', { name: /create/i }).click()
// Example form input
await page.getByLabel(/name/i).fill('Test Entity')
// Example assertion
await expect(page.getByText('Test Entity')).toBeVisible()
})
// Cleanup after each test
test.afterEach(async ({ page }) => {
// Clean up any created data or state
// e.g., delete test entities, clear local storage, etc.
})
})