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

@ -317,11 +317,31 @@ class BrowserRobot {
} }
fun longClickMatchingText(expectedText: String) { fun longClickMatchingText(expectedText: String) {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) try {
mDevice.waitNotNull(Until.findObject(text(expectedText)), waitingTime) 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)) // Refresh the page in case the first long click didn't succeed
element.click(LONG_CLICK_DURATION) 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) { fun longClickAndCopyText(expectedText: String, selectAll: Boolean = false) {

Loading…
Cancel
Save