feat(T07): Warenkorb & Mietanfrage frontend – cart store, drawer, pages, form, tests

This commit is contained in:
Implementation Engineer
2026-07-10 01:32:19 +02:00
parent e220ff7db9
commit a1bba48cd7
19 changed files with 1874 additions and 92 deletions
+68
View File
@@ -0,0 +1,68 @@
import { test, expect } from "@playwright/test";
test.describe("Cart Flow", () => {
test("should render warenkorb page with heading", async ({ page }) => {
await page.goto("/warenkorb");
await expect(page.locator("h1")).toContainText("Warenkorb");
});
test("should show empty state when cart is empty", async ({ page }) => {
await page.goto("/warenkorb");
await expect(page.getByTestId("warenkorb-empty")).toBeVisible();
await expect(page.getByTestId("warenkorb-empty-cta")).toBeVisible();
});
test("should have link to mietkatalog from empty state", async ({ page }) => {
await page.goto("/warenkorb");
const cta = page.getByTestId("warenkorb-empty-cta");
await expect(cta).toHaveAttribute("href", "/mietkatalog");
});
test("should show header cart icon", async ({ page }) => {
await page.goto("/");
await expect(page.getByTestId("header-cart-button")).toBeVisible();
});
test("should open cart drawer when header cart icon clicked", async ({ page }) => {
await page.goto("/");
await page.getByTestId("header-cart-button").click();
await expect(page.getByTestId("cart-drawer")).toBeVisible();
});
test("should show empty state in cart drawer", async ({ page }) => {
await page.goto("/");
await page.getByTestId("header-cart-button").click();
await expect(page.getByTestId("cart-drawer")).toBeVisible();
await expect(page.locator("text=Ihr Warenkorb ist leer")).toBeVisible();
});
test("should close cart drawer on backdrop click", async ({ page }) => {
await page.goto("/");
await page.getByTestId("header-cart-button").click();
await expect(page.getByTestId("cart-drawer")).toBeVisible();
await page.getByTestId("cart-drawer-backdrop").click();
await expect(page.getByTestId("cart-drawer")).not.toBeVisible();
});
test("should have checkout link in cart drawer", async ({ page }) => {
await page.goto("/");
await page.getByTestId("header-cart-button").click();
await expect(page.getByTestId("cart-drawer")).toBeVisible();
const checkout = page.getByTestId("cart-drawer-checkout");
await expect(checkout).toHaveAttribute("href", "/mietanfrage");
});
test("should have view cart link in cart drawer", async ({ page }) => {
await page.goto("/");
await page.getByTestId("header-cart-button").click();
await expect(page.getByTestId("cart-drawer")).toBeVisible();
const viewCart = page.getByTestId("cart-drawer-view-cart");
await expect(viewCart).toHaveAttribute("href", "/warenkorb");
});
test("should have mobile cart button", async ({ page }) => {
await page.goto("/");
await page.setViewportSize({ width: 375, height: 667 });
await expect(page.getByTestId("header-cart-button-mobile")).toBeVisible();
});
});