For #26286 new openPocketStoryItemTest UI test
This commit is contained in:
parent
d014295eaa
commit
808884f625
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue