mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Large tests: Make compatible with API 27
This commit is contained in:
@@ -56,7 +56,8 @@ open class BaseUserInterfaceTest {
|
||||
@After
|
||||
@Throws(Exception::class)
|
||||
fun tearDown() {
|
||||
for (i in 0..9) device.pressBack()
|
||||
device.pressBack()
|
||||
device.pressBack()
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
|
||||
package org.isoron.uhabits.acceptance.steps
|
||||
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import androidx.test.uiautomator.UiSelector
|
||||
import org.isoron.uhabits.BaseUserInterfaceTest.Companion.device
|
||||
import org.isoron.uhabits.acceptance.steps.CommonSteps.clickText
|
||||
import org.isoron.uhabits.acceptance.steps.CommonSteps.pressBack
|
||||
import org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.SETTINGS
|
||||
import org.isoron.uhabits.acceptance.steps.ListHabitsSteps.clickMenu
|
||||
|
||||
@@ -31,7 +33,8 @@ const val DOWNLOAD_FOLDER = "/sdcard/Download/"
|
||||
fun exportFullBackup() {
|
||||
clickMenu(SETTINGS)
|
||||
clickText("Export full backup")
|
||||
device.pressBack()
|
||||
if (SDK_INT < 28) return
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun clearDownloadFolder() {
|
||||
|
||||
@@ -120,10 +120,12 @@ object CommonSteps : BaseUserInterfaceTest() {
|
||||
private fun verifyDisplaysView(className: String) {
|
||||
Espresso.onView(ViewMatchers.withClassName(CoreMatchers.endsWith(className)))
|
||||
.check(ViewAssertions.matches(ViewMatchers.isEnabled()))
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
fun verifyDoesNotDisplayText(text: String?) {
|
||||
Espresso.onView(ViewMatchers.withText(text)).check(ViewAssertions.doesNotExist())
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
|
||||
@@ -110,7 +110,7 @@ fun Activity.showMessage(msg: String) {
|
||||
fun Activity.showSendFileScreen(archiveFilename: String) {
|
||||
val file = File(archiveFilename)
|
||||
val fileUri = FileProvider.getUriForFile(this, "org.isoron.uhabits", file)
|
||||
this.startActivity(
|
||||
this.startActivitySafely(
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
type = "application/zip"
|
||||
|
||||
Reference in New Issue
Block a user