- Introduced live smoke tests for Edge Gateways, verifying gateway routes and destructive-action prevention. - Added e2e scenarios for deep-link navigation, unavailable gateway recovery, token rotation, and background page refresh. - Refactored test helpers for streamlined functional validation in gateway scenarios. - Updated `EdgeGatewayTerminal.vue` with test IDs for enhanced testability. - Added and configured Husky pre-commit hooks for automated test file formatting and validation.
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { loginAsOperator } from "../fixtures/authHelpers";
|
|
import { attachPageHealthGuards, expectBodyHasContent, requiredEnv, settlePage } from "./helpers";
|
|
|
|
const liveSmokeEnabled = Boolean(
|
|
process.env.PLAYWRIGHT_BASE_URL &&
|
|
process.env.PLAYWRIGHT_SUPERUSER_USER_ID &&
|
|
process.env.PLAYWRIGHT_SUPERUSER_PASSWORD &&
|
|
process.env.PLAYWRIGHT_EDGE_GATEWAY_ID
|
|
);
|
|
|
|
function getLiveSettings() {
|
|
return {
|
|
baseURL: requiredEnv("PLAYWRIGHT_BASE_URL"),
|
|
superuserCredentials: {
|
|
userId: requiredEnv("PLAYWRIGHT_SUPERUSER_USER_ID"),
|
|
password: requiredEnv("PLAYWRIGHT_SUPERUSER_PASSWORD"),
|
|
},
|
|
gatewayId: requiredEnv("PLAYWRIGHT_EDGE_GATEWAY_ID"),
|
|
};
|
|
}
|
|
|
|
test.describe.configure({ mode: "serial" });
|
|
|
|
test.describe("Edge gateway live smoke gate", () => {
|
|
test.skip(
|
|
!liveSmokeEnabled,
|
|
"Set PLAYWRIGHT_BASE_URL, PLAYWRIGHT_SUPERUSER_USER_ID, PLAYWRIGHT_SUPERUSER_PASSWORD, and PLAYWRIGHT_EDGE_GATEWAY_ID to run the live edge gateway smoke gate."
|
|
);
|
|
|
|
test("superuser gateway routes render without destructive actions", async ({ page }) => {
|
|
const { baseURL, superuserCredentials, gatewayId } = getLiveSettings();
|
|
const guards = attachPageHealthGuards(page, baseURL);
|
|
|
|
await loginAsOperator(page, superuserCredentials);
|
|
|
|
await page.goto("/superuser/gateways");
|
|
await settlePage(page);
|
|
await expect(page).toHaveURL(/\/superuser\/gateways(?:\?.*)?$/);
|
|
await expectBodyHasContent(page);
|
|
await expect(page.getByTestId("gateway-workspace")).toBeVisible();
|
|
await expect(page.locator("body")).not.toContainText(/404/i);
|
|
|
|
await page.goto(`/superuser/gateways/${gatewayId}`);
|
|
await settlePage(page);
|
|
await expect(page).toHaveURL(new RegExp(`/superuser/gateways/${gatewayId}(?:\\?.*)?$`));
|
|
await expect(page.getByTestId("gateway-detail-header")).toBeVisible();
|
|
|
|
await guards.expectHealthy();
|
|
guards.dispose();
|
|
});
|
|
});
|