mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Fix UI tests (#3297)
This commit is contained in:
parent
458b497a6c
commit
a8ee5bd201
3 changed files with 26 additions and 11 deletions
|
|
@ -8,7 +8,7 @@ import androidx.test.espresso.NoMatchingViewException
|
|||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import fr.free.nrw.commons.utils.StringUtils
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import timber.log.Timber
|
||||
|
||||
class UITestHelper {
|
||||
|
|
@ -27,6 +27,7 @@ class UITestHelper {
|
|||
//Perform Login
|
||||
onView(ViewMatchers.withId(R.id.login_username))
|
||||
.perform(ViewActions.clearText(), ViewActions.typeText(getTestUsername()))
|
||||
closeSoftKeyboard()
|
||||
onView(ViewMatchers.withId(R.id.login_password))
|
||||
.perform(ViewActions.clearText(), ViewActions.typeText(getTestUserPassword()))
|
||||
closeSoftKeyboard()
|
||||
|
|
@ -49,14 +50,14 @@ class UITestHelper {
|
|||
|
||||
private fun getTestUsername(): String {
|
||||
val username = BuildConfig.TEST_USERNAME
|
||||
if (StringUtils.isNullOrWhiteSpace(username) || username == "null") {
|
||||
if (StringUtils.isEmpty(username) || username == "null") {
|
||||
throw NotImplementedError("Configure your beta account's username")
|
||||
} else return username
|
||||
}
|
||||
|
||||
private fun getTestUserPassword(): String {
|
||||
val password = BuildConfig.TEST_PASSWORD
|
||||
if (StringUtils.isNullOrWhiteSpace(password) || password == "null") {
|
||||
if (StringUtils.isEmpty(password) || password == "null") {
|
||||
throw NotImplementedError("Configure your beta account's password")
|
||||
} else return password
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue