[Playwright] Mock date in helper functions

This commit is contained in:
Aaro Koivukangas
2026-08-09 01:48:41 +03:00
committed by Aaro Koivukangas
parent 4e9358e69e
commit c3b8a8e224
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import { test, expect, Page } from '@playwright/test'
import { checkTableStats, init } from './support/commands'
import { checkTableStats, init, testMockTime } from './support/commands'
const getEmptyYears = (isAcademicYear = false) => {
const today = new Date()
const today = new Date(testMockTime)
const latestYear = isAcademicYear && today.getMonth() < 7 ? today.getFullYear() - 1 : today.getFullYear()
const years = []
for (let year = latestYear; year >= 2024; year--) {
+1
View File
@@ -89,6 +89,7 @@ export const init = async (page: Page, path: string, userId: UserId = 'basic', c
})
})
await page.clock.install({ time: testMockTime })
await page.goto(path || '/')
}