Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Make Pulse Pro purchase arrivals action-oriented

rcourtman5925750da3fe
diff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
index c188f48f9d..ad571a10a8 100644
--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
@@ -11,6 +11,7 @@ import { Subtabs } from '@/components/shared/Subtabs';
import { getMonitoredSystemBriefSummary } from '@/utils/monitoredSystemPresentation';
import {
SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
+ SELF_HOSTED_PRO_BILLING_RECOVERY_SECTION_ID,
SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID,
} from '@/utils/pricingHandoff';
@@ -69,6 +70,7 @@ export const ProLicensePanel: Component = () => {
loading={state.loading()}
monitoredSystemContinuityNotice={state.monitoredSystemContinuityNotice()}
onReload={() => void state.loadPanelData()}
+ purchaseActivationAction={state.purchaseActivationAction()}
purchaseActivationNotice={state.purchaseActivationNotice()}
showMonitoredSystemUpgradeArrival={state.showMonitoredSystemUpgradeArrival()}
showTrialStart={state.showTrialStart()}
@@ -95,6 +97,7 @@ export const ProLicensePanel: Component = () => {
</Show>
<SelfHostedCommercialRecoverySection
+ sectionId={SELF_HOSTED_PRO_BILLING_RECOVERY_SECTION_ID}
licenseKey={state.licenseKey()}
activating={state.activating()}
clearing={state.clearing()}
diff --git a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
index df583c977e..f990ce61a2 100644
--- a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
@@ -10,6 +10,7 @@ import {
getTrialEndedProLicenseNotice,
} from '@/utils/licensePresentation';
import { resolveSelfHostedPurchaseStartDestination } from '@/utils/pricingHandoff';
+import type { UpgradeDestination } from '@/utils/upgradeNavigation';
import { CommercialStatGrid } from './CommercialBillingSections';
import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from './selfHostedBillingPresentation';
@@ -38,6 +39,10 @@ interface ProLicensePlanSectionProps {
onReload: () => void;
onStartTrial: () => void;
purchaseActivationNotice: Notice | null;
+ purchaseActivationAction: {
+ label: string;
+ destination: UpgradeDestination;
+ } | null;
statusPresentation: {
badgeClass: string;
label: string;
@@ -70,6 +75,16 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
<div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
<p class="font-medium">{notice().title}</p>
<p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ <Show when={props.purchaseActivationAction}>
+ {(action) => (
+ <UpgradeLink
+ class="inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
+ destination={action().destination}
+ >
+ {action().label}
+ </UpgradeLink>
+ )}
+ </Show>
</div>
)}
</Show>
diff --git a/frontend-modern/src/components/Settings/SelfHostedCommercialRecoverySection.tsx b/frontend-modern/src/components/Settings/SelfHostedCommercialRecoverySection.tsx
index 2856429916..b5ea7edf15 100644
--- a/frontend-modern/src/components/Settings/SelfHostedCommercialRecoverySection.tsx
+++ b/frontend-modern/src/components/Settings/SelfHostedCommercialRecoverySection.tsx
@@ -6,6 +6,7 @@ import { CommercialSection } from './CommercialBillingSections';
import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from './selfHostedBillingPresentation';
interface SelfHostedCommercialRecoverySectionProps {
+ sectionId?: string;
licenseKey: string;
activating: boolean;
clearing: boolean;
@@ -21,6 +22,7 @@ export const SelfHostedCommercialRecoverySection: Component<
SelfHostedCommercialRecoverySectionProps
> = (props) => (
<CommercialSection
+ id={props.sectionId}
title={SELF_HOSTED_PRO_BILLING_PRESENTATION.recoverySectionTitle}
description={SELF_HOSTED_PRO_BILLING_PRESENTATION.recoverySectionDescription}
>
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index f95e9906e8..89b82c727c 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -12,6 +12,8 @@ import {
getPublicPricingUrl,
getSelfHostedPurchaseStartUrl,
SELF_HOSTED_PRO_BILLING_PLAN_HREF,
+ SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
+ SELF_HOSTED_PRO_BILLING_PLAN_RECOVERY_HREF,
SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED,
SELF_HOSTED_PRO_BILLING_PURCHASE_CANCELLED,
SELF_HOSTED_PRO_BILLING_PURCHASE_EXPIRED,
@@ -461,20 +463,28 @@ describe('ProLicensePanel', () => {
{
purchase: SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED,
title: 'Pulse Pro activated',
+ actionLabel: null,
+ actionHref: null,
},
{
purchase: SELF_HOSTED_PRO_BILLING_PURCHASE_CANCELLED,
title: 'Checkout cancelled',
+ actionLabel: 'Compare plans',
+ actionHref: getSelfHostedPurchaseStartUrl(),
},
{
purchase: SELF_HOSTED_PRO_BILLING_PURCHASE_EXPIRED,
title: 'Upgrade return expired',
+ actionLabel: 'Restart upgrade',
+ actionHref: getSelfHostedPurchaseStartUrl(),
},
{
purchase: SELF_HOSTED_PRO_BILLING_PURCHASE_FAILED,
title: 'Activation needs attention',
+ actionLabel: 'Open recovery',
+ actionHref: SELF_HOSTED_PRO_BILLING_PLAN_RECOVERY_HREF,
},
- ])('shows the purchase arrival notice for $purchase', async ({ purchase, title }) => {
+ ])('shows the purchase arrival notice for $purchase', async ({ purchase, title, actionLabel, actionHref }) => {
useLocationMock.mockReturnValue({
search: `?purchase=${purchase}`,
pathname: '/settings/system/billing/plan',
@@ -484,12 +494,34 @@ describe('ProLicensePanel', () => {
renderPanel();
expect(screen.getByText(title)).toBeInTheDocument();
+ if (actionLabel && actionHref) {
+ expect(screen.getByRole('link', { name: actionLabel })).toHaveAttribute('href', actionHref);
+ } else {
+ expect(screen.queryByRole('link', { name: 'Review usage' })).not.toBeInTheDocument();
+ }
expect(navigateMock).toHaveBeenCalledWith(SELF_HOSTED_PRO_BILLING_PLAN_HREF, {
replace: true,
scroll: false,
});
});
+ it('shows a monitored-system activation success action and suppresses the compare-plans arrival callout', async () => {
+ useLocationMock.mockReturnValue({
+ search: `?purchase=${SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED}&intent=max_monitored_systems`,
+ pathname: '/settings/system/billing/plan',
+ hash: '',
+ });
+
+ renderPanel();
+
+ expect(screen.getByText('Pulse Pro activated')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Review usage' })).toHaveAttribute(
+ 'href',
+ SELF_HOSTED_PRO_BILLING_USAGE_HREF,
+ );
+ expect(screen.queryByText('Need a higher monitored-system cap?')).not.toBeInTheDocument();
+ });
+
it('focuses the usage billing section when the usage route requests counting rules', async () => {
useLocationMock.mockReturnValue({
search: '?details=counting-rules',
diff --git a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
index ff755aa392..e12ec66f2e 100644
--- a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
+++ b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
@@ -13,6 +13,10 @@ export interface SelfHostedProBillingPresentation {
monitoredSystemUpgradeArrivalTitle: string;
monitoredSystemUpgradeArrivalBody: string;
monitoredSystemUpgradeArrivalActionLabel: string;
+ purchaseActivatedUsageActionLabel: string;
+ purchaseCancelledActionLabel: string;
+ purchaseExpiredActionLabel: string;
+ purchaseFailedActionLabel: string;
trialStartTitle: string;
trialStartBody: string;
trialStartIdleActionLabel: string;
@@ -39,6 +43,10 @@ export const SELF_HOSTED_PRO_BILLING_PRESENTATION: SelfHostedProBillingPresentat
monitoredSystemUpgradeArrivalBody:
'Open Pulse Account to compare self-hosted plans, complete checkout, and return here with Pulse Pro activated automatically.',
monitoredSystemUpgradeArrivalActionLabel: 'Compare plans',
+ purchaseActivatedUsageActionLabel: 'Review usage',
+ purchaseCancelledActionLabel: 'Compare plans',
+ purchaseExpiredActionLabel: 'Restart upgrade',
+ purchaseFailedActionLabel: 'Open recovery',
trialStartTitle: 'Try Pro for free',
trialStartBody: 'Start a 14-day Pro trial for this organization.',
trialStartIdleActionLabel: 'Start 14-day Pro Trial',
diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
index 3c735b2ed0..86727c2ef3 100644
--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts
+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
@@ -27,15 +27,24 @@ import {
getSelfHostedBillingPurchaseArrival,
getSelfHostedBillingUsageDetail,
resolveSelfHostedBillingSection,
+ resolveSelfHostedPurchaseStartDestination,
SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ SELF_HOSTED_PRO_BILLING_PLAN_RECOVERY_HREF,
+ SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED,
+ SELF_HOSTED_PRO_BILLING_PURCHASE_CANCELLED,
+ SELF_HOSTED_PRO_BILLING_PURCHASE_EXPIRED,
+ SELF_HOSTED_PRO_BILLING_PURCHASE_FAILED,
SELF_HOSTED_PRO_BILLING_PLAN_ROUTE,
SELF_HOSTED_PRO_BILLING_PURCHASE_QUERY_PARAM,
+ SELF_HOSTED_PRO_BILLING_USAGE_HREF,
SELF_HOSTED_PRO_BILLING_USAGE_ROUTE,
type SelfHostedBillingSection,
} from '@/utils/pricingHandoff';
import { buildSelfHostedCommercialPlanModel } from '@/utils/commercialBillingModel';
import { runStartProTrialAction } from '@/utils/trialStartAction';
+import { resolveUpgradeDestination, type UpgradeDestination } from '@/utils/upgradeNavigation';
+import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from './selfHostedBillingPresentation';
const formatDate = (value?: string | null) => {
if (!value) return 'Not available';
@@ -110,6 +119,7 @@ export function useProLicensePanelState() {
const showMonitoredSystemUpgradeArrival = createMemo(
() =>
+ !purchaseActivationResult() &&
activeSection() === 'plan' &&
getSelfHostedBillingPlanIntent(location.search) ===
SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
@@ -258,6 +268,39 @@ export function useProLicensePanelState() {
const purchaseActivationNotice = createMemo(() => {
return getPurchaseActivationNotice(purchaseActivationResult());
});
+ const purchaseActivationAction = createMemo<
+ { label: string; destination: UpgradeDestination } | null
+ >(() => {
+ const purchase = purchaseActivationResult().trim().toLowerCase();
+ const intent = getSelfHostedBillingPlanIntent(location.search);
+ switch (purchase) {
+ case SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED:
+ if (intent === SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT) {
+ return {
+ label: SELF_HOSTED_PRO_BILLING_PRESENTATION.purchaseActivatedUsageActionLabel,
+ destination: resolveUpgradeDestination(SELF_HOSTED_PRO_BILLING_USAGE_HREF),
+ };
+ }
+ return null;
+ case SELF_HOSTED_PRO_BILLING_PURCHASE_CANCELLED:
+ return {
+ label: SELF_HOSTED_PRO_BILLING_PRESENTATION.purchaseCancelledActionLabel,
+ destination: resolveSelfHostedPurchaseStartDestination(intent),
+ };
+ case SELF_HOSTED_PRO_BILLING_PURCHASE_EXPIRED:
+ return {
+ label: SELF_HOSTED_PRO_BILLING_PRESENTATION.purchaseExpiredActionLabel,
+ destination: resolveSelfHostedPurchaseStartDestination(intent),
+ };
+ case SELF_HOSTED_PRO_BILLING_PURCHASE_FAILED:
+ return {
+ label: SELF_HOSTED_PRO_BILLING_PRESENTATION.purchaseFailedActionLabel,
+ destination: resolveUpgradeDestination(SELF_HOSTED_PRO_BILLING_PLAN_RECOVERY_HREF),
+ };
+ default:
+ return null;
+ }
+ });
const commercialMigrationNotice = createMemo(() =>
getCommercialMigrationNotice(entitlements()?.commercial_migration),
@@ -368,6 +411,7 @@ export function useProLicensePanelState() {
loading,
looksLikeLegacyLicenseKey,
purchaseActivationNotice,
+ purchaseActivationAction,
setActiveSection,
setLicenseKey,
showCountingRulesByDefault,
diff --git a/frontend-modern/src/utils/__tests__/licensePresentation.test.ts b/frontend-modern/src/utils/__tests__/licensePresentation.test.ts
index 3763ba5463..49e70cec62 100644
--- a/frontend-modern/src/utils/__tests__/licensePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/licensePresentation.test.ts
@@ -79,6 +79,10 @@ describe('licensePresentation', () => {
monitoredSystemUpgradeArrivalBody:
'Open Pulse Account to compare self-hosted plans, complete checkout, and return here with Pulse Pro activated automatically.',
monitoredSystemUpgradeArrivalActionLabel: 'Compare plans',
+ purchaseActivatedUsageActionLabel: 'Review usage',
+ purchaseCancelledActionLabel: 'Compare plans',
+ purchaseExpiredActionLabel: 'Restart upgrade',
+ purchaseFailedActionLabel: 'Open recovery',
trialStartTitle: 'Try Pro for free',
trialStartBody: 'Start a 14-day Pro trial for this organization.',
trialStartIdleActionLabel: 'Start 14-day Pro Trial',
@@ -235,6 +239,7 @@ describe('licensePresentation', () => {
});
expect(getPurchaseActivationNotice('cancelled')).toMatchObject({
title: 'Checkout cancelled',
+ body: expect.stringContaining('start the upgrade again'),
tone: expect.stringContaining('amber'),
});
expect(getPurchaseActivationNotice('expired')).toMatchObject({
@@ -243,6 +248,7 @@ describe('licensePresentation', () => {
});
expect(getPurchaseActivationNotice('failed')).toMatchObject({
title: 'Activation needs attention',
+ body: expect.stringContaining('open recovery'),
tone: expect.stringContaining('red'),
});
expect(getPurchaseActivationNotice('')).toBeNull();
diff --git a/frontend-modern/src/utils/licensePresentation.ts b/frontend-modern/src/utils/licensePresentation.ts
index 52a417c6c6..1956e9792d 100644
--- a/frontend-modern/src/utils/licensePresentation.ts
+++ b/frontend-modern/src/utils/licensePresentation.ts
@@ -326,7 +326,7 @@ export const getPurchaseActivationNotice = (result?: string | null): LicenseInli
return {
tone: 'border-amber-200 dark:border-amber-900 bg-amber-50 dark:bg-amber-900 text-amber-900 dark:text-amber-100',
title: 'Checkout cancelled',
- body: 'Checkout was cancelled before completion. The current plan state below is unchanged.',
+ body: 'Checkout was cancelled before completion. The current plan state below is unchanged until you start the upgrade again.',
};
case 'expired':
return {
@@ -338,7 +338,7 @@ export const getPurchaseActivationNotice = (result?: string | null): LicenseInli
return {
tone: 'border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-900 text-red-900 dark:text-red-100',
title: 'Activation needs attention',
- body: 'Checkout completed, but Pulse could not finish local activation automatically. Review the plan state below, then retry the upgrade or use recovery if needed.',
+ body: 'Checkout completed, but Pulse could not finish local activation automatically. Review the plan state below, then open recovery if you already have a key from this purchase.',
};
default:
return null;
diff --git a/frontend-modern/src/utils/pricingHandoff.ts b/frontend-modern/src/utils/pricingHandoff.ts
index 530f9397b1..b1484a8b9f 100644
--- a/frontend-modern/src/utils/pricingHandoff.ts
+++ b/frontend-modern/src/utils/pricingHandoff.ts
@@ -13,6 +13,7 @@ export const SELF_HOSTED_PRO_BILLING_PLAN_ROUTE = `${SELF_HOSTED_PRO_BILLING_ROU
export const SELF_HOSTED_PRO_BILLING_USAGE_ROUTE = `${SELF_HOSTED_PRO_BILLING_ROUTE}/usage`;
export const SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID = 'pulse-pro-plan';
export const SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID = 'pulse-pro-usage';
+export const SELF_HOSTED_PRO_BILLING_RECOVERY_SECTION_ID = 'pulse-pro-recovery';
export const SELF_HOSTED_PRO_BILLING_USAGE_DETAILS_QUERY_PARAM = 'details';
export const SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM = 'intent';
export const SELF_HOSTED_PRO_BILLING_PURCHASE_QUERY_PARAM = 'purchase';
@@ -34,6 +35,7 @@ export type SelfHostedBillingPurchaseArrival =
export const SELF_HOSTED_PRO_BILLING_PLAN_HREF = SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
export const SELF_HOSTED_PRO_BILLING_USAGE_HREF = SELF_HOSTED_PRO_BILLING_USAGE_ROUTE;
+export const SELF_HOSTED_PRO_BILLING_PLAN_RECOVERY_HREF = `${SELF_HOSTED_PRO_BILLING_PLAN_ROUTE}#${SELF_HOSTED_PRO_BILLING_RECOVERY_SECTION_ID}`;
export const SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF = `${SELF_HOSTED_PRO_BILLING_USAGE_ROUTE}?${SELF_HOSTED_PRO_BILLING_USAGE_DETAILS_QUERY_PARAM}=${SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL}`;
export const SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF = `${SELF_HOSTED_PRO_BILLING_PLAN_ROUTE}?${SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM}=${SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT}`;
diff --git a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
index 9444e94571..ec0b36b8fe 100644
--- a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
+++ b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
@@ -15,6 +15,7 @@ const PORTAL_HANDOFF_ID = "cph_checkout_return";
const ACTIVATED_BILLING_URL = `${DEV_SERVER_URL}/settings/system/billing/plan?intent=max_monitored_systems&purchase=activated`;
const CANCELLED_BILLING_URL = `${DEV_SERVER_URL}/settings/system/billing/plan?intent=max_monitored_systems&purchase=cancelled`;
const FINAL_BILLING_URL = `${DEV_SERVER_URL}/settings/system/billing/plan?intent=max_monitored_systems`;
+const USAGE_BILLING_URL = `${DEV_SERVER_URL}/settings/system/billing/usage`;
const PURCHASE_RETURN_TOKEN = "prt_signed_checkout_return";
const MONITORED_SYSTEM_ENTITLEMENTS = {
@@ -220,7 +221,7 @@ test.describe("Self-hosted upgrade return flow", () => {
"<h1>Pulse Account</h1>" +
"<p>Checkout complete. Returning to Pulse Pro.</p>" +
`<script>setTimeout(function(){window.location.replace(${JSON.stringify(
- `${PURCHASE_RETURN_URL}?session_id=cs_upgrade_return&portal_handoff_id=${PORTAL_HANDOFF_ID}&purchase_return_token=${encodeURIComponent(PURCHASE_RETURN_TOKEN)}`,
+ `${PURCHASE_RETURN_URL}?session_id=cs_upgrade_return&purchase_return_token=${encodeURIComponent(PURCHASE_RETURN_TOKEN)}`,
)});},150);</script>` +
"</body></html>",
});
@@ -233,9 +234,6 @@ test.describe("Self-hosted upgrade return flow", () => {
expect(requestUrl.searchParams.get("session_id")).toBe(
"cs_upgrade_return",
);
- expect(requestUrl.searchParams.get("portal_handoff_id")).toBe(
- PORTAL_HANDOFF_ID,
- );
expect(requestUrl.searchParams.get("purchase_return_token")).toBe(
PURCHASE_RETURN_TOKEN,
);
@@ -247,7 +245,6 @@ test.describe("Self-hosted upgrade return flow", () => {
"<h1>Finalizing Pulse Pro upgrade</h1>" +
`<form id="purchase-activation-continue-form" method="POST" action="${escapeAttribute(PURCHASE_RETURN_URL)}">` +
'<input type="hidden" name="session_id" value="cs_upgrade_return">' +
- `<input type="hidden" name="portal_handoff_id" value="${escapeAttribute(PORTAL_HANDOFF_ID)}">` +
`<input type="hidden" name="purchase_return_token" value="${escapeAttribute(PURCHASE_RETURN_TOKEN)}">` +
"</form>" +
'<script>setTimeout(function(){document.getElementById("purchase-activation-continue-form")?.submit();},50);</script>' +
@@ -259,7 +256,6 @@ test.describe("Self-hosted upgrade return flow", () => {
expect(request.method()).toBe("POST");
const formData = new URLSearchParams(request.postData() || "");
expect(formData.get("session_id")).toBe("cs_upgrade_return");
- expect(formData.get("portal_handoff_id")).toBe(PORTAL_HANDOFF_ID);
expect(formData.get("purchase_return_token")).toBe(PURCHASE_RETURN_TOKEN);
await route.fulfill({
status: 200,
@@ -305,6 +301,14 @@ test.describe("Self-hosted upgrade return flow", () => {
await expect(
page.getByText("Pulse Pro activated", { exact: true }),
).toBeVisible();
+ const reviewUsageLink = page.getByRole("link", { name: "Review usage" });
+ await expect(reviewUsageLink).toHaveAttribute("href", "/settings/system/billing/usage");
+ await reviewUsageLink.click();
+ await expect(page).toHaveURL(USAGE_BILLING_URL);
+ await expect(page.getByRole("tab", { name: "Usage" })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
});
test("returns cancelled checkout directly to the owned billing plan route", async ({
@@ -357,5 +361,9 @@ test.describe("Self-hosted upgrade return flow", () => {
await expect(page).toHaveURL(CANCELLED_BILLING_URL);
await expect(page.getByText("Checkout cancelled", { exact: true })).toBeVisible();
+ await expect(page.getByRole("link", { name: "Compare plans" })).toHaveAttribute(
+ "href",
+ `${PURCHASE_START_PATH}?feature=max_monitored_systems`,
+ );
});
});