Fix v17.6.4 E2E core module loading

This commit is contained in:
pavlov346346-source 2026-09-07 20:02:29 +03:00
parent 412c28b4fe
commit 5883d36c74

View File

@ -7,6 +7,11 @@ async function loadModule(page,file,globalName){
await page.addScriptTag({content});
expect(await page.evaluate(name=>Boolean(window[name]),globalName)).toBeTruthy();
}
async function injectCore(page,file,globalName){
const content=fs.readFileSync(path.join(process.cwd(),'public','core',file),'utf8');
await page.addScriptTag({content});
if(globalName)expect(await page.evaluate(name=>Boolean(window[name]),globalName)).toBeTruthy();
}
test('legacy localStorage payload cannot execute XSS', async ({ page }) => {
const pageErrors=[]; page.on('pageerror',e=>pageErrors.push(String(e)));
await page.addInitScript(() => {
@ -96,7 +101,7 @@ test('v17.6.4 auto-completes and fully pays an order one minute after scheduled
localStorage.setItem('sunOrders',JSON.stringify([{id:764,event:'Тест авто-завершения',date:'2026-09-07',time:'12:00',status:'Новый',prepayment:100,total:1500,lines:[]}]))
});
await page.goto('/index.html',{waitUntil:'domcontentloaded'});
await page.waitForFunction(()=>Boolean(window.SunUXFixV1764),null,{timeout:7000});
await injectCore(page,'ux-fixes-v1764.js','SunUXFixV1764');
const result=await page.evaluate(()=>{
window.orderTotalValue=()=>1500;
const run=window.SunUXFixV1764.autoCompleteOrders(new Date('2026-09-07T12:01:01').getTime(),{silent:true});
@ -118,7 +123,9 @@ test('v17.6.4 keeps proposal designs per order and renders a styled menu icon',
]));
});
await page.goto('/index.html',{waitUntil:'domcontentloaded'});
await page.waitForFunction(()=>Boolean(window.SunUXFixV1764)&&Boolean(document.querySelector('header nav .nav-menu')),null,{timeout:7000});
await injectCore(page,'ops-ux-v1762.js','SunOpsUXV1762');
await injectCore(page,'ux-fixes-v1764.js','SunUXFixV1764');
await page.waitForFunction(()=>Boolean(document.querySelector('header nav .nav-menu .sun-v1764-menu-icon')),null,{timeout:5000});
const result=await page.evaluate(()=>{
window.SunUXFixV1764.persistOfferTemplate('801','midnight-glass');
const list=JSON.parse(localStorage.getItem('sunOrders')||'[]');