diff --git a/app/components/badge/index.tsx b/app/components/badge/index.tsx index c9943aecde..ff309ff52a 100644 --- a/app/components/badge/index.tsx +++ b/app/components/badge/index.tsx @@ -11,6 +11,7 @@ type Props = { borderColor?: string; color?: string; style?: Animated.WithAnimatedValue>; + testID?: string; type?: 'Normal' | 'Small'; /** @@ -27,6 +28,7 @@ export default function Badge({ type = 'Normal', value, style, + testID, ...rest }: Props) { const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0)); @@ -114,6 +116,7 @@ export default function Badge({ additionalStyle, restStyle, ]} + testID={testID} {...rest} > {badge} diff --git a/app/components/server_icon/__snapshots__/server_icon.test.tsx.snap b/app/components/server_icon/__snapshots__/server_icon.test.tsx.snap index 6fd6cf2db6..95b0a60fec 100644 --- a/app/components/server_icon/__snapshots__/server_icon.test.tsx.snap +++ b/app/components/server_icon/__snapshots__/server_icon.test.tsx.snap @@ -56,6 +56,7 @@ exports[`Server Icon Server Icon Component should match snapshot with mentions 1 "opacity": 1, } } + testID="server_icon" > 1 @@ -122,6 +124,7 @@ exports[`Server Icon Server Icon Component should match snapshot with unreads 1` "opacity": 1, } } + testID="server_icon" > diff --git a/app/components/server_icon/index.tsx b/app/components/server_icon/index.tsx index 28207a175d..a730ab3414 100644 --- a/app/components/server_icon/index.tsx +++ b/app/components/server_icon/index.tsx @@ -21,6 +21,7 @@ type Props = { onPress?: () => void; size?: number; style?: StyleProp; + testID?: string; unreadStyle?: StyleProp; } @@ -46,6 +47,7 @@ export default function ServerIcon({ onPress, size = 24, style, + testID, unreadStyle, }: Props) { const theme = useTheme(); @@ -61,6 +63,7 @@ export default function ServerIcon({ disabled={onPress === undefined} onPress={onPress} type='opacity' + testID={testID} > diff --git a/app/components/server_icon/server_icon.test.tsx b/app/components/server_icon/server_icon.test.tsx index dc9c498e92..53cb5da7db 100644 --- a/app/components/server_icon/server_icon.test.tsx +++ b/app/components/server_icon/server_icon.test.tsx @@ -24,6 +24,7 @@ describe('Server Icon', () => { , ); @@ -35,6 +36,7 @@ describe('Server Icon', () => { , ); diff --git a/app/screens/bottom_sheet/button.tsx b/app/screens/bottom_sheet/button.tsx index fe7efe1eb9..d6ec0582d4 100644 --- a/app/screens/bottom_sheet/button.tsx +++ b/app/screens/bottom_sheet/button.tsx @@ -12,9 +12,10 @@ import {makeStyleSheetFromTheme} from '@utils/theme'; type Props = { onPress?: (e: GestureResponderEvent) => void; icon?: string; + testID?: string; text?: string; } -export default function BottomSheetButton({onPress, icon, text}: Props) { +export default function BottomSheetButton({onPress, icon, testID, text}: Props) { const theme = useTheme(); const styles = getStyleSheet(theme); @@ -23,6 +24,7 @@ export default function BottomSheetButton({onPress, icon, text}: Props) { onPress={onPress} type='opacity' style={styles.button} + testID={testID} > {icon && ( diff --git a/app/screens/bottom_sheet/content.tsx b/app/screens/bottom_sheet/content.tsx index 1479f3df05..684ea2f0a7 100644 --- a/app/screens/bottom_sheet/content.tsx +++ b/app/screens/bottom_sheet/content.tsx @@ -16,6 +16,7 @@ type Props = { onPress?: (e: GestureResponderEvent) => void; showButton: boolean; showTitle: boolean; + testID?: string; title?: string; } @@ -42,18 +43,27 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { }; }); -const BottomSheetContent = ({buttonText, buttonIcon, children, onPress, showButton, showTitle, title}: Props) => { +const BottomSheetContent = ({buttonText, buttonIcon, children, onPress, showButton, showTitle, testID, title}: Props) => { const dimensions = useWindowDimensions(); const theme = useTheme(); const isTablet = useIsTablet(); const styles = getStyleSheet(theme); const separatorWidth = Math.max(dimensions.width, 450); + const buttonTestId = `${testID}.${buttonText?.replace(/ /g, '_').toLocaleLowerCase()}.button`; return ( - + {showTitle && - {title} + + {title} + } <> @@ -65,6 +75,7 @@ const BottomSheetContent = ({buttonText, buttonIcon, children, onPress, showButt