Skip to content

Commit c532d0f

Browse files
committed
test: use retry loop in Autocomplete test
1 parent 42fdec0 commit c532d0f

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

  • extensions/intellij/src/testIntegration/kotlin/com/github/continuedev/continueintellijextension

extensions/intellij/src/testIntegration/kotlin/com/github/continuedev/continueintellijextension/Autocomplete.kt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,25 @@ class Autocomplete {
3131
clickTab("Main.java")
3232
}
3333
codeEditor {
34-
keyboard {
35-
enterText("TEST_USER_MESSAGE_0")
36-
space()
34+
var success = false
35+
for (i in 1..10) {
36+
keyboard {
37+
enterText("TEST_USER_MESSAGE_0")
38+
space()
39+
}
40+
wait(2.seconds)
41+
keyboard {
42+
tab()
43+
}
44+
if (text.contains("TEST_LLM_RESPONSE_0")) {
45+
success = true
46+
break
47+
}
48+
keyboard {
49+
enter()
50+
}
3751
}
38-
wait(5.seconds)
39-
keyboard {
40-
tab()
41-
}
42-
var attempts = 0
43-
while (!text.contains("TEST_LLM_RESPONSE_0") && attempts < 10) {
44-
wait(1.seconds)
45-
attempts++
46-
}
47-
assertTrue(text.contains("TEST_LLM_RESPONSE_0")) {
52+
assertTrue(success) {
4853
"Autocomplete mismatch.\nEditor=${text.take(500)}"
4954
}
5055
}

0 commit comments

Comments
 (0)