From 558d83719c497eb42c27068a867bca2bad1e24fa Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Fri, 20 May 2022 15:51:15 -0700 Subject: [PATCH] Detox/E2E: Global threads e2e tests in Gekidou (#6300) * Detox/E2E: Global threads e2e tests in Gekidou * Revert update deps --- .../copy_permalink_option.tsx | 2 +- .../follow_thread_option.tsx | 4 +- .../common_post_options/reply_option.tsx | 2 +- .../common_post_options/save_option.tsx | 2 +- .../post_list/post/footer/footer.tsx | 9 +- .../post_list/post/header/reply/index.tsx | 2 +- app/components/post_list/post/post.tsx | 7 +- app/components/post_list/post/unread_dot.tsx | 8 +- .../thread_overview.test.tsx.snap | 10 +- .../thread_overview/thread_overview.tsx | 8 +- .../threads_list/empty_state.tsx | 5 +- .../threads_list/header/index.tsx | 2 +- .../threads_list/thread/thread.tsx | 13 +- app/screens/permalink/permalink.tsx | 6 +- .../post_options/options/copy_text_option.tsx | 2 +- .../options/delete_post_option.tsx | 2 +- .../post_options/options/edit_option.tsx | 2 +- .../mark_unread_option/mark_unread_option.tsx | 2 +- .../options/pin_channel_option.tsx | 2 +- .../thread_follow_button.tsx | 7 +- .../options/mark_as_unread_option.tsx | 3 +- .../options/open_in_channel_option.tsx | 2 +- app/screens/thread_options/thread_options.tsx | 1 + detox/e2e/support/ui/component/alert.ts | 2 + detox/e2e/support/ui/component/post.ts | 21 +- detox/e2e/support/ui/component/post_list.ts | 38 ++++ detox/e2e/support/ui/screen/global_threads.ts | 63 +++++- detox/e2e/support/ui/screen/index.ts | 4 + detox/e2e/support/ui/screen/permalink.ts | 54 +++++ detox/e2e/support/ui/screen/post_options.ts | 36 +-- detox/e2e/support/ui/screen/thread.ts | 28 +++ detox/e2e/support/ui/screen/thread_options.ts | 47 ++++ detox/e2e/test/smoke_test/threads.e2e.ts | 161 +++++++++++++ .../threads/follow_and_unfollow_thread.e2e.ts | 201 +++++++++++++++++ detox/e2e/test/threads/global_threads.e2e.ts | 211 ++++++++++++++++++ .../mark_thread_as_read_and_unread.e2e.ts | 183 +++++++++++++++ .../threads/open_thread_in_channel.e2e.ts | 137 ++++++++++++ detox/e2e/test/threads/reply_to_thread.e2e.ts | 134 +++++++++++ .../threads/save_and_unsave_thread.e2e.ts | 136 +++++++++++ 39 files changed, 1497 insertions(+), 62 deletions(-) create mode 100644 detox/e2e/support/ui/screen/permalink.ts create mode 100644 detox/e2e/support/ui/screen/thread_options.ts create mode 100644 detox/e2e/test/smoke_test/threads.e2e.ts create mode 100644 detox/e2e/test/threads/follow_and_unfollow_thread.e2e.ts create mode 100644 detox/e2e/test/threads/global_threads.e2e.ts create mode 100644 detox/e2e/test/threads/mark_thread_as_read_and_unread.e2e.ts create mode 100644 detox/e2e/test/threads/open_thread_in_channel.e2e.ts create mode 100644 detox/e2e/test/threads/reply_to_thread.e2e.ts create mode 100644 detox/e2e/test/threads/save_and_unsave_thread.e2e.ts diff --git a/app/components/common_post_options/copy_permalink_option/copy_permalink_option.tsx b/app/components/common_post_options/copy_permalink_option/copy_permalink_option.tsx index 43205ba4a..36c915a61 100644 --- a/app/components/common_post_options/copy_permalink_option/copy_permalink_option.tsx +++ b/app/components/common_post_options/copy_permalink_option/copy_permalink_option.tsx @@ -35,7 +35,7 @@ const CopyPermalinkOption = ({teamName, post, sourceScreen}: Props) => { defaultMessage='Copy Link' onPress={handleCopyLink} iconName='link-variant' - testID='post_options.copy.permalink.option' + testID='post_options.copy_permalink.option' /> ); }; diff --git a/app/components/common_post_options/follow_thread_option/follow_thread_option.tsx b/app/components/common_post_options/follow_thread_option/follow_thread_option.tsx index b6b32a946..5e0bef45d 100644 --- a/app/components/common_post_options/follow_thread_option/follow_thread_option.tsx +++ b/app/components/common_post_options/follow_thread_option/follow_thread_option.tsx @@ -52,11 +52,13 @@ const FollowThreadOption = ({thread, teamId}: FollowThreadOptionProps) => { dismissBottomSheet(Screens.POST_OPTIONS); }; + const followThreadOptionTestId = thread.isFollowing ? 'post_options.following_thread.option' : 'post_options.follow_thread.option'; + return ( diff --git a/app/components/common_post_options/reply_option.tsx b/app/components/common_post_options/reply_option.tsx index 4d941396a..fc912f733 100644 --- a/app/components/common_post_options/reply_option.tsx +++ b/app/components/common_post_options/reply_option.tsx @@ -31,7 +31,7 @@ const ReplyOption = ({post, location}: Props) => { defaultMessage='Reply' iconName='reply-outline' onPress={handleReply} - testID='post_options.reply.post.option' + testID='post_options.reply_post.option' /> ); }; diff --git a/app/components/common_post_options/save_option.tsx b/app/components/common_post_options/save_option.tsx index 2083efb5e..406f28a07 100644 --- a/app/components/common_post_options/save_option.tsx +++ b/app/components/common_post_options/save_option.tsx @@ -33,7 +33,7 @@ const SaveOption = ({isSaved, postId}: CopyTextProps) => { defaultMessage={defaultMessage} iconName='bookmark-outline' onPress={onHandlePress} - testID={`post_options.${defaultMessage.toLocaleLowerCase()}.channel.option`} + testID={`post_options.${defaultMessage.toLocaleLowerCase()}_post.option`} /> ); }; diff --git a/app/components/post_list/post/footer/footer.tsx b/app/components/post_list/post/footer/footer.tsx index 5dc3d62ac..932347817 100644 --- a/app/components/post_list/post/footer/footer.tsx +++ b/app/components/post_list/post/footer/footer.tsx @@ -20,7 +20,6 @@ import type UserModel from '@typings/database/models/servers/user'; type Props = { participants: UserModel[]; teamId?: string; - testID: string; thread: ThreadModel; }; @@ -77,7 +76,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { }; }); -const Footer = ({participants, teamId, testID, thread}: Props) => { +const Footer = ({participants, teamId, thread}: Props) => { const serverUrl = useServerUrl(); const theme = useTheme(); const styles = getStyleSheet(theme); @@ -102,7 +101,7 @@ const Footer = ({participants, teamId, testID, thread}: Props) => { { { {location !== SEARCH && commentCount > 0 && {commentCount} diff --git a/app/components/post_list/post/post.tsx b/app/components/post_list/post/post.tsx index c255c6dde..7d0b5bc72 100644 --- a/app/components/post_list/post/post.tsx +++ b/app/components/post_list/post/post.tsx @@ -294,15 +294,12 @@ const Post = ({ if (isCRTEnabled && thread) { if (thread.replyCount > 0 || thread.isFollowing) { footer = ( -