Skip to content

Commit

Permalink
Merge pull request #3465 from continuedev/pe/jb-e2e-testing
Browse files Browse the repository at this point in the history
test(jb): add autocomplete test
  • Loading branch information
Patrick-Erichsen authored Jan 10, 2025
2 parents 462ded1 + cb41d6e commit 7f9782f
Show file tree
Hide file tree
Showing 22 changed files with 462 additions and 202 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/pr_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -573,3 +573,5 @@ jobs:
name: jb-failure-report
path: |
${{ github.workspace }}/extensions/intellij/build/reports
2 changes: 2 additions & 0 deletions core/protocol/passThrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion extensions/intellij/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 0 additions & 25 deletions extensions/intellij/.run/Run IDE for UI Tests.run.xml

This file was deleted.

27 changes: 27 additions & 0 deletions extensions/intellij/.run/Run Test IDE.run.xml
Original file line number Diff line number Diff line change
@@ -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 changes: 24 additions & 0 deletions extensions/intellij/.run/Run Tests.run.xml
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions extensions/intellij/.run/Run e2e tests.run.xml
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 3 additions & 1 deletion extensions/intellij/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions extensions/intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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-->")
Expand All @@ -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.
Expand Down Expand Up @@ -180,6 +184,5 @@ tasks {

test {
useJUnitPlatform()
environment("CONTINUE_GLOBAL_DIR", "src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/test-continue")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
}
}
Loading

0 comments on commit 7f9782f

Please sign in to comment.