From ed0f2110717c1bea006fc3176e84fb9fab0f748e Mon Sep 17 00:00:00 2001 From: Benjamin Cavy Date: Wed, 30 Oct 2024 00:08:16 +0100 Subject: [PATCH] fix: frontend tests --- izanami-frontend/tests/global.setup.ts | 4 +++- izanami-frontend/tests/projects.spec.ts | 2 ++ izanami-frontend/tests/webhooks.spec.ts | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/izanami-frontend/tests/global.setup.ts b/izanami-frontend/tests/global.setup.ts index 820572e0c..cd164996e 100644 --- a/izanami-frontend/tests/global.setup.ts +++ b/izanami-frontend/tests/global.setup.ts @@ -2,11 +2,13 @@ import { test as setup, expect } from "@playwright/test"; import { STORAGE_STATE } from "../playwright.config"; import { cleanup } from "./utils"; +export const PASSWORD = "ADMIN_DEFAULT_PASSWORD"; + setup("do login", async ({ page }) => { await cleanup(); await page.goto("/"); await page.getByLabel("Username").fill("RESERVED_ADMIN_USER"); - await page.getByLabel("Password").fill("ADMIN_DEFAULT_PASSWORD"); + await page.getByLabel("Password").fill(PASSWORD); await page.getByRole("button", { name: "Login" }).click(); // Wait until the page actually signs in. diff --git a/izanami-frontend/tests/projects.spec.ts b/izanami-frontend/tests/projects.spec.ts index 3550f3d5e..5566f8ab9 100644 --- a/izanami-frontend/tests/projects.spec.ts +++ b/izanami-frontend/tests/projects.spec.ts @@ -1,6 +1,7 @@ import { Page } from "@playwright/test"; import { test, expect } from "./izanami-test"; import { testBuilder, testTenant, testproject } from "./testBuilder"; +import { PASSWORD } from "./global.setup"; test.use({ headless: true, @@ -54,6 +55,7 @@ test.describe("Project setting screen should", () => { await page.goto(`/tenants/${tenantName}/projects/project`); await page.getByLabel("Project settings").click(); await page.getByRole("button", { name: "Delete project" }).click(); + await page.getByLabel("Password").fill(PASSWORD); await page.getByRole("button", { name: "Confirm" }).click(); await expect(page).toHaveURL(`/tenants/${tenantName}`); await expect(page.getByRole("link", { name: "foo" })).toHaveCount(0); diff --git a/izanami-frontend/tests/webhooks.spec.ts b/izanami-frontend/tests/webhooks.spec.ts index b0e1783b1..1b5555827 100644 --- a/izanami-frontend/tests/webhooks.spec.ts +++ b/izanami-frontend/tests/webhooks.spec.ts @@ -7,6 +7,7 @@ import { testWebhook, testproject, } from "./testBuilder"; +import { PASSWORD } from "./global.setup"; test.use({ headless: true, @@ -124,6 +125,7 @@ test.describe("Webhook screen should", () => { await page.goto(`/tenants/${tenantName}/webhooks`); await webhookAction(page, "Delete"); + await page.getByLabel("Password").fill(PASSWORD); await page.getByRole("button", { name: "Confirm" }).click(); await expect(