30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { loginViaUi } from "../../support/login-via-ui";
|
|
|
|
import { createProformaViaUi } from "./support/create-proforma-via-ui";
|
|
|
|
test("CUSTOMER-INVOICES-PROFORMA-UPDATE-001: modifica referencia y descripción del borrador y comprueba persistencia", async ({
|
|
page,
|
|
}, testInfo) => {
|
|
await loginViaUi(page);
|
|
const proforma = await createProformaViaUi(page, testInfo);
|
|
const reference = `E2E ${proforma.token}`;
|
|
const description = `E2E updated draft ${proforma.token}`;
|
|
await page.locator('input[name="reference"]').fill(reference);
|
|
await page.locator('textarea[name="description"]').fill(description);
|
|
const responsePromise = page.waitForResponse(
|
|
(response) =>
|
|
response.request().method() === "PUT" &&
|
|
new URL(response.url()).pathname.endsWith(`/proformas/${proforma.id}`)
|
|
);
|
|
await page.getByTestId("submit-button").click();
|
|
expect((await responsePromise).status()).toBe(200);
|
|
await expect(page).toHaveURL((url) => url.pathname === `/proformas/${proforma.id}/edit`);
|
|
await expect(page.locator('input[name="reference"]')).toHaveValue(reference);
|
|
await expect(page.locator('textarea[name="description"]')).toHaveValue(description);
|
|
await page.reload();
|
|
await expect(page.locator('input[name="reference"]')).toHaveValue(reference);
|
|
await expect(page.locator('textarea[name="description"]')).toHaveValue(description);
|
|
});
|