|
|
|
@ -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) {
|
|
|
|
|