WIP: feat: přidání testů – Jest unit testy + Playwright E2E + CI pipeline #54

Draft
batmanisko wants to merge 21 commits from feat/tests into master
Showing only changes of commit 6b2deff215 - Show all commits
+3 -2
View File
@@ -28,6 +28,9 @@ test.describe.serial('pizza day životní cyklus', () => {
await page.locator('select').selectOption({ label: 'Pizza day' }); await page.locator('select').selectOption({ label: 'Pizza day' });
await page.waitForLoadState('networkidle'); await page.waitForLoadState('networkidle');
// Přijmeme všechny window.confirm() dialogy v celém testu (vytvoření i doručení pizza dne)
page.on('dialog', dialog => dialog.accept());
// --- CREATED --- // --- CREATED ---
const createBtn = page.locator('.pizza-section button', { hasText: 'Založit Pizza day' }); const createBtn = page.locator('.pizza-section button', { hasText: 'Založit Pizza day' });
await expect(createBtn).toBeVisible({ timeout: 10_000 }); await expect(createBtn).toBeVisible({ timeout: 10_000 });
@@ -72,8 +75,6 @@ test.describe.serial('pizza day životní cyklus', () => {
// --- DELIVERED --- // --- DELIVERED ---
const deliverBtn = page.locator('.pizza-section button', { hasText: 'Doručeno' }); const deliverBtn = page.locator('.pizza-section button', { hasText: 'Doručeno' });
await expect(deliverBtn).toBeVisible({ timeout: 5_000 }); await expect(deliverBtn).toBeVisible({ timeout: 5_000 });
// window.confirm dialog Playwright automaticky potvrdí
page.on('dialog', dialog => dialog.accept());
await deliverBtn.click(); await deliverBtn.click();
await page.waitForLoadState('networkidle'); await page.waitForLoadState('networkidle');
await expect(page.locator('.pizza-section')).toContainText('doručeny', { timeout: 5_000 }); await expect(page.locator('.pizza-section')).toContainText('doručeny', { timeout: 5_000 });