-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[starter examples] Add example using driver
GitOrigin-RevId: c128940d1a964caf15ac1703e04734825515bbcd
- Loading branch information
1 parent
562b4c5
commit 48410a4
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...e.starter.examples/testSrc/com/intellij/ide/starter/examples/driver/PerfTestWithDriver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.intellij.ide.starter.examples.driver | ||
|
||
import com.intellij.driver.sdk.singleProject | ||
import com.intellij.driver.sdk.waitForIndicators | ||
import com.intellij.driver.sdk.waitForProjectOpen | ||
import com.intellij.ide.starter.driver.PlaybackRunnerService | ||
import com.intellij.ide.starter.driver.engine.runIdeWithDriver | ||
import com.intellij.ide.starter.examples.data.TestCases | ||
import com.intellij.ide.starter.junit5.hyphenateWithClass | ||
import com.intellij.ide.starter.runner.CurrentTestMethod | ||
import com.intellij.ide.starter.runner.Starter | ||
import com.intellij.ide.starter.driver.execute | ||
import com.intellij.tools.ide.performanceTesting.commands.CommandChain | ||
import com.intellij.tools.ide.performanceTesting.commands.exitApp | ||
import org.junit.jupiter.api.Test | ||
import kotlin.time.Duration.Companion.minutes | ||
|
||
import com.intellij.driver.client.service | ||
import com.intellij.driver.sdk.ProjectManager | ||
import com.intellij.driver.sdk.getOpenProjects | ||
import com.intellij.ide.starter.examples.driver.model.LafManager | ||
import com.intellij.tools.ide.performanceTesting.commands.openFile | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
|
||
class PerfTestWithDriver { | ||
@Test | ||
fun openGradleJitPack() { | ||
val testContext = Starter | ||
.newContext(CurrentTestMethod.hyphenateWithClass(), TestCases.IC.GradleJitPackSimple) | ||
.prepareProjectCleanImport() | ||
|
||
testContext.runIdeWithDriver().useDriverAndCloseIde{ | ||
waitForIndicators(5.minutes) // driver don't wait by default so we need to add waiter | ||
execute(CommandChain().openFile("build.gradle")) //invocation of command via JMX call | ||
assertEquals(1, getOpenProjects().size ) // JMX call using predefined interfaces | ||
assertEquals(service<LafManager>().getCurrentUIThemeLookAndFeel().getName(), "Dark") //JMX call with custom interfaces | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ide.starter.examples/testSrc/com/intellij/ide/starter/examples/driver/model/LafManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.intellij.ide.starter.examples.driver.model | ||
|
||
import com.intellij.driver.client.Remote | ||
|
||
@Remote("com.intellij.ide.ui.LafManager") | ||
interface LafManager { | ||
fun getCurrentUIThemeLookAndFeel(): UiThemeLookAndFeelInfo | ||
} | ||
@Remote("com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo") | ||
interface UiThemeLookAndFeelInfo { | ||
fun getName(): String | ||
} |