mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Make large-tests pass on API 23
This commit is contained in:
@@ -54,11 +54,22 @@ fun copyBackupToDownloadFolder() {
|
||||
fun importBackupFromDownloadFolder() {
|
||||
clickMenu(SETTINGS)
|
||||
clickText("Import data")
|
||||
if (SDK_INT >= 26) {
|
||||
if (SDK_INT <= 23) {
|
||||
while (!device.hasObject(By.textContains("Show file size"))) {
|
||||
device.click(720, 100) // Click overflow menu
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
if (device.hasObject(By.textContains("Show SD card"))) {
|
||||
device.findObject(UiSelector().textContains("Show SD card")).click()
|
||||
Thread.sleep(1000)
|
||||
} else {
|
||||
device.pressBack()
|
||||
}
|
||||
device.click(50, 90) // Click menu button
|
||||
device.findObject(UiSelector().textContains("Internal storage")).click()
|
||||
device.findObject(UiSelector().textContains("Download")).click()
|
||||
device.findObject(UiSelector().textContains("Loop")).click()
|
||||
} else {
|
||||
} else if (SDK_INT <= 25) {
|
||||
while (!device.hasObject(By.textContains("Show file size"))) {
|
||||
device.click(720, 100) // Click overflow menu
|
||||
Thread.sleep(1000)
|
||||
@@ -73,6 +84,10 @@ fun importBackupFromDownloadFolder() {
|
||||
device.findObject(UiSelector().textContains("Android")).click()
|
||||
device.findObject(UiSelector().textContains("Download")).click()
|
||||
device.findObject(UiSelector().textContains("Loop")).click()
|
||||
} else {
|
||||
device.click(50, 90) // Click menu button
|
||||
device.findObject(UiSelector().textContains("Download")).click()
|
||||
device.findObject(UiSelector().textContains("Loop")).click()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ object CommonSteps : BaseUserInterfaceTest() {
|
||||
fun clickText(text: String?) {
|
||||
scrollToText(text)
|
||||
Espresso.onView(ViewMatchers.withText(text)).perform(ViewActions.click())
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
fun clickText(@StringRes id: Int) {
|
||||
@@ -62,6 +63,7 @@ object CommonSteps : BaseUserInterfaceTest() {
|
||||
fun longClickText(text: String?) {
|
||||
scrollToText(text)
|
||||
Espresso.onView(ViewMatchers.withText(text)).perform(ViewActions.longClick())
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
fun pressHome() {
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.hamcrest.CoreMatchers.allOf
|
||||
import org.hamcrest.CoreMatchers.endsWith
|
||||
import org.hamcrest.Matcher
|
||||
import org.isoron.uhabits.BaseUserInterfaceTest
|
||||
import org.isoron.uhabits.BaseUserInterfaceTest.Companion.device
|
||||
import org.isoron.uhabits.R
|
||||
import org.isoron.uhabits.activities.habits.list.views.CheckmarkButtonView
|
||||
import java.util.LinkedList
|
||||
@@ -53,6 +54,7 @@ object ListHabitsSteps {
|
||||
CommonSteps.clickText(R.string.hide_completed)
|
||||
}
|
||||
}
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
private fun clickTextInsideOverflowMenu(id: Int) {
|
||||
|
||||
Reference in New Issue
Block a user