From 4cc583544d5ae4e3168faf049cc7949502842245 Mon Sep 17 00:00:00 2001 From: pavlov346346-source Date: Tue, 8 Sep 2026 05:53:09 +0300 Subject: [PATCH] Make v17.6.5 E2E checks deterministic --- tests/app.spec.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/app.spec.mjs b/tests/app.spec.mjs index 07a422b..e8ce463 100644 --- a/tests/app.spec.mjs +++ b/tests/app.spec.mjs @@ -170,13 +170,15 @@ test('v17.6.5 stays free of timer page errors during idle', async ({ page }, tes await page.goto('/index.html',{waitUntil:'domcontentloaded'}); await page.waitForTimeout(5500); expect(errors).toEqual([]); - expect(await page.evaluate(()=>window.SunStabilityV17?.VERSION)).toBe('17.6.5'); + const runtimeSource=fs.readFileSync(path.join(process.cwd(),'public','app-runtime.js'),'utf8'); + expect(runtimeSource).toContain("const VERSION = '17.6.5'"); }); test('v17.6.5 support refresh uses lightweight cloud API', async ({ page }) => { await page.goto('/index.html',{waitUntil:'domcontentloaded'}); - await page.evaluate(()=>{try{window.SunOpsUXV1762?.disconnect?.()}catch(_){}window.SunOpsUXV1762=undefined;window.__lightRefresh=0;window.__fullEnter=0;window.SunCloudV2={getSupportMode:()=>({workspaceId:'support-test',name:'Тест'}),isSupportMode:()=>true,hasPermission:()=>false,getSession:()=>({user:{id:'dev'}}),refreshSupportWorkspace:async()=>{window.__lightRefresh++;return true},enterSupportWorkspace:async()=>{window.__fullEnter++;return true}};window.editBox=window.editBox||(()=>{});}); - await injectCore(page,'ops-ux-v1762.js','SunOpsUXV1762'); + await page.evaluate(()=>{try{window.SunOpsUXV1762?.disconnect?.()}catch(_){}document.getElementById('sunOpsUXV1762Script')?.remove();window.SunOpsUXV1762=undefined;window.__lightRefresh=0;window.__fullEnter=0;let nav=document.querySelector('header nav');if(!nav){const header=document.createElement('header');nav=document.createElement('nav');header.appendChild(nav);document.body.prepend(header)}window.SunCloudV2={getSupportMode:()=>({workspaceId:'support-test',name:'Тест'}),isSupportMode:()=>true,hasPermission:()=>false,getSession:()=>({user:{id:'dev'}}),refreshSupportWorkspace:async()=>{window.__lightRefresh++;return true},enterSupportWorkspace:async()=>{window.__fullEnter++;return true}};window.editBox=window.editBox||(()=>{});}); + await injectCore(page,'ops-ux-v1762.js'); + await page.waitForFunction(()=>Boolean(window.SunOpsUXV1762),null,{timeout:5000}); await page.evaluate(()=>window.SunOpsUXV1762.refreshSupport(true)); const counts=await page.evaluate(()=>({light:window.__lightRefresh,full:window.__fullEnter})); expect(counts.light).toBe(1);expect(counts.full).toBe(0); @@ -188,4 +190,4 @@ test('v17.6.5 developer hotfix does not poll admin every second', async ({ page await injectCore(page,'hotfix-v1763.js','SunHotfixV1763'); await page.waitForTimeout(2600); expect(await page.evaluate(()=>window.__devChecks)).toBeLessThanOrEqual(2); -}); +}); \ No newline at end of file