// Test für Auth-API Endpunkte import { test, expect } from '@playwright/test'; test.describe('Auth API Tests', () => { test('should register a new user', async ({ request }) => { const response = await request.post('/auth/register', { data: { email: 'test@example.com', password: 'password123', name: 'Test User' } }); expect(response.status()).toBe(201); const responseBody = await response.json(); expect(responseBody).toHaveProperty('userId'); expect(responseBody).toHaveProperty('email', 'test@example.com'); }); test('should login with valid credentials', async ({ request }) => { const response = await request.post('/auth/login', { data: { email: 'test@example.com', password: 'password123' } }); expect(response.status()).toBe(200); const responseBody = await response.json(); expect(responseBody).toHaveProperty('token'); expect(responseBody).toHaveProperty('userId'); }); test('should not login with invalid credentials', async ({ request }) => { const response = await request.post('/auth/login', { data: { email: 'test@example.com', password: 'wrongpassword' } }); expect(response.status()).toBe(401); }); test('should not register with existing email', async ({ request }) => { const response = await request.post('/auth/register', { data: { email: 'test@example.com', password: 'password123', name: 'Test User' } }); expect(response.status()).toBe(409); }); });