mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
[WIP] Adding Espresso test for orientation change (#2814)
* first commit * initial commit * added UI test for more activities * added more tests * improved code quality * reverted code
This commit is contained in:
parent
dcbf076965
commit
4578600c1e
12 changed files with 129 additions and 6 deletions
|
|
@ -1,10 +1,13 @@
|
|||
package fr.free.nrw.commons
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.pm.ActivityInfo
|
||||
import androidx.test.espresso.Espresso.closeSoftKeyboard
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
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 timber.log.Timber
|
||||
|
||||
|
|
@ -57,5 +60,11 @@ class UITestHelper {
|
|||
throw NotImplementedError("Configure your beta account's password")
|
||||
} else return password
|
||||
}
|
||||
fun <T: Activity> changeOrientation(activityRule: ActivityTestRule<T>){
|
||||
activityRule.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
assert(activityRule.activity.requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
|
||||
activityRule.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
assert(activityRule.activity.requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue