test: opravy Playwright testů
CI / Generate TypeScript types (push) Successful in 11s
CI / Server unit tests (push) Successful in 22s
CI / Build server (push) Successful in 23s
CI / Build client (push) Successful in 31s
CI / Playwright E2E tests (push) Successful in 1m15s
CI / Build and push Docker image (push) Has been skipped
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (pull_request) Successful in 13s
CI / Server unit tests (pull_request) Successful in 25s
CI / Build server (pull_request) Successful in 30s
CI / Build client (pull_request) Successful in 37s
CI / Playwright E2E tests (pull_request) Successful in 1m19s
CI / Build and push Docker image (pull_request) Has been skipped
CI / Notify (pull_request) Has been skipped

This commit is contained in:
2026-04-29 22:55:23 +02:00
parent 70ed59ab9d
commit 3ed781d0cf
3 changed files with 12 additions and 9 deletions
+8 -5
View File
@@ -11,11 +11,14 @@ export async function loginViaApi(page: Page, login: string): Promise<void> {
await page.evaluate((t) => localStorage.setItem('token', t), token);
}
/** Vyčistí stav pizza dne pro zadaný dayIndex (0=pondělí…4=pátek) přes dev API. */
export async function clearPizzaDay(request: APIRequestContext): Promise<void> {
const today = new Date('2025-01-10'); // MOCK_DATA pins to Friday = dayIndex 4
/** Vyčistí stav dne pro zadaný dayIndex (0=pondělí…4=pátek) přes dev API.
* /api/dev/* vyžaduje JWT nejdřív získáme token přes /api/login.
*/
export async function clearDay(request: APIRequestContext, dayIndex = 4): Promise<void> {
const loginResp = await request.post('/api/login', { data: {} });
const token = await loginResp.json() as string;
await request.post('/api/dev/clear', {
headers: { 'Content-Type': 'application/json', 'remote-user': 'e2e-user' },
data: { dayIndex: 4 },
headers: { Authorization: `Bearer ${token}` },
data: { dayIndex },
});
}
+2 -3
View File
@@ -1,10 +1,9 @@
import { test, expect } from '@playwright/test';
import { clearDay } from './helpers';
test.beforeEach(async ({ page, request }) => {
// Vyčistíme volby dne, aby testy neovlivnily navzájem
await request.post('/api/dev/clear', {
data: { dayIndex: 4 },
});
await clearDay(request);
await page.goto('/');
await page.waitForLoadState('networkidle');
// Počkáme, až se zobrazí volba stravování
+2 -1
View File
@@ -1,11 +1,12 @@
import { test, expect } from '@playwright/test';
import { clearDay } from './helpers';
// Pizza day testy musí běžet sekvenčně (sdílejí stav mock dne)
test.describe.serial('pizza day životní cyklus', () => {
test.beforeEach(async ({ request }) => {
// Vyčistíme data mock dne před každým testem
await request.post('/api/dev/clear', { data: { dayIndex: 4 } });
await clearDay(request);
});
test('zobrazí sekci Pizza Day bez aktivního dne', async ({ page }) => {