chore(testing): pause test execution and prep deterministic e2e admin seed
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
import { expect, test } from "@playwright/test"
|
||||
|
||||
const E2E_ADMIN_EMAIL = process.env.CMS_E2E_ADMIN_EMAIL ?? "e2e-admin@cms.local"
|
||||
const E2E_ADMIN_PASSWORD = process.env.CMS_E2E_ADMIN_PASSWORD ?? "e2e-admin-password"
|
||||
|
||||
async function ensureE2EAdminSession(page: import("@playwright/test").Page) {
|
||||
const commissionsHeading = page.getByRole("heading", { name: /commissions/i })
|
||||
|
||||
await page.goto("http://127.0.0.1:3001/commissions")
|
||||
if (await commissionsHeading.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
return
|
||||
}
|
||||
|
||||
await page.goto("http://127.0.0.1:3001/login")
|
||||
await page.locator("#email").fill(E2E_ADMIN_EMAIL)
|
||||
await page.locator("#password").fill(E2E_ADMIN_PASSWORD)
|
||||
await page.getByRole("button", { name: /sign in/i }).click()
|
||||
await page.goto("http://127.0.0.1:3001/commissions")
|
||||
await expect(commissionsHeading).toBeVisible()
|
||||
}
|
||||
|
||||
test.describe("public rendering integration", () => {
|
||||
test("header exposes portfolio/news/commissions navigation", async ({ page }, testInfo) => {
|
||||
test.skip(testInfo.project.name !== "web-chromium")
|
||||
@@ -25,7 +44,7 @@ test.describe("public rendering integration", () => {
|
||||
test("commission form rejects invalid budget ranges", async ({ page }, testInfo) => {
|
||||
test.skip(testInfo.project.name !== "web-chromium")
|
||||
|
||||
await page.goto("/commissions")
|
||||
await page.goto("http://127.0.0.1:3000/commissions")
|
||||
await page.locator('input[name="customerName"]').fill("E2E Client")
|
||||
await page.locator('input[name="customerEmail"]').fill(`e2e-${Date.now()}@example.com`)
|
||||
await page.locator('input[name="title"]').fill("E2E Budget Validation")
|
||||
@@ -36,14 +55,14 @@ test.describe("public rendering integration", () => {
|
||||
await expect(page).toHaveURL(/\/commissions\?error=budget_range_invalid/)
|
||||
})
|
||||
|
||||
test("public commission form accepts valid submission", async ({ page }, testInfo) => {
|
||||
test.skip(testInfo.project.name !== "web-chromium")
|
||||
test("public commission submission is visible in admin board", async ({ page }, testInfo) => {
|
||||
test.skip(testInfo.project.name !== "admin-chromium")
|
||||
|
||||
const customerName = `E2E Public Customer ${Date.now()}`
|
||||
const commissionTitle = `E2E Public Commission ${Date.now()}`
|
||||
const customerEmail = `public-commission-${Date.now()}@example.com`
|
||||
|
||||
await page.goto("/commissions")
|
||||
await page.goto("http://127.0.0.1:3000/commissions")
|
||||
await page.locator('input[name="customerName"]').fill(customerName)
|
||||
await page.locator('input[name="customerEmail"]').fill(customerEmail)
|
||||
await page.locator('input[name="title"]').fill(commissionTitle)
|
||||
@@ -56,5 +75,10 @@ test.describe("public rendering integration", () => {
|
||||
|
||||
await expect(page).toHaveURL(/\/commissions\?notice=submitted/)
|
||||
await expect(page.getByText(/submitted|übermittelt|enviada|envoyée/i)).toBeVisible()
|
||||
|
||||
await ensureE2EAdminSession(page)
|
||||
await page.goto("http://127.0.0.1:3001/commissions")
|
||||
await expect(page.getByText(new RegExp(commissionTitle, "i"))).toBeVisible()
|
||||
await expect(page.getByText(new RegExp(customerName, "i"))).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user