For #17309, #13447, #14534 UI tests: changed the way page Url is verified

This commit is contained in:
Oana Horvath 2021-01-20 17:43:50 +02:00
parent 928ad21c51
commit 7c56df41df
3 changed files with 12 additions and 9 deletions

View File

@ -58,9 +58,9 @@ class NavigationToolbarTest {
mDevice.waitForIdle()
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(nextWebPage.url) {
mDevice.waitForIdle()
verifyUrl(nextWebPage.url.toString())
mDevice.pressBack()
}.openThreeDotMenu {
}.goBack {
mDevice.waitForIdle()
verifyUrl(defaultWebPage.url.toString())
}

View File

@ -120,6 +120,7 @@ class SettingsBasicsTest {
navigationToolbar {
}.enterURLAndEnterToBrowser(page2.url) {
verifyUrl(page2.url.toString())
}.openThreeDotMenu {
clickAddBookmarkButton()
}

View File

@ -57,14 +57,14 @@ class BrowserRobot {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
sessionLoadedIdlingResource = SessionLoadedIdlingResource()
mDevice.waitNotNull(
Until.findObject(By.res("$packageName:id/mozac_browser_toolbar_url_view")),
waitingTime
)
runWithIdleRes(sessionLoadedIdlingResource) {
onView(withId(R.id.mozac_browser_toolbar_url_view))
.check(matches(withText(containsString(url.replace("http://", "")))))
assertTrue(
mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/mozac_browser_toolbar_url_view")
.textContains(url.replace("http://", ""))
).waitForExists(waitingTime)
)
}
}
@ -297,6 +297,8 @@ class BrowserRobot {
fun createBookmark(url: Uri) {
navigationToolbar {
}.enterURLAndEnterToBrowser(url) {
// needs to wait for the right url to load before saving a bookmark
verifyUrl(url.toString())
}.openThreeDotMenu {
clickAddBookmarkButton()
}