Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+222
@@ -0,0 +1,222 @@
|
||||
import { expectNoCriticalA11yViolations } from "./utils/axe";
|
||||
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
|
||||
import { solveCaptchaIfPresent } from "./utils/captcha";
|
||||
import { expectNoHorizontalOverflow } from "./utils/mobile";
|
||||
import { skipIfUnavailable } from "./utils/navigation";
|
||||
import { pauseForOperatorCheckpoint } from "./utils/operator-checkpoint";
|
||||
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing, skipOrFailWhenE2eOptInMissing } from "./utils/readiness";
|
||||
import { expect, test, type Page } from "./utils/test";
|
||||
|
||||
const tenantCredentials = getTenantCredentials();
|
||||
const tenantDashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
|
||||
const tenantPortalDomainPath =
|
||||
process.env.E2E_TENANT_CUSTOMER_PORTAL_DOMAIN_PATH ?? tenantDashboardPath?.replace(/\/dashboard\/?$/u, "/settings/customer-portal/domain");
|
||||
const claimHostname = process.env.E2E_PORTAL_DOMAIN_CLAIM_HOSTNAME;
|
||||
const customPortalBaseUrl = process.env.E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL;
|
||||
const standardPortalBaseUrl = process.env.E2E_PORTAL_BASE_URL;
|
||||
const portalTenantSlug = process.env.E2E_PORTAL_TENANT_SLUG;
|
||||
const portalEmail = process.env.E2E_PORTAL_EMAIL;
|
||||
const portalPassword = process.env.E2E_PORTAL_PASSWORD;
|
||||
const portalExpectedTitle = process.env.E2E_PORTAL_EXPECTED_TITLE;
|
||||
const mutationOptIn = "E2E_ALLOW_CUSTOMER_PORTAL_P26C_MUTATION";
|
||||
const starterCredentials =
|
||||
process.env.E2E_STARTER_TENANT_EMAIL && process.env.E2E_STARTER_TENANT_PASSWORD
|
||||
? { email: process.env.E2E_STARTER_TENANT_EMAIL, password: process.env.E2E_STARTER_TENANT_PASSWORD }
|
||||
: null;
|
||||
const starterDashboardPath = process.env.E2E_STARTER_TENANT_DASHBOARD_PATH;
|
||||
const starterPortalDomainPath =
|
||||
process.env.E2E_STARTER_TENANT_CUSTOMER_PORTAL_DOMAIN_PATH ?? starterDashboardPath?.replace(/\/dashboard\/?$/u, "/settings/customer-portal/domain");
|
||||
|
||||
test.use({ trace: "off", video: "off" });
|
||||
test.describe.configure({ mode: "serial" });
|
||||
|
||||
test.describe("VA-P26c customer portal domain journey", () => {
|
||||
test("starter tenant starts the exact recurring customer-portal add-on checkout or proves its active replay state", async ({ page }, testInfo) => {
|
||||
requireStarterAdminInputs();
|
||||
requireP26cMutation("Starter customer-portal add-on checkout");
|
||||
await openStarterDomainAdmin(page);
|
||||
|
||||
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
|
||||
const buyPortal = screen.getByRole("button", { name: /^(Kundenportal buchen|Purchase customer portal)$/iu });
|
||||
if (!(await buyPortal.isVisible())) {
|
||||
await expect(screen.getByLabel(/^(Vollständige Subdomain|Fully qualified subdomain)$/iu)).toBeVisible();
|
||||
return;
|
||||
}
|
||||
|
||||
const appOrigin = new URL(page.url()).origin;
|
||||
await buyPortal.click();
|
||||
await page.waitForURL((url) => url.origin !== appOrigin, { timeout: 20_000 });
|
||||
const checkoutUrl = new URL(page.url());
|
||||
expect(checkoutUrl.protocol).toBe("https:");
|
||||
expect(checkoutUrl.hostname).toMatch(/(?:^|\.)mollie\.com$/iu);
|
||||
await expect(page.getByText(/(?:€\s*23[,.]79|23[,.]79\s*€)/u).first()).toBeVisible();
|
||||
await pauseForOperatorCheckpoint(page, testInfo, "starter-addon-checkout");
|
||||
});
|
||||
|
||||
test("starter customer-portal add-on is active after the Mollie return", async ({ page }) => {
|
||||
requireStarterAdminInputs();
|
||||
await openStarterDomainAdmin(page);
|
||||
|
||||
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
|
||||
await expect(screen.getByRole("button", { name: /^(Kundenportal buchen|Purchase customer portal)$/iu })).toHaveCount(0);
|
||||
await expect(screen.getByLabel(/^(Vollständige Subdomain|Fully qualified subdomain)$/iu)).toBeVisible();
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
});
|
||||
|
||||
test("tenant admin claims a domain and exposes its one-time ownership proof", async ({ page }, testInfo) => {
|
||||
requireDomainAdminInputs(["E2E_PORTAL_DOMAIN_CLAIM_HOSTNAME"], "VA-P26c domain-claim inputs not configured");
|
||||
requireP26cMutation("domain claim");
|
||||
await openDomainAdmin(page);
|
||||
|
||||
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
|
||||
const buyPortal = screen.getByRole("button", { name: /^(Kundenportal buchen|Purchase customer portal)$/iu });
|
||||
if (await buyPortal.isVisible()) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c checkout fixture needs an active portal entitlement before a domain can be claimed");
|
||||
}
|
||||
|
||||
const hostnameInput = screen.getByLabel(/^(Vollständige Subdomain|Fully qualified subdomain)$/iu);
|
||||
if (!(await hostnameInput.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c checkout fixture needs no existing or pending custom-domain claim");
|
||||
}
|
||||
await hostnameInput.fill(claimHostname!);
|
||||
await screen.getByRole("button", { name: /^(Domain reservieren|Reserve domain)$/iu }).click();
|
||||
await expect(screen.getByText(/^(Die Domain wurde reserviert\.|The domain was reserved\.)/iu)).toBeVisible();
|
||||
await expect(screen.getByText(`_hivegrid-portal.${claimHostname!}`, { exact: true })).toBeVisible();
|
||||
await expect(screen.getByRole("button", { name: /^(DNS jetzt prüfen|Verify DNS now)$/iu })).toBeVisible();
|
||||
await expect(screen.getByRole("button", { name: /^(Einrichtung kaufen|Purchase setup)$/iu })).toHaveCount(0);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await pauseForOperatorCheckpoint(page, testInfo, "domain-ownership-txt");
|
||||
});
|
||||
|
||||
test("tenant admin verifies ownership and starts its claim-bound setup purchase", async ({ page }, testInfo) => {
|
||||
requireDomainAdminInputs([], "VA-P26c domain-ownership inputs not configured");
|
||||
requireP26cMutation("domain ownership verification and setup checkout");
|
||||
await openDomainAdmin(page);
|
||||
|
||||
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
|
||||
const verifyDns = screen.getByRole("button", { name: /^(DNS jetzt prüfen|Verify DNS now)$/iu });
|
||||
if (!(await verifyDns.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c paid setup fixture needs a claimed domain with its TXT ownership proof ready for verification");
|
||||
}
|
||||
await verifyDns.click();
|
||||
await expect(screen.getByText(/^(TXT und CNAME wurden bestätigt\.|TXT and CNAME were confirmed\.)/iu)).toBeVisible();
|
||||
const setupCheckout = screen.getByRole("button", { name: /^(Einrichtung kaufen|Purchase setup)$/iu });
|
||||
if (!(await setupCheckout.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c paid setup fixture needs a TXT-proven claim awaiting its one-time setup purchase");
|
||||
}
|
||||
const appOrigin = new URL(page.url()).origin;
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await setupCheckout.click();
|
||||
await page.waitForURL((url) => url.origin !== appOrigin, { timeout: 20_000 });
|
||||
const checkoutUrl = new URL(page.url());
|
||||
expect(checkoutUrl.protocol).toBe("https:");
|
||||
expect(checkoutUrl.hostname).toMatch(/(?:^|\.)mollie\.com$/iu);
|
||||
await expect(page.getByText(/(?:€\s*356[,.]99|356[,.]99\s*€)/u).first()).toBeVisible();
|
||||
await pauseForOperatorCheckpoint(page, testInfo, "domain-setup-checkout");
|
||||
});
|
||||
|
||||
test("tenant admin verifies DNS and advances a paid claim into provisioning", async ({ page }) => {
|
||||
requireDomainAdminInputs([], "VA-P26c domain-provisioning inputs not configured");
|
||||
requireP26cMutation("DNS verification and provisioning");
|
||||
await openDomainAdmin(page);
|
||||
|
||||
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
|
||||
const verifyDns = screen.getByRole("button", { name: /^(DNS jetzt prüfen|Verify DNS now)$/iu });
|
||||
if (!(await verifyDns.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c provisioning fixture needs a paid claim with TXT and CNAME records ready for verification");
|
||||
}
|
||||
await verifyDns.click();
|
||||
await expect(screen.getByText(/^(TXT und CNAME wurden bestätigt\.|TXT and CNAME were confirmed\.)/iu)).toBeVisible();
|
||||
await expect(screen.getByText(/^(Wird bereitgestellt|Aktiv|Provisioning|Active)$/iu).first()).toBeVisible();
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
});
|
||||
|
||||
test("active custom host serves the same tenant while the standard host remains available", async ({ page }) => {
|
||||
skipOrFailWhenE2eInputsMissing(
|
||||
[
|
||||
"E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL",
|
||||
"E2E_PORTAL_BASE_URL",
|
||||
"E2E_PORTAL_TENANT_SLUG",
|
||||
"E2E_PORTAL_EMAIL",
|
||||
"E2E_PORTAL_PASSWORD",
|
||||
"E2E_PORTAL_EXPECTED_TITLE",
|
||||
],
|
||||
"VA-P26c active custom-host and fallback inputs not configured"
|
||||
);
|
||||
|
||||
await loginToPortalHost(page, new URL("/login", customPortalBaseUrl).toString(), "/");
|
||||
const customShell = page.locator('[data-ui-id="ui.customerPortal.portalShell"]');
|
||||
await expect(customShell).toBeVisible();
|
||||
await expect(customShell.getByText(portalExpectedTitle!, { exact: true })).toBeVisible();
|
||||
expect(new URL(page.url()).origin).toBe(new URL(customPortalBaseUrl!).origin);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
await page.context().clearCookies();
|
||||
const standardPath = `/${portalTenantSlug}`;
|
||||
await loginToPortalHost(page, new URL(`${standardPath}/login`, standardPortalBaseUrl).toString(), standardPath);
|
||||
const standardShell = page.locator('[data-ui-id="ui.customerPortal.portalShell"]');
|
||||
await expect(standardShell).toBeVisible();
|
||||
await expect(standardShell.getByText(portalExpectedTitle!, { exact: true })).toBeVisible();
|
||||
expect(new URL(page.url()).origin).toBe(new URL(standardPortalBaseUrl!).origin);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
});
|
||||
});
|
||||
|
||||
function requireDomainAdminInputs(extra: readonly string[], reason: string): void {
|
||||
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH", ...extra], reason);
|
||||
if (!tenantPortalDomainPath || !tenantCredentials) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c customer-portal domain path is not derivable from E2E_TENANT_DASHBOARD_PATH");
|
||||
}
|
||||
}
|
||||
|
||||
function requireStarterAdminInputs(): void {
|
||||
skipOrFailWhenE2eInputsMissing(
|
||||
["E2E_STARTER_TENANT_EMAIL", "E2E_STARTER_TENANT_PASSWORD", "E2E_STARTER_TENANT_DASHBOARD_PATH"],
|
||||
"VA-P26c Starter commercial checkout inputs not configured"
|
||||
);
|
||||
if (!starterPortalDomainPath || !starterCredentials) {
|
||||
skipOrFailWhenE2eFixtureMissing("VA-P26c Starter customer-portal domain path is not derivable from E2E_STARTER_TENANT_DASHBOARD_PATH");
|
||||
}
|
||||
}
|
||||
|
||||
function requireP26cMutation(reason: string): void {
|
||||
skipOrFailWhenE2eOptInMissing(mutationOptIn, `skipping mutating VA-P26c ${reason}`);
|
||||
}
|
||||
|
||||
async function openDomainAdmin(page: Page): Promise<void> {
|
||||
await loginAsTenantUser(page, tenantCredentials!);
|
||||
const response = await page.goto(tenantPortalDomainPath!, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, `VA-P26c customer-portal domain route ${tenantPortalDomainPath}`);
|
||||
await expect(page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]')).toBeVisible();
|
||||
}
|
||||
|
||||
async function openStarterDomainAdmin(page: Page): Promise<void> {
|
||||
await loginAsTenantUser(page, starterCredentials!);
|
||||
const response = await page.goto(starterPortalDomainPath!, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, `VA-P26c Starter customer-portal domain route ${starterPortalDomainPath}`);
|
||||
await expect(page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]')).toBeVisible();
|
||||
}
|
||||
|
||||
async function loginToPortalHost(page: Page, loginUrl: string, expectedPath: string): Promise<void> {
|
||||
const expectedOrigin = new URL(loginUrl).origin;
|
||||
const response = await page.goto(loginUrl, { waitUntil: "domcontentloaded" });
|
||||
const responseStatus = response?.status() ?? 0;
|
||||
if (!response || [400, 403, 404].includes(responseStatus)) {
|
||||
skipOrFailWhenE2eFixtureMissing(`VA-P26c public portal login ${loginUrl} returned ${responseStatus || "no response"}`);
|
||||
}
|
||||
expect(responseStatus).toBeGreaterThanOrEqual(200);
|
||||
expect(responseStatus).toBeLessThan(400);
|
||||
await expect(page.locator('[data-ui-id="ui.customerPortal.publicShell"]')).toBeVisible();
|
||||
await expect(page.locator("html")).toHaveAttribute("data-hydrated", "true");
|
||||
await page.getByRole("button", { name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu }).click();
|
||||
await page.locator('input[name="email"]').fill(portalEmail!);
|
||||
await page.locator('input[name="password"]').fill(portalPassword!);
|
||||
await solveCaptchaIfPresent(page);
|
||||
await page.getByRole("button", { name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu }).click();
|
||||
await page.waitForURL((url) => url.origin === expectedOrigin && url.pathname.replace(/\/$/u, "") === expectedPath.replace(/\/$/u, ""), { timeout: 20_000 });
|
||||
}
|
||||
Reference in new issue
Block a user