2019-05-16 02:32:25 +02:00
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
|
@file:Suppress("TooManyFunctions")
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.ui.robots
|
|
|
|
|
|
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
2019-10-28 20:10:19 +01:00
|
|
|
|
import androidx.test.espresso.action.ViewActions
|
2020-02-07 18:07:17 +01:00
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions
|
2019-07-16 22:02:12 +02:00
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers
|
2019-10-28 20:10:19 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.hasFocus
|
2019-09-10 21:03:47 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
2019-10-28 20:10:19 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
2019-11-12 02:10:14 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
2019-09-10 21:03:47 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withResourceName
|
2019-11-12 02:10:14 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
2019-07-16 22:02:12 +02:00
|
|
|
|
import androidx.test.uiautomator.By
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.uiautomator.UiDevice
|
2019-07-16 22:02:12 +02:00
|
|
|
|
import androidx.test.uiautomator.Until
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import org.hamcrest.Matchers.allOf
|
|
|
|
|
import org.mozilla.fenix.R
|
2019-07-16 22:02:12 +02:00
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import org.mozilla.fenix.helpers.click
|
2019-10-23 23:40:28 +02:00
|
|
|
|
import org.mozilla.fenix.helpers.ext.waitNotNull
|
2019-09-26 23:25:34 +02:00
|
|
|
|
import org.mozilla.fenix.share.ShareFragment
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implementation of Robot Pattern for the three dot (main) menu.
|
|
|
|
|
*/
|
2019-10-03 18:30:55 +02:00
|
|
|
|
class ThreeDotMenuMainRobot {
|
2019-05-16 02:32:25 +02:00
|
|
|
|
fun verifySettingsButton() = assertSettingsButton()
|
|
|
|
|
fun verifyLibraryButton() = assertLibraryButton()
|
2019-10-29 14:36:37 +01:00
|
|
|
|
fun verifyHistoryButton() = assertHistoryButton()
|
|
|
|
|
fun verifyBookmarksButton() = assertBookmarksButton()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
fun verifyHelpButton() = assertHelpButton()
|
2019-07-16 22:02:12 +02:00
|
|
|
|
fun verifyThreeDotMenuExists() = threeDotMenuRecyclerViewExists()
|
|
|
|
|
fun verifyForwardButton() = assertForwardButton()
|
2019-11-12 02:10:14 +01:00
|
|
|
|
fun verifyAddBookmarkButton() = assertAddBookmarkButton()
|
|
|
|
|
fun verifyEditBookmarkButton() = assertEditBookmarkButton()
|
2019-07-16 22:02:12 +02:00
|
|
|
|
fun verifyRefreshButton() = assertRefreshButton()
|
2019-08-27 19:56:12 +02:00
|
|
|
|
fun verifyCloseAllTabsButton() = assertCloseAllTabsButton()
|
|
|
|
|
fun verifyShareButton() = assertShareButton()
|
2020-02-07 18:07:17 +01:00
|
|
|
|
fun verifyReaderViewToggle(visible: Boolean) = assertReaderViewToggle(visible)
|
|
|
|
|
fun verifyReaderViewAppearance(visible: Boolean) = assertReaderViewAppearanceButton(visible)
|
2019-09-10 21:03:47 +02:00
|
|
|
|
fun clickShareButton() {
|
|
|
|
|
shareButton().click()
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("SHARE A LINK")), waitingTime)
|
2019-09-10 21:03:47 +02:00
|
|
|
|
}
|
2019-09-26 23:25:34 +02:00
|
|
|
|
|
2019-09-13 00:56:36 +02:00
|
|
|
|
fun verifyShareTabButton() = assertShareTabButton()
|
2019-08-27 19:56:12 +02:00
|
|
|
|
fun verifySaveCollection() = assertSaveCollectionButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun clickBrowserViewSaveCollectionButton() {
|
|
|
|
|
browserViewSaveCollectionButton().click()
|
|
|
|
|
}
|
2019-12-03 11:44:54 +01:00
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun clickAddNewCollection() {
|
|
|
|
|
addNewCollectionButton().click()
|
|
|
|
|
}
|
2019-12-03 11:44:54 +01:00
|
|
|
|
|
|
|
|
|
fun clickAddBookmarkButton() {
|
|
|
|
|
mDevice.waitNotNull(
|
|
|
|
|
Until.findObject(By.desc("Bookmark")),
|
|
|
|
|
waitingTime
|
|
|
|
|
)
|
|
|
|
|
addBookmarkButton().click()
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun verifyCollectionNameTextField() = assertCollectionNameTextField()
|
2019-09-09 20:16:47 +02:00
|
|
|
|
fun verifyFindInPageButton() = assertFindInPageButton()
|
2019-09-26 23:25:34 +02:00
|
|
|
|
fun verifyShareScrim() = assertShareScrim()
|
2019-09-10 21:03:47 +02:00
|
|
|
|
fun verifySendToDeviceTitle() = assertSendToDeviceTitle()
|
|
|
|
|
fun verifyShareALinkTitle() = assertShareALinkTitle()
|
2019-09-11 17:41:05 +02:00
|
|
|
|
fun verifyWhatsNewButton() = assertWhatsNewButton()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
|
|
|
|
class Transition {
|
|
|
|
|
|
2019-07-16 22:02:12 +02:00
|
|
|
|
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
|
|
|
|
fun openSettings(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
|
|
|
|
settingsButton().click()
|
|
|
|
|
|
|
|
|
|
SettingsRobot().interact()
|
|
|
|
|
return SettingsRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openLibrary(interact: LibraryRobot.() -> Unit): LibraryRobot.Transition {
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("Your Library")), waitingTime)
|
2019-05-16 02:32:25 +02:00
|
|
|
|
libraryButton().click()
|
|
|
|
|
|
|
|
|
|
LibraryRobot().interact()
|
|
|
|
|
return LibraryRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 14:36:37 +01:00
|
|
|
|
fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
|
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
|
|
|
|
|
bookmarksButton().click()
|
|
|
|
|
|
|
|
|
|
BookmarksRobot().interact()
|
|
|
|
|
return BookmarksRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openHistory(interact: HistoryRobot.() -> Unit): HistoryRobot.Transition {
|
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("History")), waitingTime)
|
|
|
|
|
historyButton().click()
|
|
|
|
|
|
|
|
|
|
HistoryRobot().interact()
|
|
|
|
|
return HistoryRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
fun openHelp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("Help")), waitingTime)
|
2019-05-16 02:32:25 +02:00
|
|
|
|
helpButton().click()
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
2019-07-16 22:02:12 +02:00
|
|
|
|
|
|
|
|
|
fun goForward(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.desc("Forward")), waitingTime)
|
2019-07-16 22:02:12 +02:00
|
|
|
|
forwardButton().click()
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun goBack(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
2019-11-12 02:10:14 +01:00
|
|
|
|
// Close three dot
|
|
|
|
|
mDevice.pressBack()
|
|
|
|
|
// Nav back to previous page
|
|
|
|
|
mDevice.pressBack()
|
2019-07-16 22:02:12 +02:00
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-10 12:05:47 +01:00
|
|
|
|
fun close(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
|
|
|
|
// Close three dot
|
|
|
|
|
mDevice.pressBack()
|
|
|
|
|
|
|
|
|
|
HomeScreenRobot().interact()
|
|
|
|
|
return HomeScreenRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun closeBrowserMenuToBrowser(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
// Close three dot
|
|
|
|
|
mDevice.pressBack()
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-16 22:02:12 +02:00
|
|
|
|
fun refreshPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.desc("Refresh")), waitingTime)
|
2019-07-16 22:02:12 +02:00
|
|
|
|
refreshButton().click()
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
|
|
|
|
fun closeAllTabs(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("Close all tabs")), waitingTime)
|
2019-08-27 19:56:12 +02:00
|
|
|
|
closeAllTabsButton().click()
|
|
|
|
|
|
|
|
|
|
HomeScreenRobot().interact()
|
|
|
|
|
return HomeScreenRobot.Transition()
|
|
|
|
|
}
|
2019-09-09 20:16:47 +02:00
|
|
|
|
|
|
|
|
|
fun openFindInPage(interact: FindInPageRobot.() -> Unit): FindInPageRobot.Transition {
|
2019-10-23 23:40:28 +02:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("Find in page")), waitingTime)
|
2019-09-09 20:16:47 +02:00
|
|
|
|
findInPageButton().click()
|
|
|
|
|
|
|
|
|
|
FindInPageRobot().interact()
|
|
|
|
|
return FindInPageRobot.Transition()
|
|
|
|
|
}
|
2019-09-11 17:41:05 +02:00
|
|
|
|
|
|
|
|
|
fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
2019-12-02 19:05:55 +01:00
|
|
|
|
mDevice.waitNotNull(Until.findObject(By.text("What’s New")), waitingTime)
|
2019-09-11 17:41:05 +02:00
|
|
|
|
whatsNewButton().click()
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
2019-10-28 20:10:19 +01:00
|
|
|
|
|
|
|
|
|
fun typeCollectionName(name: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/name_collection_edittext")), waitingTime)
|
|
|
|
|
|
|
|
|
|
collectionNameTextField().check(matches(hasFocus()))
|
|
|
|
|
collectionNameTextField().perform(ViewActions.replaceText(name), ViewActions.pressImeActionButton())
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
2020-02-07 18:07:17 +01:00
|
|
|
|
|
|
|
|
|
fun toggleReaderView(interact: NavigationToolbarRobot.() -> Unit): NavigationToolbarRobot.Transition {
|
|
|
|
|
readerViewToggle().click()
|
|
|
|
|
|
|
|
|
|
NavigationToolbarRobot().interact()
|
|
|
|
|
return NavigationToolbarRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openReaderViewAppearance(interact: ReaderViewRobot.() -> Unit): ReaderViewRobot.Transition {
|
|
|
|
|
readerViewAppearanceToggle().click()
|
|
|
|
|
|
|
|
|
|
ReaderViewRobot().interact()
|
|
|
|
|
return ReaderViewRobot.Transition()
|
|
|
|
|
}
|
2019-05-16 02:32:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-10 21:03:47 +02:00
|
|
|
|
|
2019-07-16 22:02:12 +02:00
|
|
|
|
private fun threeDotMenuRecyclerViewExists() {
|
|
|
|
|
onView(withId(R.id.mozac_browser_menu_recyclerView)).check(matches(isDisplayed()))
|
|
|
|
|
}
|
2019-09-26 23:25:34 +02:00
|
|
|
|
|
2019-12-02 10:33:14 +01:00
|
|
|
|
private fun settingsButton() = onView(allOf(withText(R.string.settings),
|
|
|
|
|
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-05-16 02:32:25 +02:00
|
|
|
|
private fun assertSettingsButton() = settingsButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
|
|
|
|
private fun libraryButton() = onView(allOf(withText(R.string.browser_menu_your_library)))
|
|
|
|
|
private fun assertLibraryButton() = libraryButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
2019-10-29 14:36:37 +01:00
|
|
|
|
private fun historyButton() = onView(allOf(withText(R.string.library_history)))
|
|
|
|
|
private fun assertHistoryButton() = historyButton()
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun bookmarksButton() = onView(allOf(withText(R.string.library_bookmarks)))
|
|
|
|
|
private fun assertBookmarksButton() = bookmarksButton()
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
private fun helpButton() = onView(allOf(withText(R.string.browser_menu_help)))
|
|
|
|
|
private fun assertHelpButton() = helpButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-07-16 22:02:12 +02:00
|
|
|
|
|
|
|
|
|
private fun forwardButton() = onView(ViewMatchers.withContentDescription("Forward"))
|
|
|
|
|
private fun assertForwardButton() = forwardButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-07-16 22:02:12 +02:00
|
|
|
|
|
2019-11-12 02:10:14 +01:00
|
|
|
|
private fun addBookmarkButton() = onView(ViewMatchers.withContentDescription("Bookmark"))
|
|
|
|
|
private fun assertAddBookmarkButton() = addBookmarkButton()
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun editBookmarkButton() = onView(ViewMatchers.withContentDescription("Edit bookmark"))
|
|
|
|
|
private fun assertEditBookmarkButton() = editBookmarkButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-07-16 22:02:12 +02:00
|
|
|
|
|
|
|
|
|
private fun refreshButton() = onView(ViewMatchers.withContentDescription("Refresh"))
|
|
|
|
|
private fun assertRefreshButton() = refreshButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
|
|
|
|
private fun closeAllTabsButton() = onView(allOf(withText("Close all tabs")))
|
|
|
|
|
private fun assertCloseAllTabsButton() = closeAllTabsButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
2019-09-13 00:56:36 +02:00
|
|
|
|
private fun shareTabButton() = onView(allOf(withText("Share tabs")))
|
|
|
|
|
private fun assertShareTabButton() = shareTabButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-09-26 23:25:34 +02:00
|
|
|
|
|
2019-11-12 02:10:14 +01:00
|
|
|
|
private fun shareButton() = onView(ViewMatchers.withContentDescription("Share"))
|
2019-08-27 19:56:12 +02:00
|
|
|
|
private fun assertShareButton() = shareButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun browserViewSaveCollectionButton() = onView(allOf(withText("Save to Collection"),
|
|
|
|
|
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
|
|
|
|
private fun saveCollectionButton() = onView(allOf(withText("Save to collection")))
|
|
|
|
|
private fun assertSaveCollectionButton() = saveCollectionButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun addNewCollectionButton() = onView(allOf(withText("Add new collection")))
|
|
|
|
|
private fun assertaddNewCollectionButton() = addNewCollectionButton()
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun collectionNameTextField() = onView(allOf(withResourceName("name_collection_edittext")))
|
|
|
|
|
private fun assertCollectionNameTextField() = collectionNameTextField()
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-09-09 20:16:47 +02:00
|
|
|
|
|
|
|
|
|
private fun findInPageButton() = onView(allOf(withText("Find in page")))
|
|
|
|
|
private fun assertFindInPageButton() = findInPageButton()
|
2019-09-10 21:03:47 +02:00
|
|
|
|
|
2019-09-26 23:25:34 +02:00
|
|
|
|
private fun shareScrim() = onView(withResourceName("closeSharingScrim"))
|
|
|
|
|
private fun assertShareScrim() =
|
|
|
|
|
shareScrim().check(matches(ViewMatchers.withAlpha(ShareFragment.SHOW_PAGE_ALPHA)))
|
|
|
|
|
|
|
|
|
|
private fun SendToDeviceTitle() =
|
|
|
|
|
onView(allOf(withText("SEND TO DEVICE"), withResourceName("accountHeaderText")))
|
|
|
|
|
|
2019-09-10 21:03:47 +02:00
|
|
|
|
private fun assertSendToDeviceTitle() = SendToDeviceTitle()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-09-10 21:03:47 +02:00
|
|
|
|
|
2019-09-26 23:25:34 +02:00
|
|
|
|
private fun ShareALinkTitle() =
|
|
|
|
|
onView(allOf(withText("SHARE A LINK"), withResourceName("link_header")))
|
|
|
|
|
|
2019-09-10 21:03:47 +02:00
|
|
|
|
private fun assertShareALinkTitle() = ShareALinkTitle()
|
2019-09-11 17:41:05 +02:00
|
|
|
|
|
2019-12-02 19:05:55 +01:00
|
|
|
|
private fun whatsNewButton() = onView(
|
|
|
|
|
allOf(
|
|
|
|
|
withText("What’s New"),
|
2019-12-02 10:33:14 +01:00
|
|
|
|
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2019-09-11 17:41:05 +02:00
|
|
|
|
private fun assertWhatsNewButton() = whatsNewButton()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
2020-02-07 18:07:17 +01:00
|
|
|
|
|
|
|
|
|
private fun readerViewToggle() = onView(allOf(withText(R.string.browser_menu_read)))
|
|
|
|
|
private fun assertReaderViewToggle(visible: Boolean) = readerViewToggle()
|
|
|
|
|
.check(
|
|
|
|
|
if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) else ViewAssertions.doesNotExist()
|
|
|
|
|
)
|
|
|
|
|
private fun readerViewAppearanceToggle() = onView(allOf(withText(R.string.browser_menu_read_appearance)))
|
|
|
|
|
private fun assertReaderViewAppearanceButton(visible: Boolean) = readerViewAppearanceToggle()
|
|
|
|
|
.check(
|
|
|
|
|
if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) else ViewAssertions.doesNotExist()
|
|
|
|
|
)
|