test(web): await sidebar collapse before measuring plugin header

This commit is contained in:
fz committed 2026-10-13 00:50:08 +08:00
1 parent 0f0b30b3aa
commit cd5d5bc7bd
2 files changed
+4 -1

No files matched your search

@@ -1,7 +1,7 @@
# Plugin header responsive layout
en 1680px: actions beside the heading, single-line; contained; information follows subtitle; focus retained
en 768px: actions below the heading, single-line; contained; information follows subtitle; focus retained
en 768px: actions beside the heading, single-line; contained; information follows subtitle; focus retained
en 520px: actions below the heading, single-line; contained; information follows subtitle; focus retained
en 440px: actions below the heading, single-line; contained; information follows subtitle; focus retained
en 390px: actions below the heading, single-line; contained; information follows subtitle; focus retained
+3
View File
@@ -125,8 +125,11 @@ describe('web e2e: plugin manager', () => {
const add = header.getByRole('button', { name: language === 'en' ? 'Add plugin' : '添加插件', exact: true })
await expect.poll(() => add.isEnabled()).toBe(true)
await add.focus()
const frame = probe.locator('[data-shell-bottom]').locator('..')
for (const width of [1680, 768, 520, 440, 390, 430, 1024]) {
await probe.setViewportSize({ width, height: 1000 })
// The responsive sidebar changes the header's available width after ResizeObserver delivery.
await expect.poll(() => frame.getAttribute('data-sidebar-collapsed')).toBe(width < 1024 ? 'true' : null)
const measure = () => header.evaluate((element) => {
const heading = element.firstElementChild!
const actions = element.lastElementChild!