const { chromium } = require('C:/Users/Sowmya/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright'); const path = require('path'); const fs = require('fs'); (async () => { const browser = await chromium.launch({channel:'msedge',headless:true}); const page = await browser.newPage({viewport:{width:1440,height:1000}}); const errors=[]; page.on('pageerror',e=>errors.push(String(e))); async function login(username) { await page.goto('http://127.0.0.1:5001/login'); await page.getByLabel('Team member').selectOption(username); await page.getByLabel('Password',{exact:true}).fill('Password@123'); await page.getByRole('button',{name:'Sign in',exact:false}).click(); await page.getByLabel('Current password',{exact:true}).fill('Password@123'); await page.getByLabel('New password',{exact:true}).fill('BrowserTest@456'); await page.getByLabel('Confirm new password',{exact:true}).fill('BrowserTest@456'); await page.getByRole('button',{name:'Save password & continue',exact:false}).click(); } await page.goto('http://127.0.0.1:5001/login'); await page.screenshot({path:'validation/login-desktop.png',fullPage:true}); await login('kishan'); await page.getByLabel('Previous MOM workbook', {exact:false}).setInputFiles(path.resolve('sources/MOM_Technical Report on 15-09-2026.xlsx')); await page.getByRole('button',{name:'Read report & preview',exact:false}).click(); await page.getByLabel('Actual date of the old meeting').fill('2026-09-21'); await page.getByLabel('Upcoming meeting (Monday)',{exact:true}).first().fill('2026-09-28'); await page.screenshot({path:'validation/import-preview.png',fullPage:true}); await page.getByRole('button',{name:'Confirm import & open workspace',exact:false}).click(); await page.getByRole('heading',{name:'Hello, Kishan.'}).waitFor(); await page.screenshot({path:'validation/dashboard-desktop.png',fullPage:true}); await page.setViewportSize({width:390,height:844}); await page.screenshot({path:'validation/dashboard-mobile.png',fullPage:true}); const overflow=await page.evaluate(()=>document.documentElement.scrollWidth>window.innerWidth); if(overflow)throw new Error('Mobile dashboard has horizontal overflow'); await page.setViewportSize({width:1440,height:1000}); await page.getByRole('button',{name:'Sign out',exact:true}).click(); await login('harshitha'); await page.getByRole('link',{name:'Coordinate meeting',exact:false}).click(); await page.screenshot({path:'validation/coordinator-desktop.png',fullPage:true}); const card=page.locator('.delegate-card').filter({has:page.getByRole('heading',{name:'Vinay',exact:true})}); await card.getByRole('link',{name:'Prepare entry',exact:false}).click(); await page.locator('input[type=checkbox]').first().check(); await page.getByRole('button',{name:'Save & continue',exact:false}).click(); await page.getByLabel('What have you worked on?').fill('Confirmed the screen-pop integration after the weekly review.'); await page.getByRole('button',{name:'Save update',exact:false}).click(); await page.screenshot({path:'validation/updates-desktop.png',fullPage:true}); await page.getByRole('button',{name:'Continue to actions',exact:false}).click(); await page.getByLabel('What needs to be done?').fill('Complete the remaining integration checks.'); await page.getByLabel('Due date',{exact:true}).fill('2026-09-30'); await page.getByRole('button',{name:'Save action',exact:false}).click(); await page.getByRole('button',{name:'Review my entry',exact:false}).click(); await page.getByRole('button',{name:'Submit meeting entry',exact:false}).click(); await page.getByRole('link',{name:'Review full report',exact:false}).click(); const downloadPromise=page.waitForEvent('download'); await page.getByRole('link',{name:'Download Excel',exact:false}).click(); const download=await downloadPromise; await download.saveAs('validation/browser-report.xlsx'); if(errors.length)throw new Error(errors.join('\n')); fs.writeFileSync('validation/browser-result.json',JSON.stringify({passed:true,checks:['login and forced password change','upload and owner preview','setup confirmation','desktop and mobile dashboard','coordinator delegation for Vinay','completion review','saved update','dated action','submission','Excel download'],javascriptErrors:errors,mobileOverflow:overflow},null,2)); console.log('Browser workflow passed, including upload, coordinator delegation, mobile layout and Excel download.'); await browser.close(); })().catch(e=>{console.error(e);process.exit(1)});