From 8a039a53169ed4fbb977651d46256e3447ec0ed1 Mon Sep 17 00:00:00 2001 From: pavlov346346-source Date: Tue, 8 Sep 2026 13:20:53 +0300 Subject: [PATCH] Add v17.7.0 E2E fix script --- .github/scripts/fix-e2e-v1770.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/scripts/fix-e2e-v1770.mjs diff --git a/.github/scripts/fix-e2e-v1770.mjs b/.github/scripts/fix-e2e-v1770.mjs new file mode 100644 index 0000000..dfba32a --- /dev/null +++ b/.github/scripts/fix-e2e-v1770.mjs @@ -0,0 +1,21 @@ +import fs from 'node:fs'; +const f='tests/app.spec.mjs'; +let s=fs.readFileSync(f,'utf8'); +function replace(a,b,label){if(!s.includes(a))throw new Error(label+' not found');s=s.replace(a,b)} +replace("expect(result.version).toBe('17.6.9');","expect(result.version).toBe('17.7.0');",'memory version'); +replace("expect(runtimeSource).toContain(\"const VERSION = '17.6.5'\");","expect(runtimeSource).toContain(\"const VERSION = '17.7.0'\");",'runtime version'); +replace( +` await page.evaluate(()=>localStorage.setItem('sunOrders',JSON.stringify([{id:77,status:'Новый',total:1000}]))); + const result=await page.evaluate(()=>{const before=window.CateriumDataV1770.orders.get(77);window.CateriumDataV1770.orders.update(77,o=>({...o,status:'Тест'}));return {before:before.status,after:window.CateriumDataV1770.orders.get(77).status,version:window.CateriumDataV1770.VERSION}});`, +` const result=await page.evaluate(()=>{window.CateriumDataV1770.orders.replace([{id:77,status:'Новый',total:1000}],{persistLocal:false,reason:'e2e-seed'});const before=window.CateriumDataV1770.orders.get(77);window.CateriumDataV1770.orders.update(77,o=>({...o,status:'Тест'}),{persistLocal:false});return {before:before.status,after:window.CateriumDataV1770.orders.get(77).status,version:window.CateriumDataV1770.VERSION}});`, +'data layer seed'); +replace( +` await page.evaluate(()=>{window.__applied=[];window.CateriumDataV1770={isSupportReadOnly:()=>false,diagnostics:{measure:async(_n,fn)=>fn()},orders:{applyServerChanges:(orders)=>window.__applied.push(...orders)}};window.CateriumData=window.CateriumDataV1770;window.SunCloudV2={getSession:()=>({user:{id:'u'}}),getWorkspace:()=>({id:'w'}),getClient:()=>({rpc:async()=>({data:{changed:1,orders:[{id:8,status:'Отдан заказчику'}]},error:null})})};}); + const source=fs.readFileSync(path.join(process.cwd(),'public','core','server-automation-v1770.js'),'utf8');await page.addScriptTag({content:source}); + await page.waitForFunction(()=>Boolean(window.CateriumServerAutomationV1770));await page.evaluate(()=>window.CateriumServerAutomationV1770.run({force:true}));`, +` await page.evaluate(()=>{window.__applied=[];window.__signed=false;window.CateriumDataV1770={isSupportReadOnly:()=>false,diagnostics:{measure:async(_n,fn)=>fn()},orders:{applyServerChanges:(orders)=>window.__applied.push(...orders)}};window.CateriumData=window.CateriumDataV1770;window.SunCloudV2={getSession:()=>window.__signed?({user:{id:'u'}}):null,getWorkspace:()=>({id:'w'}),getClient:()=>({rpc:async()=>({data:{changed:1,orders:[{id:8,status:'Отдан заказчику'}]},error:null})})};}); + const source=fs.readFileSync(path.join(process.cwd(),'public','core','server-automation-v1770.js'),'utf8');await page.addScriptTag({content:source}); + await page.waitForFunction(()=>Boolean(window.CateriumServerAutomationV1770));await page.evaluate(async()=>{window.__signed=true;await window.CateriumServerAutomationV1770.run({force:true})});`, +'server automation deterministic start'); +fs.writeFileSync(f,s); +console.log('v17.7.0 E2E checks stabilized');