fix(shopping-e2e): beforeEach-Cleanup + checked-Count statt first-Row
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 32s

This commit is contained in:
hsiegeln
2026-04-22 08:57:17 +02:00
parent a15390f4b8
commit 42b1aed023

View File

@@ -3,6 +3,10 @@ import { setActiveProfile, HENDRIK_ID } from './fixtures/profile';
import { clearShoppingCart } from './fixtures/api-cleanup'; import { clearShoppingCart } from './fixtures/api-cleanup';
test.describe('Einkaufsliste E2E', () => { test.describe('Einkaufsliste E2E', () => {
test.beforeEach(async ({ request }) => {
await clearShoppingCart(request);
});
test.afterEach(async ({ request }) => { test.afterEach(async ({ request }) => {
await clearShoppingCart(request); await clearShoppingCart(request);
}); });
@@ -71,9 +75,13 @@ test.describe('Einkaufsliste E2E', () => {
const badgeTextBefore = await countBadge.textContent(); const badgeTextBefore = await countBadge.textContent();
const numBefore = Number((badgeTextBefore ?? '').replace(/\D+/g, '')) || 0; const numBefore = Number((badgeTextBefore ?? '').replace(/\D+/g, '')) || 0;
const firstRow = page.locator('label.row').first(); // Anzahl abgehakter Zeilen vorher (sollte 0 sein, weil beforeEach cart leert)
await firstRow.locator('input[type=checkbox]').check(); const checkedBefore = await page.locator('label.row.checked').count();
await expect(firstRow).toHaveClass(/checked/); // Erste Zeile abhaken — Playwright laesst die Checkbox direkt interagieren
await page.locator('label.row').first().locator('input[type=checkbox]').check();
// Nach Store-Refresh sortiert SQL "ORDER BY checked ASC" abgehakte ans
// Ende, also pruefen wir die Gesamtzahl, nicht die Position.
await expect(page.locator('label.row.checked')).toHaveCount(checkedBefore + 1);
// Badge muss sinken (nach Store-Refresh) // Badge muss sinken (nach Store-Refresh)
await expect await expect