import { test, Page } from '@playwright/test'; import { UATHelper } from './uat-helper'; export interface ScenarioConfig { name: string; description: string; priority: 'P0' | 'P1' | 'P2'; setup?: (page: Page) => Promise; execute: (page: Page, helper: UATHelper) => Promise; verify?: (page: Page, helper: UATHelper) => Promise; cleanup?: (page: Page) => Promise; } export class ScenarioRunner { static async runScenario(config: ScenarioConfig) { test.describe(`${config.name} (${config.priority})`, () => { test.beforeEach(async ({ page }) => { if (config.setup) { await config.setup(page); } }); test(config.description, async ({ page }) => { const helper = new UATHelper(page); await config.execute(page, helper); if (config.verify) { await config.verify(page, helper); } }); test.afterEach(async ({ page }) => { if (config.cleanup) { await config.cleanup(page); } }); }); } static async runMultipleScenarios(scenarios: ScenarioConfig[]) { for (const scenario of scenarios) { await this.runScenario(scenario); } } }