From 6a7e69cb5b9ee99da7043b9483850a5eebd0624b Mon Sep 17 00:00:00 2001 From: pavlov346346-source Date: Wed, 9 Sep 2026 02:38:16 +0300 Subject: [PATCH] Add v17.7.1 E2E repair script --- ops/fix_v1771_e2e.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ops/fix_v1771_e2e.py diff --git a/ops/fix_v1771_e2e.py b/ops/fix_v1771_e2e.py new file mode 100644 index 0000000..0ddc39a --- /dev/null +++ b/ops/fix_v1771_e2e.py @@ -0,0 +1,26 @@ +from pathlib import Path +import subprocess + +p = Path('tests/app.spec.mjs') +s = subprocess.check_output([ + 'git', 'show', + '1e781f51b3ca39b4fda5260d9073855801cd802f:tests/app.spec.mjs' +], text=True, encoding='utf-8') + +old = """test('v17.7.0 data layer can update orders without direct UI globals', async ({ page }) => { + await page.goto('/index.html',{waitUntil:'domcontentloaded'}); + const source=fs.readFileSync(path.join(process.cwd(),'public','core','data-layer-v1770.js'),'utf8');await page.addScriptTag({content:source}); + 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}}); + expect(result).toEqual({before:'Новый',after:'Тест',version:'17.7.0'}); +});""" +new = """test('v17.7.1 data layer can update orders without direct UI globals', async ({ page }) => { + await page.goto('/index.html',{waitUntil:'domcontentloaded'}); + await page.waitForFunction(()=>Boolean(window.CateriumDataV1771),null,{timeout:5000}); + const result=await page.evaluate(()=>{const d=window.CateriumDataV1771;d.orders.replace([{id:77,status:'Новый',total:1000}],{persistLocal:false,reason:'e2e-seed'});const before=d.orders.get(77);d.orders.update(77,o=>({...o,status:'Тест'}),{persistLocal:false});return {before:before.status,after:d.orders.get(77).status,version:d.VERSION,alias:window.CateriumDataV1770===d}}); + expect(result).toEqual({before:'Новый',after:'Тест',version:'17.7.1',alias:true}); +});""" +if old not in s: + raise SystemExit('target v17.7.0 data-layer test not found in restored suite') +s = s.replace(old, new, 1) +p.write_text(s, encoding='utf-8') +print('Restored full E2E suite and patched v17.7.1 compatibility test')