just testing the environment
Some checks failed
Tests / test (push) Has been cancelled

This commit is contained in:
tom.hempel
2026-05-20 07:10:08 +02:00
parent 2a11dfd0d1
commit 06fc134299
56 changed files with 1890 additions and 361 deletions

25
e2e/api/auth.spec.ts Normal file
View File

@ -0,0 +1,25 @@
import { test, expect } from '@playwright/test';
const API = '/api';
test.describe('Android API auth', () => {
test('login returns token', async ({ request }) => {
const res = await request.post(`${API}/auth/login`, {
data: { username: 'testadmin', password: 'testpass123' },
});
expect(res.ok()).toBeTruthy();
const json = await res.json();
expect(json.ok).toBe(true);
expect(json.data.token).toBeTruthy();
expect(json.data.role).toBe('admin');
});
test('bad password returns error', async ({ request }) => {
const res = await request.post(`${API}/auth/login`, {
data: { username: 'testadmin', password: 'wrong' },
});
expect(res.status()).toBe(401);
const json = await res.json();
expect(json.ok).toBe(false);
});
});