mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
[Playwright] Mock date in helper functions
This commit is contained in:
committed by
Aaro Koivukangas
parent
4e9358e69e
commit
c3b8a8e224
@@ -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--) {
|
||||
|
||||
@@ -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 || '/')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user