From 711fb4838bc1603cf77ce7ca0199d891a0562e4e Mon Sep 17 00:00:00 2001 From: kristianwind Date: Mon, 24 Aug 2026 08:19:17 +0200 Subject: [PATCH] test(e2e): the calendar test counted other tests' tasks as its own MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The calendar test asserted `[data-date=day] .tevent` had a count of exactly one — the mocked meeting — after dragging its task to the next day. That count assumed the day held nothing but this test's own events. It does not: the suite shares one database, and an earlier test drags a task across a month boundary, which on some dates lands a timed task on this very day. A timed task renders as a `.tevent` too, so the count was two, and the test failed — but only in the full run, and only when the date arithmetic put the two tests on the same cell. Alone it passed, which is exactly the shape of a shared-state collision rather than a real bug. Named, not counted: assert the meeting is still there and the task is no longer in the day's column, which is what "the events stayed, the task moved" actually means — and is true however full another test left the day. Same for the all-day band. No product code changed; the drag and everything it checks are untouched. Co-Authored-By: Claude Opus 5 --- web/e2e/smoke.spec.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/web/e2e/smoke.spec.js b/web/e2e/smoke.spec.js index b11bf25..53ddd69 100644 --- a/web/e2e/smoke.spec.js +++ b/web/e2e/smoke.spec.js @@ -1202,8 +1202,18 @@ test('kalenderen viser Googles begivenheder over egne opgaver, og kun opgaven ka await expect(page.locator(`[data-date="${next}"] .tevent`).getByText('vande blomster')).toBeVisible(); await expect(band.getByText('vande blomster')).toBeHidden(); // The events stayed where they were; a rescheduled task moves nothing else. - await expect(cell.locator('.tevent')).toHaveCount(1); - await expect(band.locator('.event')).toHaveCount(1); + // + // Named, not counted. A raw `.tevent` count here assumes this day holds nothing + // but this test's own events — and it does not: the suite shares one database, + // so an earlier test that drags a task across a month boundary can leave a timed + // task on this very day, and a timed task is a `.tevent` too. Counting them all + // made this pass alone and fail in the full run, on whatever date the arithmetic + // happened to land the two tests on the same cell. Asserting the meeting stayed + // and the task left is the thing the test actually means, and it is true however + // full somebody else left the day. + await expect(cell.locator('.tevent').filter({ hasText: 'Bestyrelsesmøde' })).toHaveCount(1); + await expect(cell.locator('.tevent').filter({ hasText: 'vande blomster' })).toHaveCount(0); + await expect(band.locator('.event').filter({ hasText: 'Feriedag' })).toHaveCount(1); expect(trouble).toEqual([]); });