776149e7d3
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
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
import { expect, test } from "@playwright/test"
|
|
|
|
import { ApiClient } from "../api-client"
|
|
import { SEED } from "../seed-constants"
|
|
|
|
const apiClient = new ApiClient()
|
|
|
|
test.describe("Grow Page @full", () => {
|
|
test.beforeEach(async () => {
|
|
await apiClient.login(SEED.admin.email, SEED.admin.password)
|
|
await apiClient.resetDb()
|
|
})
|
|
|
|
test("shows seed grow entries", async ({ page }) => {
|
|
await page.goto("/grow")
|
|
await expect(
|
|
page.getByText("Northern Lights Batch #2")
|
|
).toBeVisible()
|
|
await expect(page.getByText("CBD Outdoor")).toBeVisible()
|
|
})
|
|
|
|
test("displays grow stages", async ({ page }) => {
|
|
await page.goto("/grow")
|
|
// Should show VEGETATIVE and SEEDLING stage indicators
|
|
await expect(
|
|
page
|
|
.getByText(/vegetativ|vegetative/i)
|
|
.first()
|
|
.or(page.locator("[data-testid*='stage-VEGETATIVE']").first())
|
|
).toBeVisible()
|
|
await expect(
|
|
page
|
|
.getByText(/sämling|seedling/i)
|
|
.first()
|
|
.or(page.locator("[data-testid*='stage-SEEDLING']").first())
|
|
).toBeVisible()
|
|
})
|
|
|
|
test("stage progress indicators shown", async ({ page }) => {
|
|
await page.goto("/grow")
|
|
// Look for progress bars or step indicators
|
|
const progressIndicators = page
|
|
.locator("[role='progressbar']")
|
|
.or(page.locator("[data-testid*='progress']"))
|
|
.or(page.locator("[data-testid*='stage-indicator']"))
|
|
|
|
const count = await progressIndicators.count()
|
|
expect(count).toBeGreaterThanOrEqual(1)
|
|
})
|
|
|
|
test("new grow button links to correct path", async ({ page }) => {
|
|
await page.goto("/grow")
|
|
const newBtn = page
|
|
.getByRole("link", { name: /neuer grow|new grow|anlegen/i })
|
|
.or(page.locator('[data-testid="grow-new-button"]'))
|
|
.or(page.getByRole("button", { name: /neuer grow|new grow|anlegen/i }))
|
|
|
|
await expect(newBtn).toBeVisible()
|
|
await newBtn.click()
|
|
await page.waitForURL(/\/grow\/new/)
|
|
})
|
|
|
|
test("click on entry navigates to detail page", async ({ page }) => {
|
|
await page.goto("/grow")
|
|
|
|
// Click on the first grow entry
|
|
const entry = page
|
|
.getByText("Northern Lights Batch #2")
|
|
.or(page.locator("[data-testid*='grow-entry']").first())
|
|
await entry.click()
|
|
|
|
// Should navigate to /grow/[id]
|
|
await page.waitForURL(/\/grow\/[a-zA-Z0-9-]+/)
|
|
await expect(page.locator("body")).toBeVisible()
|
|
})
|
|
})
|