diff options
Diffstat (limited to 'src/view/com')
-rw-r--r-- | src/view/com/modals/ProfilePreview.tsx | 2 | ||||
-rw-r--r-- | src/view/com/pager/FeedsTabBarMobile.tsx | 1 | ||||
-rw-r--r-- | src/view/com/posts/FeedItem.tsx | 1 | ||||
-rw-r--r-- | src/view/com/profile/ProfileHeader.tsx | 1 | ||||
-rw-r--r-- | src/view/com/search/HeaderWithInput.tsx | 1 | ||||
-rw-r--r-- | src/view/com/testing/TestCtrls.e2e.tsx | 76 | ||||
-rw-r--r-- | src/view/com/testing/TestCtrls.tsx | 3 | ||||
-rw-r--r-- | src/view/com/util/forms/ToggleButton.tsx | 4 |
8 files changed, 87 insertions, 2 deletions
diff --git a/src/view/com/modals/ProfilePreview.tsx b/src/view/com/modals/ProfilePreview.tsx index e0b3ec072..225a3972b 100644 --- a/src/view/com/modals/ProfilePreview.tsx +++ b/src/view/com/modals/ProfilePreview.tsx @@ -35,7 +35,7 @@ export const Component = observer(function ProfilePreviewImpl({ }, [model, screen]) return ( - <View style={[pal.view, s.flex1]}> + <View testID="profilePreview" style={[pal.view, s.flex1]}> <View style={[ styles.headerWrapper, diff --git a/src/view/com/pager/FeedsTabBarMobile.tsx b/src/view/com/pager/FeedsTabBarMobile.tsx index 30a712541..e39e2dd68 100644 --- a/src/view/com/pager/FeedsTabBarMobile.tsx +++ b/src/view/com/pager/FeedsTabBarMobile.tsx @@ -67,6 +67,7 @@ export const FeedsTabBar = observer(function FeedsTabBarImpl( </Text> <View style={[pal.view]}> <Link + testID="viewHeaderHomeFeedPrefsBtn" href="/settings/home-feed" hitSlop={HITSLOP_10} accessibilityRole="button" diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 59ab28d72..23d8546bc 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -299,6 +299,7 @@ export const FeedItem = observer(function FeedItemImpl({ {item.richText?.text ? ( <View style={styles.postTextContainer}> <RichText + testID="postText" type="post-text" richText={item.richText} lineHeight={1.3} diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index 7f3e52d96..82b992551 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -556,6 +556,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({ {!isDesktop && !hideBackButton && ( <TouchableWithoutFeedback + testID="profileHeaderBackBtn" onPress={onPressBack} hitSlop={BACK_HITSLOP} accessibilityRole="button" diff --git a/src/view/com/search/HeaderWithInput.tsx b/src/view/com/search/HeaderWithInput.tsx index 7a8676602..f04175afd 100644 --- a/src/view/com/search/HeaderWithInput.tsx +++ b/src/view/com/search/HeaderWithInput.tsx @@ -102,6 +102,7 @@ export function HeaderWithInput({ /> {query ? ( <TouchableOpacity + testID="searchTextInputClearBtn" onPress={onPressClearQuery} accessibilityRole="button" accessibilityLabel="Clear search query" diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx new file mode 100644 index 000000000..019c7a508 --- /dev/null +++ b/src/view/com/testing/TestCtrls.e2e.tsx @@ -0,0 +1,76 @@ +import React from 'react' +import {Pressable, View} from 'react-native' +import {useStores} from 'state/index' +import {navigate} from '../../../Navigation' + +/** + * This utility component is only included in the test simulator + * build. It gives some quick triggers which help improve the pace + * of the tests dramatically. + */ + +const BTN = {height: 1, width: 1, backgroundColor: 'red'} + +export function TestCtrls() { + const store = useStores() + const onPressSignInAlice = async () => { + await store.session.login({ + service: 'http://localhost:3000', + identifier: 'alice.test', + password: 'hunter2', + }) + } + const onPressSignInBob = async () => { + await store.session.login({ + service: 'http://localhost:3000', + identifier: 'bob.test', + password: 'hunter2', + }) + } + return ( + <View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}> + <Pressable + testID="e2eSignInAlice" + onPress={onPressSignInAlice} + accessibilityRole="button" + style={BTN} + /> + <Pressable + testID="e2eSignInBob" + onPress={onPressSignInBob} + accessibilityRole="button" + style={BTN} + /> + <Pressable + testID="e2eGotoHome" + onPress={() => navigate('Home')} + accessibilityRole="button" + style={BTN} + /> + <Pressable + testID="e2eGotoSettings" + onPress={() => navigate('Settings')} + accessibilityRole="button" + style={BTN} + /> + <Pressable + testID="e2eGotoModeration" + onPress={() => navigate('Moderation')} + accessibilityRole="button" + style={BTN} + /> + <Pressable + testID="e2eToggleMergefeed" + onPress={() => store.preferences.toggleHomeFeedMergeFeedEnabled()} + accessibilityRole="button" + style={BTN} + /> + <Pressable + testID="e2eRefreshHome" + onPress={() => store.me.mainFeed.refresh()} + accessibilityRole="button" + style={BTN} + /> + </View> + ) +} diff --git a/src/view/com/testing/TestCtrls.tsx b/src/view/com/testing/TestCtrls.tsx new file mode 100644 index 000000000..36fc48327 --- /dev/null +++ b/src/view/com/testing/TestCtrls.tsx @@ -0,0 +1,3 @@ +export function TestCtrls() { + return null +} diff --git a/src/view/com/util/forms/ToggleButton.tsx b/src/view/com/util/forms/ToggleButton.tsx index 46ceb8c81..c98e846cd 100644 --- a/src/view/com/util/forms/ToggleButton.tsx +++ b/src/view/com/util/forms/ToggleButton.tsx @@ -8,6 +8,7 @@ import {colors} from 'lib/styles' import {TypographyVariant} from 'lib/ThemeContext' export function ToggleButton({ + testID, type = 'default-light', label, isSelected, @@ -15,6 +16,7 @@ export function ToggleButton({ labelType, onPress, }: { + testID?: string type?: ButtonType label: string isSelected: boolean @@ -134,7 +136,7 @@ export function ToggleButton({ }, }) return ( - <Button type={type} onPress={onPress} style={style}> + <Button testID={testID} type={type} onPress={onPress} style={style}> <View style={styles.outer}> <View style={[circleStyle, styles.circle]}> <View |