2026-09-24 16:10:08 +03:00
|
|
|
const { chromium } = require('playwright');
|
|
|
|
|
|
|
|
|
|
function launchBrowser() {
|
|
|
|
|
const channel = process.env.MEGURI_BROWSER_CHANNEL || 'chrome';
|
|
|
|
|
return chromium.launch({
|
|
|
|
|
headless: true,
|
|
|
|
|
...(channel === 'chromium' ? {} : { channel }),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.launchBrowser = launchBrowser;
|
|
|
|
|
|
2026-09-24 14:35:05 +03:00
|
|
|
exports.openSetup = async (page, name) => {
|
|
|
|
|
await page.waitForFunction(()=>window.Alpine && Alpine.$data(document.body).ready && Alpine.$data(document.body).workspace);
|
|
|
|
|
const combined=['Schedules','Escalations & routing','Variables & rules'].includes(name);
|
|
|
|
|
const target=page.getByRole('link',{name:combined?'Schedule setup':name,exact:true});
|
|
|
|
|
if(!await target.isVisible())await page.getByRole('button',{name:'Setup',exact:true}).click();
|
|
|
|
|
await target.click();
|
|
|
|
|
if(combined)await page.locator(name==='Schedules'?'#schedules':name==='Escalations & routing'?'#schedules':'#generation').scrollIntoViewIfNeeded();
|
|
|
|
|
};
|