Refactor infra tests, clean E2E step suites, and fix TS in tests

This commit is contained in:
2025-11-30 10:58:49 +01:00
parent af14526ae2
commit f8a1fbeb50
43 changed files with 883 additions and 2159 deletions

View File

@@ -0,0 +1,70 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { PlaywrightAutomationAdapter, FixtureServer } from 'packages/infrastructure/adapters/automation';
import { StepId } from 'packages/domain/value-objects/StepId';
import { PinoLogAdapter } from 'packages/infrastructure/adapters/logging/PinoLogAdapter';
describe('Step 6 admins', () => {
let server: FixtureServer;
let adapter: PlaywrightAutomationAdapter;
let logger: PinoLogAdapter;
beforeEach(async () => {
server = new FixtureServer();
const serverInfo = await server.start();
logger = new PinoLogAdapter();
adapter = new PlaywrightAutomationAdapter(
{
headless: true,
timeout: 5000,
mode: 'mock',
baseUrl: serverInfo.url,
},
logger,
);
await adapter.connect();
});
afterEach(async () => {
await adapter.disconnect();
await server.stop();
});
it('completes successfully from Set Admins page', async () => {
await adapter.navigateToPage(server.getFixtureUrl(5));
const page = adapter.getPage();
expect(page).not.toBeNull();
const sidebarAdmins = await page!.textContent('#wizard-sidebar-link-set-admins');
expect(sidebarAdmins).toContain('Admins');
const result = await adapter.executeStep(StepId.create(6), {
adminSearch: 'Marc',
});
expect(result.success).toBe(true);
const footerText = await page!.textContent('.wizard-footer');
expect(footerText).toContain('Time Limit');
});
it('handles Add Admin drawer state without regression', async () => {
await adapter.navigateToPage(server.getFixtureUrl(6));
const page = adapter.getPage();
expect(page).not.toBeNull();
const header = await page!.textContent('#set-admins .card-header');
expect(header).toContain('Set Admins');
const result = await adapter.executeStep(StepId.create(6), {
adminSearch: 'Mintel',
});
expect(result.success).toBe(true);
const footerText = await page!.textContent('.wizard-footer');
expect(footerText).toContain('Time Limit');
});
});