import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { PlaywrightAutomationAdapter } from '../../packages/infrastructure/adapters/automation/PlaywrightAutomationAdapter'; import { StepId } from '../../packages/domain/value-objects/StepId'; import { NoOpLogAdapter } from '../../packages/infrastructure/adapters/logging/NoOpLogAdapter'; /** * RED Phase Test: Step 6 Missing Case * * This test exercises step 6 (SET_ADMINS) and MUST fail with "Unknown step: 6" error * because case 6 is missing from the executeStep() switch statement. * * Given: A mock automation adapter configured for step execution * When: Step 6 is executed * Then: The adapter should throw "Unknown step: 6" error */ describe('E2E: Step 6 Missing Case (RED Phase)', () => { let adapter: PlaywrightAutomationAdapter; beforeEach(async () => { const logger = new NoOpLogAdapter(); adapter = new PlaywrightAutomationAdapter({ headless: true, timeout: 5000, mode: 'mock', baseUrl: 'file://' + process.cwd() + '/html-dumps', }, logger); await adapter.connect(); }); afterEach(async () => { if (adapter) { await adapter.disconnect(); } }); it('should successfully execute step 6 (SET_ADMINS)', async () => { // Given: Navigate to step 6 fixture (Set Admins page) const navResult = await adapter.navigateToPage(`file://${process.cwd()}/html-dumps/step-06-set-admins.html`); expect(navResult.success).toBe(true); // When: Execute step 6 (should navigate to Time Limits) const step6Result = await adapter.executeStep(StepId.create(6), {}); // Then: Should succeed (RED phase - this WILL FAIL because case 6 is missing) expect(step6Result.success).toBe(true); expect(step6Result.error).toBeUndefined(); }); it('should verify step 6 is recognized as valid by StepId', () => { // Step 6 should be within valid range (1-17) expect(() => StepId.create(6)).not.toThrow(); const step6 = StepId.create(6); expect(step6.value).toBe(6); }); });