test(web): assert dialog clearance instead of a filled viewport

The install dialog is content-sized, so trimming the guide to its one
package-name entry leaves it shorter than the 520x600 viewport and centered
inside the same clearances; the caption-overlays case pinned y to the margin
and height to the full available box, which only held while the three-entry
guide overflowed. Assert the intent instead: the dialog stays inside the
Windows caption margin and clear of the mask.
This commit is contained in:
Yif committed 2026-09-29 12:19:10 +08:00
1 parent fd4cd8b348
commit ec3197d122
1 file changed
+6 -2
+6 -2
View File
@@ -56,8 +56,12 @@ it('keeps settings and expanded plugin dialogs clear of the Windows caption acro
for (const fullscreen of [false, true, false]) {
await page.evaluate(value => document.documentElement.toggleAttribute('data-fullscreen', value), fullscreen)
const margin = fullscreen ? 24 : 60
await expect.poll(async () => (await plugin.boundingBox())?.y).toBe(margin)
expect((await plugin.boundingBox())?.height).toBe(600 - 2 * margin)
// The dialog is content-sized: it fills the available height only while its content needs it,
// and otherwise stays centered inside the same clearances.
await expect.poll(async () => {
const box = await plugin.boundingBox()
return box !== null && box.y >= margin && box.y + box.height <= 600 - margin
}, { timeout: 5_000 }).toBe(true)
expect((await plugin.locator('..').locator(':scope > [aria-hidden="true"]').boundingBox())?.y).toBe(fullscreen ? 0 : 40)
expect(await plugin.getByRole('button', { name: '关闭', exact: true }).isVisible()).toBe(true)
expect(await plugin.getByRole('button', { name: '安装', exact: true }).isVisible()).toBe(true)