124 lines
5.9 KiB
TypeScript
124 lines
5.9 KiB
TypeScript
import { expect, test } from "@playwright/experimental-ct-react";
|
|
|
|
import { Bill20BillingHubVisualFixture as BillingFixture } from "../../apps/web/app/components/screens/billing/bill-20-billing-hub.visual-fixture";
|
|
import {
|
|
Bill20CheckoutSuccessVisualFixture as CheckoutSuccessFixture,
|
|
Bill20TrialSuccessVisualFixture as TrialSuccessFixture,
|
|
Bill20WelcomeSetupVisualFixture as WelcomeSetupFixture,
|
|
} from "../../apps/web/app/components/screens/onboarding/bill-20-welcome.visual-fixture";
|
|
|
|
test.describe("BILL-20 welcome and billing journey visual baseline", () => {
|
|
test("confirmed payment hands off to workspace setup", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<CheckoutSuccessFixture />
|
|
</div>
|
|
);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(component.locator('[data-ui-id="ui.subscription.checkout.success.page"]')).toHaveCount(1);
|
|
await expect(component).toHaveScreenshot("bill-20-checkout-success-desktop.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("a catalog trial never presents itself as an immediate charge", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<TrialSuccessFixture />
|
|
</div>
|
|
);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(component.getByRole("heading", { name: "Deine Testphase läuft" })).toBeVisible();
|
|
await expect(component).toContainText("Vor dem angezeigten Ende der Testphase wird nichts berechnet.");
|
|
await expect(component).toHaveScreenshot("bill-20-checkout-trial-desktop.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("payment handoff remains clear on mobile", async ({ mount, page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
const component = await mount(<CheckoutSuccessFixture />);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(page.locator("body")).toHaveJSProperty("scrollWidth", 390);
|
|
await expect(component).toHaveScreenshot("bill-20-checkout-success-mobile.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("desktop welcome prioritizes automatic setup and team invitation", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<WelcomeSetupFixture />
|
|
</div>
|
|
);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(component.locator('[data-ui-id="ui.onboarding.welcome.checklist"]')).toContainText("Team einladen");
|
|
await expect(component).toHaveScreenshot("bill-20-welcome-setup-desktop.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("mobile welcome remains a deliberate setup path without horizontal overflow", async ({ mount, page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
const component = await mount(<WelcomeSetupFixture />);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(component).toHaveCSS("width", "390px");
|
|
await expect(page.locator("body")).toHaveJSProperty("scrollWidth", 390);
|
|
await expect(component).toHaveScreenshot("bill-20-welcome-setup-mobile.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("active billing opens with status and usage instead of a purchase wall", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<BillingFixture />
|
|
</div>
|
|
);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.current"]')).toBeVisible();
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.builder"]')).toHaveCount(0);
|
|
await expect(component).toHaveScreenshot("bill-20-billing-overview-desktop.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("billing overview remains scannable on mobile", async ({ mount, page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
const component = await mount(<BillingFixture />);
|
|
|
|
await waitForSettledFonts(page);
|
|
await expect(page.locator("body")).toHaveJSProperty("scrollWidth", 390);
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.managementActions"]')).toBeVisible();
|
|
await expect(component).toHaveScreenshot("bill-20-billing-overview-mobile.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("plan and seat management has its own focused surface", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<BillingFixture />
|
|
</div>
|
|
);
|
|
|
|
await component.getByRole("button", { name: "Tarif und Plätze verwalten" }).click();
|
|
await waitForSettledFonts(page);
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.builder"]')).toBeVisible();
|
|
await expect(component).toContainText("5 Büro + 15 Baustelle inklusive · 500 GB Speicher");
|
|
await expect(component).toContainText("10 Büro + 30 Baustelle inklusive · 2 TB Speicher");
|
|
await expect(component).toHaveScreenshot("bill-20-billing-plan-desktop.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
|
|
test("commercial add-ons are separated from the base plan", async ({ mount, page }) => {
|
|
const component = await mount(
|
|
<div style={{ width: "1200px" }}>
|
|
<BillingFixture />
|
|
</div>
|
|
);
|
|
|
|
await component.getByRole("button", { name: "Zusatzmodule ansehen" }).click();
|
|
await waitForSettledFonts(page);
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.storageAddOns"]')).toBeVisible();
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.emailMarketing"]')).toBeVisible();
|
|
await expect(component.locator('[data-ui-id="ui.billing.selfServiceSubscription.customerPortal"]')).toBeVisible();
|
|
await expect(component).toHaveScreenshot("bill-20-billing-addons-desktop.png", { maxDiffPixelRatio: 0 });
|
|
});
|
|
});
|
|
|
|
async function waitForSettledFonts(page: import("@playwright/test").Page): Promise<void> {
|
|
await page.evaluate(async () => document.fonts.ready);
|
|
}
|