Files
dashboard/e2e/tests/settings-permissions.spec.ts
Maycon Santos 7653e3411c Merge NetBird cloud edition into the dashboard (#674)
Brings the unified dashboard into the open-source repo. Premium features
ship in the open code, gated at runtime via NETBIRD_CLOUD and
NETBIRD_LICENSED, with upgrade prompts for unlicensed self-hosted
deployments. Adds the cloud-only feature areas (billing, integrations,
MSP, traffic events, notifications) and the Playwright e2e suite.
2026-06-21 16:01:08 +02:00

42 lines
1.5 KiB
TypeScript

import { test, expect } from "../helpers/fixtures";
import { navigateTo } from "../helpers/auth";
test.describe.serial("Settings - Permissions @settings", () => {
test("Should toggle restrict dashboard for regular users", async ({
dashboardAsOwner: page,
}) => {
await navigateTo(page, "/settings?tab=permissions");
const toggle = page.getByTestId("restrict-regular-users");
await expect(toggle).toBeVisible({ timeout: 15_000 });
const initialState = await toggle.getAttribute("data-state");
const expectedState = initialState === "checked" ? "unchecked" : "checked";
await toggle.click();
await expect(toggle).toHaveAttribute("data-state", expectedState);
await page.getByTestId("save-permissions-settings").click();
await expect(page.getByText("updated successfully").first()).toBeVisible();
// Verify persistence — wait for settings API to load after reload
await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().includes("/api/accounts") &&
resp.request().method() === "GET",
),
page.reload(),
]);
await expect(page.getByTestId("restrict-regular-users")).toHaveAttribute(
"data-state",
expectedState,
{ timeout: 15_000 },
);
// Toggle back to restore original state
await page.getByTestId("restrict-regular-users").click();
await page.getByTestId("save-permissions-settings").click();
await expect(page.getByText("updated successfully").first()).toBeVisible();
});
});