shot-quill.mjs 996 B

123456789101112131415161718192021
  1. import { chromium } from 'playwright'
  2. const b = await chromium.launch()
  3. const ctx = await b.newContext({ viewport: { width: 1600, height: 1000 } })
  4. const p = await ctx.newPage()
  5. await p.goto('http://localhost:8080/')
  6. await p.fill('input[placeholder="请输入账号"]', 'admin')
  7. await p.fill('input[placeholder="请输入密码"]', '123456')
  8. await p.click('button.login-btn')
  9. await p.waitForTimeout(1500)
  10. await p.goto('http://localhost:8080/#/customization/hsbc/equity-products/add')
  11. await p.waitForTimeout(2000)
  12. const dims = await p.evaluate(() => {
  13. const cs = document.querySelectorAll('.ql-container')
  14. return Array.from(cs).map(c => ({ w: getComputedStyle(c).width, h: getComputedStyle(c).height }))
  15. })
  16. console.log('CONTAINERS:', JSON.stringify(dims))
  17. // scroll to find the editor
  18. await p.evaluate(() => { document.querySelector('.ql-toolbar')?.scrollIntoView({ block: 'center' }) })
  19. await p.waitForTimeout(500)
  20. await p.screenshot({ path: 'scripts/shot-quill-fixed.png' })
  21. await b.close()