Skip to content

Instantly share code, notes, and snippets.

@AaronMT
Created May 9, 2019 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AaronMT/cfd0e9250c3e18d636da5c701dd36236 to your computer and use it in GitHub Desktop.
Save AaronMT/cfd0e9250c3e18d636da5c701dd36236 to your computer and use it in GitHub Desktop.
diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt
index 2a4d4b9..85b720f 100644
--- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt
+++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt
@@ -10,9 +10,11 @@ import androidx.test.InstrumentationRegistry
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers
-import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
-import androidx.test.espresso.matcher.ViewMatchers.Visibility
+import androidx.test.espresso.matcher.ViewMatchers.*
+import androidx.test.espresso.action.ViewActions.click
import androidx.test.uiautomator.UiDevice
+import org.hamcrest.Matchers.allOf
+import org.mozilla.fenix.R
class HomeScreenRobot {
fun verifyHomeScreen() = homeScreen()
@@ -28,6 +30,9 @@ class HomeScreenRobot {
fun openThreeDotMenuMain(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition {
+ mDevice.waitForIdle()
+ threeDotButton().perform(click())
+
ThreeDotMenuMainRobot().interact()
return ThreeDotMenuMainRobot.Transition()
}
@@ -44,13 +49,14 @@ fun homeScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition
private fun homeScreen() = onView(ViewMatchers.withResourceName("homeLayout"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
-private fun homePrivateBrowsingButton() = onView(ViewMatchers.withResourceName("privateBrowsingButton"))
- .check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun homeMenu() = onView(ViewMatchers.withResourceName("menuButton"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
+private fun homePrivateBrowsingButton() = onView(ViewMatchers.withResourceName("privateBrowsingButton"))
+ .check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun homeWordmark() = onView(ViewMatchers.withResourceName("wordmark"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun homeToolbar() = onView(ViewMatchers.withResourceName("toolbar"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun homeComponent() = onView(ViewMatchers.withResourceName("home_component"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
+private fun threeDotButton() = onView(allOf(ViewMatchers.withId(R.id.menuButton)))
diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt
index b281bd6..7de12b6 100644
--- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt
+++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt
@@ -12,6 +12,7 @@ import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.uiautomator.UiDevice
import org.hamcrest.Matchers.allOf
import org.mozilla.fenix.R
@@ -60,20 +61,13 @@ class ThreeDotMenuMainRobot {
// return HelpRobot.Transition()
// }
-
}
-
}
-private fun settingsButton() = onView(allOf(withId(R.string.browser_menu_settings)))
+private fun settingsButton() = onView(allOf(withText("Settings")))
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
-private fun yourLibraryButton() = onView(allOf(withId(R.string.browser_menu_your_library)))
+private fun yourLibraryButton() = onView(allOf(withText(R.string.browser_menu_your_library)))
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
-private fun helpButton() = onView(allOf(withId(R.string.browser_menu_help)))
+private fun helpButton() = onView(allOf(withText(R.string.browser_menu_help)))
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
-
-
-
-
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment