Use isolated module injection in v17.7.1 E2E tests

This commit is contained in:
pavlov346346-source 2026-09-09 02:50:00 +03:00
parent eee001fc55
commit baf77724ae

View File

@ -2,10 +2,10 @@ from pathlib import Path
p=Path('tests/app.spec.mjs')
s=p.read_text(encoding='utf-8')
old="await page.waitForFunction(()=>Boolean(window.CateriumDataV1771),null,{timeout:5000});"
new="await page.waitForFunction(()=>Boolean(window.SunPerformance),null,{timeout:10000});await page.evaluate(()=>window.SunPerformance.loadDataLayer());await page.waitForFunction(()=>Boolean(window.CateriumDataV1771),null,{timeout:10000});"
new="await injectCore(page,'data-layer-v1771.js','CateriumDataV1771');"
count=s.count(old)
if count != 2:
raise SystemExit(f'Expected 2 v17.7.1 loader waits, found {count}')
s=s.replace(old,new)
p.write_text(s,encoding='utf-8')
print('Patched both v17.7.1 E2E loader waits')
print('Patched both v17.7.1 E2E tests to inject the isolated data layer module')