test(web): probe locale dialog scroll container

Anchor the desktop-locale overflow probe to the locale selector's nearest horizontal scroll container instead of nav's next sibling. Master moved the settings header between nav and options, so the old positional target put the probe in a fixed header row and the negative control could not overflow.
This commit is contained in:
Tianyi Cui committed 2026-10-21 18:04:02 +08:00
1 parent c7278aa4d5
commit 0891effd68
1 file changed
+9 -3
+9 -3
View File
@@ -109,13 +109,19 @@ describe.skipIf(MODE === 'record')('web e2e: native and Client locale preference
return containers.filter(element => element.clientWidth > 0 && element.scrollWidth > element.clientWidth + 1).length
})
await expect.poll(overflows).toBe(0)
await jaDialog.evaluate((dialog) => {
const options = dialog.querySelector('nav')!.nextElementSibling!.lastElementChild!
await jaDialog.getByRole('button', { name: '日本語', exact: true }).evaluate((button) => {
const dialog = button.closest('[role="dialog"]')
let container: HTMLElement | null = button.parentElement
while (container !== null && container !== dialog
&& !['auto', 'scroll'].includes(getComputedStyle(container).overflowX)) {
container = container.parentElement
}
if (container === null || container === dialog) throw new Error('locale selector has no horizontal scroll container')
const probe = document.createElement('div')
probe.dataset.localeOverflowProbe = ''
probe.style.width = '2000px'
probe.style.height = '1px'
options.append(probe)
container.append(probe)
})
try {
expect(await overflows()).toBeGreaterThan(0)