mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-23 02:02:40 +01:00
Add some support links for numberless flows.
This commit is contained in:
committed by
Cody Henthorne
parent
9df8b1845d
commit
98a4fe1069
+33
-1
@@ -7,6 +7,7 @@ package org.signal.appsettings.account
|
||||
|
||||
import android.app.Application
|
||||
import android.text.format.DateUtils
|
||||
import androidx.compose.ui.semantics.SemanticsActions
|
||||
import androidx.compose.ui.test.assertHasClickAction
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.assertIsEnabled
|
||||
@@ -15,10 +16,13 @@ import androidx.compose.ui.test.hasTestTag
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.compose.ui.test.onAllNodesWithTag
|
||||
import androidx.compose.ui.test.onChildren
|
||||
import androidx.compose.ui.test.onFirst
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performScrollToNode
|
||||
import androidx.compose.ui.test.performSemanticsAction
|
||||
import assertk.assertThat
|
||||
import assertk.assertions.contains
|
||||
import org.junit.Rule
|
||||
@@ -422,10 +426,30 @@ class AccountSettingsScreenTest {
|
||||
composeTestRule.onNodeWithTag(AccountSettingsTestTags.DIALOG_MAX_TOTP_APPS_REACHED).assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTag(Dialogs.TEST_TAG_ALERT_DIALOG_DISMISS_BUTTON).performClick()
|
||||
|
||||
assertThat(events).contains(AccountSettingsEvent.LearnMoreClicked)
|
||||
assertThat(events).contains(AccountSettingsEvent.LearnMoreClicked("https://support.signal.org/hc/articles/11228705649690"))
|
||||
assertThat(events).contains(AccountSettingsEvent.DialogDismissed)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun whenIClickTheSignalLoginLearnMore_thenIExpectLearnMoreForTheSignalLoginArticle() {
|
||||
setContent(createState(signalLogin = signalLogin()))
|
||||
|
||||
scrollTo(AccountSettingsTestTags.LINK_SIGNAL_LOGIN_LEARN_MORE)
|
||||
clickLink(AccountSettingsTestTags.LINK_SIGNAL_LOGIN_LEARN_MORE)
|
||||
|
||||
assertThat(events).contains(AccountSettingsEvent.LearnMoreClicked("https://support.signal.org/hc/articles/11197884108826"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun whenIClickTheTwoFactorLearnMore_thenIExpectLearnMoreForTheTwoFactorArticle() {
|
||||
setContent(createState(signalLogin = signalLogin()))
|
||||
|
||||
scrollTo(AccountSettingsTestTags.LINK_TWO_FACTOR_LEARN_MORE)
|
||||
clickLink(AccountSettingsTestTags.LINK_TWO_FACTOR_LEARN_MORE)
|
||||
|
||||
assertThat(events).contains(AccountSettingsEvent.LearnMoreClicked("https://support.signal.org/hc/articles/11228705649690"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun whenTheTwoFactorListHasntArrived_thenIExpectASpinnerRatherThanAnEmptyList() {
|
||||
setContent(createState(signalLogin = signalLogin(loadState = LoadState.LOADING)))
|
||||
@@ -478,6 +502,14 @@ class AccountSettingsScreenTest {
|
||||
return AccountSettingsState.SignalLogin(twoFactorMethods = twoFactorMethods, loadState = loadState, maxTotpApps = maxTotpApps)
|
||||
}
|
||||
|
||||
/** Links inside an [androidx.compose.ui.text.AnnotatedString] have no bounds to tap, so their click action is invoked directly. */
|
||||
private fun clickLink(testTag: String) {
|
||||
composeTestRule.onNodeWithTag(testTag)
|
||||
.onChildren()
|
||||
.onFirst()
|
||||
.performSemanticsAction(SemanticsActions.OnClick)
|
||||
}
|
||||
|
||||
private fun scrollTo(testTag: String) {
|
||||
composeTestRule.onNodeWithTag(AccountSettingsTestTags.SCROLLER)
|
||||
.performScrollToNode(hasTestTag(testTag))
|
||||
|
||||
Reference in New Issue
Block a user