Merge pull request #3465 from continuedev/pe/jb-e2e-testing
test(jb): add autocomplete test
This commit is contained in:
commit
7f9782fb2a
22 changed files with 462 additions and 202 deletions
18
.github/workflows/pr_checks.yaml
vendored
18
.github/workflows/pr_checks.yaml
vendored
|
|
@ -96,7 +96,7 @@ jobs:
|
|||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
|
||||
install-gui:
|
||||
needs: [install-root, install-core]
|
||||
needs: [ install-root, install-core ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -157,7 +157,7 @@ jobs:
|
|||
npx tsc --noEmit
|
||||
|
||||
binary-checks:
|
||||
needs: [install-root, install-core]
|
||||
needs: [ install-root, install-core ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -193,7 +193,7 @@ jobs:
|
|||
npx tsc --noEmit
|
||||
|
||||
install-vscode:
|
||||
needs: [install-root, install-core]
|
||||
needs: [ install-root, install-core ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -277,7 +277,7 @@ jobs:
|
|||
|
||||
vscode-get-test-file-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [install-root, install-vscode]
|
||||
needs: [ install-root, install-vscode ]
|
||||
outputs:
|
||||
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
|
||||
steps:
|
||||
|
|
@ -306,7 +306,7 @@ jobs:
|
|||
|
||||
vscode-package-extension:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [install-vscode, install-core]
|
||||
needs: [ install-vscode, install-core ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
|
|
@ -338,7 +338,7 @@ jobs:
|
|||
|
||||
vscode-download-e2e-dependencies:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [install-vscode, install-core]
|
||||
needs: [ install-vscode, install-core ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
|
|
@ -445,7 +445,7 @@ jobs:
|
|||
path: extensions/vscode/e2e/storage/screenshots
|
||||
|
||||
gui-tests:
|
||||
needs: [install-gui, install-core]
|
||||
needs: [ install-gui, install-core ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -476,7 +476,7 @@ jobs:
|
|||
npm test
|
||||
|
||||
jetbrains-tests:
|
||||
needs: [install-root, install-core]
|
||||
needs: [ install-root, core-checks ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -573,3 +573,5 @@ jobs:
|
|||
name: jb-failure-report
|
||||
path: |
|
||||
${{ github.workspace }}/extensions/intellij/build/reports
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
|
|||
];
|
||||
|
||||
// Message types to pass through from core to webview
|
||||
// Note: If updating these values, make a corresponding update in
|
||||
// extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt
|
||||
export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
|
||||
[
|
||||
"configUpdate",
|
||||
|
|
|
|||
4
extensions/intellij/.gitignore
vendored
4
extensions/intellij/.gitignore
vendored
|
|
@ -3,4 +3,6 @@ src/main/resources/webview
|
|||
src/main/resources/bin
|
||||
src/main/resources/config_schema.json
|
||||
src/main/resources/continue_rc_schema.json
|
||||
video
|
||||
video
|
||||
src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/test-continue/*
|
||||
!src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/test-continue/config.json
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<!--<component name="ProjectRunConfigurationManager">-->
|
||||
<!-- <configuration default="false" name="Run IDE for UI Tests" type="GradleRunConfiguration" factoryName="Gradle">-->
|
||||
<!-- <log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />-->
|
||||
<!-- <ExternalSystemSettings>-->
|
||||
<!-- <option name="executionName" />-->
|
||||
<!-- <option name="externalProjectPath" value="$PROJECT_DIR$" />-->
|
||||
<!-- <option name="externalSystemIdString" value="GRADLE" />-->
|
||||
<!-- <option name="scriptParameters" value="" />-->
|
||||
<!-- <option name="taskDescriptions">-->
|
||||
<!-- <list />-->
|
||||
<!-- </option>-->
|
||||
<!-- <option name="taskNames">-->
|
||||
<!-- <list>-->
|
||||
<!-- <option value="runIdeForUiTests" />-->
|
||||
<!-- </list>-->
|
||||
<!-- </option>-->
|
||||
<!-- <option name="vmOptions" />-->
|
||||
<!-- </ExternalSystemSettings>-->
|
||||
<!-- <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>-->
|
||||
<!-- <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>-->
|
||||
<!-- <DebugAllEnabled>false</DebugAllEnabled>-->
|
||||
<!-- <RunAsTest>false</RunAsTest>-->
|
||||
<!-- <method v="2" />-->
|
||||
<!-- </configuration>-->
|
||||
<!--</component>-->
|
||||
27
extensions/intellij/.run/Run Test IDE.run.xml
Normal file
27
extensions/intellij/.run/Run Test IDE.run.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Test IDE" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName"/>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij"/>
|
||||
<option name="externalSystemIdString" value="GRADLE"/>
|
||||
<option name="scriptParameters" value=""/>
|
||||
<option name="taskDescriptions">
|
||||
<list/>
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="runIdeForUiTests"/>
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions"/>
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2">
|
||||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean"
|
||||
externalProjectPath="$PROJECT_DIR$/extensions/intellij" vmOptions="" scriptParameters=""/>
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
24
extensions/intellij/.run/Run Tests.run.xml
Normal file
24
extensions/intellij/.run/Run Tests.run.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle" focusToolWindowBeforeRun="true">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="test" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
7
extensions/intellij/.run/Run e2e tests.run.xml
Normal file
7
extensions/intellij/.run/Run e2e tests.run.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run e2e tests" type="CompoundRunConfigurationType">
|
||||
<toRun name="Run Test IDE" type="GradleRunConfiguration" />
|
||||
<toRun name="Run Tests" type="GradleRunConfiguration" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@ -101,7 +101,9 @@ toolbar.
|
|||
_Run | Debugging Actions | Reload Changed Classes`_
|
||||
- This will often fail on new imports, schema changes etc. In that case, you need to stop and restart the extension
|
||||
- `gui`: Changes will be reloaded automatically
|
||||
- `core`: Run `npm run build` from the `binary` directory (requires restarting the `Start Core Dev Server` task)
|
||||
- `core`: Run `npm run build -- --os [darwin | linux | win32]` from the `binary` directory (requires
|
||||
restarting the
|
||||
`Start Core Dev Server` task)
|
||||
|
||||
### Setting breakpoints
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,10 @@ tasks {
|
|||
// Configure UI tests plugin
|
||||
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
|
||||
runIdeForUiTests {
|
||||
environment("CONTINUE_GLOBAL_DIR", "src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/test-continue")
|
||||
environment(
|
||||
"CONTINUE_GLOBAL_DIR",
|
||||
"${rootProject.projectDir}/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/test-continue"
|
||||
)
|
||||
systemProperty("robot-server.port", "8082")
|
||||
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
|
||||
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
|
||||
|
|
@ -141,6 +144,7 @@ tasks {
|
|||
systemProperty("idea.trust.all.projects", "true")
|
||||
systemProperty("ide.show.tips.on.startup.default.value", "false")
|
||||
systemProperty("ide.browser.jcef.jsQueryPoolSize", "10000")
|
||||
systemProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true")
|
||||
|
||||
// This is to ensure we load the GUI with OSR enabled. We have logic that
|
||||
// renders with OSR disabled below a particular IDE version.
|
||||
|
|
@ -180,6 +184,5 @@ tasks {
|
|||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
environment("CONTINUE_GLOBAL_DIR", "src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/test-continue")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,12 +294,13 @@ class AutocompleteService(private val project: Project) {
|
|||
}
|
||||
|
||||
private fun isInjectedFile(editor: Editor): Boolean {
|
||||
val psiFile = runReadAction { PsiDocumentManager.getInstance(project).getPsiFile(editor.document) }
|
||||
if (psiFile == null) {
|
||||
return false
|
||||
}
|
||||
val response = runReadAction { psiFile.isInjectedText() }
|
||||
return response
|
||||
return ApplicationManager.getApplication().executeOnPooledThread<Boolean> {
|
||||
ApplicationManager.getApplication().runReadAction<Boolean> {
|
||||
val psiFile =
|
||||
PsiDocumentManager.getInstance(project).getPsiFile(editor.document) ?: return@runReadAction false
|
||||
return@runReadAction psiFile.isInjectedText()
|
||||
}
|
||||
}.get()
|
||||
}
|
||||
|
||||
fun hideCompletions(editor: Editor) {
|
||||
|
|
|
|||
|
|
@ -50,13 +50,78 @@ class MessageTypes {
|
|||
"showToast",
|
||||
)
|
||||
|
||||
// Note: If updating these values, make a corresponding update in
|
||||
// core/protocol/passThrough.ts
|
||||
val PASS_THROUGH_TO_WEBVIEW = listOf(
|
||||
"configUpdate",
|
||||
"getDefaultModelTitle",
|
||||
"indexProgress",
|
||||
"indexProgress", // Codebase
|
||||
"indexing/statusUpdate", // Docs, etc.
|
||||
"addContextItem",
|
||||
"refreshSubmenuItems",
|
||||
"isContinueInputFocused",
|
||||
"didChangeAvailableProfiles",
|
||||
"addContextItem"
|
||||
"setTTSActive",
|
||||
"getWebviewHistoryLength",
|
||||
"getCurrentSessionId",
|
||||
"signInToControlPlane",
|
||||
"openDialogMessage",
|
||||
"docs/suggestions",
|
||||
)
|
||||
|
||||
// Note: If updating these values, make a corresponding update in
|
||||
// core/protocol/passThrough.ts
|
||||
val PASS_THROUGH_TO_CORE = listOf(
|
||||
"abort",
|
||||
"history/list",
|
||||
"history/delete",
|
||||
"history/load",
|
||||
"history/save",
|
||||
"devdata/log",
|
||||
"config/addModel",
|
||||
"config/addContextProvider",
|
||||
"config/newPromptFile",
|
||||
"config/ideSettingsUpdate",
|
||||
"config/getSerializedProfileInfo",
|
||||
"config/deleteModel",
|
||||
"config/listProfiles",
|
||||
"config/openProfile",
|
||||
"context/getContextItems",
|
||||
"context/getSymbolsForFiles",
|
||||
"context/loadSubmenuItems",
|
||||
"context/addDocs",
|
||||
"context/removeDocs",
|
||||
"context/indexDocs",
|
||||
"autocomplete/complete",
|
||||
"autocomplete/cancel",
|
||||
"autocomplete/accept",
|
||||
"command/run",
|
||||
"tts/kill",
|
||||
"llm/complete",
|
||||
"llm/streamComplete",
|
||||
"llm/streamChat",
|
||||
"llm/listModels",
|
||||
"streamDiffLines",
|
||||
"chatDescriber/describe",
|
||||
"stats/getTokensPerDay",
|
||||
"stats/getTokensPerModel",
|
||||
// Codebase
|
||||
"index/setPaused",
|
||||
"index/forceReIndex",
|
||||
"index/forceReIndexFiles",
|
||||
"index/indexingProgressBarInitialized",
|
||||
// Docs, etc.
|
||||
"indexing/reindex",
|
||||
"indexing/abort",
|
||||
"indexing/setPaused",
|
||||
"docs/getSuggestedDocs",
|
||||
"docs/initStatuses",
|
||||
//
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel",
|
||||
"profiles/switch",
|
||||
"didChangeSelectedProfile",
|
||||
"tools/call",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.github.continuedev.continueintellijextension.toolWindow
|
|||
|
||||
import com.github.continuedev.continueintellijextension.activities.ContinuePluginDisposable
|
||||
import com.github.continuedev.continueintellijextension.constants.MessageTypes
|
||||
import com.github.continuedev.continueintellijextension.constants.MessageTypes.Companion.PASS_THROUGH_TO_CORE
|
||||
import com.github.continuedev.continueintellijextension.factories.CustomSchemeHandlerFactory
|
||||
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
|
|
@ -18,58 +19,6 @@ import org.cef.browser.CefBrowser
|
|||
import org.cef.handler.CefLoadHandlerAdapter
|
||||
|
||||
class ContinueBrowser(val project: Project, url: String) {
|
||||
private val PASS_THROUGH_TO_CORE = listOf(
|
||||
"abort",
|
||||
"history/list",
|
||||
"history/delete",
|
||||
"history/load",
|
||||
"history/save",
|
||||
"devdata/log",
|
||||
"config/addModel",
|
||||
"config/addContextProvider",
|
||||
"config/newPromptFile",
|
||||
"config/ideSettingsUpdate",
|
||||
"config/getSerializedProfileInfo",
|
||||
"config/deleteModel",
|
||||
"config/listProfiles",
|
||||
"config/openProfile",
|
||||
"context/getContextItems",
|
||||
"context/getSymbolsForFiles",
|
||||
"context/loadSubmenuItems",
|
||||
"context/addDocs",
|
||||
"context/removeDocs",
|
||||
"context/indexDocs",
|
||||
"autocomplete/complete",
|
||||
"autocomplete/cancel",
|
||||
"autocomplete/accept",
|
||||
"command/run",
|
||||
"tts/kill",
|
||||
"llm/complete",
|
||||
"llm/streamComplete",
|
||||
"llm/streamChat",
|
||||
"llm/listModels",
|
||||
"streamDiffLines",
|
||||
"chatDescriber/describe",
|
||||
"stats/getTokensPerDay",
|
||||
"stats/getTokensPerModel",
|
||||
// Codebase
|
||||
"index/setPaused",
|
||||
"index/forceReIndex",
|
||||
"index/indexingProgressBarInitialized",
|
||||
// Docs, etc.
|
||||
"indexing/reindex",
|
||||
"indexing/abort",
|
||||
"indexing/setPaused",
|
||||
"docs/getSuggestedDocs",
|
||||
"docs/initStatuses",
|
||||
//
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel",
|
||||
"profiles/switch",
|
||||
"didChangeSelectedProfile",
|
||||
"tools/call",
|
||||
)
|
||||
|
||||
private fun registerAppSchemeHandler() {
|
||||
CefApp.getInstance().registerSchemeHandlerFactory(
|
||||
"http",
|
||||
|
|
@ -82,14 +31,9 @@ class ContinueBrowser(val project: Project, url: String) {
|
|||
|
||||
init {
|
||||
val isOSREnabled = ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR
|
||||
|
||||
this.browser = JBCefBrowser.createBuilder().setOffScreenRendering(isOSREnabled).build()
|
||||
|
||||
|
||||
browser.jbCefClient.setProperty(
|
||||
JBCefClient.Properties.JS_QUERY_POOL_SIZE,
|
||||
JS_QUERY_POOL_SIZE
|
||||
)
|
||||
|
||||
registerAppSchemeHandler()
|
||||
browser.loadURL(url);
|
||||
Disposer.register(ContinuePluginDisposable.getInstance(project), browser)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.github.continuedev.continueintellijextension.e2e
|
||||
|
||||
import com.automation.remarks.junit5.Video
|
||||
import com.github.continuedev.continueintellijextension.fixtures.dialog
|
||||
import com.github.continuedev.continueintellijextension.fixtures.idea
|
||||
import com.github.continuedev.continueintellijextension.fixtures.welcomeFrame
|
||||
import com.github.continuedev.continueintellijextension.utils.RemoteRobotExtension
|
||||
import com.github.continuedev.continueintellijextension.utils.StepsLogger
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.fixtures.ComponentFixture
|
||||
import com.intellij.remoterobot.search.locators.byXpath
|
||||
import com.intellij.remoterobot.steps.CommonSteps
|
||||
import com.intellij.remoterobot.utils.keyboard
|
||||
import com.intellij.remoterobot.utils.waitFor
|
||||
import com.intellij.remoterobot.utils.waitForIgnoringError
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
import java.time.Duration.ofMinutes
|
||||
import java.time.Duration.ofSeconds
|
||||
|
||||
@ExtendWith(RemoteRobotExtension::class)
|
||||
class Autocomplete {
|
||||
init {
|
||||
StepsLogger.init()
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
fun waitForIde(remoteRobot: RemoteRobot) {
|
||||
waitForIgnoringError(ofMinutes(3)) { remoteRobot.callJs("true") }
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
// @Test
|
||||
@Video
|
||||
fun displayCompletion(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
createNewProjectLink.click()
|
||||
dialog("New Project") {
|
||||
findText("Java").click()
|
||||
checkBox("Add sample code").select()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the default "Main.java" tab to load
|
||||
// Our "continue_tutorial.java.ft" tab loads first, but then "Main.java" takes focus.
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
idea {
|
||||
with(textEditor()) {
|
||||
val userMsg = "TEST_USER_MESSAGE_0"
|
||||
editor.insertTextAtLine(0, 0, userMsg)
|
||||
editor.clickOnOffset(userMsg.length)
|
||||
|
||||
keyboard {
|
||||
enterText(" ")
|
||||
}
|
||||
|
||||
waitFor(ofSeconds(10)) {
|
||||
editor.hasText("TEST_LLM_RESPONSE_0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/**
|
||||
* Currently we can't test any actions in the GUI that involve clicks.
|
||||
* See this open issue for details: https://github.com/JetBrains/intellij-ui-test-robot/issues/491
|
||||
*/
|
||||
package com.github.continuedev.continueintellijextension.e2e
|
||||
|
||||
import com.automation.remarks.junit5.Video
|
||||
import com.github.continuedev.continueintellijextension.fixtures.*
|
||||
import com.github.continuedev.continueintellijextension.utils.RemoteRobotExtension
|
||||
import com.github.continuedev.continueintellijextension.utils.StepsLogger
|
||||
import com.github.continuedev.continueintellijextension.utils.getMetaKey
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.fixtures.ComponentFixture
|
||||
import com.intellij.remoterobot.search.locators.byXpath
|
||||
import com.intellij.remoterobot.steps.CommonSteps
|
||||
import com.intellij.remoterobot.stepsProcessing.step
|
||||
import com.intellij.remoterobot.utils.keyboard
|
||||
import com.intellij.remoterobot.utils.waitFor
|
||||
import com.intellij.remoterobot.utils.waitForIgnoringError
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
import java.awt.event.KeyEvent.*
|
||||
import java.time.Duration.ofMinutes
|
||||
import java.time.Duration.ofSeconds
|
||||
|
||||
@ExtendWith(RemoteRobotExtension::class)
|
||||
class GUI {
|
||||
init {
|
||||
StepsLogger.init()
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
fun waitForIde(remoteRobot: RemoteRobot) {
|
||||
waitForIgnoringError(ofMinutes(3)) { remoteRobot.callJs("true") }
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
// @Test
|
||||
@Video
|
||||
fun highlightCode(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
createNewProjectLink.click()
|
||||
dialog("New Project") {
|
||||
findText("Java").click()
|
||||
checkBox("Add sample code").select()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the default "Main.java" tab to load
|
||||
// Our "continue_tutorial.java.ft" tab loads first, but then "Main.java" takes focus.
|
||||
// If we don't wait for this, clicking on the GUI may fail because a popup displays
|
||||
// while the `continue_tutorial.java` is loading.
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
idea {
|
||||
step("Manually open the webview") {
|
||||
// Manually open the webview
|
||||
find<ComponentFixture>(byXpath("//div[@text='Continue']"), ofSeconds((10))).click()
|
||||
|
||||
waitFor(ofSeconds(10)) {
|
||||
browser().isShowing
|
||||
}
|
||||
|
||||
// Arbitrary timeout due to a bug where the webview will refresh
|
||||
// and clear the editor state on first load
|
||||
Thread.sleep(5000)
|
||||
}
|
||||
|
||||
step("Verify we can highlight code and add to webview") {
|
||||
val textToInsert = "Hello world!"
|
||||
|
||||
with(textEditor()) {
|
||||
editor.insertTextAtLine(0, 0, textToInsert)
|
||||
editor.selectText(textToInsert)
|
||||
|
||||
keyboard {
|
||||
hotKey(getMetaKey(), VK_J)
|
||||
}
|
||||
}
|
||||
|
||||
waitFor(ofSeconds(10)) {
|
||||
browser().findElementByContainsText(textToInsert).html.isNotEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.github.continuedev.continueintellijextension.e2e
|
||||
|
||||
import com.automation.remarks.junit5.Video
|
||||
import com.github.continuedev.continueintellijextension.fixtures.dialog
|
||||
import com.github.continuedev.continueintellijextension.fixtures.idea
|
||||
import com.github.continuedev.continueintellijextension.fixtures.welcomeFrame
|
||||
import com.github.continuedev.continueintellijextension.utils.RemoteRobotExtension
|
||||
import com.github.continuedev.continueintellijextension.utils.StepsLogger
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.fixtures.ComponentFixture
|
||||
import com.intellij.remoterobot.search.locators.byXpath
|
||||
import com.intellij.remoterobot.steps.CommonSteps
|
||||
import com.intellij.remoterobot.stepsProcessing.step
|
||||
import com.intellij.remoterobot.utils.waitFor
|
||||
import com.intellij.remoterobot.utils.waitForIgnoringError
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
import java.time.Duration.ofMinutes
|
||||
import java.time.Duration.ofSeconds
|
||||
|
||||
@ExtendWith(RemoteRobotExtension::class)
|
||||
class Onboarding {
|
||||
init {
|
||||
StepsLogger.init()
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
fun waitForIde(remoteRobot: RemoteRobot) {
|
||||
waitForIgnoringError(ofMinutes(3)) { remoteRobot.callJs("true") }
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
|
||||
// @Test
|
||||
@Video
|
||||
fun onboarding(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
createNewProjectLink.click()
|
||||
dialog("New Project") {
|
||||
findText("Java").click()
|
||||
checkBox("Add sample code").select()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
// Wait for the default "Main.java" tab to load
|
||||
// Our "continue_tutorial.java.ft" tab loads first, but then "Main.java" takes focus.
|
||||
// So we need to wait for that to occur, and then focus on "continue_tutorial.java.ft"
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
// TODO: Need a good way to ensure this is the first test ran in the entire suite
|
||||
// step("Verify Continue tutorial file is loaded") {
|
||||
// find<ComponentFixture>(byXpath("//div[@visible_text='continue_tutorial.java']"))
|
||||
// }
|
||||
|
||||
step("Manually open the webview") {
|
||||
// Manually open the webview
|
||||
find<ComponentFixture>(byXpath("//div[@text='Continue']"), ofSeconds((10))).click()
|
||||
|
||||
waitFor(ofSeconds(10)) {
|
||||
browser().isShowing
|
||||
}
|
||||
}
|
||||
|
||||
step("Verify the onboarding card is present") {
|
||||
waitFor(ofSeconds(30)) {
|
||||
try {
|
||||
browser().findElement("//*[@data-testid='onboarding-card']").html.isNotEmpty()
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
package com.github.continuedev.continueintellijextension.e2e
|
||||
|
||||
import com.automation.remarks.junit5.Video
|
||||
import com.github.continuedev.continueintellijextension.pages.dialog
|
||||
import com.github.continuedev.continueintellijextension.pages.idea
|
||||
import com.github.continuedev.continueintellijextension.pages.welcomeFrame
|
||||
import com.github.continuedev.continueintellijextension.utils.RemoteRobotExtension
|
||||
import com.github.continuedev.continueintellijextension.utils.StepsLogger
|
||||
import com.github.continuedev.continueintellijextension.utils.getMetaKey
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.fixtures.ComponentFixture
|
||||
import com.intellij.remoterobot.fixtures.JCefBrowserFixture
|
||||
import com.intellij.remoterobot.search.locators.Locator
|
||||
import com.intellij.remoterobot.search.locators.byXpath
|
||||
import com.intellij.remoterobot.steps.CommonSteps
|
||||
import com.intellij.remoterobot.utils.keyboard
|
||||
import com.intellij.remoterobot.utils.waitFor
|
||||
import com.intellij.remoterobot.utils.waitForIgnoringError
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
import java.awt.event.KeyEvent.*
|
||||
import java.time.Duration.ofMinutes
|
||||
import java.time.Duration.ofSeconds
|
||||
|
||||
@ExtendWith(RemoteRobotExtension::class)
|
||||
class TutorialTest {
|
||||
init {
|
||||
StepsLogger.init()
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
fun waitForIde(remoteRobot: RemoteRobot) {
|
||||
waitForIgnoringError(ofMinutes(3)) { remoteRobot.callJs("true") }
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
@Test
|
||||
@Video
|
||||
fun completeTutorial(remoteRobot: RemoteRobot) = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
createNewProjectLink.click()
|
||||
dialog("New Project") {
|
||||
findText("Java").click()
|
||||
checkBox("Add sample code").select()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the default "Main.java" tab to load
|
||||
// Our "continue_tutorial.java" tab loads first, but then "Main.java" takes focus.
|
||||
// So we need to wait for that to occur, and then focus on "continue_tutorial.java"
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
val tutorialEditorTabLocator: Locator =
|
||||
byXpath("//div[@accessiblename='continue_tutorial.java' and @class='EditorTabLabel']")
|
||||
val tutorialEditorTab: ComponentFixture =
|
||||
remoteRobot.find(ComponentFixture::class.java, tutorialEditorTabLocator)
|
||||
tutorialEditorTab.click()
|
||||
|
||||
// Manually open the webview
|
||||
find<ComponentFixture>(byXpath("//div[@text='Continue']")).click()
|
||||
|
||||
// Arbitrary sleep while we wait for the webview to load
|
||||
Thread.sleep(10000)
|
||||
|
||||
val textToInsert = "Hello world!"
|
||||
|
||||
idea {
|
||||
with(textEditor()) {
|
||||
editor.insertTextAtLine(0, 0, textToInsert)
|
||||
editor.selectText(textToInsert)
|
||||
keyboard {
|
||||
hotKey(getMetaKey(), VK_J)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: locator needs to be OS aware
|
||||
// https://github.com/JetBrains/intellij-ui-test-robot/blob/139a05eb99e9a49f13605626b81ad9864be23c96/remote-fixtures/src/main/kotlin/com/intellij/remoterobot/fixtures/CommonContainerFixture.kt#L203
|
||||
val jcefBrowser = find<JCefBrowserFixture>(JCefBrowserFixture.macLocator)
|
||||
assert(jcefBrowser.getDom().isNotEmpty()) { "JCEF browser not found or empty" }
|
||||
|
||||
val codeSnippetText = jcefBrowser.findElementByContainsText(textToInsert)
|
||||
assert(codeSnippetText.html.isNotEmpty()) { "Failed to find code snippet in webview" }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"ui": {
|
||||
"displayRawMarkdown": false
|
||||
},
|
||||
"models": [
|
||||
{
|
||||
"title": "TEST LLM",
|
||||
"provider": "test",
|
||||
"model": "this field is not used"
|
||||
},
|
||||
{
|
||||
"title": "Mock",
|
||||
"provider": "mock",
|
||||
"model": "this field is not used"
|
||||
}
|
||||
],
|
||||
"analytics": {
|
||||
"provider": "continue-proxy"
|
||||
},
|
||||
"tabAutocompleteModel": {
|
||||
"title": "TEST LLM",
|
||||
"provider": "test",
|
||||
"model": "this field is not used"
|
||||
},
|
||||
"tabAutocompleteOptions": {
|
||||
"useCache": false
|
||||
},
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs"
|
||||
},
|
||||
{
|
||||
"name": "diff"
|
||||
},
|
||||
{
|
||||
"name": "url"
|
||||
},
|
||||
{
|
||||
"name": "folder"
|
||||
}
|
||||
],
|
||||
"docs": []
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.github.continuedev.continueintellijextension.pages
|
||||
package com.github.continuedev.continueintellijextension.fixtures
|
||||
|
||||
/*
|
||||
* Source: https://github.com/JetBrains/intellij-ui-test-robot/blob/139a05eb99e9a49f13605626b81ad9864be23c96/ui-test-example/src/test/kotlin/org/intellij/examples/simple/plugin/pages/DialogFixture.kt
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.github.continuedev.continueintellijextension.pages
|
||||
package com.github.continuedev.continueintellijextension.fixtures
|
||||
|
||||
/*
|
||||
* Source: https://github.com/JetBrains/intellij-ui-test-robot/blob/139a05eb99e9a49f13605626b81ad9864be23c96/ui-test-example/src/test/kotlin/org/intellij/examples/simple/plugin/pages/IdeaFrame.kt
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.github.continuedev.continueintellijextension.pages
|
||||
package com.github.continuedev.continueintellijextension.fixtures
|
||||
|
||||
/*
|
||||
* Source: https://github.com/JetBrains/intellij-ui-test-robot/blob/139a05eb99e9a49f13605626b81ad9864be23c96/ui-test-example/src/test/kotlin/org/intellij/examples/simple/plugin/pages/WelcomeFrame.kt
|
||||
|
|
@ -41,7 +41,10 @@ export function OnboardingCard() {
|
|||
}
|
||||
|
||||
return (
|
||||
<StyledCard className="xs:py-4 xs:px-4 relative px-2 py-3">
|
||||
<StyledCard
|
||||
className="xs:py-4 xs:px-4 relative px-2 py-3"
|
||||
data-testid="onboarding-card"
|
||||
>
|
||||
<OnboardingCardTabs
|
||||
activeTab={onboardingCard.activeTab || "Best"}
|
||||
onTabClick={onboardingCard.setActiveTab}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function ConfirmationDialog(props: ConfirmationDialogProps) {
|
|||
|
||||
return (
|
||||
<div className="p-4 pt-0">
|
||||
<h1 className="text-2x mb-1 text-center">
|
||||
<h1 className="mb-1 text-center text-xl">
|
||||
{props.title ?? "Confirmation"}
|
||||
</h1>
|
||||
<p className="text-center text-base" style={{ whiteSpace: "pre-wrap" }}>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue