fix(suite-native): welcome flow test ids

This commit is contained in:
Petr Knetl
2025-01-17 08:31:31 +01:00
committed by Petr Knetl
parent d411d2d44a
commit e13b21f577
3 changed files with 10 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ type SwitchProps = {
isChecked: boolean;
onChange: (value: boolean) => void;
isDisabled?: boolean; // Functionality of disabled works but styles are not implemented yet (waiting for design)
testID?: string;
};
const SWITCH_CONTAINER_BORDER_WIDTH = 1;
@@ -89,7 +90,7 @@ const useAnimationStyles = ({ isChecked }: Pick<SwitchProps, 'isChecked'>) => {
};
};
export const Switch = ({ isChecked, onChange, isDisabled = false }: SwitchProps) => {
export const Switch = ({ isChecked, onChange, isDisabled = false, testID }: SwitchProps) => {
const { applyStyle } = useNativeStyles();
const { animatedSwitchCircleStyle, animatedSwitchContainerStyle } = useAnimationStyles({
@@ -102,7 +103,7 @@ export const Switch = ({ isChecked, onChange, isDisabled = false }: SwitchProps)
};
return (
<Pressable onPress={handlePress} accessibilityRole="switch">
<Pressable onPress={handlePress} accessibilityRole="switch" testID={testID}>
<Animated.View
style={[
animatedSwitchContainerStyle,

View File

@@ -98,6 +98,7 @@ export const AnalyticsConsentScreen = () => {
<Translation id="moduleOnboarding.analyticsConsentScreen.helpSwitchTitle" />
</Text>
<Switch
testID="@onboarding/AnalyticsConsent/consentSwitch"
isChecked={isEnabled}
onChange={enabled => {
setIsEnabled(enabled);
@@ -110,14 +111,14 @@ export const AnalyticsConsentScreen = () => {
</VStack>
<VStack spacing="sp12">
<Button
testID="@onboarding/UserDataConsent/allow"
testID="@onboarding/AnalyticsConsent/nextBtn"
onPress={isEnabled ? handleAnalyticsConsent : handleRedirect}
>
<Translation id="generic.buttons.confirm" />
</Button>
<Button
colorScheme="tertiaryElevation0"
testID="@onboarding/UserDataConsent/allow"
testID="@onboarding/AnalyticsConsent/learMoreBtn"
onPress={handleClickOnLearMoreLink}
>
<Translation id="moduleOnboarding.analyticsConsentScreen.learnMoreButton" />

View File

@@ -77,7 +77,10 @@ export const WelcomeScreen = ({
</Box>
</VStack>
<Box style={applyStyle(buttonWrapperStyle)}>
<Button onPress={navigateToAnalyticsConsent}>
<Button
onPress={navigateToAnalyticsConsent}
testID="@onboarding/Welcome/nextBtn"
>
<Translation id="moduleOnboarding.welcomeScreen.button" />
</Button>
</Box>