diff --git a/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html b/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html index e00cbc1a331d4f4b8da0080d79dd644b19c47a25..b8e0f7bc553aa1693b224a8e0254ecc00e94b2ff 100644 --- a/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html +++ b/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html @@ -3,6 +3,7 @@ - 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/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> +<meta name="viewport" content="width=device-width"> <head> <meta charset="UTF-8"> <title>adsTrackers</title> diff --git a/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html b/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html index 1c47a8814f89c1abc9d9d652ddc0097b65b5613e..e97a7e35c6f1c3a29591f65ba63d0a616230e9ad 100644 --- a/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html +++ b/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html @@ -3,6 +3,7 @@ - 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/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> +<meta name="viewport" content="width=device-width"> <head> <meta charset="UTF-8"> <title>analyticsTrackers</title> diff --git a/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html b/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html index 8710081d65087a5dc21c3ec15990d6c48e92b870..5e4bd63a78f502df6a92fcee37d94d4a69385aeb 100644 --- a/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html +++ b/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html @@ -3,6 +3,7 @@ - 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/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> +<meta name="viewport" content="width=device-width"> <head> <meta charset="UTF-8"> <title>otherTrackers</title> diff --git a/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html b/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html index f40c8c785215b6ee44d6e3235e0404396641f897..5f1afd19aa3fbfdc825d556e91556765725cd5d7 100644 --- a/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html +++ b/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html @@ -3,6 +3,7 @@ - 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/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> +<meta name="viewport" content="width=device-width"> <head> <meta charset="UTF-8"> <title>socialTrackers</title> diff --git a/focus-android/app/src/androidTest/assets/storage_check.html b/focus-android/app/src/androidTest/assets/storage_check.html index 2887493ede2e579e9305d299a8db24d40d19f47c..d51a99165b82e7f42d9ae3b8c1e6e98a2c65710d 100644 --- a/focus-android/app/src/androidTest/assets/storage_check.html +++ b/focus-android/app/src/androidTest/assets/storage_check.html @@ -1,5 +1,6 @@ <!DOCTYPE html> <html> +<meta name="viewport" content="width=device-width"> <body> <h1>Storage check</h1> diff --git a/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/BrowserRobot.kt b/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/BrowserRobot.kt index 999b4545fae2c50fba369e6be6a05ec8ee280eef..08e4c05bf470294917d66915d3ac4d20dbd522a2 100644 --- a/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/BrowserRobot.kt +++ b/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/BrowserRobot.kt @@ -50,7 +50,24 @@ class BrowserRobot { ) fun verifyPageContent(expectedText: String) { - mDevice.wait(Until.findObject(By.textContains(expectedText)), waitingTime) + sessionLoadedIdlingResource = SessionLoadedIdlingResource() + + runWithIdleRes(sessionLoadedIdlingResource) { + for (i in 1..RETRY_COUNT) { + try { + assertTrue( + webPageItemContainingText(expectedText).waitForExists(pageLoadingTime), + ) + break + } catch (e: AssertionError) { + if (i == RETRY_COUNT) { + throw e + } else { + refreshPageIfStillLoading(expectedText) + } + } + } + } } fun verifyTrackingProtectionAlert(expectedText: String) { @@ -59,7 +76,7 @@ class BrowserRobot { for (i in 1..RETRY_COUNT) { try { assertTrue( - mDevice.findObject(UiSelector().textContains(expectedText)) + webPageItemContainingText(expectedText) .waitForExists(pageLoadingTime), ) // close the JavaScript alert