Skip to content

Commit

Permalink
fix(suite-native): welcome flow test ids
Browse files Browse the repository at this point in the history
  • Loading branch information
PeKne committed Jan 17, 2025
1 parent d411d2d commit e13b21f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions suite-native/atoms/src/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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({
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const AnalyticsConsentScreen = () => {
<Translation id="moduleOnboarding.analyticsConsentScreen.helpSwitchTitle" />
</Text>
<Switch
testID="@onboarding/AnalyticsConsent/consentSwitch"
isChecked={isEnabled}
onChange={enabled => {
setIsEnabled(enabled);
Expand All @@ -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" />
Expand Down
5 changes: 4 additions & 1 deletion suite-native/module-onboarding/src/screens/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit e13b21f

Please sign in to comment.