| 123456789101112131415161718192021222324252627282930313233 |
- import { chromium } from 'playwright'
- const browser = await chromium.launch()
- const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } })
- const page = await ctx.newPage()
- const errors = []
- page.on('pageerror', e => errors.push('PAGEERROR: ' + e.message))
- page.on('console', m => { if (m.type() === 'error') errors.push('CONSOLE: ' + m.text()) })
- await page.goto('http://localhost:8080/')
- await page.waitForTimeout(500)
- await page.fill('input[placeholder="请输入账号"]', 'admin')
- await page.fill('input[placeholder="请输入密码"]', '123456')
- await page.click('button.login-btn')
- await page.waitForTimeout(1500)
- await page.screenshot({ path: 'scripts/shot-equity.png' })
- const pages = [
- ['#/customization/hsbc/crowd-tasks', 'crowd-tasks'],
- ['#/customization/hsbc/tags', 'tags'],
- ['#/customization/hsbc/rule-groups', 'rule-groups'],
- ['#/customization/hsbc/equity-grant-campaign', 'grant-campaign'],
- ['#/customization/hsbc/pages/home', 'page-home'],
- ['#/customization/hsbc/equity-products/add', 'add-equity'],
- ['#/customization/hsbc/sms-templates', 'sms-templates'],
- ]
- for (const [hash, name] of pages) {
- await page.goto('http://localhost:8080/' + hash)
- await page.waitForTimeout(1500)
- await page.screenshot({ path: `scripts/shot-${name}.png` })
- }
- console.log('ERRORS:', errors.length)
- errors.forEach(e => console.log(' -', e))
- await browser.close()
|