1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 13:59:36 +01:00

init e2e ui tests base skeleton

This commit is contained in:
Janosch 2026-03-27 09:41:35 +01:00
parent 83c7321c8f
commit c84629cc4e
16 changed files with 1219 additions and 0 deletions

View file

@ -0,0 +1,34 @@
import { test as base, expect } from '@playwright/test';
type AuthFixtures = {
adminToken: string;
viewerToken: string;
};
export const test = base.extend<AuthFixtures>({
adminToken: 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',
},
});
expect(res.status()).toBe(200);
const { token } = await res.json();
await use(token);
},
viewerToken: async ({ request }, use) => {
const res = await request.post('/api/auth/login', {
data: {
username: process.env.TEST_USER_VIEWER ?? 'viewer',
password: process.env.TEST_USER_VIEWER_PASS ?? 'viewer123',
},
});
expect(res.status()).toBe(200);
const { token } = await res.json();
await use(token);
},
});
export { expect };