mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 03:17:46 -08:00
16 lines
593 B
TypeScript
16 lines
593 B
TypeScript
import type { Page } from '@playwright/test'
|
|
import assert from 'node:assert/strict'
|
|
import process from 'node:process'
|
|
|
|
export async function hoverProgress(page: Page, percentage: number) {
|
|
const inner = page.locator('.art-control-progress-inner')
|
|
if (process.env.ARTPLAYER_CHAPTER_HOVER_BASELINE !== '1')
|
|
await inner.hover({ trial: true })
|
|
const box = await inner.boundingBox()
|
|
assert(box, 'Chapter progress must have a visible box')
|
|
const x = Math.round(box.x + box.width * percentage)
|
|
const y = box.y + box.height / 2
|
|
await page.mouse.move(x, y)
|
|
return { box, x, y }
|
|
}
|