Created
February 18, 2022 14:30
-
-
Save gunesmes/6c59a4585d47e03b2aa76550424cdeb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testrisk.dictionary.pages | |
import androidx.annotation.IdRes | |
import androidx.test.espresso.Espresso | |
import androidx.test.espresso.ViewInteraction | |
import androidx.test.espresso.matcher.ViewMatchers.withId | |
import androidx.test.platform.app.InstrumentationRegistry | |
import androidx.test.uiautomator.UiDevice | |
import androidx.test.uiautomator.UiSelector | |
import testrisk.dictionary.R | |
import testrisk.dictionary.utils.Utility | |
open class BaseScreen : Utility() { | |
private val device: UiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | |
val packageName: String = device.currentPackageName | |
open var baseElement: ViewInteraction? = Espresso.onView(withId(R.id.text)) | |
companion object { | |
const val defaultLoadTime = 30000 | |
const val defaultWaitTime = 10000 | |
} | |
fun tapClose() { | |
device.findObject(UiSelector().textContains("Close")).click() | |
} | |
fun waitForPageLoading(@IdRes element: ViewInteraction? = baseElement) { | |
if (element != null) { | |
waitUntilElementVisible(element) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment