Make v17.6.5 E2E checks deterministic

This commit is contained in:
pavlov346346-source 2026-09-08 05:53:09 +03:00
parent 591f27ac24
commit 4cc583544d

View File

@ -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.goto('/index.html',{waitUntil:'domcontentloaded'});
await page.waitForTimeout(5500); await page.waitForTimeout(5500);
expect(errors).toEqual([]); 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 }) => { test('v17.6.5 support refresh uses lightweight cloud API', async ({ page }) => {
await page.goto('/index.html',{waitUntil:'domcontentloaded'}); 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 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','SunOpsUXV1762'); await injectCore(page,'ops-ux-v1762.js');
await page.waitForFunction(()=>Boolean(window.SunOpsUXV1762),null,{timeout:5000});
await page.evaluate(()=>window.SunOpsUXV1762.refreshSupport(true)); await page.evaluate(()=>window.SunOpsUXV1762.refreshSupport(true));
const counts=await page.evaluate(()=>({light:window.__lightRefresh,full:window.__fullEnter})); const counts=await page.evaluate(()=>({light:window.__lightRefresh,full:window.__fullEnter}));
expect(counts.light).toBe(1);expect(counts.full).toBe(0); expect(counts.light).toBe(1);expect(counts.full).toBe(0);