From ef4323b275248f19f0d95393b0947c1bc39f0e90 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 5 Mar 2024 14:29:27 +0100 Subject: [PATCH] fix ci --- frontend/tests/log.spec.ts | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/frontend/tests/log.spec.ts b/frontend/tests/log.spec.ts index c8638a8..f0d8f7a 100644 --- a/frontend/tests/log.spec.ts +++ b/frontend/tests/log.spec.ts @@ -75,13 +75,15 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => { await page.goto("/log"); await page.locator("div:nth-child(2) > .border-0").click(); + // Add a minute - await page.locator('#arrivaljs').click(); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('ArrowUp'); + const datetimeSelector = '#arrivaljs'; + const currentValue = await page.$eval(datetimeSelector, el => el.value); + const currentDate = new Date(currentValue); + currentDate.setMinutes(currentDate.getMinutes() + 1); + currentDate.setHours(currentDate.getHours() + 1); + const newDatetime = currentDate.toISOString().slice(0, 16); + await page.$eval(datetimeSelector, (el, value) => el.value = value, newDatetime); await page.getByRole("combobox", { name: "Destination" }).click(); await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim"); @@ -159,12 +161,13 @@ test("Kiosk can start and finish trip", async ({ page }, testInfo) => { await page.locator('div:nth-child(2) > .pt-2 > div > div > div:nth-child(2) > .border-0').click(); // 2 trips currently running, try to close second one // Add a minute - await page.locator('#arrivaljs').click(); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('Tab'); - await page.locator('#arrivaljs').press('ArrowUp'); + const datetimeSelector = '#arrivaljs'; + const currentValue = await page.$eval(datetimeSelector, el => el.value); + const currentDate = new Date(currentValue); + currentDate.setMinutes(currentDate.getMinutes() + 1); + currentDate.setHours(currentDate.getHours() + 1); + const newDatetime = currentDate.toISOString().slice(0, 16); + await page.$eval(datetimeSelector, (el, value) => el.value = value, newDatetime); await page.getByRole("combobox", { name: "Destination" }).click(); await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim"); -- 2.45.2