diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7bc7a03d..85bbc184 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -58,6 +58,9 @@ jobs: timeout 30s bash -c 'until curl -f http://localhost:4096/healthcheck; do echo "Waiting for server..." && sleep 2; done' continue-on-error: false + - name: Make data directory writable + run: sudo chmod -R 777 data + - name: Run Playwright tests run: bun run test:e2e diff --git a/e2e/0001-initial-setup.spec.ts b/e2e/0001-initial-setup.spec.ts index 5a14323e..38251896 100644 --- a/e2e/0001-initial-setup.spec.ts +++ b/e2e/0001-initial-setup.spec.ts @@ -1,13 +1,13 @@ import fs from "fs"; import { test, expect } from "@playwright/test"; import { resetDatabase } from "./helpers/db"; -import { createTestAccount } from "./helpers/account"; + +// TODO: Run these tests with different users once multi-user support is added // Run tests in serial mode to avoid conflicts during onboarding test.describe.configure({ mode: "serial" }); -test.beforeEach(async () => { - console.log("Resetting database..."); +test.beforeAll(async () => { await resetDatabase(); }); @@ -36,7 +36,13 @@ test("user can register a new account", async ({ page }) => { }); test("user can download recovery key", async ({ page }) => { - await createTestAccount(page); + await page.goto("/login"); + + await page.getByRole("textbox", { name: "Username" }).fill("test"); + await page.getByRole("textbox", { name: "Password" }).fill("password"); + await page.getByRole("button", { name: "Login" }).click(); + + await expect(page.getByText("Download Your Recovery Key")).toBeVisible(); await page.getByRole("textbox", { name: "Confirm Your Password" }).fill("test"); await page.getByRole("button", { name: "Download Recovery Key" }).click(); @@ -60,8 +66,6 @@ test("user can download recovery key", async ({ page }) => { }); test("can't create another admin user after initial setup", async ({ page }) => { - await createTestAccount(page); - await page.goto("/onboarding"); await page.getByRole("textbox", { name: "Email" }).click();