Files
sencho/e2e/nodes.spec.ts
T
Anso 4f26f22cce feat: add Community/Pro licensing, fleet view, and UI reorganization (#145)
* feat: add license gating system with Lemon Squeezy integration

Add Community/Pro tier infrastructure:
- LicenseService singleton with Lemon Squeezy license API integration
- /api/license endpoints (GET info, POST activate/deactivate/validate)
- 14-day Pro trial activated automatically on first boot
- 72-hour periodic validation with 30-day offline grace period
- LicenseContext provider for frontend tier awareness
- License settings tab with activation UI and status display
- ProBadge and ProGate reusable components for feature gating
- requirePro per-route guard for backend Pro-only endpoints
- Proxy bypass for /api/license routes (local-only, never proxied)

* feat: add user profile dropdown and reorganize top navigation

- Create UserProfileDropdown component with settings, billing, theme
  toggle (System/Light/Dark), documentation links, and logout button
- Remove logout button from sidebar header
- Remove standalone settings button from top bar
- Move theme toggle from Settings modal to profile dropdown
- Inject app version via Vite define from root package.json
- Add globals.d.ts for __APP_VERSION__ type declaration

* refactor(settings): remove appearance tab from settings modal

Theme toggle was moved to the User Profile Dropdown in the previous
commit. Remove the now-redundant Appearance section, its nav button,
and the unused theme/setTheme props from SettingsModal.

* feat: add fleet view dashboard and about settings section

Fleet Overview: aggregates all nodes into a card grid showing status,
container counts, CPU/RAM/disk usage bars. Pro tier unlocks stack
drill-down with auto-refresh (30s). Backend endpoints /api/fleet/overview
and /api/fleet/node/:nodeId/stacks query nodes in parallel.

About section in Settings: displays version, license tier, status,
instance ID, and links to docs/changelog/issues.

Sidebar perf fix: stack status fetches now run in parallel via
Promise.allSettled instead of sequential for-loop, significantly
reducing load time for nodes with many stacks.

Also removes version number from User Profile Dropdown (now in About).

* fix(ci): resolve Docker build and E2E test failures

- Copy root package.json into frontend build stage so vite.config.ts
  can read the app version during Docker multi-stage build.
- Update auth E2E test: logout button moved into User Profile Dropdown.
- Update nodes E2E test: Settings button moved into User Profile Dropdown.
2026-03-25 08:32:07 -04:00

64 lines
2.8 KiB
TypeScript

/**
* Node management E2E tests.
* Tests the SSRF validation we added (C2 fix) is surfaced in the UI.
*/
import { test, expect } from '@playwright/test';
import { loginAs } from './helpers';
test.describe('Node management', () => {
test.beforeEach(async ({ page }) => {
await loginAs(page);
// Settings is inside the User Profile Dropdown — open it first
await page.getByRole('button', { name: /profile/i }).click();
await page.getByRole('button', { name: /settings/i }).click();
await page.getByRole('button', { name: /^nodes$/i }).click();
});
/**
* Open the Add Node dialog and switch the type to Remote so the API URL
* field becomes visible. Returns false (and skips) if the button isn't found.
*/
async function openAddNodeAsRemote(page: import('@playwright/test').Page): Promise<boolean> {
const addBtn = page.getByRole('button', { name: /add node/i }).first();
if (!await addBtn.isVisible()) {
test.skip();
return false;
}
await addBtn.click();
// Wait for the dialog form to be ready
await expect(page.locator('#node-name')).toBeVisible({ timeout: 5_000 });
// The API URL field only renders when type === 'remote'.
// #node-type is a Radix UI combobox — click to open, then pick the option.
await page.locator('#node-type').click();
await page.getByRole('option', { name: /remote/i }).click();
// Confirm the API URL field is now visible before proceeding
await expect(page.locator('#node-api-url')).toBeVisible({ timeout: 3_000 });
return true;
}
test('adding a node with localhost api_url shows a validation error', async ({ page }) => {
if (!await openAddNodeAsRemote(page)) return;
await page.locator('#node-name').fill('bad-node');
await page.locator('#node-api-url').fill('http://localhost:6379');
// api_token is required to enable the submit button; use a dummy value since we're testing URL validation
await page.locator('#node-api-token').fill('dummy-token');
// Use .last() to target the dialog submit button, not the trigger
await page.getByRole('button', { name: /add node/i }).last().click();
await expect(page.getByText(/loopback|localhost/i)).toBeVisible({ timeout: 5_000 });
});
test('adding a node with an invalid URL shows an error', async ({ page }) => {
if (!await openAddNodeAsRemote(page)) return;
await page.locator('#node-name').fill('bad-url-node');
await page.locator('#node-api-url').fill('not-a-url-at-all');
// api_token is required to enable the submit button; use a dummy value since we're testing URL validation
await page.locator('#node-api-token').fill('dummy-token');
await page.getByRole('button', { name: /add node/i }).last().click();
await expect(page.getByText(/valid url|invalid url/i)).toBeVisible({ timeout: 5_000 });
});
});