-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from solidtime-io/feature/add_time_overview
Feature/add time overview
- Loading branch information
Showing
52 changed files
with
2,461 additions
and
973 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { expect, Page } from '@playwright/test'; | ||
|
||
export async function startOrStopTimerWithButton(page: Page) { | ||
await page | ||
.locator('[data-testid="dashboard_timer"] [data-testid="timer_button"]') | ||
.click(); | ||
} | ||
|
||
export async function assertThatTimerHasStarted(page: Page) { | ||
await page.locator( | ||
'[data-testid="dashboard_timer"] [data-testid="timer_button"].bg-red-400/80' | ||
); | ||
} | ||
|
||
export function newTimeEntryResponse(page: Page) { | ||
return page.waitForResponse(async (response) => { | ||
return ( | ||
response.status() === 201 && | ||
(await response.headerValue('Content-Type')) === | ||
'application/json' && | ||
(await response.json()).data.id !== null && | ||
(await response.json()).data.start !== null && | ||
(await response.json()).data.end === null && | ||
(await response.json()).data.project_id === null && | ||
(await response.json()).data.description === '' && | ||
(await response.json()).data.task_id === null && | ||
(await response.json()).data.duration === null && | ||
(await response.json()).data.user_id !== null && | ||
JSON.stringify((await response.json()).data.tags) === | ||
JSON.stringify([]) | ||
); | ||
}); | ||
} | ||
|
||
export async function assertThatTimerIsStopped(page: Page) { | ||
await expect( | ||
page.locator( | ||
'[data-testid="dashboard_timer"] [data-testid="timer_button"]' | ||
) | ||
).toHaveClass(/bg-accent-300\/50/); | ||
} | ||
|
||
export async function stoppedTimeEntryResponse(page: Page) { | ||
return page.waitForResponse(async (response) => { | ||
return ( | ||
response.status() === 200 && | ||
(await response.headerValue('Content-Type')) === | ||
'application/json' && | ||
(await response.json()).data.id !== null && | ||
(await response.json()).data.start !== null && | ||
(await response.json()).data.end !== null && | ||
(await response.json()).data.project_id === null && | ||
(await response.json()).data.description === '' && | ||
(await response.json()).data.task_id === null && | ||
(await response.json()).data.duration !== null && | ||
(await response.json()).data.user_id !== null && | ||
JSON.stringify((await response.json()).data.tags) === | ||
JSON.stringify([]) | ||
); | ||
}); | ||
} |
Oops, something went wrong.