FactuGES_ERP/tests/e2e/customers/support/search-customers-via-ui.ts

17 lines
576 B
TypeScript

import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";
export async function searchCustomersViaUi(page: Page, search: string) {
const responsePromise = page.waitForResponse((response) => {
const url = new URL(response.url());
return (
response.request().method() === "GET" &&
/\/customers\/?$/.test(url.pathname) &&
url.searchParams.get("q") === search
);
});
await page.locator('input[inputmode="search"]').fill(search);
const response = await responsePromise;
expect(response.status()).toBe(200);
}