118 lines
6.6 KiB
TypeScript
118 lines
6.6 KiB
TypeScript
import { expect, test } from "@playwright/experimental-ct-react";
|
|
|
|
import { VaP24aInterimVisualFixture as VisualFixture } from "../../apps/web/app/components/screens/billing/va-p24a-interim.visual-fixture";
|
|
import { RegisterScreenVisualFixture } from "../../apps/web/app/modules/users/components/RegisterScreen.visual-fixture";
|
|
|
|
test.describe("BILL-19 registration activation checkout visual baseline", () => {
|
|
test("password policy stays in the account step and explains the correction inline", async ({ mount, page }) => {
|
|
await page.route("**/auth/registration-plan-advice**", async (route) => route.fulfill({ status: 503 }));
|
|
const component = await mount(<RegisterScreenVisualFixture requireEmailVerification={false} />);
|
|
|
|
await component.locator('[name="email"]').fill("ada@example.test");
|
|
await component.locator('[name="password"]').fill("TooShort1!");
|
|
await component.locator('[name="first-name"]').fill("Ada");
|
|
await component.locator('[name="last-name"]').fill("Lovelace");
|
|
await component.locator('[name="company"]').fill("Analytical Engines GmbH");
|
|
await component.locator('[data-ui-id="ui.auth.register.toTeamStep"]').click();
|
|
|
|
await expect(component.locator('[data-ui-id="ui.auth.register.accountStep"]')).toBeVisible();
|
|
await expect(component.locator('[data-ui-id="ui.auth.register.passwordPolicyError"]')).toBeVisible();
|
|
await expect(component.locator('[name="password"]')).toBeFocused();
|
|
await expect(component).toHaveScreenshot("bill-19-registration-password-validation.png", {
|
|
animations: "disabled",
|
|
maxDiffPixelRatio: 0,
|
|
});
|
|
});
|
|
|
|
test("desktop walks through team, plan, storage, email and payment", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<VisualFixture activationMode activationTrialDays={0} />
|
|
</div>
|
|
);
|
|
|
|
await page.evaluate(async () => document.fonts.ready);
|
|
await expect(component.locator('[data-ui-id="ui.billing.activation.page"]')).toHaveCount(1);
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.usage"]')).toHaveCount(0);
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.emailMarketing"]')).toHaveCount(0);
|
|
await expect(component.locator('[data-ui-id="ui.billing.activation.team"]')).toBeVisible();
|
|
await expect(component).toHaveScreenshot("bill-22-activation-team-desktop.png", {
|
|
animations: "disabled",
|
|
maxDiffPixelRatio: 0,
|
|
});
|
|
|
|
await goToNextActivationStep(component, "ui.billing.activation.plan");
|
|
await expect(component).toHaveScreenshot("bill-22-activation-plan-desktop.png", { animations: "disabled", maxDiffPixelRatio: 0 });
|
|
|
|
await goToNextActivationStep(component, "ui.billing.activation.storage");
|
|
await expect(component).toHaveScreenshot("bill-22-activation-storage-desktop.png", { animations: "disabled", maxDiffPixelRatio: 0 });
|
|
|
|
await goToNextActivationStep(component, "ui.billing.activation.emailMarketing");
|
|
await component.getByRole("radio", { name: /Ja, Pakete ansehen/u }).click();
|
|
await component.getByRole("radio", { name: /E-Mail-Marketing S/u }).click();
|
|
await expect(component).toHaveScreenshot("bill-22-activation-email-desktop.png", { animations: "disabled", maxDiffPixelRatio: 0 });
|
|
|
|
await goToNextActivationStep(component, "ui.billing.activation.payment");
|
|
await expect(component).toContainText("Kreditkarte");
|
|
await expect(component).toContainText("Monatlicher Zahlbetrag");
|
|
await expect(component).toHaveScreenshot("bill-22-activation-payment-desktop.png", { animations: "disabled", maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("mobile preserves the activation hierarchy without horizontal overflow", async ({ mount, page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
const component = await mount(<VisualFixture activationMode activationTrialDays={0} />);
|
|
|
|
await page.evaluate(async () => document.fonts.ready);
|
|
await expect(component).toHaveCSS("width", "390px");
|
|
await expect(page.locator("body")).toHaveJSProperty("scrollWidth", 390);
|
|
await expect(component).toHaveScreenshot("bill-22-activation-team-mobile.png", {
|
|
animations: "disabled",
|
|
maxDiffPixelRatio: 0,
|
|
});
|
|
|
|
await goToNextActivationStep(component, "ui.billing.activation.plan");
|
|
await goToNextActivationStep(component, "ui.billing.activation.storage");
|
|
await goToNextActivationStep(component, "ui.billing.activation.emailMarketing");
|
|
await component.getByRole("radio", { name: /Nein, später entscheiden/u }).click();
|
|
await goToNextActivationStep(component, "ui.billing.activation.payment");
|
|
await expect(page.locator("body")).toHaveJSProperty("scrollWidth", 390);
|
|
await expect(component).toHaveScreenshot("bill-22-activation-payment-mobile.png", { animations: "disabled", maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("payment step exposes totals and the hosted Mollie handoff before redirect", async ({ mount, page }) => {
|
|
await page.setViewportSize({ width: 1366, height: 1200 });
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<VisualFixture activationMode activationTrialDays={0} />
|
|
</div>
|
|
);
|
|
|
|
await goToNextActivationStep(component, "ui.billing.activation.plan");
|
|
await goToNextActivationStep(component, "ui.billing.activation.storage");
|
|
await goToNextActivationStep(component, "ui.billing.activation.emailMarketing");
|
|
await component.getByRole("radio", { name: /Nein, später entscheiden/u }).click();
|
|
await goToNextActivationStep(component, "ui.billing.activation.payment");
|
|
|
|
const payment = component.locator('[data-ui-id="ui.billing.activation.payment"]');
|
|
await expect(payment).toContainText("Monatlicher Nettobetrag");
|
|
await expect(payment).toContainText("Monatlicher Zahlbetrag");
|
|
await expect(payment).toContainText("Sicherer Hosted Checkout");
|
|
await expect(payment).toHaveScreenshot("bill-22-activation-payment-detail.png", {
|
|
animations: "disabled",
|
|
maxDiffPixelRatio: 0,
|
|
});
|
|
});
|
|
});
|
|
|
|
async function goToNextActivationStep(component: import("@playwright/experimental-ct-react").Locator, targetUiId: string): Promise<void> {
|
|
const next = component.locator('[data-ui-id="ui.billing.activation.next"]');
|
|
await expect(next).toBeEnabled();
|
|
await next.click();
|
|
await expect(component.locator(`[data-ui-id="${targetUiId}"]`)).toBeVisible();
|
|
if (targetUiId === "ui.billing.activation.plan" || targetUiId === "ui.billing.activation.storage") {
|
|
const livePrice = component.locator('[data-ui-id="ui.billing.activation.livePrice"]');
|
|
await expect(livePrice).toContainText("Monatlicher Zahlbetrag");
|
|
await expect(next).toBeEnabled();
|
|
}
|
|
}
|