mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
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.matcher.PreferenceMatchers.withKey
|
||||
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.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
@ -36,8 +37,15 @@ import org.hamcrest.Matchers.`is`
|
||||
|
||||
fun clickOnPreference(@StringRes textResId: Int) {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(textResId)), click()))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
allOf(
|
||||
hasDescendant(withText(textResId)),
|
||||
// Avoid to click on the Preference Category
|
||||
isFocusable()
|
||||
), click()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun clickOnSwitchPreference(preferenceKey: String) {
|
||||
|
@ -56,10 +56,8 @@ class RoomDetailRobot {
|
||||
// Menu
|
||||
openMenu()
|
||||
pressBack()
|
||||
/* TODO something has changed in the menu :/
|
||||
clickMenu(R.id.voice_call)
|
||||
pressBack()
|
||||
*/
|
||||
clickMenu(R.id.video_call)
|
||||
pressBack()
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ package im.vector.app.ui.robot.settings
|
||||
|
||||
import androidx.test.espresso.Espresso
|
||||
import im.vector.app.R
|
||||
import im.vector.app.clickOnAndGoBack
|
||||
import im.vector.app.espresso.tools.clickOnPreference
|
||||
|
||||
class SettingsSecurityRobot {
|
||||
@ -38,10 +37,7 @@ class SettingsSecurityRobot {
|
||||
clickOnPreference(R.string.settings_opt_in_of_analytics)
|
||||
Espresso.pressBack()
|
||||
|
||||
ignoredUsers()
|
||||
}
|
||||
|
||||
private fun ignoredUsers(block: () -> Unit = {}) {
|
||||
clickOnAndGoBack(R.string.settings_ignored_users) { block() }
|
||||
clickOnPreference(R.string.settings_ignored_users)
|
||||
Espresso.pressBack()
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,12 @@ data class RoomDetailViewState(
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user