116 / 139 · 13 Browser Automation with Playwright · Production Framework← prev⊞ allnext →☰ Read as one page
13.6Global Setup and Teardown
// global-setup.ts
import { chromium, FullConfig } from '@playwright/test';
async function globalSetup(config: FullConfig) {
// Seed the database
// Create test users via API
// Warm up the application
}
export default globalSetup;
// playwright.config.ts
export default defineConfig({
globalSetup: require.resolve('./global-setup'),
globalTeardown: require.resolve('./global-teardown'),
});