Merge pull request #7856 from vector-im/feature/bca/fix_ui_tests

FIx UI Tests
This commit is contained in:
Valere 2022-12-29 14:27:34 +01:00 committed by GitHub
commit ebd0f8a5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 13 deletions

View File

@ -89,7 +89,7 @@ fun getString(@StringRes id: Int): String {
return EspressoHelper.getCurrentActivity()!!.resources.getString(id) return EspressoHelper.getCurrentActivity()!!.resources.getString(id)
} }
fun waitForView(viewMatcher: Matcher<View>, timeout: Long = 10_000, waitForDisplayed: Boolean = true): ViewAction { fun waitForView(viewMatcher: Matcher<View>, timeout: Long = 20_000, waitForDisplayed: Boolean = true): ViewAction {
return object : ViewAction { return object : ViewAction {
private val clock = DefaultClock() private val clock = DefaultClock()

View File

@ -28,7 +28,6 @@ import im.vector.app.espresso.tools.ScreenshotFailureRule
import im.vector.app.features.MainActivity import im.vector.app.features.MainActivity
import im.vector.app.getString import im.vector.app.getString
import im.vector.app.ui.robot.ElementRobot import im.vector.app.ui.robot.ElementRobot
import im.vector.app.ui.robot.settings.labs.LabFeature
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
import im.vector.app.ui.robot.withDeveloperMode import im.vector.app.ui.robot.withDeveloperMode
import org.junit.Rule import org.junit.Rule
@ -133,6 +132,10 @@ class UiAllScreensSanityTest {
} }
} }
// Some instability with the bottomsheet
// not sure what's the source, maybe the expanded state?
Thread.sleep(10_000)
elementRobot.space { selectSpace(spaceName) } elementRobot.space { selectSpace(spaceName) }
elementRobot.layoutPreferences { elementRobot.layoutPreferences {
@ -175,7 +178,6 @@ class UiAllScreensSanityTest {
* Testing multiple threads screens * Testing multiple threads screens
*/ */
private fun testThreadScreens() { private fun testThreadScreens() {
elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES)
elementRobot.newRoom { elementRobot.newRoom {
createNewRoom { createNewRoom {
crawl() crawl()
@ -189,6 +191,5 @@ class UiAllScreensSanityTest {
} }
} }
} }
elementRobot.toggleLabFeature(LabFeature.THREAD_MESSAGES)
} }
} }

View File

@ -28,7 +28,6 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import im.vector.app.R import im.vector.app.R
import im.vector.app.espresso.tools.waitUntilActivityVisible import im.vector.app.espresso.tools.waitUntilActivityVisible
import im.vector.app.espresso.tools.waitUntilDialogVisible
import im.vector.app.espresso.tools.waitUntilViewVisible import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.home.HomeActivity import im.vector.app.features.home.HomeActivity
import im.vector.app.features.home.room.detail.RoomDetailActivity import im.vector.app.features.home.room.detail.RoomDetailActivity
@ -86,14 +85,17 @@ class SpaceCreateRobot {
clickOn(R.id.nextButton) clickOn(R.id.nextButton)
waitUntilViewVisible(withId(R.id.recyclerView)) waitUntilViewVisible(withId(R.id.recyclerView))
clickOn(R.id.nextButton) clickOn(R.id.nextButton)
// waitUntilActivityVisible<RoomDetailActivity> {
// waitUntilDialogVisible(withId(R.id.inviteByMxidButton))
// }
// // close invite dialog
// pressBack()
waitUntilActivityVisible<RoomDetailActivity> { waitUntilActivityVisible<RoomDetailActivity> {
waitUntilDialogVisible(withId(R.id.inviteByMxidButton)) pressBack()
} }
// close invite dialog // waitUntilViewVisible(withId(R.id.timelineRecyclerView))
pressBack()
waitUntilViewVisible(withId(R.id.timelineRecyclerView))
// close room // close room
pressBack() // pressBack()
waitUntilViewVisible(withId(R.id.roomListContainer)) waitUntilViewVisible(withId(R.id.roomListContainer))
} }
} }

View File

@ -89,9 +89,8 @@ class SpaceMenuRobot {
clickOnSheet(R.id.leaveSpace) clickOnSheet(R.id.leaveSpace)
waitUntilActivityVisible<SpaceLeaveAdvancedActivity> { waitUntilActivityVisible<SpaceLeaveAdvancedActivity> {
waitUntilViewVisible(ViewMatchers.withId(R.id.roomList)) waitUntilViewVisible(ViewMatchers.withId(R.id.roomList))
clickOn(R.id.spaceLeaveSelectAll)
clickOn(R.id.spaceLeaveButton)
} }
clickOn(R.id.spaceLeaveSelectAll)
clickOn(R.id.spaceLeaveButton)
waitUntilViewVisible(ViewMatchers.withId(R.id.groupListView))
} }
} }