Files
upstream-atomic-crm/e2e/adminAccountManagerFilter.spec.ts
upstream-mirror 93ecc1a6f8
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
snapshot of https://github.com/marmelab/atomic-crm.git (main, 2026-09-18; blobs > 131072B omitted)
2026-09-18 01:48:50 +05:00

101 lines
2.9 KiB
TypeScript

import { expect, test } from "./fixtures";
test.describe("admin filtering by account manager", () => {
test.beforeEach(async ({ createSales, createCompany, createContact }) => {
const admin = await createSales({
administrator: true,
email: "john@doe.com",
first_name: "John",
last_name: "Doe",
password: "password",
});
const teammate = await createSales({
email: "marie@curie.com",
first_name: "Marie",
last_name: "Curie",
password: "password",
});
const company = await createCompany({
name: "Smith Corp",
salesId: admin.id,
});
await createContact({
company_id: company.id,
first_name: "Ada",
last_name: "Lovelace",
sales_id: admin.id,
title: "CTO",
});
await createContact({
company_id: company.id,
first_name: "Grace",
last_name: "Hopper",
sales_id: teammate.id,
title: "Rear Admiral",
});
});
test("admin narrows the contact list down to a teammate's contacts", async ({
page,
isMobile,
menu,
}) => {
await page.goto("/");
await page.getByLabel("Email").fill("john@doe.com");
await page.getByLabel("Password").fill("password");
await page.getByRole("button", { name: "Sign in" }).click();
await menu.goToContacts();
await expect(page.getByText("Ada Lovelace")).toBeVisible();
await expect(page.getByText("Grace Hopper")).toBeVisible();
if (isMobile) {
await page.getByRole("button", { name: "Add filter" }).click();
}
await page.getByRole("button", { name: "Marie Curie" }).click();
if (isMobile) {
await page.getByRole("button", { name: "Confirm" }).click();
}
await expect(page.getByText("Grace Hopper")).toBeVisible();
await expect(page.getByText("Ada Lovelace")).toBeHidden();
if (isMobile) {
await page.getByRole("button", { name: "Add filter" }).click();
}
await page.getByRole("button", { name: "Marie Curie" }).click();
if (isMobile) {
await page.getByRole("button", { name: "Confirm" }).click();
}
await expect(page.getByText("Ada Lovelace")).toBeVisible();
await expect(page.getByText("Grace Hopper")).toBeVisible();
});
test("a non-admin user gets no account manager list", async ({
page,
isMobile,
menu,
}) => {
await page.goto("/");
await page.getByLabel("Email").fill("marie@curie.com");
await page.getByLabel("Password").fill("password");
await page.getByRole("button", { name: "Sign in" }).click();
await menu.goToContacts();
await expect(page.getByText("Grace Hopper")).toBeVisible();
if (isMobile) {
await page.getByRole("button", { name: "Add filter" }).click();
}
await expect(
page.getByRole("button", { name: "Me", exact: true }),
).toBeVisible();
await expect(page.getByRole("button", { name: "John Doe" })).toBeHidden();
});
});