using static imports for the espresso helpers and reusing existing wait for view

This commit is contained in:
Adam Brown 2021-11-05 14:56:18 +00:00
parent 7b6773f90e
commit 803929ea45
5 changed files with 49 additions and 48 deletions

View File

@ -16,7 +16,7 @@
package im.vector.app.ui.robot.settings
import androidx.test.espresso.Espresso
import androidx.test.espresso.Espresso.pressBack
import im.vector.app.R
import im.vector.app.espresso.tools.clickOnPreference
@ -24,10 +24,10 @@ class SettingsAdvancedRobot {
fun crawl() {
clickOnPreference(R.string.settings_notifications_targets)
Espresso.pressBack()
pressBack()
clickOnPreference(R.string.settings_push_rules)
Espresso.pressBack()
pressBack()
/* TODO P2 test developer screens
// Enable developer mode

View File

@ -16,35 +16,36 @@
package im.vector.app.ui.robot.settings
import androidx.test.espresso.Espresso
import com.adevinta.android.barista.interaction.BaristaClickInteractions
import com.adevinta.android.barista.interaction.BaristaDialogInteractions
import androidx.test.espresso.Espresso.pressBack
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.R
import im.vector.app.espresso.tools.clickOnPreference
class SettingsGeneralRobot {
fun crawl() {
BaristaClickInteractions.clickOn(R.string.settings_profile_picture)
BaristaDialogInteractions.clickDialogPositiveButton()
BaristaClickInteractions.clickOn(R.string.settings_display_name)
BaristaDialogInteractions.clickDialogNegativeButton()
BaristaClickInteractions.clickOn(R.string.settings_password)
BaristaDialogInteractions.clickDialogNegativeButton()
BaristaClickInteractions.clickOn(R.string.settings_emails_and_phone_numbers_title)
Espresso.pressBack()
BaristaClickInteractions.clickOn(R.string.settings_discovery_manage)
BaristaClickInteractions.clickOn(R.string.add_identity_server)
Espresso.pressBack()
Espresso.pressBack()
clickOn(R.string.settings_profile_picture)
clickDialogPositiveButton()
clickOn(R.string.settings_display_name)
clickDialogNegativeButton()
clickOn(R.string.settings_password)
clickDialogNegativeButton()
clickOn(R.string.settings_emails_and_phone_numbers_title)
pressBack()
clickOn(R.string.settings_discovery_manage)
clickOn(R.string.add_identity_server)
pressBack()
pressBack()
// Homeserver
clickOnPreference(R.string.settings_home_server)
Espresso.pressBack()
pressBack()
// Identity server
clickOnPreference(R.string.settings_identity_server)
Espresso.pressBack()
pressBack()
// Deactivate account
clickOnPreference(R.string.settings_deactivate_my_account)
Espresso.pressBack()
pressBack()
}
}

View File

@ -16,8 +16,8 @@
package im.vector.app.ui.robot.settings
import com.adevinta.android.barista.interaction.BaristaClickInteractions
import com.adevinta.android.barista.interaction.BaristaDialogInteractions
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogPositiveButton
import im.vector.app.R
class SettingsHelpRobot {
@ -34,7 +34,7 @@ class SettingsHelpRobot {
clickOn(R.string.settings_privacy_policy)
pressBack()
*/
BaristaClickInteractions.clickOn(R.string.settings_third_party_notices)
BaristaDialogInteractions.clickDialogPositiveButton()
clickOn(R.string.settings_third_party_notices)
clickDialogPositiveButton()
}
}

View File

@ -16,8 +16,8 @@
package im.vector.app.ui.robot.settings
import androidx.test.espresso.Espresso
import com.adevinta.android.barista.interaction.BaristaClickInteractions
import androidx.test.espresso.Espresso.pressBack
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.espresso.tools.clickOnPreference
@ -26,16 +26,16 @@ class SettingsNotificationsRobot {
fun crawl() {
if (BuildConfig.USE_NOTIFICATION_SETTINGS_V2) {
BaristaClickInteractions.clickOn(R.string.settings_notification_default)
Espresso.pressBack()
BaristaClickInteractions.clickOn(R.string.settings_notification_mentions_and_keywords)
clickOn(R.string.settings_notification_default)
pressBack()
clickOn(R.string.settings_notification_mentions_and_keywords)
// TODO Test adding a keyword?
Espresso.pressBack()
BaristaClickInteractions.clickOn(R.string.settings_notification_other)
Espresso.pressBack()
pressBack()
clickOn(R.string.settings_notification_other)
pressBack()
} else {
BaristaClickInteractions.clickOn(R.string.settings_notification_advanced)
Espresso.pressBack()
clickOn(R.string.settings_notification_advanced)
pressBack()
}
/*
clickOn(R.string.settings_noisy_notifications_preferences)
@ -47,6 +47,6 @@ class SettingsNotificationsRobot {
pressBack()
*/
clickOnPreference(R.string.settings_notification_troubleshoot)
Espresso.pressBack()
pressBack()
}
}

View File

@ -16,23 +16,23 @@
package im.vector.app.ui.robot.settings
import androidx.test.espresso.Espresso
import androidx.test.espresso.matcher.ViewMatchers
import com.adevinta.android.barista.interaction.BaristaClickInteractions
import com.adevinta.android.barista.interaction.BaristaDialogInteractions
import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.matcher.ViewMatchers.withText
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogNegativeButton
import im.vector.app.R
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.waitForView
class SettingsPreferencesRobot {
fun crawl() {
BaristaClickInteractions.clickOn(R.string.settings_interface_language)
Espresso.onView(ViewMatchers.isRoot())
.perform(waitForView(ViewMatchers.withText("Dansk (Danmark)")))
Espresso.pressBack()
BaristaClickInteractions.clickOn(R.string.settings_theme)
BaristaDialogInteractions.clickDialogNegativeButton()
BaristaClickInteractions.clickOn(R.string.font_size)
BaristaDialogInteractions.clickDialogNegativeButton()
clickOn(R.string.settings_interface_language)
waitUntilViewVisible(withText("Dansk (Danmark)"))
pressBack()
clickOn(R.string.settings_theme)
clickDialogNegativeButton()
clickOn(R.string.font_size)
clickDialogNegativeButton()
}
}