From ec3197d12282d1138f8bcfd96d2f51c508397674 Mon Sep 17 00:00:00 2001 From: Yif <877193178@qq.com> Date: Tue, 29 Sep 2026 12:19:10 +0800 Subject: [PATCH] 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. --- apps/web/tests/caption-overlays.e2e.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/tests/caption-overlays.e2e.ts b/apps/web/tests/caption-overlays.e2e.ts index 9a28468a2f..d0713573c2 100644 --- a/apps/web/tests/caption-overlays.e2e.ts +++ b/apps/web/tests/caption-overlays.e2e.ts @@ -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)