mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-04-22 01:15:48 +02:00
Create UI test for Rider
This commit is contained in:
parent
8a173c801c
commit
2b1b4fc71e
tests
ui-fixtures/src/testFixtures/kotlin/ui/pages
ui-rd-tests/src/test/kotlin
@ -33,6 +33,14 @@ class WelcomeFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) :
|
||||
),
|
||||
)
|
||||
|
||||
val createNewSolutionLink
|
||||
get() = actionLink(
|
||||
byXpath(
|
||||
"New Solution",
|
||||
"//div[(@class='MainButton' and @text='New Solution') or (@accessiblename='New Solution' and @class='JButton')]",
|
||||
),
|
||||
)
|
||||
|
||||
@Suppress("unused")
|
||||
val moreActions
|
||||
get() = button(byXpath("More Action", "//div[@accessiblename='More Actions' and @class='ActionButton']"))
|
||||
|
37
tests/ui-rd-tests/src/test/kotlin/ManageLicensesFrame.kt
Normal file
37
tests/ui-rd-tests/src/test/kotlin/ManageLicensesFrame.kt
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE.txt file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.data.RemoteComponent
|
||||
import com.intellij.remoterobot.fixtures.CommonContainerFixture
|
||||
import com.intellij.remoterobot.fixtures.ComponentFixture
|
||||
import com.intellij.remoterobot.fixtures.DefaultXpath
|
||||
import com.intellij.remoterobot.fixtures.FixtureName
|
||||
import com.intellij.remoterobot.search.locators.byXpath
|
||||
import java.time.Duration
|
||||
|
||||
fun RemoteRobot.manageLicensesFrame(function: ManageLicensesFrame.() -> Unit) {
|
||||
find(ManageLicensesFrame::class.java, Duration.ofSeconds(10)).apply(function)
|
||||
}
|
||||
|
||||
@FixtureName("Manage Licenses Frame")
|
||||
@DefaultXpath("type", "//div[@class='MyDialog' and @title='Manage Licenses']")
|
||||
class ManageLicensesFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) :
|
||||
CommonContainerFixture(remoteRobot, remoteComponent) {
|
||||
|
||||
fun enableFreeTier() {
|
||||
find<ComponentFixture>(
|
||||
byXpath(
|
||||
"//div[@class='SegmentedButton' and @action='Non-commercial use (null)']",
|
||||
)
|
||||
).click()
|
||||
checkBox("I agree with", contains = true).select()
|
||||
button("Start Non-Commercial Use").click()
|
||||
button("Close").click()
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@ import com.intellij.remoterobot.RemoteRobot
|
||||
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 org.assertj.swing.core.MouseButton
|
||||
import org.junit.jupiter.api.Test
|
||||
import ui.pages.Editor
|
||||
@ -23,7 +22,6 @@ import ui.pages.idea
|
||||
import ui.pages.welcomeFrame
|
||||
import ui.utils.StepsLogger
|
||||
import ui.utils.uiTest
|
||||
import java.time.Duration
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class RiderUiTest {
|
||||
@ -44,42 +42,35 @@ class RiderUiTest {
|
||||
idea {
|
||||
waitSmartMode()
|
||||
|
||||
createFile("1.txt", this@uiTest)
|
||||
val editor = editor("1.txt") {
|
||||
step("Write a text") {
|
||||
injectText(
|
||||
"""
|
||||
|One Two
|
||||
|Three Four
|
||||
""".trimMargin()
|
||||
)
|
||||
}
|
||||
}
|
||||
waitFor(Duration.ofMinutes(1)) { editor.findAllText("One").isNotEmpty() }
|
||||
val editor = editor("Program.cs")
|
||||
|
||||
testEnterWorksInNormalMode(editor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun IdeaFrame.testEnterWorksInNormalMode(editor: Editor) {
|
||||
editor.findText("Two").click()
|
||||
editor.findText(" for more information").click()
|
||||
keyboard {
|
||||
enter()
|
||||
}
|
||||
|
||||
assertEquals(
|
||||
"""
|
||||
|One Two
|
||||
|Three Four
|
||||
|// See https://aka.ms/new-console-template for more information
|
||||
|
|
||||
|Console.WriteLine("Hello, World!");
|
||||
""".trimMargin(), editor.text
|
||||
)
|
||||
|
||||
assertEquals(8, editor.caretOffset)
|
||||
assertEquals(64, editor.caretOffset)
|
||||
}
|
||||
|
||||
private fun RemoteRobot.startNewProject() {
|
||||
manageLicensesFrame {
|
||||
enableFreeTier()
|
||||
}
|
||||
welcomeFrame {
|
||||
createNewProjectLink.click()
|
||||
createNewSolutionLink.click()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user