_probe.mjs 1.1 KB

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