Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/tests/frontend-new/specs/outdated_notice.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const freshPad = async (page: Page, clientVarOverrides: Record<string, unknown>
// padHelper.ts) so it can't race with postAceInit or steal DOM focus.
// clientVarOverrides lets a test simulate server-side settings (e.g.
// updateCheck:false for updates.tier "off") without restarting the server.
// updateCheck defaults to true because every test mocks
// /api/version-status: the result must not depend on the server's
// updates.tier (plugin CI runs core with the tier "off").
const overrides = {updateCheck: true, ...clientVarOverrides};
await page.addInitScript((overrides) => {
let stored: unknown;
Object.defineProperty(window, 'clientVars', {
Expand All @@ -24,7 +28,7 @@ const freshPad = async (page: Page, clientVarOverrides: Record<string, unknown>
stored = v;
},
});
}, clientVarOverrides);
}, overrides);
const padId = `FRONTEND_TESTS${randomUUID()}`;
await page.goto(`http://localhost:9001/p/${padId}`);
await page.waitForSelector('iframe[name="ace_outer"]');
Expand Down Expand Up @@ -139,7 +143,10 @@ test.describe('outdated notice (gritter-based)', () => {
await expect(page.locator(NOTICE)).toHaveCount(0);
});

test('default tier — the version-status request is still made', async ({page}) => {
// freshPad forces updateCheck:true, so this checks the client side only. The
// server's tier -> clientVars.updateCheck mapping is covered by the backend
// spec updateCheckClientVar.ts.
test('updateCheck:true — the version-status request is made', async ({page}) => {
const requests: string[] = [];
await page.route('**/api/version-status*', (route) => {
requests.push(route.request().url());
Expand Down
Loading