[remote-driver] add SearchEveryWhereUiTest#testShortcutAdd

GitOrigin-RevId: d69498b3b0cd6382074942dfc5de5f89c73c707f
This commit is contained in:
vladislav.shishov
2024-09-19 22:35:46 +03:00
committed by intellij-monorepo-bot
parent 71a0700960
commit ad8eb7b98f

View File

@@ -46,6 +46,10 @@ class SearchEverywherePopupUI(data: ComponentData) : PopupUiComponent(data) {
invokeActionWithShortcut("[shift pressed TAB]") invokeActionWithShortcut("[shift pressed TAB]")
} }
fun invokeAssignShortcutAction() {
invokeActionWithShortcut("[alt pressed ENTER]")
}
fun getSelectedTab(): SearchEverywhereTab = SearchEverywhereTab.entries.single { it.id == searchEverywhereUi.getSelectedTabID() } fun getSelectedTab(): SearchEverywhereTab = SearchEverywhereTab.entries.single { it.id == searchEverywhereUi.getSelectedTabID() }
fun searchAndChooseFirst(text: String, exactMatch: Boolean = true) { fun searchAndChooseFirst(text: String, exactMatch: Boolean = true) {
@@ -64,6 +68,10 @@ class SearchEverywherePopupUI(data: ComponentData) : PopupUiComponent(data) {
waitFor("Popup is closed") { notPresent() } waitFor("Popup is closed") { notPresent() }
} }
fun printActions() {
println(driver.utility(ActionUtils::class).getActions(searchEverywhereUi.component).map { it.getShortcutSet().getShortcuts().contentToString() })
}
private fun invokeActionWithShortcut(shortcut: String, chooser: (List<AnAction>) -> AnAction? = { it.singleOrNull() }) { private fun invokeActionWithShortcut(shortcut: String, chooser: (List<AnAction>) -> AnAction? = { it.singleOrNull() }) {
val action = driver.utility(ActionUtils::class).getActions(searchEverywhereUi.component).filter { val action = driver.utility(ActionUtils::class).getActions(searchEverywhereUi.component).filter {
it.getShortcutSet().getShortcuts().singleOrNull()?.toString() == shortcut it.getShortcutSet().getShortcuts().singleOrNull()?.toString() == shortcut