import { chromium } from 'playwright'
const b = await chromium.launch()
const ctx = await b.newContext({ viewport: { width: 1400, height: 900 } })
const p = await ctx.newPage()
await p.goto('http://localhost:8080/')
await p.fill('input[placeholder="请输入账号"]', 'admin')
await p.fill('input[placeholder="请输入密码"]', '123456')
await p.click('button.login-btn')
await p.waitForTimeout(1500)
await p.goto('http://localhost:8080/#/customization/hsbc/channel')
await p.waitForTimeout(1500)
await p.click('button:has-text("新建 Channel")')
await p.waitForTimeout(800)
const r = await p.evaluate(() => {
  const sel = document.querySelector('.el-dialog .inline-field .el-select')
  const wrap = sel?.querySelector('.el-select__wrapper')
  const parent = sel?.parentElement
  return {
    inlineField: parent ? { display: getComputedStyle(parent).display, w: getComputedStyle(parent).width } : null,
    selectRoot: sel ? { display: getComputedStyle(sel).display, w: getComputedStyle(sel).width, flex: getComputedStyle(sel).flex, minW: getComputedStyle(sel).minWidth } : null,
    selectWrapper: wrap ? { display: getComputedStyle(wrap).display, w: getComputedStyle(wrap).width } : null
  }
})
console.log(JSON.stringify(r, null, 2))
await b.close()
