| 1 | package com.github.continuedev.continueintellijextension |
| 2 | |
| 3 | import com.automation.remarks.junit5.Video |
| 4 | import com.intellij.driver.sdk.ui.components.* |
| 5 | import com.intellij.driver.sdk.wait |
| 6 | import com.intellij.ide.starter.driver.engine.runIdeWithDriver |
| 7 | import com.intellij.ide.starter.ide.IdeProductProvider |
| 8 | import com.intellij.ide.starter.models.TestCase |
| 9 | import com.intellij.ide.starter.plugins.PluginConfigurator |
| 10 | import com.intellij.ide.starter.project.NoProject |
| 11 | import com.intellij.ide.starter.runner.Starter |
| 12 | import org.junit.jupiter.api.Test |
| 13 | import org.junit.jupiter.api.Assertions.assertTrue |
| 14 | import java.io.File |
| 15 | import kotlin.time.Duration.Companion.seconds |
| 16 | |
| 17 | class Autocomplete { |
| 18 | |
| 19 | @Video |
| 20 | @Test |
| 21 | fun testAutocomplete() { |
| 22 | val starter = Starter.newContext("testExample", TestCase(IdeProductProvider.IC, NoProject).withVersion("2024.3")) |
| 23 | PluginConfigurator(starter).installPluginFromFolder(File(System.getProperty("CONTINUE_PLUGIN_DIR"))) |
| 24 | starter.runIdeWithDriver().useDriverAndCloseIde { |
| 25 | welcomeScreen { |
| 26 | createNewProjectButton.click() |
| 27 | button("Create").click() |
| 28 | } |
| 29 | ideFrame { |
| 30 | editorTabs { |
| 31 | clickTab("Main.java") |
| 32 | } |
| 33 | codeEditor { |
| 34 | keyboard { |
| 35 | enterText("TEST_USER_MESSAGE_0") |
| 36 | space() |
| 37 | } |
| 38 | wait(2.seconds) |
| 39 | keyboard { |
| 40 | tab() |
| 41 | } |
| 42 | assertTrue(text.contains("TEST_LLM_RESPONSE_0")) |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | } |