Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

fix some e2e tests

erwanMarmelabbe5d0b155eb0
diff --git a/e2e/adminAccountManagerFilter.spec.ts b/e2e/adminAccountManagerFilter.spec.ts
index 22ce164b..092013d7 100644
--- a/e2e/adminAccountManagerFilter.spec.ts
+++ b/e2e/adminAccountManagerFilter.spec.ts
@@ -49,7 +49,7 @@ test.describe("admin filtering by account manager", () => {
await page.getByLabel("Password").fill("password");
await page.getByRole("button", { name: "Sign in" }).click();
- await menu.goToContacts();
+ await menu.goToContacts({ isMobile });
await expect(page.getByText("Ada Lovelace")).toBeVisible();
await expect(page.getByText("Grace Hopper")).toBeVisible();
@@ -86,7 +86,7 @@ test.describe("admin filtering by account manager", () => {
await page.getByLabel("Password").fill("password");
await page.getByRole("button", { name: "Sign in" }).click();
- await menu.goToContacts();
+ await menu.goToContacts({ isMobile });
await expect(page.getByText("Grace Hopper")).toBeVisible();
if (isMobile) {
diff --git a/e2e/bulkContactTags.spec.ts b/e2e/bulkContactTags.spec.ts
index 02c5c934..a3aeac12 100644
--- a/e2e/bulkContactTags.spec.ts
+++ b/e2e/bulkContactTags.spec.ts
@@ -39,7 +39,7 @@ test("user adds a tag to several contacts", async ({
await expect(page).toHaveTitle(/Atomic CRM/);
await expect(page.getByRole("link", { name: "Contacts" })).toBeVisible();
- await menu.goToContacts();
+ await menu.goToContacts({ isMobile });
await expect(page.getByText("Ada Lovelace")).toBeVisible();
await expect(page.getByText("Grace Hopper")).toBeVisible();
diff --git a/e2e/fixtures.ts b/e2e/fixtures.ts
index 421ad277..b6e580fa 100644
--- a/e2e/fixtures.ts
+++ b/e2e/fixtures.ts
@@ -200,8 +200,10 @@ const getMenuMethod = ({ page }: { page: Page; isMobile: boolean }) => ({
await page.getByRole("link", { name: "Dashboard" }).click();
await page.waitForLoadState("networkidle");
},
- goToContacts: async () => {
- await page.getByRole("link", { name: "Contacts" }).click();
+ goToContacts: async ({ isMobile }: { isMobile: boolean }) => {
+ await page
+ .getByRole(isMobile ? "button" : "link", { name: "Contacts" })
+ .click();
await page.waitForLoadState("networkidle");
},
});
diff --git a/e2e/onboarding.spec.ts b/e2e/onboarding.spec.ts
index 7eb4d172..c870ad4a 100644
--- a/e2e/onboarding.spec.ts
+++ b/e2e/onboarding.spec.ts
@@ -24,7 +24,7 @@ test("user onboarding", async ({ page, isMobile, menu, dismissToast }) => {
.getByRole(isMobile ? "button" : "link", { name: "Add contact" })
.click();
await page.waitForLoadState("networkidle");
- await page.getByLabel("She/Her").click();
+ await page.getByRole("radio", { name: "She/Her" }).click();
await page.getByLabel("First name").fill("Jane");
await page.getByLabel("Last name").fill("Smith");
await page.getByLabel("Title").fill("CEO");
@@ -57,7 +57,7 @@ test("user onboarding", async ({ page, isMobile, menu, dismissToast }) => {
.getByLabel("Background info (bio, how you met, etc)")
.fill("Met at a conference.");
- await page.getByLabel("Has newsletter").check();
+ await page.getByRole("switch", { name: "Has newsletter" }).check();
await expect(page.getByLabel("Account manager *")).toHaveText("John Doe");
@@ -73,9 +73,7 @@ test("user onboarding", async ({ page, isMobile, menu, dismissToast }) => {
await expect(page.getByText("2/3 done")).toBeVisible();
- await page
- .getByRole(isMobile ? "button" : "link", { name: "Add note" })
- .click();
+ await page.getByRole("button", { name: "Add note" }).click();
await page.waitForLoadState("networkidle");
diff --git a/e2e/userAddingATask.spec.ts b/e2e/userAddingATask.spec.ts
index 70a9ff86..f3f2737f 100644
--- a/e2e/userAddingATask.spec.ts
+++ b/e2e/userAddingATask.spec.ts
@@ -48,7 +48,7 @@ test.describe("user adding a task", () => {
await expect(page).toHaveTitle(/Atomic CRM/);
await expect(page.getByText("Latest Activity")).toBeVisible();
- await menu.goToContacts();
+ await menu.goToContacts({ isMobile });
await page.waitForLoadState("networkidle");
await page.getByText("Jane Smith").click();
diff --git a/makefile b/makefile
index a47b2ce2..f907028e 100644
--- a/makefile
+++ b/makefile
@@ -118,6 +118,9 @@ test-functions:
test-e2e: start-e2e
npx playwright test --ui
+test-e2e-mobile: start-e2e ## start the stack and run the e2e tests on the mobile viewport only
+ npx playwright test --ui --project="Mobile Chrome"
+
test-e2e-ci: start-e2e-ci
npx wait-on http-get://localhost:54341/auth/v1/health http-get://localhost:5175
npx playwright test
diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx
index a9006cfb..81b11c4c 100644
--- a/src/components/ui/select.tsx
+++ b/src/components/ui/select.tsx
@@ -47,11 +47,9 @@ function SelectTrigger({
{...props}
>
{children}
- <SelectPrimitive.Icon
- render={
- <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
- }
- />
+ <SelectPrimitive.Icon className="pointer-events-none flex text-muted-foreground">
+ <ChevronDownIcon className="size-4" />
+ </SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
)
}