Add v17.7.1 E2E repair script
This commit is contained in:
parent
fe4cb6446d
commit
6a7e69cb5b
26
ops/fix_v1771_e2e.py
Normal file
26
ops/fix_v1771_e2e.py
Normal file
@ -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')
|
||||||
Loading…
Reference in New Issue
Block a user