feat: complete unified plugin admin v1.1.0
This commit is contained in:
@@ -8,7 +8,9 @@ const outputDir = process.env.PLUGIN_SCREENSHOT_DIR || '.playwright-cli/subscrip
|
||||
|
||||
await fs.mkdir(path.resolve(outputDir), { recursive: true })
|
||||
|
||||
const browser = await chromium.launch({ headless: true })
|
||||
const launchOptions = { headless: true }
|
||||
if (process.env.PLAYWRIGHT_EXECUTABLE_PATH) launchOptions.executablePath = process.env.PLAYWRIGHT_EXECUTABLE_PATH
|
||||
const browser = await chromium.launch(launchOptions)
|
||||
try {
|
||||
for (const width of [425, 900, 1440]) {
|
||||
const page = await browser.newPage({ viewport: { width, height: 900 }, deviceScaleFactor: 1 })
|
||||
@@ -21,18 +23,12 @@ try {
|
||||
} catch (_) {}
|
||||
})
|
||||
await page.goto(entry, { waitUntil: 'domcontentloaded' })
|
||||
await page.getByLabel('管理员邮箱').fill('admin@example.com')
|
||||
await page.getByLabel('密码').fill('password')
|
||||
await page.getByRole('button', { name: '登录' }).click()
|
||||
await page.locator('#app-view').waitFor({ state: 'visible' })
|
||||
await page.getByRole('heading', { name: '订阅管理已纳入统一控制面' }).waitFor()
|
||||
if (await page.locator('input[type="password"], form').count()) throw new Error('subscription module exposed an independent login form')
|
||||
await page.waitForTimeout(50)
|
||||
if (responseLeaks.length) throw new Error(`sensitive response field exposed at ${width}px: ${responseLeaks.join(', ')}`)
|
||||
await page.getByRole('button', { name: '用户订阅' }).click()
|
||||
await page.locator('#subscriptions-list table').waitFor()
|
||||
await page.getByRole('button', { name: '下一页' }).click()
|
||||
await page.getByRole('button', { name: '概览' }).click()
|
||||
await page.reload({ waitUntil: 'domcontentloaded' })
|
||||
await page.locator('#app-view').waitFor({ state: 'visible' })
|
||||
await page.getByRole('heading', { name: '订阅管理已纳入统一控制面' }).waitFor()
|
||||
const overflow = await page.evaluate(() => document.documentElement.scrollWidth > window.innerWidth)
|
||||
if (overflow) throw new Error(`horizontal overflow at ${width}px`)
|
||||
await page.screenshot({ path: path.join(outputDir, `subscription-admin-${width}.png`), fullPage: true })
|
||||
|
||||
Reference in New Issue
Block a user