2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/26286 new openPocketStoryItemTest UI test

This commit is contained in:
AndiAJ 2022-11-24 09:57:40 +02:00 committed by mergify[bot]
parent 099a89e856
commit f76dcc4da7
2 changed files with 50 additions and 0 deletions

View File

@ -35,6 +35,7 @@ class HomeScreenTest {
private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer
private lateinit var firstPocketStoryPublisher: String
@get:Rule(order = 0)
val activityTestRule =
@ -238,6 +239,25 @@ class HomeScreenTest {
}
}
@Test
fun openPocketStoryItemTest() {
activityTestRule.activityRule.applySettingsExceptions {
it.isRecentTabsFeatureEnabled = false
it.isRecentlyVisitedFeatureEnabled = false
}
homeScreen {
}.dismissOnboarding()
homeScreen {
verifyThoughtProvokingStories(true)
scrollToPocketProvokingStories()
firstPocketStoryPublisher = getProvokingStoryPublisher(1)
}.clickPocketStoryItem(firstPocketStoryPublisher, 1) {
verifyUrl(firstPocketStoryPublisher)
}
}
@Test
fun verifyCustomizeHomepageTest() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)

View File

@ -382,6 +382,20 @@ class HomeScreenRobot {
)
}
fun getProvokingStoryPublisher(position: Int): String {
val publisher = mDevice.findObject(
UiSelector()
.className("android.view.View")
.index(position - 1),
).getChild(
UiSelector()
.className("android.widget.TextView")
.index(1),
).text
return publisher
}
class Transition {
fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
@ -653,6 +667,22 @@ class HomeScreenRobot {
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun clickPocketStoryItem(publisher: String, position: Int, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.findObject(
UiSelector()
.className("android.view.View")
.index(position - 1),
).getChild(
UiSelector()
.className("android.widget.TextView")
.index(1)
.textContains(publisher),
).clickAndWaitForNewWindow(waitingTime)
BrowserRobot().interact()
return BrowserRobot.Transition()
}
}
}