WIP: feat: přidání testů – Jest unit testy + Playwright E2E + CI pipeline #54
@@ -20,6 +20,8 @@ test.describe.serial('pizza day životní cyklus', () => {
|
||||
});
|
||||
|
||||
test('vytvoří, uzamkne a dokončí pizza day', async ({ page }) => {
|
||||
// Tento test má více kroků a server při MOCK_DATA=true záměrně zpožďuje scraping pizz o 3s
|
||||
test.setTimeout(60_000);
|
||||
await page.goto('/');
|
||||
await page.waitForLoadState('networkidle');
|
||||
// Sekce pizza-section se zobrazí jen pokud má uživatel zvolenou možnost "Pizza day"
|
||||
@@ -30,7 +32,11 @@ test.describe.serial('pizza day životní cyklus', () => {
|
||||
const createBtn = page.locator('.pizza-section button', { hasText: 'Založit Pizza day' });
|
||||
await expect(createBtn).toBeVisible({ timeout: 10_000 });
|
||||
// Čekáme na odpověď API před reloadem – jinak by reload přerušil probíhající request
|
||||
const createResponse = page.waitForResponse(resp => resp.url().includes('/api/pizzaDay/create'));
|
||||
// Server s MOCK_DATA=true záměrně zpožďuje stahování pizz o 3s, proto velkorysý timeout
|
||||
const createResponse = page.waitForResponse(
|
||||
resp => resp.url().includes('/api/pizzaDay/create'),
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await createBtn.click();
|
||||
await createResponse;
|
||||
await page.reload();
|
||||
|
||||
Reference in New Issue
Block a user