Skip to content

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

update onboarding test to handle mobile ui too

ThieryMichel0456ad6d3198
diff --git a/e2e/onboarding.spec.ts b/e2e/onboarding.spec.ts
index 0b070b0b..40a6978b 100644
--- a/e2e/onboarding.spec.ts
+++ b/e2e/onboarding.spec.ts
@@ -1,6 +1,6 @@
import { test, expect } from "./fixtures";
-test("user onboarding", async ({ page }) => {
+test("user onboarding", async ({ page, isMobile }) => {
await page.goto("http://localhost:5175/");
// Expect a title "to contain" a substring.
@@ -60,31 +60,38 @@ test("user onboarding", async ({ page }) => {
await page.getByRole("button", { name: "Save" }).click();
- await page.waitForURL("**/contacts/*");
await page.waitForLoadState("networkidle");
- await expect(page.getByText("Jane Smith")).toBeVisible();
+ await expect(page.locator(isMobile ? "h2" : "h5")).toHaveText("Jane Smith");
await expect(page.getByText("CEO at Smith Corp")).toBeVisible();
- await page.getByRole("link", { name: "Dashboard" }).click();
+ await page
+ .getByRole("link", { name: isMobile ? "Home" : "Dashboard" })
+ .click();
await page.waitForLoadState("networkidle");
await expect(page.getByText("2/3 done")).toBeVisible();
- await page.getByRole("link", { name: "Add note" }).click();
+ await page.getByRole("button", { name: "Add note" }).click();
await page.waitForLoadState("networkidle");
await page.getByPlaceholder("Add a note").fill("This is a note about Jane.");
- await page.getByRole("button", { name: "Add this note" }).click();
+ await page
+ .getByRole("button", { name: isMobile ? "Save" : "Add this note" })
+ .click();
await expect(page.getByText("Element created")).toBeVisible();
await page.waitForLoadState("networkidle");
- await expect(page.getByText("You added a note")).toBeVisible();
+ await expect(
+ page.getByText(isMobile ? "By you" : "You added a note"),
+ ).toBeVisible();
await expect(page.getByText("This is a note about Jane.")).toBeVisible();
- await page.getByRole("link", { name: "Dashboard" }).click();
+ await page
+ .getByRole("link", { name: isMobile ? "Home" : "Dashboard" })
+ .click();
await page.waitForLoadState("networkidle");
diff --git a/playwright.config.ts b/playwright.config.ts
index 04aa260e..a0bc446c 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -53,14 +53,14 @@ export default defineConfig({
},
/* Test against mobile viewports. */
- // {
- // name: 'Mobile Chrome',
- // use: { ...devices['Pixel 5'] },
- // },
- // {
- // name: 'Mobile Safari',
- // use: { ...devices['iPhone 12'] },
- // },
+ {
+ name: "Mobile Chrome",
+ use: { ...devices["Pixel 5"] },
+ },
+ {
+ name: "Mobile Safari",
+ use: { ...devices["iPhone 12"] },
+ },
/* Test against branded browsers. */
// {
diff --git a/src/components/atomic-crm/dashboard/DashboardStepper.tsx b/src/components/atomic-crm/dashboard/DashboardStepper.tsx
index 711202d5..3cc48d04 100644
--- a/src/components/atomic-crm/dashboard/DashboardStepper.tsx
+++ b/src/components/atomic-crm/dashboard/DashboardStepper.tsx
@@ -134,7 +134,7 @@ export const DashboardStepper = ({
</Button>
) : (
<Button asChild disabled={step < 2} className="w-[100px]">
- <Link to={`/contacts/${contactId}/show`}>
+ <Link role="button" to={`/contacts/${contactId}/show`}>
{translate("resources.notes.action.add", {
_: "Add note",
})}