Admin test: wait for cookies to be set

This commit is contained in:
Kuba Orlik 2025-08-05 16:43:32 +02:00
parent 36dbe94113
commit 8ed2095c33

View File

@ -1,4 +1,5 @@
import { test, expect } from "./backend-fixture.js"; import { test, expect } from "./backend-fixture.js";
import { setTimeout as sleep } from "node:timers/promises";
test.beforeEach(async ({ page, backend }) => { test.beforeEach(async ({ page, backend }) => {
await page.goto(backend.url); await page.goto(backend.url);
@ -8,6 +9,9 @@ test.beforeEach(async ({ page, backend }) => {
await page.getByPlaceholder("text").press("Tab"); await page.getByPlaceholder("text").press("Tab");
await page.getByPlaceholder("password").fill("adminadmin"); await page.getByPlaceholder("password").fill("adminadmin");
await page.getByRole("button", { name: "Wyślij" }).click(); 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 }) => { test("Basic flow of adding a navbar link", async ({ page }) => {