feat: přesun Pizza day do Objednání – Pizza Chefie jako obchod
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 28s
CI / Build server (push) Successful in 31s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Canceled after 1m23s
CI / Build and push Docker image (push) Canceled after 0s
CI / Notify (push) Canceled after 0s
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 28s
CI / Build server (push) Successful in 31s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Canceled after 1m23s
CI / Build and push Docker image (push) Canceled after 0s
CI / Notify (push) Canceled after 0s
Pizza Chefie je nový zdroj nabídky skupinových objednávek (vedle Bolt Food a Wolt) pro obchod s URL pizzachefie.cz. Stahuje se celá nabídka: pizzy po velikostech seskupené pod názvem pizzy, pinsy, těstoviny, Čína, saláty, nápoje a dezerty. Ceny včetně krabice (13 Kč u jídel, ověřeno v košíku webu). Lze tak mít víc objednávek z Chefie za den se vším, co skupiny umí. Při přechodu Chefie skupiny do stavu Objednáno jde notifikace „Objednána pizza“ jen členům skupiny (callNotifikace umí předat příjemce). Na hlavní stránce už nejde založit Pizza day ani zvolit „Pizza day“ (kromě toho, kdo ji už má); dobíhající Pizza day jde dokončit. Odebráno tlačítko „Jdeme na oběd!“. Kód Pizza day na serveru zůstává do pozdějšího úklidu.
This commit is contained in:
18 files changed
+566
-167
No files matched your search
@@ -1,83 +0,0 @@
|
||||
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 clearDay(request);
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
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"
|
||||
await page.locator('select').selectOption({ label: 'Pizza day' });
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Přijmeme všechny window.confirm() dialogy v celém testu (vytvoření i doručení pizza dne)
|
||||
page.on('dialog', dialog => dialog.accept());
|
||||
|
||||
// --- CREATED ---
|
||||
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
|
||||
// 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();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('.pizza-section')).toContainText('spravován uživatelem', { timeout: 5_000 });
|
||||
|
||||
// Přidáme pizzu přes API (obejde komplex SelectSearch)
|
||||
const token = await page.evaluate(() => localStorage.getItem('token'));
|
||||
const addResp = await page.request.post('/api/pizzaDay/add', {
|
||||
headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
data: { pizzaIndex: 0, pizzaSizeIndex: 0 },
|
||||
});
|
||||
expect(addResp.ok()).toBeTruthy();
|
||||
|
||||
// Reload – server aktualizoval data přes WebSocket, ale reload je jistější
|
||||
await page.reload();
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// --- LOCK ---
|
||||
const lockBtn = page.locator('.pizza-section button', { hasText: 'Uzamknout' });
|
||||
await expect(lockBtn).toBeEnabled({ timeout: 5_000 });
|
||||
await lockBtn.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('.pizza-section')).toContainText('uzamčeny', { timeout: 5_000 });
|
||||
|
||||
// --- ORDERED ---
|
||||
const orderBtn = page.locator('.pizza-section button', { hasText: 'Objednáno' });
|
||||
await expect(orderBtn).toBeEnabled({ timeout: 5_000 });
|
||||
await orderBtn.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('.pizza-section')).toContainText('objednány', { timeout: 5_000 });
|
||||
|
||||
// --- DELIVERED ---
|
||||
const deliverBtn = page.locator('.pizza-section button', { hasText: 'Doručeno' });
|
||||
await expect(deliverBtn).toBeVisible({ timeout: 5_000 });
|
||||
await deliverBtn.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('.pizza-section')).toContainText('doručeny', { timeout: 5_000 });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user