Commit 4e4bbcc3 authored by Oana Horvath's avatar Oana Horvath
Browse files

For #16317: resets long press delay at the end of UI tests

parent dfc5628c
......@@ -27,9 +27,14 @@ class HomeActivityTestRule(
ActivityTestRule<HomeActivity>(HomeActivity::class.java, initialTouchMode, launchActivity) {
override fun beforeActivityLaunched() {
super.beforeActivityLaunched()
setLongTapTimeout()
setLongTapTimeout("3000")
if (skipOnboarding) { skipOnboardingBeforeLaunch() }
}
override fun afterActivityFinished() {
super.afterActivityFinished()
setLongTapTimeout("400")
}
}
/**
......@@ -48,15 +53,20 @@ class HomeActivityIntentTestRule(
IntentsTestRule<HomeActivity>(HomeActivity::class.java, initialTouchMode, launchActivity) {
override fun beforeActivityLaunched() {
super.beforeActivityLaunched()
setLongTapTimeout()
setLongTapTimeout("3000")
if (skipOnboarding) { skipOnboardingBeforeLaunch() }
}
override fun afterActivityFinished() {
super.afterActivityFinished()
setLongTapTimeout("400")
}
}
// changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click
fun setLongTapTimeout() {
fun setLongTapTimeout(delay: String) {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mDevice.executeShellCommand("settings put secure long_press_timeout 3000")
mDevice.executeShellCommand("settings put secure long_press_timeout $delay")
}
private fun skipOnboardingBeforeLaunch() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment