import { expect, test } from "@playwright/test"; import { loginViaUi } from "../support/login-via-ui"; import { createCustomerViaUi } from "./support/create-customer-via-ui"; test("CUSTOMERS-UPDATE-001: modifica un cliente propio y conserva el cambio tras recargar", async ({ page, }, testInfo) => { await loginViaUi(page); const customer = await createCustomerViaUi(page, testInfo); const updatedName = `${customer.name} updated`; await page.locator('input[name="name"]').fill(updatedName); const responsePromise = page.waitForResponse( (response) => response.request().method() === "PUT" && new URL(response.url()).pathname.endsWith(`/customers/${customer.id}`) ); await page.getByTestId("submit-button").click(); const response = await responsePromise; expect(response.status()).toBe(200); await expect(page).toHaveURL((url) => url.pathname === `/customers/${customer.id}/`); await expect(page.locator("#customer-view-name")).toHaveText(updatedName); await page.reload(); await expect(page.locator("#customer-view-name")).toHaveText(updatedName); });