Refactor infra tests, clean E2E step suites, and fix TS in tests
This commit is contained in:
70
tests/e2e/steps/step-06-admins.e2e.test.ts
Normal file
70
tests/e2e/steps/step-06-admins.e2e.test.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user