Files
sencho/e2e/auto-heal-policies.spec.ts
T
Anso 865d792874 feat(pricing): collapse to two tiers (#1309)
* feat(pricing): collapse to two tiers (Community + Admiral)

Collapse Sencho's pricing from three tiers (Community / Skipper / Admiral)
to two: a generous free Community tier and a single paid Admiral tier. The
Skipper tier is removed.

Now free in Community: auto-heal, auto-update, scheduled operations,
webhooks, notification routing, Fleet Actions and bulk operations, SSO
preset providers (Google / GitHub / Okta), unlimited users with admin and
viewer roles, and deploy safety (atomic deploys, auto-rollback, and
one-click rollback).

Admiral (paid) is focused on running and governing a fleet: blueprints,
Fleet Secrets, deploy enforcement, vulnerability report export, audit log,
host console, private registries, mesh networking, node cordon, managed
cloud backup, LDAP / Active Directory SSO, and the advanced RBAC roles
(deployer, node-admin, auditor) with per-resource scoped assignments.

Internally the license variant distinction is removed so tier is binary
(community / paid). License validation still verifies the Lemon Squeezy
store and product before granting paid status.

Docs and the contributor guide are updated to the two-tier model.

* docs(pricing): correct licensing page to two-tier pricing and tidy stale tier wording

The licensing docs page kept the old Admiral pricing plus a Founder
Lifetime column and an Enterprise paragraph after the two-tier collapse.
Update it to $12/month or $99/year, drop the lifetime and Enterprise
content, and link to the pricing page for current pricing.

Also fix stale "Skipper" wording in CLA.md, SUPPORT.md, one test title,
and three test comments. Historical CHANGELOG entries and the
retired-Skipper license-guard test are intentionally left as-is.

* docs: align licensing and SSO pages with the two-tier model

Correct the SSO overview so the Google, GitHub, and Okta presets read as
available on every tier, matching the provider table; only LDAP and Active
Directory require Sencho Admiral. Remove the lifetime-plan references from the
licensing, settings, and troubleshooting pages so they reflect subscription-only
Admiral pricing.

* fix(rbac): omit scoped permissions from /me on the Community tier

Scoped role assignments only take effect on the paid tier, but GET /api/permissions/me returned them unconditionally, so a downgraded instance with leftover assignments rendered per-resource affordances the API then rejected with 403. The endpoint now mirrors the permission middleware and includes scoped permissions only on the paid tier. Adds a regression test covering the downgrade case.

* docs: use custom-pricing wording on the contact page

The two-tier model has no Enterprise tier; reword the contact page's enterprise pricing/deals to custom pricing/deals so it does not imply a tier that no longer exists.
2026-06-04 17:45:53 -04:00

102 lines
4.4 KiB
TypeScript

/**
* Auto-Heal Policies E2E tests - happy-path CRUD via the sheet UI.
*
* Opens the Auto-Heal sheet from the stack sidebar context menu, creates a
* policy, verifies it appears in the list, then deletes it.
*
* Auto-heal policies are available on every tier, so no paid license is
* required; the test skips gracefully when no stacks exist on the instance.
*/
import { test, expect } from '@playwright/test';
import { loginAs } from './helpers';
/** Wait for the stacks sidebar to finish loading. */
async function waitForStacksLoaded(page: import('@playwright/test').Page) {
await expect(page.getByRole('button', { name: 'Create Stack' })).toBeVisible({ timeout: 15_000 });
await expect(page.locator('[data-stacks-loaded="true"]')).toBeAttached({ timeout: 15_000 });
}
test.describe('Auto-Heal Policies', () => {
test.beforeEach(async ({ page }) => {
await loginAs(page);
await waitForStacksLoaded(page);
});
test('CRUD: create and delete a policy via the sheet', async ({ page }) => {
// Find the first stack item in the sidebar. cmdk renders items with role="option".
const stackItems = page.locator('[data-stacks-loaded="true"] [role="option"]');
const count = await stackItems.count();
if (count === 0) {
test.skip();
return;
}
// Right-click the first stack to open the context menu
await stackItems.first().click({ button: 'right' });
// Wait for the Radix context menu to appear
await expect(page.locator('[role="menu"]')).toBeVisible({ timeout: 5_000 });
// Click "Auto-Heal" menu item
await page.locator('[role="menu"]').getByText('Auto-Heal').click();
// The sheet title should be visible
await expect(page.getByText(/Auto-Heal Policies/)).toBeVisible({ timeout: 5_000 });
// Detect PaidGate: skip if the upgrade prompt blocks the UI (community instance)
const upgradePrompt = page.getByText(/requires a paid license/i);
if (await upgradePrompt.isVisible({ timeout: 2_000 }).catch(() => false)) {
test.skip();
return;
}
// Wait for the policy list and form to be ready
await expect(page.getByText('Active Policies')).toBeVisible({ timeout: 5_000 });
await expect(page.getByRole('button', { name: 'Add Policy' })).toBeVisible({ timeout: 8_000 });
// ── Fill in the add-policy form ─────────────────────────────────────────
// Leave Service as default "All services"
const unhealthyInput = page.locator('#unhealthy-duration');
await unhealthyInput.clear();
await unhealthyInput.fill('2');
const cooldownInput = page.locator('#cooldown');
await cooldownInput.clear();
await cooldownInput.fill('5');
const maxRestartsInput = page.locator('#max-restarts');
await maxRestartsInput.clear();
await maxRestartsInput.fill('3');
const autoDisableInput = page.locator('#auto-disable');
await autoDisableInput.clear();
await autoDisableInput.fill('5');
// ── Submit ──────────────────────────────────────────────────────────────
await page.getByRole('button', { name: 'Add Policy' }).click();
// Wait for the save to complete (button re-enables) then verify the row appears
await expect(page.getByRole('button', { name: 'Add Policy' })).toBeEnabled({ timeout: 8_000 });
// The PolicyRow subtitle shows "Unhealthy for 2 min" for the value we entered
const policySubtitle = page.getByText(/Unhealthy for 2 min/i).first();
await expect(policySubtitle).toBeVisible({ timeout: 8_000 });
// ── Delete the policy ───────────────────────────────────────────────────
// Find the policy card containing the subtitle and click its delete button
const policyCard = page
.locator('.rounded-lg.border')
.filter({ hasText: 'Unhealthy for 2 min' })
.first();
await expect(policyCard).toBeVisible({ timeout: 5_000 });
const deleteBtn = policyCard.getByRole('button', { name: 'Delete policy' });
await expect(deleteBtn).toBeVisible({ timeout: 5_000 });
await deleteBtn.click();
// Confirm the policy row is removed
await expect(policySubtitle).not.toBeVisible({ timeout: 8_000 });
});
});