1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 10:19:35 +01:00
effigenix/test-automation/web-ui/fixtures/seed.fixture.ts
2026-03-27 09:41:35 +01:00

29 lines
908 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test as base } from '@playwright/test';
import { ApiClient } from '../helpers/api-client.js';
type SeedFixtures = {
apiClient: ApiClient;
};
/**
* Seed-Fixture: stellt einen authentifizierten ApiClient bereit.
*
* Strategie (zu klären in Phase 1):
* Option A DB-Reset vor jeder Suite via Spring Boot test-Profile + Liquibase
* Option B Test-Daten mit zufälligen Namen (UUID-Suffix) zur Isolation
*
* Aktuell: Option B als pragmatischer Einstieg.
*/
export const test = base.extend<SeedFixtures>({
apiClient: async ({ request }, use) => {
const res = await request.post('/api/auth/login', {
data: {
username: process.env.TEST_USER_ADMIN ?? 'admin',
password: process.env.TEST_USER_ADMIN_PASS ?? 'admin123',
},
});
const { token } = await res.json();
const client = new ApiClient(request, token);
await use(client);
},
});