Bug 1812461 - Add compose test tags & ignore failing tests

Added needed test tags to compose elements. Ignored
`ContextualHintsTest` which seem to fail due to not finding
the compose elements.
fenix/119.0
DreVla 1 year ago committed by mergify[bot]
parent 611df98d22
commit b7db4a7875

@ -9,8 +9,12 @@ import android.view.View
import androidx.annotation.VisibleForTesting
import androidx.compose.foundation.clickable
import androidx.compose.material.Text
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat.getColor
@ -211,6 +215,7 @@ class BrowserToolbarCFRPresenter(
}
}
@OptIn(ExperimentalComposeUiApi::class)
@VisibleForTesting
internal fun showTcpCfr() {
CFRPopup(
@ -246,6 +251,11 @@ class BrowserToolbarCFRPresenter(
text = context.getString(R.string.tcp_cfr_message),
color = FirefoxTheme.colors.textOnColorPrimary,
style = FirefoxTheme.typography.body2,
modifier = Modifier
.semantics {
testTagsAsResourceId = true
testTag = "tcp_cfr.message"
},
)
}
},
@ -254,16 +264,21 @@ class BrowserToolbarCFRPresenter(
Text(
text = context.getString(R.string.tcp_cfr_learn_more),
color = FirefoxTheme.colors.textOnColorPrimary,
modifier = Modifier.clickable {
context.components.useCases.tabsUseCases.selectOrAddTab.invoke(
SupportUtils.getSumoURLForTopic(
context,
TOTAL_COOKIE_PROTECTION,
),
)
TrackingProtection.tcpSumoLinkClicked.record(NoExtras())
popup?.dismiss()
},
modifier = Modifier
.semantics {
testTagsAsResourceId = true
testTag = "tcp_cfr.action"
}
.clickable {
context.components.useCases.tabsUseCases.selectOrAddTab.invoke(
SupportUtils.getSumoURLForTopic(
context,
TOTAL_COOKIE_PROTECTION,
),
)
TrackingProtection.tcpSumoLinkClicked.record(NoExtras())
popup?.dismiss()
},
style = FirefoxTheme.typography.body2.copy(
textDecoration = TextDecoration.Underline,
),

@ -871,6 +871,11 @@ class HomeFragment : Fragment() {
text = context.getString(R.string.private_mode_cfr_message_2),
color = FirefoxTheme.colors.textOnColorPrimary,
style = FirefoxTheme.typography.headline7,
modifier = Modifier
.semantics {
testTagsAsResourceId = true
testTag = "private.message"
},
)
}
},

@ -7,6 +7,11 @@ package org.mozilla.fenix.onboarding
import android.content.Context
import android.view.View
import androidx.compose.material.Text
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat.getColor
import androidx.recyclerview.widget.RecyclerView
@ -55,6 +60,7 @@ class HomeCFRPresenter(
}
}
@OptIn(ExperimentalComposeUiApi::class)
private fun showSyncedTabCFR(view: View) {
CFRPopup(
anchor = view,
@ -84,6 +90,11 @@ class HomeCFRPresenter(
text = context.getString(R.string.sync_cfr_message),
color = FirefoxTheme.colors.textOnColorPrimary,
style = FirefoxTheme.typography.body2,
modifier = Modifier
.semantics {
testTagsAsResourceId = true
testTag = "sync_cfr.message"
},
)
}
},
@ -92,6 +103,7 @@ class HomeCFRPresenter(
Onboarding.synCfrShown.record(NoExtras())
}
@OptIn(ExperimentalComposeUiApi::class)
@Suppress("MagicNumber")
private fun showJumpBackInCFR(view: View) {
CFRPopup(
@ -122,6 +134,11 @@ class HomeCFRPresenter(
text = context.getString(R.string.onboarding_home_screen_jump_back_contextual_hint_2),
color = FirefoxTheme.colors.textOnColorPrimary,
style = FirefoxTheme.typography.body2,
modifier = Modifier
.semantics {
testTagsAsResourceId = true
testTag = "jump_back_cfr.message"
},
)
}
},

Loading…
Cancel
Save