From bf39687921bd98a01aa018ed35e7d43fb5a7fbd6 Mon Sep 17 00:00:00 2001 From: matthiola0 Date: Fri, 9 Oct 2026 23:33:29 +0800 Subject: [PATCH] Use a locator to wait for bracket marks to clear The editor cache test already waits for bracket marks to clear before resetting the paint counter. Express the wait with a locator so the expected DOM state is clear, and document why the wait is needed. --- tests/browser/editor-pipeline.test.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/browser/editor-pipeline.test.js b/tests/browser/editor-pipeline.test.js index 867661f8..2a1dd126 100644 --- a/tests/browser/editor-pipeline.test.js +++ b/tests/browser/editor-pipeline.test.js @@ -377,9 +377,12 @@ test("caret and focus changes reuse ranges until code or language changes", asyn editor.focus(); }); await page.keyboard.press("ControlOrMeta+A"); - await page.waitForFunction( - () => document.querySelectorAll(".matching-bracket").length === 0, - ); + // Selecting all clears the bracket marks in a queued paint. Count the + // replacement only after that paint, whatever frame the keypress reached. + await page + .locator(".matching-bracket") + .first() + .waitFor({ state: "detached" }); await page.evaluate(() => { window.overlayPaints = 0; });