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
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:
@@ -11,11 +11,14 @@ export async function loginViaApi(page: Page, login: string): Promise<void> {
|
|||||||
await page.evaluate((t) => localStorage.setItem('token', t), token);
|
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. */
|
/** Vyčistí stav dne pro zadaný dayIndex (0=pondělí…4=pátek) přes dev API.
|
||||||
export async function clearPizzaDay(request: APIRequestContext): Promise<void> {
|
* /api/dev/* vyžaduje JWT – nejdřív získáme token přes /api/login.
|
||||||
const today = new Date('2025-01-10'); // MOCK_DATA pins to Friday = dayIndex 4
|
*/
|
||||||
|
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', {
|
await request.post('/api/dev/clear', {
|
||||||
headers: { 'Content-Type': 'application/json', 'remote-user': 'e2e-user' },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
data: { dayIndex: 4 },
|
data: { dayIndex },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
|
import { clearDay } from './helpers';
|
||||||
|
|
||||||
test.beforeEach(async ({ page, request }) => {
|
test.beforeEach(async ({ page, request }) => {
|
||||||
// Vyčistíme volby dne, aby testy neovlivnily navzájem
|
// Vyčistíme volby dne, aby testy neovlivnily navzájem
|
||||||
await request.post('/api/dev/clear', {
|
await clearDay(request);
|
||||||
data: { dayIndex: 4 },
|
|
||||||
});
|
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
// Počkáme, až se zobrazí volba stravování
|
// Počkáme, až se zobrazí volba stravování
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
|
import { clearDay } from './helpers';
|
||||||
|
|
||||||
// Pizza day testy musí běžet sekvenčně (sdílejí stav mock dne)
|
// Pizza day testy musí běžet sekvenčně (sdílejí stav mock dne)
|
||||||
test.describe.serial('pizza day životní cyklus', () => {
|
test.describe.serial('pizza day životní cyklus', () => {
|
||||||
|
|
||||||
test.beforeEach(async ({ request }) => {
|
test.beforeEach(async ({ request }) => {
|
||||||
// Vyčistíme data mock dne před každým testem
|
// 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 }) => {
|
test('zobrazí sekci Pizza Day bez aktivního dne', async ({ page }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user