mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
moving the signout to the robot but commenting out whilst a bug is fixed
- also makes waitForActivity stronger by also waiting for child views
This commit is contained in:
parent
0f1c9f4af5
commit
32f5893798
5 changed files with 37 additions and 70 deletions
|
@ -17,34 +17,18 @@
|
|||
package im.vector.app.ui
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.Espresso.pressBack
|
||||
import androidx.test.espresso.action.ViewActions.closeSoftKeyboard
|
||||
import androidx.test.espresso.action.ViewActions.longClick
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
|
||||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.ext.junit.rules.ActivityScenarioRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogNegativeButton
|
||||
import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogPositiveButton
|
||||
import im.vector.app.EspressoHelper
|
||||
import im.vector.app.R
|
||||
import im.vector.app.SleepViewAction
|
||||
import im.vector.app.activityIdlingResource
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.login.LoginActivity
|
||||
import im.vector.app.initialSyncIdlingResource
|
||||
import im.vector.app.ui.robot.ElementRobot
|
||||
import im.vector.app.withIdlingResource
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -61,7 +45,6 @@ class UiAllScreensSanityTest {
|
|||
@get:Rule
|
||||
val activityRule = ActivityScenarioRule(MainActivity::class.java)
|
||||
|
||||
private val uiTestBase = UiTestBase()
|
||||
private val elementRobot = ElementRobot()
|
||||
|
||||
// Last passing:
|
||||
|
@ -72,23 +55,8 @@ class UiAllScreensSanityTest {
|
|||
fun allScreensTest() {
|
||||
// Create an account
|
||||
val userId = "UiTest_" + UUID.randomUUID().toString()
|
||||
uiTestBase.createAccount(userId = userId)
|
||||
elementRobot.login(userId)
|
||||
|
||||
withIdlingResource(activityIdlingResource(HomeActivity::class.java)) {
|
||||
assertDisplayed(R.id.roomListContainer)
|
||||
closeSoftKeyboard()
|
||||
}
|
||||
|
||||
val activity = EspressoHelper.getCurrentActivity()!!
|
||||
val uiSession = (activity as HomeActivity).activeSessionHolder.getActiveSession()
|
||||
|
||||
withIdlingResource(initialSyncIdlingResource(uiSession)) {
|
||||
assertDisplayed(R.id.roomListContainer)
|
||||
}
|
||||
|
||||
assertDisplayed(R.id.bottomNavigationView)
|
||||
|
||||
// Settings
|
||||
elementRobot.settings {
|
||||
general { crawl() }
|
||||
notifications { crawl() }
|
||||
|
@ -106,9 +74,6 @@ class UiAllScreensSanityTest {
|
|||
verifyInviteFriendsButton()
|
||||
}
|
||||
|
||||
assertDisplayed(R.id.bottomNavigationView)
|
||||
sleep(1000)
|
||||
|
||||
elementRobot.newRoom {
|
||||
createNewRoom {
|
||||
crawl()
|
||||
|
@ -120,35 +85,19 @@ class UiAllScreensSanityTest {
|
|||
}
|
||||
}
|
||||
|
||||
assertDisplayed(R.id.bottomNavigationView)
|
||||
|
||||
// Long click on the room
|
||||
onView(withId(R.id.roomListView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.room_displayname_empty_room)),
|
||||
longClick()
|
||||
)
|
||||
)
|
||||
pressBack()
|
||||
|
||||
uiTestBase.signout()
|
||||
|
||||
// We have sent a message in a e2e room, accept to loose it
|
||||
clickOn(R.id.exitAnywayButton)
|
||||
// Dark pattern
|
||||
clickDialogNegativeButton()
|
||||
|
||||
// Login again on the same account
|
||||
waitUntilActivityVisible<LoginActivity> {
|
||||
assertDisplayed(R.id.loginSplashLogo)
|
||||
elementRobot.roomList {
|
||||
verifyCreatedRoom()
|
||||
}
|
||||
|
||||
uiTestBase.login(userId)
|
||||
ignoreVerification()
|
||||
|
||||
uiTestBase.signout()
|
||||
clickDialogPositiveButton()
|
||||
// Disable until the "you don't have a session for id %d" sign out bug is fixed
|
||||
// elementRobot.signout()
|
||||
//// Login again on the same account
|
||||
// elementRobot.login(userId)
|
||||
//
|
||||
// ignoreVerification()
|
||||
//
|
||||
// elementRobot.signout()
|
||||
// clickDialogPositiveButton()
|
||||
|
||||
// TODO Deactivate account instead of logout?
|
||||
}
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
package im.vector.app.ui.robot
|
||||
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import com.adevinta.android.barista.assertion.BaristaListAssertions
|
||||
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions
|
||||
import com.adevinta.android.barista.interaction.BaristaListInteractions
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||
|
||||
class CreateNewRoomRobot(
|
||||
|
@ -33,9 +34,9 @@ class CreateNewRoomRobot(
|
|||
createdRoom = true
|
||||
BaristaListAssertions.assertListItemCount(R.id.createRoomForm, 12)
|
||||
BaristaListInteractions.clickListItemChild(R.id.createRoomForm, 11, R.id.form_submit_button)
|
||||
waitUntilActivityVisible<RoomDetailActivity>()
|
||||
Thread.sleep(1000)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.roomDetailContainer)
|
||||
waitUntilActivityVisible<RoomDetailActivity> {
|
||||
waitUntilViewVisible(withId(R.id.composerEditText))
|
||||
}
|
||||
block(RoomDetailRobot())
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import im.vector.app.espresso.tools.waitUntilActivityVisible
|
|||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.createdirect.CreateDirectRoomActivity
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.login.LoginActivity
|
||||
import im.vector.app.initialSyncIdlingResource
|
||||
import im.vector.app.withIdlingResource
|
||||
|
||||
|
@ -63,7 +64,9 @@ class ElementRobot {
|
|||
fun newDirectMessage(block: NewDirectMessageRobot.() -> Unit) {
|
||||
clickOn(R.id.bottom_action_people)
|
||||
clickOn(R.id.createChatRoomButton)
|
||||
waitUntilActivityVisible<CreateDirectRoomActivity>()
|
||||
waitUntilActivityVisible<CreateDirectRoomActivity> {
|
||||
waitUntilViewVisible(withId(R.id.userListSearch))
|
||||
}
|
||||
// close keyboard
|
||||
pressBack()
|
||||
block(NewDirectMessageRobot())
|
||||
|
@ -82,4 +85,11 @@ class ElementRobot {
|
|||
block(RoomListRobot())
|
||||
waitUntilViewVisible(withId(R.id.bottomNavigationView))
|
||||
}
|
||||
|
||||
fun signout() {
|
||||
OnboardingRobot().signout()
|
||||
waitUntilActivityVisible<LoginActivity> {
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSplashLogo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.adevinta.android.barista.assertion.BaristaEnabledAssertions.assertDis
|
|||
import com.adevinta.android.barista.assertion.BaristaEnabledAssertions.assertEnabled
|
||||
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.interaction.BaristaDialogInteractions
|
||||
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
|
@ -90,5 +91,10 @@ class OnboardingRobot {
|
|||
fun signout() {
|
||||
clickOn(R.id.groupToolbarAvatarImageView)
|
||||
clickOn(R.id.homeDrawerHeaderSignoutView)
|
||||
|
||||
// We have sent a message in a e2e room, accept to loose it
|
||||
clickOn(R.id.exitAnywayButton)
|
||||
// Dark pattern
|
||||
BaristaDialogInteractions.clickDialogNegativeButton()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,9 @@ class RoomListRobot {
|
|||
|
||||
fun newRoom(block: NewRoomRobot.() -> Unit) {
|
||||
BaristaClickInteractions.clickOn(R.id.createGroupRoomButton)
|
||||
waitUntilActivityVisible<RoomDirectoryActivity>()
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.publicRoomsList)
|
||||
waitUntilActivityVisible<RoomDirectoryActivity> {
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.publicRoomsList)
|
||||
}
|
||||
block(NewRoomRobot())
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue