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; });