From 478d358e6dca60384da2b0d6445197ada3a77efb Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Fri, 8 Apr 2022 13:51:27 -0300 Subject: [PATCH 1/2] Update ios.info.js --- appium/config/ios.info.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appium/config/ios.info.js b/appium/config/ios.info.js index 00069fd6f..684de83b0 100644 --- a/appium/config/ios.info.js +++ b/appium/config/ios.info.js @@ -1,5 +1,5 @@ module.exports = { - deviceName: 'iPhone 11 Pro', - platformVersion: '14.5', + deviceName: 'iPhone 11 Pro', // pass the udid or device name + platformVersion: '14.5', // pass the platform version app: 'chat.rocket.reactnative' }; From 6d1829bbdd7d2949880d90b39952dba2207a8836 Mon Sep 17 00:00:00 2001 From: GleidsonDaniel Date: Fri, 8 Apr 2022 15:02:44 -0300 Subject: [PATCH 2/2] add testProps --- app/containers/ActionSheet/ActionSheet.tsx | 5 +++-- app/containers/ActionSheet/Handle.tsx | 3 ++- app/containers/ActionSheet/Item.tsx | 3 ++- app/containers/Avatar/Avatar.tsx | 3 ++- app/containers/Button/index.tsx | 22 +++++++++++++++---- app/containers/DirectoryItem/index.tsx | 3 ++- app/containers/EmojiPicker/EmojiCategory.tsx | 3 ++- app/containers/EmojiPicker/TabBar.tsx | 3 ++- app/containers/FormContainer.tsx | 3 ++- app/containers/HeaderButton/Common.tsx | 17 +++++++------- .../HeaderButton/HeaderButtonItem.tsx | 3 ++- app/containers/List/ListContainer.tsx | 4 +++- app/containers/List/ListIcon.tsx | 3 ++- app/containers/List/ListItem.tsx | 5 ++++- app/containers/Loading.tsx | 3 ++- app/containers/MessageActions/Header.tsx | 5 +++-- .../MessageBox/CommandsPreview/Item.tsx | 3 ++- .../MessageBox/CommandsPreview/index.tsx | 3 ++- app/containers/MessageBox/EmojiKeyboard.tsx | 3 ++- .../MessageBox/Mentions/MentionItem.tsx | 3 ++- app/containers/MessageBox/Mentions/index.tsx | 3 ++- app/containers/MessageBox/RecordAudio.tsx | 4 ++-- .../MessageBox/buttons/BaseButton.tsx | 6 ++--- app/containers/MessageBox/index.tsx | 5 +++-- app/containers/SearchHeader.tsx | 3 ++- app/containers/TextInput.tsx | 7 +++--- app/containers/markdown/Preview.tsx | 3 ++- app/containers/message/Broadcast.tsx | 3 ++- .../Components/CollapsibleQuote/index.tsx | 7 ++++-- app/containers/message/Reactions.tsx | 5 +++-- app/containers/message/RepliedThread.tsx | 3 ++- app/containers/message/Thread.tsx | 5 ++++- app/lib/methods/testProps.ts | 4 ++++ app/lib/methods/withTest.ts | 4 ---- app/presentation/TextInput.tsx | 2 ++ app/views/NewServerView/ServerInput/index.tsx | 4 ++-- appium/config/wdio.conf.js | 2 +- 37 files changed, 111 insertions(+), 59 deletions(-) create mode 100644 app/lib/methods/testProps.ts delete mode 100644 app/lib/methods/withTest.ts diff --git a/app/containers/ActionSheet/ActionSheet.tsx b/app/containers/ActionSheet/ActionSheet.tsx index 673e515a1..97d233940 100644 --- a/app/containers/ActionSheet/ActionSheet.tsx +++ b/app/containers/ActionSheet/ActionSheet.tsx @@ -18,6 +18,7 @@ import { Handle } from './Handle'; import { IActionSheetItem, Item } from './Item'; import { TActionSheetOptions, TActionSheetOptionsItem } from './Provider'; import styles, { ITEM_HEIGHT } from './styles'; +import { testProps } from '../../lib/methods/testProps'; const getItemLayout = (data: TActionSheetOptionsItem[] | null | undefined, index: number) => ({ length: ITEM_HEIGHT, @@ -152,7 +153,7 @@ const ActionSheet = React.memo( <> - testID='action-sheet' + {...testProps('action-sheet')} ref={bottomSheetRef} componentType='FlatList' snapPoints={snaps} diff --git a/app/containers/ActionSheet/Handle.tsx b/app/containers/ActionSheet/Handle.tsx index 650d44ef5..4c308bf1c 100644 --- a/app/containers/ActionSheet/Handle.tsx +++ b/app/containers/ActionSheet/Handle.tsx @@ -4,11 +4,12 @@ import { View } from 'react-native'; import styles from './styles'; import { themes } from '../../lib/constants'; import { useTheme } from '../../theme'; +import { testProps } from '../../lib/methods/testProps'; export const Handle = React.memo(() => { const { theme } = useTheme(); return ( - + ); diff --git a/app/containers/ActionSheet/Item.tsx b/app/containers/ActionSheet/Item.tsx index 1a1627006..8f6c8a4a9 100644 --- a/app/containers/ActionSheet/Item.tsx +++ b/app/containers/ActionSheet/Item.tsx @@ -3,6 +3,7 @@ import { Text, View } from 'react-native'; import { themes } from '../../lib/constants'; import { CustomIcon } from '../../lib/Icons'; +import { testProps } from '../../lib/methods/testProps'; import { useTheme } from '../../theme'; import { Button } from './Button'; import styles from './styles'; @@ -31,7 +32,7 @@ export const Item = React.memo(({ item, hide }: IActionSheetItem) => { onPress={onPress} style={[styles.item, { backgroundColor: themes[theme].focusedBackground }]} theme={theme} - testID={item.testID}> + {...testProps(item.testID || '')}> + {image} {children} diff --git a/app/containers/Button/index.tsx b/app/containers/Button/index.tsx index dd29a0da6..bb09dbde3 100644 --- a/app/containers/Button/index.tsx +++ b/app/containers/Button/index.tsx @@ -3,6 +3,7 @@ import { ButtonProps, StyleSheet, Text } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import { themes } from '../../lib/constants'; +import { testProps } from '../../lib/methods/testProps'; import sharedStyles from '../../views/Styles'; import ActivityIndicator from '../ActivityIndicator'; @@ -49,8 +50,21 @@ export default class Button extends React.PureComponent, a }; render() { - const { title, type, onPress, disabled, backgroundColor, color, loading, style, theme, fontSize, styleText, ...otherProps } = - this.props; + const { + title, + type, + onPress, + disabled, + backgroundColor, + color, + loading, + style, + theme, + fontSize, + styleText, + testID, + ...otherProps + } = this.props; const isPrimary = type === 'primary'; let textColor = isPrimary ? themes[theme!].buttonText : themes[theme!].bodyText; @@ -70,8 +84,8 @@ export default class Button extends React.PureComponent, a disabled && styles.disabled, style ]} - accessibilityLabel={title} - {...otherProps}> + {...otherProps} + {...testProps((testID || title) as string)}> {loading ? ( ) : ( diff --git a/app/containers/DirectoryItem/index.tsx b/app/containers/DirectoryItem/index.tsx index 14d4c361d..1fd160f50 100644 --- a/app/containers/DirectoryItem/index.tsx +++ b/app/containers/DirectoryItem/index.tsx @@ -7,6 +7,7 @@ import RoomTypeIcon from '../RoomTypeIcon'; import styles, { ROW_HEIGHT } from './styles'; import { themes } from '../../lib/constants'; import { useTheme } from '../../theme'; +import { testProps } from '../../lib/methods/testProps'; export { ROW_HEIGHT }; @@ -49,7 +50,7 @@ const DirectoryItem = ({ }: IDirectoryItem): React.ReactElement => { const { theme } = useTheme(); return ( - + diff --git a/app/containers/EmojiPicker/EmojiCategory.tsx b/app/containers/EmojiPicker/EmojiCategory.tsx index 391c9fc70..ca90a36da 100644 --- a/app/containers/EmojiPicker/EmojiCategory.tsx +++ b/app/containers/EmojiPicker/EmojiCategory.tsx @@ -6,6 +6,7 @@ import styles from './styles'; import CustomEmoji from './CustomEmoji'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import { IEmoji, IEmojiCategory } from '../../definitions/IEmoji'; +import { testProps } from '../../lib/methods/testProps'; const EMOJI_SIZE = 50; @@ -34,7 +35,7 @@ class EmojiCategory extends React.Component> { activeOpacity={0.7} key={emoji && emoji.isCustom ? emoji.content : emoji} onPress={() => onEmojiSelected!(emoji)} - testID={`reaction-picker-${emoji && emoji.isCustom ? emoji.content : emoji}`}> + {...testProps(`reaction-picker-${emoji && emoji.isCustom ? emoji.content : emoji}`)}> {renderEmoji(emoji, EMOJI_SIZE, baseUrl!)} ); diff --git a/app/containers/EmojiPicker/TabBar.tsx b/app/containers/EmojiPicker/TabBar.tsx index 240c56ecd..43dbecf5d 100644 --- a/app/containers/EmojiPicker/TabBar.tsx +++ b/app/containers/EmojiPicker/TabBar.tsx @@ -3,6 +3,7 @@ import { Text, TouchableOpacity, View } from 'react-native'; import styles from './styles'; import { themes } from '../../lib/constants'; +import { testProps } from '../../lib/methods/testProps'; interface ITabBarProps { goToPage: Function; @@ -35,7 +36,7 @@ export default class TabBar extends React.Component> { key={tab} onPress={() => goToPage!(i)} style={styles.tab} - testID={`reaction-picker-${tab}`}> + {...testProps(`reaction-picker-${tab}`)}> {tab} {activeTab === i ? ( diff --git a/app/containers/FormContainer.tsx b/app/containers/FormContainer.tsx index 3cdf0de7f..ab494e8a2 100644 --- a/app/containers/FormContainer.tsx +++ b/app/containers/FormContainer.tsx @@ -10,6 +10,7 @@ import StatusBar from './StatusBar'; import AppVersion from './AppVersion'; import { isTablet } from '../utils/deviceInfo'; import SafeAreaView from './SafeAreaView'; +import { testProps } from '../lib/methods/testProps'; interface IFormContainer extends ScrollViewProps { testID: string; @@ -40,7 +41,7 @@ const FormContainer = ({ children, testID, ...props }: IFormContainer) => { contentContainerStyle={[sharedStyles.containerScrollView, styles.scrollView]} {...scrollPersistTaps} {...props}> - + {children} diff --git a/app/containers/HeaderButton/Common.tsx b/app/containers/HeaderButton/Common.tsx index 50206f836..e54b5c291 100644 --- a/app/containers/HeaderButton/Common.tsx +++ b/app/containers/HeaderButton/Common.tsx @@ -4,6 +4,7 @@ import { isIOS } from '../../utils/deviceInfo'; import I18n from '../../i18n'; import Container from './HeaderButtonContainer'; import Item from './HeaderButtonItem'; +import { testProps } from '../../lib/methods/testProps'; interface IHeaderButtonCommon { navigation?: any; // TODO: Evaluate proper type @@ -15,7 +16,7 @@ interface IHeaderButtonCommon { export const Drawer = React.memo( ({ navigation, testID, onPress = () => navigation?.toggleDrawer(), ...props }: IHeaderButtonCommon) => ( - + ) ); @@ -23,7 +24,7 @@ export const Drawer = React.memo( export const CloseModal = React.memo( ({ navigation, testID, onPress = () => navigation?.pop(), ...props }: IHeaderButtonCommon) => ( - + ) ); @@ -31,9 +32,9 @@ export const CloseModal = React.memo( export const CancelModal = React.memo(({ onPress, testID }: Partial) => ( {isIOS ? ( - + ) : ( - + )} )); @@ -41,24 +42,24 @@ export const CancelModal = React.memo(({ onPress, testID }: Partial) => ( - + )); export const Download = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => ( - + )); export const Preferences = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => ( - + )); export const Legal = React.memo( ({ navigation, testID, onPress = () => navigation?.navigate('LegalView') }: IHeaderButtonCommon) => ( - + ) ); diff --git a/app/containers/HeaderButton/HeaderButtonItem.tsx b/app/containers/HeaderButton/HeaderButtonItem.tsx index 20ea46082..8c1d68e91 100644 --- a/app/containers/HeaderButton/HeaderButtonItem.tsx +++ b/app/containers/HeaderButton/HeaderButtonItem.tsx @@ -6,6 +6,7 @@ import { CustomIcon } from '../../lib/Icons'; import { useTheme } from '../../theme'; import { themes } from '../../lib/constants'; import sharedStyles from '../../views/Styles'; +import { testProps } from '../../lib/methods/testProps'; interface IHeaderButtonItem { title?: string; @@ -42,7 +43,7 @@ const styles = StyleSheet.create({ const Item = ({ title, iconName, onPress, testID, badge }: IHeaderButtonItem): React.ReactElement => { const { theme } = useTheme(); return ( - + <> {iconName ? ( diff --git a/app/containers/List/ListContainer.tsx b/app/containers/List/ListContainer.tsx index 349c71bee..8228aab23 100644 --- a/app/containers/List/ListContainer.tsx +++ b/app/containers/List/ListContainer.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { ScrollView, StyleSheet } from 'react-native'; +import { testProps } from '../../lib/methods/testProps'; import { withTheme } from '../../theme'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; @@ -19,7 +20,8 @@ const ListContainer = React.memo(({ children, ...props }: IListContainer) => ( contentContainerStyle={styles.container} scrollIndicatorInsets={{ right: 1 }} // https://github.com/facebook/react-native/issues/26610#issuecomment-539843444 {...scrollPersistTaps} - {...props}> + {...props} + {...testProps(props.testID || '')}> {children} )); diff --git a/app/containers/List/ListIcon.tsx b/app/containers/List/ListIcon.tsx index 79e24ea66..5c2dfbda8 100644 --- a/app/containers/List/ListIcon.tsx +++ b/app/containers/List/ListIcon.tsx @@ -3,6 +3,7 @@ import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; import { themes } from '../../lib/constants'; import { CustomIcon } from '../../lib/Icons'; +import { testProps } from '../../lib/methods/testProps'; import { useTheme } from '../../theme'; import { ICON_SIZE } from './constants'; @@ -25,7 +26,7 @@ const ListIcon = React.memo(({ name, color, style, testID }: IListIcon) => { return ( - + ); }); diff --git a/app/containers/List/ListItem.tsx b/app/containers/List/ListItem.tsx index 0fef43c2a..8d8955415 100644 --- a/app/containers/List/ListItem.tsx +++ b/app/containers/List/ListItem.tsx @@ -10,6 +10,7 @@ import { Icon } from '.'; import { BASE_HEIGHT, ICON_SIZE, PADDING_HORIZONTAL } from './constants'; import { useDimensions } from '../../dimensions'; import { CustomIcon } from '../../lib/Icons'; +import { testProps } from '../../lib/methods/testProps'; const styles = StyleSheet.create({ container: { @@ -86,7 +87,9 @@ const Content = React.memo( const { fontScale } = useDimensions(); return ( - + {left ? {left()} : null} diff --git a/app/containers/Loading.tsx b/app/containers/Loading.tsx index 93ad43be2..aa0094900 100644 --- a/app/containers/Loading.tsx +++ b/app/containers/Loading.tsx @@ -3,6 +3,7 @@ import { Animated, Modal, StyleSheet, View } from 'react-native'; import { withTheme } from '../theme'; import { themes } from '../lib/constants'; +import { testProps } from '../lib/methods/testProps'; const styles = StyleSheet.create({ container: { @@ -108,7 +109,7 @@ class Loading extends React.PureComponent { return ( {}}> - + { const emoji = (emojiModel.id ? emojiModel.content : item) as string; return (