mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 17:04:49 +01:00
init e2e ui tests base skeleton
This commit is contained in:
parent
83c7321c8f
commit
c84629cc4e
16 changed files with 1219 additions and 0 deletions
30
test-automation/web-ui/tests/api/auth/authorization.spec.ts
Normal file
30
test-automation/web-ui/tests/api/auth/authorization.spec.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { test, expect } from '../../../fixtures/auth.fixture.js';
|
||||
|
||||
/**
|
||||
* TC-AUTH – Autorisierung Masterdata
|
||||
* Quelle: GitHub Issue #67
|
||||
*/
|
||||
test.describe('TC-AUTH: Autorisierung', () => {
|
||||
test('TC-AUTH-01: Unauthentifizierter Zugriff wird abgelehnt', async ({ request }) => {
|
||||
const res = await request.get('/api/suppliers');
|
||||
expect([401, 403]).toContain(res.status());
|
||||
});
|
||||
|
||||
test('TC-AUTH-02: Admin darf Lieferant erstellen', async ({ request, adminToken }) => {
|
||||
const res = await request.post('/api/suppliers', {
|
||||
data: { name: `Auth-Test-${Date.now()}`, phone: '+49 30 00000' },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(201);
|
||||
});
|
||||
|
||||
test('TC-AUTH-03: Viewer darf keine Lieferanten erstellen', async ({ request, viewerToken }) => {
|
||||
const res = await request.post('/api/suppliers', {
|
||||
data: { name: `Viewer-Test-${Date.now()}`, phone: '+49 30 00001' },
|
||||
headers: { Authorization: `Bearer ${viewerToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(403);
|
||||
});
|
||||
|
||||
// TODO: Weitere ACs aus Issue #67 ergänzen
|
||||
});
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
import { test, expect } from '../../../fixtures/auth.fixture.js';
|
||||
|
||||
/**
|
||||
* TC-CAT – Produktkategorien
|
||||
* Quelle: GitHub Issue #62
|
||||
*/
|
||||
test.describe('TC-CAT: Produktkategorien', () => {
|
||||
test('TC-CAT-01: Kategorie erstellen – Happy Path', async ({ request, adminToken }) => {
|
||||
const res = await request.post('/api/product-categories', {
|
||||
data: { name: 'Obst & Gemüse', description: 'Frische Produkte' },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(201);
|
||||
const body = await res.json();
|
||||
expect(body.name).toBe('Obst & Gemüse');
|
||||
expect(body.description).toBe('Frische Produkte');
|
||||
});
|
||||
|
||||
test('TC-CAT-02: Kategorie erstellen – ohne Beschreibung', async ({ request, adminToken }) => {
|
||||
const res = await request.post('/api/product-categories', {
|
||||
data: { name: `Milchprodukte-${Date.now()}` },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(201);
|
||||
});
|
||||
|
||||
test('TC-CAT-04: Doppelter Name wird abgelehnt', async ({ request, adminToken }) => {
|
||||
const name = `Duplikat-${Date.now()}`;
|
||||
await request.post('/api/product-categories', {
|
||||
data: { name },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
const res = await request.post('/api/product-categories', {
|
||||
data: { name },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect([409, 422]).toContain(res.status());
|
||||
});
|
||||
|
||||
test('TC-CAT-06: Leerer Name wird abgelehnt', async ({ request, adminToken }) => {
|
||||
const res = await request.post('/api/product-categories', {
|
||||
data: { name: '' },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(400);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
import { test, expect } from '../../../fixtures/auth.fixture.js';
|
||||
|
||||
/**
|
||||
* TC-SUP – Lieferanten
|
||||
* Quelle: GitHub Issue #63
|
||||
*/
|
||||
test.describe('TC-SUP: Lieferanten', () => {
|
||||
test('TC-SUP-01: Lieferant erstellen – Pflichtfelder', async ({ request, adminToken }) => {
|
||||
const res = await request.post('/api/suppliers', {
|
||||
data: { name: `Frisch AG ${Date.now()}`, phone: '+49 30 12345' },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(201);
|
||||
const body = await res.json();
|
||||
expect(body.status).toBe('AKTIV');
|
||||
});
|
||||
|
||||
test('TC-SUP-02: Lieferant erscheint in Liste nach Erstellung', async ({ request, adminToken }) => {
|
||||
const name = `ListTest-${Date.now()}`;
|
||||
await request.post('/api/suppliers', {
|
||||
data: { name, phone: '+49 30 99999' },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
const res = await request.get('/api/suppliers', {
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(200);
|
||||
const body = await res.json();
|
||||
const found = (Array.isArray(body) ? body : body.content ?? []).some(
|
||||
(s: { name: string }) => s.name === name,
|
||||
);
|
||||
expect(found).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-SUP-03: Lieferant ohne Name wird abgelehnt', async ({ request, adminToken }) => {
|
||||
const res = await request.post('/api/suppliers', {
|
||||
data: { phone: '+49 30 12345' },
|
||||
headers: { Authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(res.status()).toBe(400);
|
||||
});
|
||||
|
||||
// TODO: Weitere TCs aus Issue #63 nach Implementierung hinzufügen
|
||||
// TC-SUP-04: Doppelter Name abgelehnt
|
||||
// TC-SUP-05: Lieferant deaktivieren
|
||||
// TC-SUP-06: Filter nach Name
|
||||
});
|
||||
0
test-automation/web-ui/tests/web/.gitkeep
Normal file
0
test-automation/web-ui/tests/web/.gitkeep
Normal file
Loading…
Add table
Add a link
Reference in a new issue