28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
import { randomUUID } from "node:crypto";
|
|
|
|
import { expect, test } from "@playwright/test";
|
|
|
|
import { loginViaUi } from "../support/login-via-ui";
|
|
|
|
import { createCustomerViaUi } from "./support/create-customer-via-ui";
|
|
import { searchCustomersViaUi } from "./support/search-customers-via-ui";
|
|
|
|
test("CUSTOMERS-SEARCH-001: buscar por nombre incluye el cliente correcto y excluye el otro", async ({
|
|
page,
|
|
}, testInfo) => {
|
|
await loginViaUi(page);
|
|
const group = `e2esearch${randomUUID().replaceAll("-", "")}`;
|
|
const alpha = await createCustomerViaUi(page, testInfo, `E2E Alpha ${group}`);
|
|
const beta = await createCustomerViaUi(page, testInfo, `E2E Beta ${group}`);
|
|
await page.goto("/customers");
|
|
await searchCustomersViaUi(page, group);
|
|
await expect(page.getByTestId(`customer-edit-${alpha.id}`)).toBeVisible();
|
|
await expect(page.getByTestId(`customer-edit-${beta.id}`)).toBeVisible();
|
|
|
|
await searchCustomersViaUi(page, `Alpha ${group}`);
|
|
|
|
await expect(page.getByTestId(`customer-edit-${alpha.id}`)).toBeVisible();
|
|
await expect(page.getByTestId(`customer-edit-${beta.id}`)).toHaveCount(0);
|
|
await expect(page.locator('[data-testid^="customer-edit-"]')).toHaveCount(1);
|
|
});
|