Files
pleno-vue/tests/e2e/release/edge-gateways.live-smoke.spec.ts
T

54 lines
2.0 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 executing 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("edge-gateway-workspace")).toBeVisible();
await expect(page.locator("body")).not.toContainText(/404/i);
await page.goto(`/superuser/gateways/${gatewayId}/overview`);
await settlePage(page);
await expect(page).toHaveURL(new RegExp(`/superuser/gateways/${gatewayId}/overview(?:\\?.*)?$`));
await expect(page.getByTestId("gateway-detail-header")).toBeVisible();
await expect(page.locator("body")).not.toContainText(/404/i);
await guards.expectHealthy();
guards.dispose();
});
});