52 lines
3.8 KiB
YAML
52 lines
3.8 KiB
YAML
name: Fix v17.7.0 E2E checks
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- feature/v17.7.0-architecture-foundation
|
|
paths:
|
|
- .github/workflows/fix-e2e-v1770.yml
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
fix:
|
|
if: github.actor != 'github-actions[bot]'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- name: Stabilize E2E assertions
|
|
run: |
|
|
node <<'NODE'
|
|
const fs=require('fs');
|
|
const f='tests/app.spec.mjs';let s=fs.readFileSync(f,'utf8');
|
|
const 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 deterministic 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);
|
|
NODE
|
|
- name: Commit
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add tests/app.spec.mjs
|
|
git commit -m "Stabilize v17.7.0 E2E checks"
|
|
git push
|