Merge pull request #5866 from vector-im/feature/bma/fix_sanity_test
Fix sanity test
This commit is contained in:
commit
8dd87321da
@ -26,6 +26,7 @@ import androidx.test.espresso.action.ViewActions.click
|
|||||||
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
|
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
|
||||||
import androidx.test.espresso.matcher.PreferenceMatchers.withKey
|
import androidx.test.espresso.matcher.PreferenceMatchers.withKey
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.isFocusable
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||||
@ -36,8 +37,15 @@ import org.hamcrest.Matchers.`is`
|
|||||||
|
|
||||||
fun clickOnPreference(@StringRes textResId: Int) {
|
fun clickOnPreference(@StringRes textResId: Int) {
|
||||||
onView(withId(R.id.recycler_view))
|
onView(withId(R.id.recycler_view))
|
||||||
.perform(actionOnItem<RecyclerView.ViewHolder>(
|
.perform(
|
||||||
hasDescendant(withText(textResId)), click()))
|
actionOnItem<RecyclerView.ViewHolder>(
|
||||||
|
allOf(
|
||||||
|
hasDescendant(withText(textResId)),
|
||||||
|
// Avoid to click on the Preference Category
|
||||||
|
isFocusable()
|
||||||
|
), click()
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clickOnSwitchPreference(preferenceKey: String) {
|
fun clickOnSwitchPreference(preferenceKey: String) {
|
||||||
|
@ -56,10 +56,8 @@ class RoomDetailRobot {
|
|||||||
// Menu
|
// Menu
|
||||||
openMenu()
|
openMenu()
|
||||||
pressBack()
|
pressBack()
|
||||||
/* TODO something has changed in the menu :/
|
|
||||||
clickMenu(R.id.voice_call)
|
clickMenu(R.id.voice_call)
|
||||||
pressBack()
|
pressBack()
|
||||||
*/
|
|
||||||
clickMenu(R.id.video_call)
|
clickMenu(R.id.video_call)
|
||||||
pressBack()
|
pressBack()
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ package im.vector.app.ui.robot.settings
|
|||||||
|
|
||||||
import androidx.test.espresso.Espresso
|
import androidx.test.espresso.Espresso
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.clickOnAndGoBack
|
|
||||||
import im.vector.app.espresso.tools.clickOnPreference
|
import im.vector.app.espresso.tools.clickOnPreference
|
||||||
|
|
||||||
class SettingsSecurityRobot {
|
class SettingsSecurityRobot {
|
||||||
@ -38,10 +37,7 @@ class SettingsSecurityRobot {
|
|||||||
clickOnPreference(R.string.settings_opt_in_of_analytics)
|
clickOnPreference(R.string.settings_opt_in_of_analytics)
|
||||||
Espresso.pressBack()
|
Espresso.pressBack()
|
||||||
|
|
||||||
ignoredUsers()
|
clickOnPreference(R.string.settings_ignored_users)
|
||||||
}
|
Espresso.pressBack()
|
||||||
|
|
||||||
private fun ignoredUsers(block: () -> Unit = {}) {
|
|
||||||
clickOnAndGoBack(R.string.settings_ignored_users) { block() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,12 @@ data class RoomDetailViewState(
|
|||||||
rootThreadEventId = args.threadTimelineArgs?.rootThreadEventId
|
rootThreadEventId = args.threadTimelineArgs?.rootThreadEventId
|
||||||
)
|
)
|
||||||
|
|
||||||
fun isCallOptionAvailable() = asyncRoomSummary.invoke()?.isDirect ?: true
|
fun isCallOptionAvailable(): Boolean {
|
||||||
|
return asyncRoomSummary.invoke()?.isDirect ?: true ||
|
||||||
|
// When there is only one member, a warning will be displayed when the user
|
||||||
|
// clicks on the menu item to start a call
|
||||||
|
asyncRoomSummary.invoke()?.joinedMembersCount == 1
|
||||||
|
}
|
||||||
|
|
||||||
fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false
|
fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user