[fenix] For https://github.com/mozilla-mobile/fenix/issues/18421 fix and re-enable verifyContextShareLink, verifyContextSaveImage and verifyContextMixedVariations UI tests

pull/600/head
AndiAJ 3 years ago committed by mergify[bot]
parent ecb13fa173
commit ba3f51814c

@ -32,7 +32,6 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
*
*/
@Ignore("Test failures: https://github.com/mozilla-mobile/fenix/issues/18421")
class ContextMenusTest {
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
private lateinit var mockWebServer: MockWebServer
@ -53,6 +52,7 @@ class ContextMenusTest {
mockWebServer.shutdown()
}
@Ignore("Test failures: https://github.com/mozilla-mobile/fenix/issues/18421")
@Test
fun verifyContextOpenLinkNewTab() {
val pageLinks =
@ -76,6 +76,7 @@ class ContextMenusTest {
}
}
@Ignore("Test failures: https://github.com/mozilla-mobile/fenix/issues/18421")
@Test
fun verifyContextOpenLinkPrivateTab() {
val pageLinks =
@ -177,7 +178,6 @@ class ContextMenusTest {
}
@Test
@Ignore("Intermittent: https://github.com/mozilla-mobile/fenix/issues/12309")
fun verifyContextSaveImage() {
val pageLinks =
TestAssetHelper.getGenericAsset(mockWebServer, 4)
@ -202,7 +202,6 @@ class ContextMenusTest {
}
@Test
@Ignore("Intermittent: https://github.com/mozilla-mobile/fenix/issues/12309")
fun verifyContextMixedVariations() {
val pageLinks =
TestAssetHelper.getGenericAsset(mockWebServer, 4)

@ -317,11 +317,31 @@ class BrowserRobot {
}
fun longClickMatchingText(expectedText: String) {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mDevice.waitNotNull(Until.findObject(text(expectedText)), waitingTime)
try {
mDevice.waitForWindowUpdate(packageName, waitingTime)
mDevice.findObject(UiSelector().resourceId("$packageName:id/engineView"))
.waitForExists(waitingTime)
mDevice.findObject(UiSelector().textContains(expectedText)).waitForExists(waitingTime)
val link = mDevice.findObject(By.textContains(expectedText))
link.click(LONG_CLICK_DURATION)
} catch (e: NullPointerException) {
println(e)
val element = mDevice.findObject(text(expectedText))
element.click(LONG_CLICK_DURATION)
// Refresh the page in case the first long click didn't succeed
navigationToolbar {
}.openThreeDotMenu {
}.refreshPage {
mDevice.waitForIdle()
}
// Long click again the desired text
mDevice.waitForWindowUpdate(packageName, waitingTime)
mDevice.findObject(UiSelector().resourceId("$packageName:id/engineView"))
.waitForExists(waitingTime)
mDevice.findObject(UiSelector().textContains(expectedText)).waitForExists(waitingTime)
val link = mDevice.findObject(By.textContains(expectedText))
link.click(LONG_CLICK_DURATION)
}
}
fun longClickAndCopyText(expectedText: String, selectAll: Boolean = false) {

Loading…
Cancel
Save