From d6d73e1072ee90d4661568ba52cd7d20063ccdd1 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Mon, 23 Nov 2026 13:09:37 +0800 Subject: [PATCH] test(search): measure the scope pattern field after the dialog settles (#5364) The Scopes dialog relays out over a few frames after the viewport shrinks; wait until the pattern field's position is stable before measuring it. --- e2e/searchScopesDialogLayout.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e2e/searchScopesDialogLayout.spec.ts b/e2e/searchScopesDialogLayout.spec.ts index 9c93ad66c..afe504349 100644 --- a/e2e/searchScopesDialogLayout.spec.ts +++ b/e2e/searchScopesDialogLayout.spec.ts @@ -29,7 +29,14 @@ test("Find in Files keeps the scope list and pattern editor usable in a narrow w expect((await list.boundingBox())!.x).toBeLessThan((await name.boundingBox())!.x); await page.setViewportSize({ width: 460, height: 530 }); - const fields = (await pattern.boundingBox())!; + // The dialog relays out over a few frames after the resize; measure once it has settled. + let fields = (await pattern.boundingBox())!; + await expect(async () => { + const previous = fields.y; + await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)))); + fields = (await pattern.boundingBox())!; + expect(fields.y).toBe(previous); + }).toPass(); expect(fields.y).toBeGreaterThanOrEqual((await list.boundingBox())!.y + (await list.boundingBox())!.height); expect(fields.width).toBeGreaterThan(250); await list.evaluate((el) => (el.scrollTop = el.scrollHeight));