Add release runtime bootstrap implementation with unit and E2E tests
- Create `releaseBootstrap.js` service to handle runtime configuration and remote frontend loading. - Integrate runtime-aware API URL resolution across components and services. - Update i18n phrases to clarify new domains for `ssl_domain_message`. - Enhance unit and E2E tests to validate runtime-based frontend loading and fallback behavior. - Refactor session-related API calls and incorporate runtime-configured base URLs.
This commit is contained in:
@@ -46,6 +46,75 @@ const availableRuntime = () => ({
|
||||
},
|
||||
});
|
||||
|
||||
const runtimeWithSelectableReleaseDetails = () => ({
|
||||
...unavailableRuntime,
|
||||
versions: {
|
||||
frontend: null,
|
||||
api: null,
|
||||
bundle_id: null,
|
||||
},
|
||||
availability: {
|
||||
configured: false,
|
||||
missing: ["release_bundle"],
|
||||
status: "unconfigured",
|
||||
},
|
||||
available_channels: [
|
||||
{
|
||||
channel: {
|
||||
id: 1,
|
||||
slug: "stable",
|
||||
name: "Stable",
|
||||
description: "Standard production channel.",
|
||||
enabled: true,
|
||||
default_channel: true,
|
||||
},
|
||||
versions: {
|
||||
frontend: {
|
||||
version_label: "frontend-stable",
|
||||
commit_sha: "abc1234567890000111122223333444455556666",
|
||||
deployed_at: "2026-05-18T07:45:00.000Z",
|
||||
},
|
||||
api: {
|
||||
version_label: "api-stable",
|
||||
commit_sha: "def456789abc0000111122223333444455556666",
|
||||
deployed_at: "2026-05-18T07:47:00.000Z",
|
||||
},
|
||||
bundle_id: 31,
|
||||
bundle: {
|
||||
id: 31,
|
||||
promoted_at: "2026-05-18T08:00:00.000Z",
|
||||
},
|
||||
},
|
||||
availability: {
|
||||
configured: true,
|
||||
missing: [],
|
||||
status: "ready",
|
||||
},
|
||||
},
|
||||
{
|
||||
channel: unavailableRuntime.channel,
|
||||
versions: {
|
||||
frontend: {
|
||||
version_label: "frontend-canary",
|
||||
commit_sha: "c0ffee0000001111222233334444555566667777",
|
||||
deployed_at: "2026-05-19T08:15:00.000Z",
|
||||
},
|
||||
api: {
|
||||
version_label: "api-canary",
|
||||
commit_sha: "feedface00001111222233334444555566667777",
|
||||
deployed_at: "2026-05-19T08:18:00.000Z",
|
||||
},
|
||||
bundle_id: null,
|
||||
},
|
||||
availability: {
|
||||
configured: false,
|
||||
missing: ["release_bundle"],
|
||||
status: "unconfigured",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
async function boot(page, runtime = unavailableRuntime, locale = "en") {
|
||||
await page.addInitScript((selectedLocale) => {
|
||||
window.localStorage.setItem("locale", selectedLocale);
|
||||
@@ -85,6 +154,33 @@ test("users assigned to an unconfigured release channel can ignore the guard tem
|
||||
await page.evaluate(() => window.localStorage.removeItem("release_channel_unavailable_ignore_until"));
|
||||
});
|
||||
|
||||
test("release channel choices show git commit and release time when available", async ({ page }) => {
|
||||
const runtime = runtimeWithSelectableReleaseDetails();
|
||||
await boot(page, runtime);
|
||||
await page.route("**/release/runtime", async (route) => {
|
||||
await route.fulfill(json({ data: runtime }));
|
||||
});
|
||||
|
||||
await page.goto("/user", { waitUntil: "domcontentloaded" });
|
||||
const guard = page.getByTestId("release-channel-unavailable-page");
|
||||
await expect(guard).toBeVisible();
|
||||
|
||||
const canary = page.getByTestId("release-channel-option-canary");
|
||||
await expect(canary).toBeVisible();
|
||||
await expect(canary).toContainText("Release bundle");
|
||||
await expect(page.getByTestId("release-channel-option-canary-frontend-release")).toContainText("c0ffee000000");
|
||||
await expect(page.getByTestId("release-channel-option-canary-frontend-release")).toContainText(
|
||||
/May 19, 2026|19 May 2026/
|
||||
);
|
||||
await expect(page.getByTestId("release-channel-option-canary-api-release")).toContainText("feedface0000");
|
||||
await expect(page.getByTestId("release-channel-option-canary-api-release")).toContainText(/May 19, 2026|19 May 2026/);
|
||||
|
||||
await expect(page.getByTestId("release-channel-option-stable-bundle-release")).toContainText("#31");
|
||||
await expect(page.getByTestId("release-channel-option-stable-bundle-release")).toContainText(
|
||||
/May 18, 2026|18 May 2026/
|
||||
);
|
||||
});
|
||||
|
||||
test("predefined release channel text is localized on the guard page", async ({ page }) => {
|
||||
const internalRuntime = {
|
||||
...unavailableRuntime,
|
||||
|
||||
Reference in New Issue
Block a user