Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,111 @@
|
||||
import { expect, test, type Page } from "./utils/test";
|
||||
import { expectNoCriticalA11yViolations } from "./utils/axe";
|
||||
import { loginAsTenantUser } from "./utils/auth";
|
||||
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
|
||||
import { escapeRegExp, interceptCurrentRoutePost, postDataIncludesField, skipIfUnavailable } from "./utils/navigation";
|
||||
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
|
||||
|
||||
// Admin-host pages need a dedicated OPERATOR admin user — the shared tenant user
|
||||
// must not be one (it would redirect to the admin host on login and break every
|
||||
// tenant-app login flow). The seed provisions `e2e.admin@example.test` with an
|
||||
// AdminUser row + the global SuperAdmin role and emits E2E_ADMIN_EMAIL/PASSWORD.
|
||||
const adminCredentials =
|
||||
process.env.E2E_ADMIN_EMAIL && process.env.E2E_ADMIN_PASSWORD
|
||||
? { email: process.env.E2E_ADMIN_EMAIL, password: process.env.E2E_ADMIN_PASSWORD }
|
||||
: null;
|
||||
const adminEmailSequencesPath = process.env.E2E_ADMIN_EMAIL_SEQUENCES_PATH;
|
||||
const readinessSequenceName = "E2E Customer Welcome Sequence";
|
||||
const readinessSequenceId = "seq_e2e_customer_welcome";
|
||||
|
||||
test.describe("admin email sequences mobile a11y", () => {
|
||||
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
|
||||
|
||||
test.beforeEach(() => {
|
||||
skipOrFailWhenE2eInputsMissing(
|
||||
["E2E_ADMIN_EMAIL", "E2E_ADMIN_PASSWORD", "E2E_ADMIN_EMAIL_SEQUENCES_PATH"],
|
||||
"Admin email sequence mobile a11y inputs not configured"
|
||||
);
|
||||
});
|
||||
|
||||
test("renders seeded sequence list, detail, and stats surfaces on mobile", async ({ page }) => {
|
||||
await openAdminEmailSequences(page);
|
||||
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(adminEmailSequencesPath!)}(?:[?#].*)?$`, "u"));
|
||||
await expect(page.getByRole("heading", { name: /email sequences|e-mail-sequenzen/i }).first()).toBeVisible();
|
||||
const sequenceLink = seededSequenceLink(page);
|
||||
if (!(await isVisible(sequenceLink))) {
|
||||
skipOrFailWhenE2eFixtureMissing("Admin email sequence fixture is missing the seeded customer welcome sequence");
|
||||
}
|
||||
await expect(page.locator("table").first()).toContainText("lead.converted_to_customer");
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
await sequenceLink.click();
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(adminEmailSequencesPath!)}/${readinessSequenceId}(?:[?#].*)?$`, "u"));
|
||||
await expect(page.getByRole("heading", { name: readinessSequenceName })).toBeVisible();
|
||||
await expect(page.locator('input[name="name"]')).toHaveValue(readinessSequenceName);
|
||||
await expect(page.locator('input[name="triggerEvent"]')).toHaveValue("lead.converted_to_customer");
|
||||
await expect(page.locator('textarea[name="stepsJson"]')).toContainText("E2E Readiness customer setup");
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
const statsLink = page.getByRole("link", { name: /stats|statistiken/i }).first();
|
||||
await expect(statsLink).toBeVisible();
|
||||
await statsLink.click();
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(adminEmailSequencesPath!)}/${readinessSequenceId}/stats(?:[?#].*)?$`, "u"));
|
||||
await expect(page.getByRole("heading", { name: readinessSequenceName })).toBeVisible();
|
||||
await expect(page.locator("table").first()).toContainText("E2E Readiness customer setup");
|
||||
await expect(page.getByRole("link", { name: /edit sequence|sequenz bearbeiten/i }).first()).toHaveAttribute(
|
||||
"href",
|
||||
new RegExp(`${escapeRegExp(adminEmailSequencesPath!)}/${readinessSequenceId}(?:[?#].*)?$`, "u")
|
||||
);
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
});
|
||||
|
||||
test("toggle lifecycle form posts intent without mutating the seeded sequence", async ({ page }) => {
|
||||
await openAdminEmailSequences(page);
|
||||
const sequenceLink = seededSequenceLink(page);
|
||||
if (!(await isVisible(sequenceLink))) {
|
||||
skipOrFailWhenE2eFixtureMissing("Admin email sequence fixture is missing the seeded customer welcome sequence");
|
||||
}
|
||||
|
||||
await sequenceLink.click();
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(adminEmailSequencesPath!)}/${readinessSequenceId}(?:[?#].*)?$`, "u"));
|
||||
const toggleForm = page.locator('form:has(input[name="intent"][value="toggle"])').first();
|
||||
if (!(await isVisible(toggleForm))) {
|
||||
skipOrFailWhenE2eFixtureMissing("Admin email sequence detail fixture has no toggle lifecycle form");
|
||||
}
|
||||
await expect(toggleForm.locator('input[name="intent"]')).toHaveValue("toggle");
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
const submittedPostData = await interceptCurrentRoutePost(page);
|
||||
const toggleButton = toggleForm.locator('button[type="submit"]').first();
|
||||
await toggleButton.focus();
|
||||
await expect(toggleButton).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await expect.poll(() => submittedPostData.value, { message: "email sequence toggle POST payload was captured" }).not.toBeNull();
|
||||
expect(postDataIncludesField(submittedPostData.value, "intent", /^toggle$/u)).toBe(true);
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(adminEmailSequencesPath!)}/${readinessSequenceId}(?:[?#].*)?$`, "u"));
|
||||
});
|
||||
});
|
||||
|
||||
async function openAdminEmailSequences(page: Page): Promise<void> {
|
||||
await loginAsTenantUser(page, adminCredentials!);
|
||||
const response = await page.goto(adminEmailSequencesPath!, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, "Admin email sequence path is not reachable in this environment");
|
||||
}
|
||||
|
||||
function seededSequenceLink(page: Page) {
|
||||
return page.getByRole("link", { name: readinessSequenceName }).first();
|
||||
}
|
||||
|
||||
async function isVisible(locator: ReturnType<Page["locator"]>): Promise<boolean> {
|
||||
return (await locator.count()) > 0 && (await locator.isVisible());
|
||||
}
|
||||
Reference in new issue
Block a user