| 1234567891011121314151617181920 |
- import { chromium } from 'playwright';
- const browser = await chromium.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe' });
- const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
- const p = await ctx.newPage();
- await p.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });
- await p.fill('input[type="tel"]', '13800138000');
- await p.fill('input[type="text"][maxlength="6"]', '123456');
- await p.click('button[type="submit"]');
- await p.waitForTimeout(3000);
- console.log('登录后 URL:', p.url());
- await p.goto('http://localhost:4200/desktop/workbench', { waitUntil: 'networkidle' });
- await p.waitForTimeout(2500);
- console.log('工作台 URL:', p.url());
- const hasNew = await p.locator('text=个任务已阻塞').count();
- const hasUiStat = await p.locator('ui-statistic').count();
- const hasOldCard = await p.locator('.agent-card').count();
- console.log(`新代码标记「个任务已阻塞」: ${hasNew} | ui-statistic 元素: ${hasUiStat} | 旧 .agent-card: ${hasOldCard}`);
- const h1 = await p.locator('h1').first().textContent().catch(()=>null);
- console.log('页面 h1:', h1);
- await browser.close();
|