make sure e2e tests use the visible timer button only

This commit is contained in:
Gregor Vostrak
2026-02-12 17:43:04 +01:00
parent 0e63ecb520
commit 38457cae4d
5 changed files with 43 additions and 13 deletions

View File

@@ -2,12 +2,19 @@ import { expect } from '@playwright/test';
import type { Page } from '@playwright/test';
export async function startOrStopTimerWithButton(page: Page) {
await page.locator('[data-testid="dashboard_timer"] [data-testid="timer_button"]').click();
await page
.getByTestId('dashboard_timer')
.getByTestId('timer_button')
.and(page.locator(':visible'))
.click();
}
export async function assertThatTimerHasStarted(page: Page) {
await expect(
page.locator('[data-testid="dashboard_timer"] [data-testid="timer_button"]')
page
.getByTestId('dashboard_timer')
.getByTestId('timer_button')
.and(page.locator(':visible'))
).toHaveClass(/bg-red-400\/80/);
}
@@ -34,7 +41,10 @@ export function newTimeEntryResponse(
export async function assertThatTimerIsStopped(page: Page) {
await expect(
page.locator('[data-testid="dashboard_timer"] [data-testid="timer_button"]')
page
.getByTestId('dashboard_timer')
.getByTestId('timer_button')
.and(page.locator(':visible'))
).toHaveClass(/bg-accent-300\/70/);
}