feat: přidání testů – Jest unit testy + Playwright E2E + CI pipeline #54
@@ -29,8 +29,10 @@ test.describe.serial('pizza day životní cyklus', () => {
|
|||||||
// --- 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 });
|
||||||
|
// Č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/pizza/create'));
|
||||||
await createBtn.click();
|
await createBtn.click();
|
||||||
// Reload zajistí aktuální stav – aktualizace přichází přes WebSocket, který networkidle nečeká
|
await createResponse;
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
await expect(page.locator('.pizza-section')).toContainText('spravován uživatelem', { timeout: 5_000 });
|
await expect(page.locator('.pizza-section')).toContainText('spravován uživatelem', { timeout: 5_000 });
|
||||||
|
|||||||
Reference in New Issue
Block a user