46 lines
2.1 KiB
JavaScript
46 lines
2.1 KiB
JavaScript
// round2 单批验证:guides 渲染 + 类目色点 token + 行内按钮实心(本地真实栈)。
|
|
import { chromium } from '@playwright/test'
|
|
const BASE = 'http://localhost:5174/admin-vue'
|
|
const browser = await chromium.launch({ channel: 'msedge', headless: true })
|
|
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } })
|
|
await page.goto(`${BASE}/`, { waitUntil: 'networkidle' })
|
|
await page.waitForTimeout(500)
|
|
if (await page.locator('#loginUsername').isVisible().catch(() => false)) {
|
|
await page.locator('#loginUsername').fill('admin')
|
|
await page.locator('#loginPassword').fill('admin123')
|
|
await page.locator('.btn-login').click()
|
|
await page.waitForURL(/admin-vue\/(account|asin|shop|records)/, { timeout: 20000 }).catch(() => {})
|
|
await page.waitForTimeout(1200)
|
|
}
|
|
async function open(path) {
|
|
await page.goto(`${BASE}/${path}`, { waitUntil: 'domcontentloaded' })
|
|
await page.locator('.page-heading').first().waitFor({ state: 'visible', timeout: 15000 }).catch(() => {})
|
|
await page.waitForLoadState('networkidle').catch(() => {})
|
|
await page.waitForTimeout(600)
|
|
}
|
|
|
|
await open('account/users')
|
|
const guide = await page.locator('.operation-guide').count()
|
|
const guideText = guide ? (await page.locator('.og-text').textContent())?.trim() : null
|
|
console.log('users guide visible:', guide > 0, '| text:', guideText)
|
|
|
|
await open('asin-center/categories')
|
|
const token = await page.evaluate(() => {
|
|
const el = document.querySelector('.tree-node-mark')
|
|
if (!el) return null
|
|
const cs = getComputedStyle(el)
|
|
return { color: cs.color, bg: cs.backgroundColor }
|
|
})
|
|
console.log('categories tree-node-mark:', JSON.stringify(token))
|
|
|
|
await open('asin-center/registry')
|
|
const solid = await page.evaluate(() => {
|
|
const btns = [...document.querySelectorAll('.el-table .el-button--small')]
|
|
const linkOrText = btns.filter((b) => b.classList.contains('is-link') || b.classList.contains('is-text')).length
|
|
const primary = btns.filter((b) => b.classList.contains('el-button--primary')).length
|
|
return { smallSolid: btns.length, linkOrText, primary }
|
|
})
|
|
console.log('registry row buttons:', JSON.stringify(solid))
|
|
|
|
await browser.close()
|