import { expect, test } from "@playwright/test"; import { uniqueCustomerReference } from "../fixtures/quotes"; test("creates, edits and persists a quote line", async ({ page }) => { await page.goto("/quotes/add"); await page.locator('input[name="customer_reference"]').fill(uniqueCustomerReference()); await page.locator('textarea[name="customer_information"]').fill("E2E Customer"); await Promise.all([page.waitForURL(/\/quotes\/edit\/[\w-]+$/), page.locator('button[type="submit"]').click()]); await page.getByRole("button", { name: /AƱadir fila/i }).click(); await page.locator('textarea[name^="items."][name$=".description"]').last().fill("E2E Line"); await page.locator('input[name^="items."][name$=".quantity"]').last().fill("2"); await page.locator('input[name^="items."][name$=".unit_price"]').last().fill("100"); await Promise.all([ page.waitForResponse((response) => response.request().method() === "PUT" && /\/quotes\//.test(response.url()) && response.ok()), page.getByRole("button", { name: /^Guardar$/i }).click(), ]); await page.reload(); await expect(page.locator('textarea[name^="items."][name$=".description"]')).toContainText("E2E Line"); await expect(page.locator('input[name^="items."][name$=".quantity"]')).toHaveValue(/2/); await expect(page.locator('input[name^="items."][name$=".unit_price"]')).toHaveValue(/100/); });