From c964074b3326f38229e2f5584acfcc837579704f Mon Sep 17 00:00:00 2001 From: Bart van Helvert Date: Thu, 5 Nov 2026 22:51:10 +0100 Subject: [PATCH] test(ui-test): wait for typing to reach the backend The snippets test typed a prefix and invoked completion at once. On a busy Windows runner the extension host's startup held the backend, which gave up on the requests because the typing hadn't reached it yet ("Editor did not reach the expected caret/document version"). The lookup then closed, and nothing asked again. Wait until the backend's document holds the typed prefix, then invoke completion once. Refs #84 --- .../uitest/runtime/SplitModeSnippetsTest.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ui-test/src/test/kotlin/me/helvert/codebridge/uitest/runtime/SplitModeSnippetsTest.kt b/src/ui-test/src/test/kotlin/me/helvert/codebridge/uitest/runtime/SplitModeSnippetsTest.kt index 0397d625..9c20c391 100644 --- a/src/ui-test/src/test/kotlin/me/helvert/codebridge/uitest/runtime/SplitModeSnippetsTest.kt +++ b/src/ui-test/src/test/kotlin/me/helvert/codebridge/uitest/runtime/SplitModeSnippetsTest.kt @@ -1,5 +1,7 @@ package me.helvert.codebridge.uitest.runtime +import com.intellij.driver.model.OnDispatcher +import com.intellij.driver.model.RdTarget import com.intellij.driver.sdk.invokeAction import com.intellij.driver.sdk.ui.components.common.codeEditor import com.intellij.driver.sdk.ui.components.common.editor.completionList @@ -51,6 +53,16 @@ class SplitModeSnippetsTest { editor.goToPosition(2, 1) editor.keyboard { typeText("probeb") } + // Completion runs on the backend, which gives up on a request whose typing it has not yet + // received ("Editor did not reach the expected caret/document version"), and the lookup + // closes with nothing asking again. On CI the extension host's startup once held the + // backend that long, so the typing has to reach it first. + awaitProbeValue("the typed prefix on the backend", { + driver.withContext(OnDispatcher.EDT) { + driver.service(SplitModeWorkbenchTest.EditorFactoryRef::class, RdTarget.BACKEND).getAllEditors() + .map { it.getDocument().getText() } + } + }) { "${CONTENT}probeb" in it } driver.invokeAction("CodeCompletion", component = editor.component) // Found again each time: a lookup asked again as more is typed is another list. The item // is drawn as its label split where it matched, so it is told by its raw text, and it is