diff --git a/e2e/tests/pizza-day.spec.ts b/e2e/tests/pizza-day.spec.ts index 792dd89..1eb087d 100644 --- a/e2e/tests/pizza-day.spec.ts +++ b/e2e/tests/pizza-day.spec.ts @@ -11,6 +11,9 @@ test.describe.serial('pizza day životní cyklus', () => { test('zobrazí sekci Pizza Day bez aktivního dne', async ({ page }) => { await page.goto('/'); await page.waitForLoadState('networkidle'); + // Sekce pizza-section se zobrazí jen pokud má uživatel zvolenou možnost "Pizza day" + await page.locator('select').selectOption({ label: 'Pizza day' }); + await page.waitForLoadState('networkidle'); const pizzaSection = page.locator('.pizza-section'); await expect(pizzaSection).toBeVisible({ timeout: 10_000 }); await expect(pizzaSection.locator('text=není aktuálně založen')).toBeVisible(); @@ -19,6 +22,9 @@ test.describe.serial('pizza day životní cyklus', () => { test('vytvoří, uzamkne a dokončí pizza day', async ({ page }) => { await page.goto('/'); await page.waitForLoadState('networkidle'); + // Sekce pizza-section se zobrazí jen pokud má uživatel zvolenou možnost "Pizza day" + await page.locator('select').selectOption({ label: 'Pizza day' }); + await page.waitForLoadState('networkidle'); // --- CREATED --- const createBtn = page.locator('.pizza-section button', { hasText: 'Založit Pizza day' }); diff --git a/e2e/tests/qr.spec.ts b/e2e/tests/qr.spec.ts index b8a0ceb..3440c01 100644 --- a/e2e/tests/qr.spec.ts +++ b/e2e/tests/qr.spec.ts @@ -23,18 +23,19 @@ test('Nastavení ukládají číslo účtu a jméno do localStorage', async ({ p // Modal musí být viditelný await expect(page.locator('.modal-title')).toContainText('Nastavení', { timeout: 5_000 }); - // Změníme číslo účtu + // Změníme číslo účtu – pressSequentially zajistí spuštění React onChange na každý znak const accountInput = page.getByPlaceholder('123456-1234567890/1234'); - await accountInput.clear(); - await accountInput.fill('1234567890/5500'); + await accountInput.click({ clickCount: 3 }); + await accountInput.pressSequentially('1234567890/5500'); // Změníme jméno const nameInput = page.getByPlaceholder('Jan Novák'); - await nameInput.clear(); - await nameInput.fill('Nové Jméno'); + await nameInput.click({ clickCount: 3 }); + await nameInput.pressSequentially('Nové Jméno'); - // Uložíme + // Uložíme a počkáme na zavření modalu await page.locator('.modal-footer button', { hasText: 'Uložit' }).click(); + await expect(page.locator('.modal')).not.toBeVisible({ timeout: 5_000 }); // Ověříme v localStorage const bankAccount = await page.evaluate(() => localStorage.getItem('bank_account_number'));