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() }) })