Stub app APIs in v17.6.2 isolated E2E

This commit is contained in:
pavlov346346-source 2026-09-07 18:50:09 +03:00
parent 7bfe88a67b
commit a5bea1708d

View File

@ -39,9 +39,18 @@ test('chat photo guard compresses a large camera image', async ({ page }) => {
}); });
test('v17.6.2 operations UX boots with menu and route features', async ({ page }) => { test('v17.6.2 operations UX boots with menu and route features', async ({ page }) => {
await page.goto('/index.html', { waitUntil:'domcontentloaded' }); await page.goto('/index.html', { waitUntil:'domcontentloaded' });
await page.evaluate(()=>{
window.SunCloudV2={
getSupportMode:()=>null,
isSupportMode:()=>false,
hasPermission:()=>true,
getSession:()=>({user:{id:'e2e'}})
};
window.editBox=()=>{};
});
const content=fs.readFileSync(path.join(process.cwd(),'public','core','ops-ux-v1762.js'),'utf8'); const content=fs.readFileSync(path.join(process.cwd(),'public','core','ops-ux-v1762.js'),'utf8');
await page.addScriptTag({content}); await page.addScriptTag({content});
await page.waitForFunction(()=>Boolean(window.SunOpsUXV1762),null,{timeout:15000}); await page.waitForFunction(()=>Boolean(window.SunOpsUXV1762),null,{timeout:5000});
const checks=await page.evaluate(()=>window.SunOpsUXV1762.checks()); const checks=await page.evaluate(()=>window.SunOpsUXV1762.checks());
expect(checks.version).toBe('17.6.2'); expect(checks.version).toBe('17.6.2');
expect(checks.menuPage).toBeTruthy(); expect(checks.menuPage).toBeTruthy();