Skip to content

Commit

Permalink
Add e2e test for live timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Onatcer committed Nov 15, 2024
1 parent f49f7b2 commit 5b27853
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions e2e/timetracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}) => {
Expand Down

0 comments on commit 5b27853

Please sign in to comment.