Files
pleno-vue/tests/e2e/release-channel-switched.spec.js
T
Jeppe Bundgaard 3715da8fd3 Add release channel selector components, subject autocomplete, and related tests
- Implement components for `ReleaseChannelSelector`, including panel and sidebar variants.
- Add `ReleaseAssignmentSubjectAutocomplete` for user, subuser, and customer search functionality.
- Update i18n phrases for channel selector and subject assignment.
- Enhance unit and E2E tests for release channel availability, switching, and runtime configuration.
- Modify modules for channel-related state handling and runtime refresh mechanics.
2026-05-20 10:31:49 +02:00

74 lines
2.4 KiB
JavaScript

import { expect, test } from "@playwright/test";
import { mockApi, seedAuthenticatedState } from "./support/network.js";
const availableRuntime = () => ({
generated_at: "2026-05-19T09:30:00.000Z",
trace_id: "trace-switched-channel",
channel: {
id: 2,
slug: "canary",
name: "Canary",
description: "Early production validation before broader rollout.",
enabled: true,
default_channel: false,
},
versions: {
frontend: { version_label: "frontend-canary", commit_sha: "c0ffee" },
api: { version_label: "api-canary", commit_sha: "feedface" },
bundle_id: 31,
},
availability: {
configured: true,
missing: [],
status: "ready",
},
capture_policy: {
enabled: false,
capture_level: "metadata",
all_failure_metadata: true,
retention_days: 14,
},
});
async function boot(page) {
await page.addInitScript(() => {
window.localStorage.setItem("locale", "en");
window.localStorage.removeItem("release_channel_unavailable_ignore_until");
window.localStorage.removeItem("release_channel_switch_notice_seen");
});
await mockApi(page, {
authenticated: true,
permissions: ["user"],
sessionData: {
id: 77,
customer_number: 990077,
runtime_config: {
release: availableRuntime(),
},
},
});
await seedAuthenticatedState(page, "release-channel-switched-token");
}
test("users assigned to a configured release channel see the switched notice once on the device", async ({ page }) => {
await boot(page);
await page.goto("/user", { waitUntil: "domcontentloaded" });
const notice = page.getByTestId("release-channel-switched-page");
await expect(notice).toBeVisible({ timeout: 30_000 });
await expect(notice).toContainText("You are now on Canary");
await expect(notice).toContainText("Early production validation");
await expect(page.getByTestId("release-channel-switched-details")).toContainText("#31");
await expect(page.getByTestId("release-channel-switched-details")).toContainText("frontend-canary");
await expect(page.getByTestId("release-channel-switched-details")).toContainText("api-canary");
const currentUrl = page.url();
await page.getByTestId("release-channel-switched-continue").click();
await expect(notice).toHaveCount(0);
await expect(page).toHaveURL(currentUrl);
await page.goto("/user", { waitUntil: "domcontentloaded" });
await expect(page.getByTestId("release-channel-switched-page")).toHaveCount(0);
});