added LibraryMenuTest, BookmarksRobot, HistoryRobot (#4769)
ran ktlint added the goBack()method in Transition added the goBack method in Transitionnightly-build-test
parent
5586b18c3e
commit
7402013126
@ -0,0 +1,63 @@
|
||||
package org.mozilla.fenix.ui
|
||||
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
import org.mozilla.fenix.ui.robots.homeScreen
|
||||
|
||||
class LibraryMenuTest {
|
||||
|
||||
@get:Rule
|
||||
val activityTestRule = HomeActivityTestRule()
|
||||
|
||||
@Test
|
||||
fun libraryMenuItemsTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openLibrary {
|
||||
verifyLibraryView()
|
||||
verifyHistoryButton()
|
||||
verifyBookmarksButton()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun closeMenuButtonTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openLibrary {
|
||||
}.closeMenu {
|
||||
verifyHomeScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun backButtonTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openLibrary {
|
||||
}.goBack {
|
||||
verifyHomeScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bookmarksButtonTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openLibrary {
|
||||
}.openBookmarks {
|
||||
verifyBookmarksMenuView()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun historyButtonTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openLibrary {
|
||||
}.openHistory {
|
||||
verifyHistoryMenuView()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package org.mozilla.fenix.ui.robots
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withParent
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.helpers.click
|
||||
|
||||
class BookmarksRobot {
|
||||
|
||||
fun verifyBookmarksMenuView() = assertBookmarksView()
|
||||
|
||||
class Transition {
|
||||
fun goBack(interact: LibraryRobot.() -> Unit): LibraryRobot.Transition {
|
||||
goBackButton().click()
|
||||
|
||||
LibraryRobot().interact()
|
||||
return LibraryRobot.Transition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bookmarksMenu(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
|
||||
BookmarksRobot().interact()
|
||||
return BookmarksRobot.Transition()
|
||||
}
|
||||
|
||||
private fun assertBookmarksView() {
|
||||
onView(allOf(
|
||||
withText("Bookmarks"),
|
||||
withParent(withId(R.id.navigationToolbar))))
|
||||
.check(ViewAssertions.matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun goBackButton() = onView(withContentDescription("Navigate up"))
|
@ -0,0 +1,39 @@
|
||||
package org.mozilla.fenix.ui.robots
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withParent
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.helpers.click
|
||||
|
||||
class HistoryRobot {
|
||||
|
||||
fun verifyHistoryMenuView() = assertHistoryView()
|
||||
|
||||
class Transition {
|
||||
fun goBack(interact: LibraryRobot.() -> Unit): LibraryRobot.Transition {
|
||||
goBackButton().click()
|
||||
|
||||
LibraryRobot().interact()
|
||||
return LibraryRobot.Transition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun historyMenu(interact: HistoryRobot.() -> Unit): HistoryRobot.Transition {
|
||||
HistoryRobot().interact()
|
||||
return HistoryRobot.Transition()
|
||||
}
|
||||
|
||||
private fun assertHistoryView() {
|
||||
onView(allOf(withText("History"), withParent(withId(R.id.navigationToolbar))))
|
||||
.check(ViewAssertions.matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun goBackButton() = onView(withContentDescription("Navigate up"))
|
Loading…
Reference in New Issue