Skip to content

Commit

Permalink
UI and README fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TarCV committed May 4, 2024
1 parent 5514a71 commit 9b30a16
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 32 deletions.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,21 @@
[![Downloads](https://img.shields.io/jetbrains/plugin/d/21218-ui-surveyor.svg)](https://plugins.jetbrains.com/plugin/21218-ui-surveyor)

## Description

UI Surveyor plugin provides tools helping with mobile application automation.
<!-- Plugin description -->
UI Surveyor plugin provides features helping designing selectors for mobile automated tests:
They provide the following features:
* **_Evaluating_ element selectors against an XML UI snapshots** <br />
* **_Evaluating_ selectors against XML UI snapshots** <br />
* UIAutomator UISelectors and BySelectors for Android
* (Experimental) WebDriverAgent/Appium class chain and predicate queries for iOS
![Search](docs/Search.png)
* **Syntax highlighting and autocomplete for element selectors (Java IDEs only)** <br />
* **Syntax highlighting and autocomplete for element selectors (UIAutomator selectors in Java IDEs only)** <br />
![Autocomplete & Highlighting](docs/Autocomplete.png)
* **Improved structure navigation for XML UI snapshots** <br />
![Structure navigation](docs/StructureNavigation.png)

If for some reason `Locate Element` tool window is not enabled, you can open it from the View menu: <br />
![View &gt; Tool windows &gt; Locate Element](docs/MenuLocation.png)

At the moment
<!-- Plugin description -->
UI Surveyor plugin provides tools helping work with Android UI Snapshot in XML format and UIAutomator selectors.

Those tools are:
* `Locate Element` tool window for **evaluating** element selectors against a currently open XML UI snapshots
* Basic syntax highlighting and autocomplete for UIAutomator selectors (as Java code, supported only for Java IDEs)
* Improved structure navigation for UI snapshots

All trademarks are the property of their respective owners. All company, product and service names
used in this plugin description are for identification purposes only. Use of these names or brands does not imply endorsement.
<!-- Plugin description end -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import com.github.tarcv.testingteam.surveyoridea.gui.fixtures.IdeaFrame
import com.github.tarcv.testingteam.surveyoridea.gui.fixtures.idea
import com.github.tarcv.testingteam.surveyoridea.gui.fixtures.ifTipOfTheDayDialogPresent
import com.intellij.remoterobot.RemoteRobot
import com.intellij.remoterobot.fixtures.JButtonFixture
import com.intellij.remoterobot.steps.CommonSteps
import com.intellij.remoterobot.utils.DefaultHttpClient
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException
import com.intellij.remoterobot.utils.waitForIgnoringError
import org.apache.commons.io.file.PathUtils
import org.junit.jupiter.api.AfterEach
Expand Down Expand Up @@ -65,12 +67,24 @@ open class BaseTestProjectTests {
ifTipOfTheDayDialogPresent {
close()
}

closeCodeWithMeBubbleIfNeeded()

resizeWindow(1280, 800)
commonSteps.waitForSmartMode(1)
}
}
}

private fun IdeaFrame.closeCodeWithMeBubbleIfNeeded() {
try {
find<JButtonFixture>(JButtonFixture.byText("Got It"))
.click()
} catch (e: WaitForConditionTimeoutException) {
// no tooltip displayed, so nothing to do
}
}

private fun IdeaFrame.resizeWindow(newWidth: Int, newHeight: Int) {
runJs(
runInEdt = true, script =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import com.github.tarcv.testingteam.surveyoridea.gui.fixtures.idea
import com.github.tarcv.testingteam.surveyoridea.gui.fixtures.locateElementToolWindow
import com.github.tarcv.testingteam.surveyoridea.gui.fixtures.noticeFrame
import com.github.tarcv.testingteam.surveyoridea.waitingAssertion
import com.intellij.remoterobot.utils.keyboard
import org.junit.jupiter.api.Test
import java.lang.Thread.sleep

class NoticeTests : BaseTestProjectTests() {
@Test
fun testLocatingFromToolButton() = with(remoteRobot) {
fun testNotices() = with(remoteRobot) {
idea {
openFileInTestProject(relativeToProject(droidAutomatorSnapshotFile), "editorWithSnapshot")

Expand All @@ -27,25 +28,29 @@ class NoticeTests : BaseTestProjectTests() {
noticeButton.click()
}
}
noticeFrame {
val overallIntroFragment = "depends on libraries which are covered by"
try {
noticeFrame {
val overallIntroFragment = "depends on libraries which are covered by"

waitingAssertion("Correct text is present in the overall intro area", { overallIntro.text }) {
it.contains(overallIntroFragment)
}
waitingAssertion("Correct text is present in the overall intro area", { overallIntro.text }) {
it.contains(overallIntroFragment)
}

jList {
clickItem("UIAutomator library - Apache License")
}
waitingAssertion("Correct text is present in the overall intro area", { overallIntro.text }) {
it.contains(overallIntroFragment)
}
waitingAssertion("Correct text is present in the notice intro area", { noticeIntro.text }) {
it.contains("library which is covered by")
}
waitingAssertion("Correct text is present in the notice area", { noticeText.text }) {
it.contains("Licensed under the Apache License")
jList {
clickItem("UIAutomator library - Apache License")
}
waitingAssertion("Correct text is present in the overall intro area", { overallIntro.text }) {
it.contains(overallIntroFragment)
}
waitingAssertion("Correct text is present in the notice intro area", { noticeIntro.text }) {
it.contains("library which is covered by")
}
waitingAssertion("Correct text is present in the notice area", { noticeText.text }) {
it.contains("Licensed under the Apache License")
}
}
} finally {
keyboard { escape() }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ data object DroidUiSelectorLocatorType: LocatorType {
}

data object IPredicateLocatorType: LocatorType {
override val title = "Appium/WDA Predicate Query"
override val title = "Appium/WDA Predicate"
override fun evaluate(nodes: List<Node>, locator: String): Node? {
return nodes
.mapNotNull { evaluateIPredicate(it, locator) }
Expand All @@ -50,7 +50,7 @@ data object IPredicateLocatorType: LocatorType {
}

data object IClassChainLocatorType: LocatorType {
override val title = "Appium/WDA Classchain"
override val title = "Appium/WDA Class Chain"
override fun evaluate(nodes: List<Node>, locator: String): Node? {
return nodes
.mapNotNull { evaluateIClassChain(it, locator) }
Expand Down

0 comments on commit 9b30a16

Please sign in to comment.