/** * E2E — GST rate selection correctness on the PO line-items editor. * * Bug covered: GST-0PCT-FALLBACK (fixed 2026-05-26) * `parseFloat('0') || 0.18` is falsy, so selecting 0% GST silently fell back * to 18%. Fixed by changing the expression to an explicit null/empty-string * guard: `row.gstRate !== "" && row.gstRate != null ? parseFloat(row.gstRate) : 0.18` * * User story: S-01 (create PO, line items with correct GST calculation) * Acceptance criterion: selecting any GST rate (0 / 5 / 12 / 18 / 28 %) on a * line item must produce the mathematically correct Grand Total in the footer. * * Preconditions: * - Dev server running at http://localhost:3000 * - Seed data present (at least one vessel and account selectable) * - tech@pelagia.local / tech1234 credentials valid */ import { test, expect, type Page } from "@playwright/test"; import { login, fillPoHeader, USERS } from "./helpers/login"; // ── Helpers ────────────────────────────────────────────────────────────────── /** Selects a GST rate in the first line-item row's GST dropdown. */ async function selectGstRate(page: Page, value: string): Promise { const lineItemsSection = page.locator("section").filter({ has: page.getByRole("heading", { name: /line items/i }), }); const firstRow = lineItemsSection.locator("tbody tr").first(); // The GST select is the second