A full-featured CRM built with React, shadcn/ui, and Supabase.
test: target the contact autocomplete in deal form tests
ThieryMichele87b4f0347c0
diff --git a/e2e/createContactFromDeal.spec.ts b/e2e/createContactFromDeal.spec.tsindex 0f6b4da8..b3b91bc2 100644--- a/e2e/createContactFromDeal.spec.ts+++ b/e2e/createContactFromDeal.spec.ts@@ -48,8 +48,8 @@ test.describe("user creating a contact from the deal form", () => {await dealForm.getByRole("combobox", { name: "Company" }).click();await page.getByRole("option", { name: "Smith Corp" }).click();- // Grace is not in the contact list yet- const contactInput = dealForm.getByPlaceholder("Search");+ // Grace is not in the contact list yet; contacts is the form's first autocomplete+ const contactInput = dealForm.getByPlaceholder("Search").first();await contactInput.click();await contactInput.fill("Grace Hopper");await expect(diff --git a/src/components/atomic-crm/deals/DealInputs.test.tsx b/src/components/atomic-crm/deals/DealInputs.test.tsxindex 3608503c..20a87f81 100644--- a/src/components/atomic-crm/deals/DealInputs.test.tsx+++ b/src/components/atomic-crm/deals/DealInputs.test.tsx@@ -16,7 +16,8 @@ describe("DealInputs", () => {await screen.getByRole("combobox", { name: /company/i }).click();await screen.getByRole("option", { name: /Smith Corp/ }).click();- const contactInput = screen.getByPlaceholder("Search");+ // contacts is the first of the form's autocompletes (categories comes later)+ const contactInput = screen.getByPlaceholder("Search").first();await contactInput.click();await userEvent.type(contactInput, "Grace Hopper");@@ -45,7 +46,7 @@ describe("DealInputs", () => {it("does not offer to create a contact before anything is typed", async () => {const screen = await render(<CreateForm />);- await screen.getByPlaceholder("Search").click();+ await screen.getByPlaceholder("Search").first().click();// the hint is shown instead, and cannot be selectedconst hint = screen.getByRole("option", {