From 5b278535463834f31800fb66928893939b7ef673 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Fri, 15 Nov 2024 18:04:39 +0100 Subject: [PATCH] Add e2e test for live timer --- e2e/timetracker.spec.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/e2e/timetracker.spec.ts b/e2e/timetracker.spec.ts index 2ae2f94b..67877533 100644 --- a/e2e/timetracker.spec.ts +++ b/e2e/timetracker.spec.ts @@ -57,6 +57,38 @@ test('test that starting and stopping a timer with a description works', async ( await assertThatTimerIsStopped(page); }); +test('test that starting the time entry starts the live timer and that it keeps running after reload', async ({ + page, +}) => { + await goToDashboard(page); + + await Promise.all([ + newTimeEntryResponse(page), + startOrStopTimerWithButton(page), + ]); + await assertThatTimerHasStarted(page); + await page.waitForTimeout(500); + const beforeTimerValue = await page + .getByTestId('time_entry_time') + .inputValue(); + await page.waitForTimeout(2000); + const afterWaitTimeValue = await page + .getByTestId('time_entry_time') + .inputValue(); + expect(afterWaitTimeValue).not.toEqual(beforeTimerValue); + await page.reload(); + await page.waitForTimeout(500); + + const afterReloadTimerValue = await page + .getByTestId('time_entry_time') + .inputValue(); + await page.waitForTimeout(2000); + const afterReloadAfterWaitTimerValue = await page + .getByTestId('time_entry_time') + .inputValue(); + expect(afterReloadTimerValue).not.toEqual(afterReloadAfterWaitTimerValue); +}); + test('test that starting and updating the description while running works', async ({ page, }) => {