Files
cannamanage/cannamanage-frontend/e2e/integration/04-distributions.spec.ts
T
Patrick Plate 776149e7d3 test: add full-stack Playwright integration test infrastructure
Sprint 12 Phase 2: Real integration tests with seed DB
- R__seed_test_data.sql (Flyway repeatable, 7 members, strains, batches, docs, board, events)
- TestResetController (profile-gated per-test DB reset)
- docker-compose.test.yml (self-contained, tmpfs Postgres)
- Dockerfile.playwright (v1.60.0, pre-installed deps)
- 13 integration spec files, 70+ test cases (@smoke + @full)
- seed-constants.ts, selectors.ts, api-client.ts test helpers
2026-06-18 14:43:16 +02:00

60 lines
1.8 KiB
TypeScript

import { expect, test } from "@playwright/test"
import { ApiClient } from "../api-client"
import { SEED } from "../seed-constants"
import { SEL } from "../selectors"
const apiClient = new ApiClient()
test.describe("Distributions Page @smoke", () => {
test.beforeEach(async () => {
await apiClient.login(SEED.admin.email, SEED.admin.password)
await apiClient.resetDb()
})
test("displays recent distributions from seed", async ({ page }) => {
await page.goto("/distributions")
// Verify distributions table/list is visible
await expect(
page.locator(SEL.distributions.table).or(page.getByRole("table"))
).toBeVisible()
})
test("date filter works", async ({ page }) => {
await page.goto("/distributions")
// Look for filter buttons/tabs for today/week/month/all
const todayFilter = page.getByRole("button", { name: /heute|today/i })
const allFilter = page.getByRole("button", { name: /alle|all/i })
if (await todayFilter.isVisible()) {
await todayFilter.click()
// Page should update (no error)
await expect(page.locator("body")).toBeVisible()
}
if (await allFilter.isVisible()) {
await allFilter.click()
await expect(page.locator("body")).toBeVisible()
}
})
test("new distribution button navigates to form", async ({ page }) => {
await page.goto("/distributions")
const newBtn = page
.locator(SEL.distributions.newButton)
.or(page.getByRole("link", { name: /neue ausgabe|new/i }))
await expect(newBtn).toBeVisible()
await newBtn.click()
await page.waitForURL(/\/distributions\/new/)
})
test("shows gram total display", async ({ page }) => {
await page.goto("/distributions")
// The page should show some kind of total/summary
await expect(
page.getByText(/gramm|gesamt|total/i).first()
).toBeVisible()
})
})