接口开始5%
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const origin = 'http://localhost:5173'
|
||||
const outputDirectory = path.join(require('os').tmpdir(), 'jiapuapp-runtime', 'g01-approval')
|
||||
const sizes = [
|
||||
{ width: 320, height: 568 },
|
||||
{ width: 360, height: 640 },
|
||||
@@ -141,24 +137,13 @@ const getMetrics = (send) => valueOf(send, `(() => {
|
||||
listScrollTop: list?.scrollTop || 0,
|
||||
blankBelowLastItem: list && last ? list.getBoundingClientRect().bottom - last.getBoundingClientRect().bottom : null,
|
||||
horizontalOverflow: document.documentElement.scrollWidth > innerWidth || document.body.scrollWidth > innerWidth,
|
||||
addDialogVisible: Boolean(document.querySelector('.add-genealogy-sheet')),
|
||||
addDialogVisible: Boolean(document.querySelector('.add-dialog')),
|
||||
switcherVisible: Boolean(dialog),
|
||||
borderImageSource: dialog ? getComputedStyle(dialog).borderImageSource : '',
|
||||
borderImageSlice: dialog ? getComputedStyle(dialog).borderImageSlice : ''
|
||||
}
|
||||
})()`)
|
||||
|
||||
const capture = async (send, filename) => {
|
||||
await send('Page.bringToFront')
|
||||
const screenshot = await send('Page.captureScreenshot', {
|
||||
format: 'png',
|
||||
fromSurface: false,
|
||||
captureBeyondViewport: false
|
||||
})
|
||||
fs.mkdirSync(outputDirectory, { recursive: true })
|
||||
fs.writeFileSync(path.join(outputDirectory, filename), Buffer.from(screenshot.data, 'base64'))
|
||||
}
|
||||
|
||||
const assert = (condition, message) => {
|
||||
if (!condition) throw new Error(message)
|
||||
}
|
||||
@@ -201,7 +186,6 @@ const run = async () => {
|
||||
assert(metrics.blankBelowLastItem <= (72 * rpx) + 2, `${size.width}x${size.height}: too much blank space below last item`)
|
||||
assert(!metrics.horizontalOverflow, `${size.width}x${size.height}: horizontal overflow`)
|
||||
sizeResults.push(metrics)
|
||||
await capture(send, `06-switch-dialog-stretchable-${size.width}x${size.height}.png`)
|
||||
}
|
||||
|
||||
await setSize(send, 412, 915)
|
||||
@@ -214,7 +198,6 @@ const run = async () => {
|
||||
assert(sixItems.dialog.height > sizeResults.at(-1).dialog.height + 1, 'Six-item dialog did not grow')
|
||||
assert(sixItems.dialog.height < 915 - ((120 * 412) / 750) - 1, 'Six-item dialog reached the maximum height too early')
|
||||
assert(sixItems.listScrollHeight <= sixItems.listClientHeight + 1, 'Six-item list unexpectedly scrolls')
|
||||
await capture(send, '06-switch-dialog-stretchable-six-items-412x915.png')
|
||||
|
||||
assert(await addClonesToTotal(send, 12), 'Could not prepare twelve-item stress state')
|
||||
await sleep(100)
|
||||
|
||||
Reference in New Issue
Block a user