Skip to content

Commit

Permalink
Add one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
MaXal committed Sep 25, 2024
1 parent 952f45b commit c8c3e91
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
}

intellijPlatform {
pluginConfiguration {
ideaVersion {
sinceBuild.set("242")
untilBuild.set("243.*")
}
}
}

kotlin {
jvmToolchain(17)
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/kotlin/ShowDialogAction.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.ui.Messages

class ShowDialogAction: AnAction() {
override fun actionPerformed(e: AnActionEvent) {
Messages.showMessageDialog(
e.getProject(),
"This is a test dialog",
"Test Dialog",
Messages.getInformationIcon()
);
}
}
6 changes: 6 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
<depends>com.intellij.modules.platform</depends>

<actions>
<action id="ShowDialogAction" class="ShowDialogAction" text="Show Test Dialog">
<add-to-group group-id="ToolsMenu" anchor="last"/>
</action>
</actions>

<!-- Extension points defined by the plugin.
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
<extensions defaultExtensionNs="com.intellij">
Expand Down
32 changes: 32 additions & 0 deletions src/test/kotlin/PluginTest.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import com.intellij.driver.sdk.invokeAction
import com.intellij.driver.sdk.openFile
import com.intellij.driver.sdk.ui.components.button
import com.intellij.driver.sdk.ui.components.dialog
import com.intellij.driver.sdk.ui.components.ideFrame
import com.intellij.driver.sdk.ui.components.welcomeScreen
import com.intellij.driver.sdk.ui.shouldBe
import com.intellij.driver.sdk.waitForIndicators
import com.intellij.ide.starter.driver.engine.runIdeWithDriver
import com.intellij.ide.starter.ide.IdeProductProvider
import com.intellij.ide.starter.models.TestCase
import com.intellij.ide.starter.plugins.PluginConfigurator
import com.intellij.ide.starter.project.GitHubProject
import com.intellij.ide.starter.project.NoProject
import com.intellij.ide.starter.runner.Starter
import org.junit.jupiter.api.Test
import kotlin.io.path.Path
import kotlin.time.Duration.Companion.minutes

class PluginTest {
@Test
Expand All @@ -31,4 +39,28 @@ class PluginTest {
}
}
}

@Test
fun oneMoreTest() {
Starter.newContext(
"oneMoreTest",
TestCase(
IdeProductProvider.WS,
GitHubProject.fromGithub(branchName = "master", repoRelativeUrl = "JetBrains/ij-perf-report-aggregator")
).useEAP()
).apply {
setLicense(System.getenv("LICENSE_KEY"))
val pathToPlugin = System.getProperty("path.to.build.plugin")
PluginConfigurator(this).installPluginFromPath(Path(pathToPlugin))
}.runIdeWithDriver().useDriverAndCloseIde {
waitForIndicators(5.minutes)
openFile("package.json")
ideFrame {
invokeAction("ShowDialogAction", now = false)
dialog({ byTitle("Test Dialog") }) {
button("OK").click()
}
}
}
}
}

0 comments on commit c8c3e91

Please sign in to comment.