From 8ed2095c33f3d920975a0e3fc057c32be8b8ac65 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 5 Aug 2025 16:43:32 +0200 Subject: [PATCH] Admin test: wait for cookies to be set --- tests/admin.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/admin.test.ts b/tests/admin.test.ts index 1a46700..34130dd 100644 --- a/tests/admin.test.ts +++ b/tests/admin.test.ts @@ -1,4 +1,5 @@ import { test, expect } from "./backend-fixture.js"; +import { setTimeout as sleep } from "node:timers/promises"; test.beforeEach(async ({ page, backend }) => { await page.goto(backend.url); @@ -8,6 +9,9 @@ test.beforeEach(async ({ page, backend }) => { await page.getByPlaceholder("text").press("Tab"); await page.getByPlaceholder("password").fill("adminadmin"); await page.getByRole("button", { name: "Wyƛlij" }).click(); + while (JSON.stringify(await page.context().cookies()) == "[]") { + await sleep(200); + } }); test("Basic flow of adding a navbar link", async ({ page }) => {