From 9b30a16479b76e7bc1313b681fbacf48641bfaf1 Mon Sep 17 00:00:00 2001 From: TarCV Date: Thu, 2 May 2024 05:13:22 +0300 Subject: [PATCH] UI and README fixes --- README.md | 19 +++------ .../surveyoridea/gui/BaseTestProjectTests.kt | 14 +++++++ .../surveyoridea/gui/NoticeTests.kt | 39 +++++++++++-------- .../surveyoridea/data/LocatorType.kt | 4 +- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index d364ced4..cabed892 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,14 @@ [![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. + +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**
+* **_Evaluating_ selectors against XML UI snapshots**
+ * 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)**
+* **Syntax highlighting and autocomplete for element selectors (UIAutomator selectors in Java IDEs only)**
![Autocomplete & Highlighting](docs/Autocomplete.png) * **Improved structure navigation for XML UI snapshots**
![Structure navigation](docs/StructureNavigation.png) @@ -18,15 +20,6 @@ They provide the following features: If for some reason `Locate Element` tool window is not enabled, you can open it from the View menu:
![View > Tool windows > Locate Element](docs/MenuLocation.png) -At the moment - -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. diff --git a/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/BaseTestProjectTests.kt b/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/BaseTestProjectTests.kt index a0f9e460..efae7e02 100644 --- a/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/BaseTestProjectTests.kt +++ b/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/BaseTestProjectTests.kt @@ -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 @@ -65,12 +67,24 @@ open class BaseTestProjectTests { ifTipOfTheDayDialogPresent { close() } + + closeCodeWithMeBubbleIfNeeded() + resizeWindow(1280, 800) commonSteps.waitForSmartMode(1) } } } + private fun IdeaFrame.closeCodeWithMeBubbleIfNeeded() { + try { + find(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 = diff --git a/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/NoticeTests.kt b/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/NoticeTests.kt index 00a1d7d1..3480288f 100644 --- a/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/NoticeTests.kt +++ b/plugin-test/src/test/kotlin/com/github/tarcv/testingteam/surveyoridea/gui/NoticeTests.kt @@ -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") @@ -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() } } } } diff --git a/plugin/src/main/kotlin/com/github/tarcv/testingteam/surveyoridea/data/LocatorType.kt b/plugin/src/main/kotlin/com/github/tarcv/testingteam/surveyoridea/data/LocatorType.kt index 42f70465..3b13a646 100644 --- a/plugin/src/main/kotlin/com/github/tarcv/testingteam/surveyoridea/data/LocatorType.kt +++ b/plugin/src/main/kotlin/com/github/tarcv/testingteam/surveyoridea/data/LocatorType.kt @@ -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, locator: String): Node? { return nodes .mapNotNull { evaluateIPredicate(it, locator) } @@ -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, locator: String): Node? { return nodes .mapNotNull { evaluateIClassChain(it, locator) }