From c18686aad3ab0440d6015e47bf9e485c3be799f1 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 09:29:21 +0200 Subject: [PATCH 01/20] Add drawer menu test id --- fe1-web/src/core/components/DrawerMenuButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe1-web/src/core/components/DrawerMenuButton.tsx b/fe1-web/src/core/components/DrawerMenuButton.tsx index 4c15fc87eb..433a305c1c 100644 --- a/fe1-web/src/core/components/DrawerMenuButton.tsx +++ b/fe1-web/src/core/components/DrawerMenuButton.tsx @@ -17,7 +17,7 @@ const DrawerMenuButton = ({ padding }: IPropTypes) => { return ( <> - + From 74fc1ebe7127f5d3378dd540c279b04c863bbd57 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 09:35:22 +0200 Subject: [PATCH 02/20] Add lao name test id --- fe1-web/src/features/lao/navigation/LaoNavigation.tsx | 2 +- tests/karate/src/test/java/fe/utils/web.feature | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx index 71c1f484f6..7cdef60be1 100644 --- a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx +++ b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx @@ -80,7 +80,7 @@ const LaoDrawerContent = ({ descriptors, navigation, state }: DrawerContentCompo - {lao.name} + {lao.name} Date: Wed, 1 May 2024 09:42:52 +0200 Subject: [PATCH 03/20] Add drawer menu test id --- fe1-web/src/features/lao/navigation/LaoNavigation.tsx | 2 +- tests/karate/src/test/java/fe/utils/web.feature | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx index 7cdef60be1..4bfcabef55 100644 --- a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx +++ b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx @@ -77,7 +77,7 @@ const LaoDrawerContent = ({ descriptors, navigation, state }: DrawerContentCompo const lao = LaoHooks.useCurrentLao(); return ( - + {lao.name} diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index 35d3208a4e..303b5e47bd 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -36,6 +36,7 @@ Feature: web page object # Drawer menu * def drawer_menu_button = "[data-testid='drawer_menu_button']" + * def drawer_menu_container = "[data-testid='drawer_menu_container']" @name=open_app Scenario: From c777f14274ce49ab9a6d904c0acfd541ef8aff20 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 09:55:21 +0200 Subject: [PATCH 04/20] Add menu test ids --- fe1-web/src/core/components/PoPIcon.tsx | 7 ++++--- .../digital-cash/navigation/DigitalCashNavigation.tsx | 2 +- fe1-web/src/features/lao/navigation/LaoNavigation.tsx | 6 +++--- .../features/social/navigation/SocialMediaNavigation.tsx | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fe1-web/src/core/components/PoPIcon.tsx b/fe1-web/src/core/components/PoPIcon.tsx index d37154d27e..66c1a5da0e 100644 --- a/fe1-web/src/core/components/PoPIcon.tsx +++ b/fe1-web/src/core/components/PoPIcon.tsx @@ -246,12 +246,13 @@ type IconPropTypes = ExtendType< name: PopIconName; color: string; size: number; + testID?: string; } >; export default PoPIcon; -export const makeIcon = (name: PopIconName) => { +export const makeIcon = (name: PopIconName, defaultTestID?: string) => { // we need to cast it here to a more generic type due to limitations // in the static type checking const Entry = iconNameMap[name] as { @@ -263,8 +264,8 @@ export const makeIcon = (name: PopIconName) => { throw new Error(`Unkown icon name ${name}`); } - return ({ color, size, focused }: Omit) => ( - + return ({ color, size, focused, ...props }: Omit) => ( + ); diff --git a/fe1-web/src/features/digital-cash/navigation/DigitalCashNavigation.tsx b/fe1-web/src/features/digital-cash/navigation/DigitalCashNavigation.tsx index 3d24d008c9..6100c874ff 100644 --- a/fe1-web/src/features/digital-cash/navigation/DigitalCashNavigation.tsx +++ b/fe1-web/src/features/digital-cash/navigation/DigitalCashNavigation.tsx @@ -54,7 +54,7 @@ export const DigitalCashLaoScreen: DigitalCashFeature.LaoScreen = { id: STRINGS.navigation_lao_digital_cash, title: STRINGS.navigation_lao_digital_cash_title, Component: DigitalCashNavigation, - Icon: makeIcon('digitalCash'), + Icon: makeIcon('digitalCash', 'drawer_menu_digital_cash'), headerShown: false, order: 10000000, }; diff --git a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx index 4bfcabef55..39bc2ba09f 100644 --- a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx +++ b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx @@ -91,7 +91,7 @@ const LaoDrawerContent = ({ descriptors, navigation, state }: DrawerContentCompo screen: STRINGS.navigation_home_home, }); }} - icon={DisconnectIcon} + icon={props => } style={drawerNavigationOptions.drawerItemStyle} labelStyle={drawerNavigationOptions.drawerLabelStyle} activeTintColor={drawerNavigationOptions.drawerActiveTintColor} @@ -117,7 +117,7 @@ const LaoNavigation: React.FC = () => { ...passedScreens, { id: STRINGS.navigation_lao_invite, - Icon: makeIcon('invite'), + Icon: makeIcon('invite', 'drawer_menu_invite'), Component: InviteScreen, headerShown: true, headerRight: ButtonPadding, @@ -125,7 +125,7 @@ const LaoNavigation: React.FC = () => { } as LaoFeature.LaoScreen, { id: STRINGS.navigation_lao_events, - Icon: makeIcon('event'), + Icon: makeIcon('event', 'drawer_menu_events'), Component: EventsNavigation, headerShown: false, order: 0, diff --git a/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx b/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx index 2bab011739..ad3bbd37d6 100644 --- a/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx +++ b/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx @@ -154,7 +154,7 @@ export const SocialMediaScreen: SocialFeature.LaoScreen = { id: STRINGS.navigation_social_media, Component: SocialMediaNavigation, headerShown: false, - Icon: makeIcon('socialMedia'), + Icon: makeIcon('socialMedia', 'drawer_menu_social_media'), headerLeft: DrawerMenuButton, order: 10000, }; From 5857c8d602e49772f8722b4cc26eaf0cd13be734 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 10:08:33 +0200 Subject: [PATCH 05/20] Add social pages test ids --- fe1-web/src/core/components/ScreenWrapper.tsx | 8 ++++---- fe1-web/src/features/social/screens/SocialHome.tsx | 5 +++-- fe1-web/src/features/social/screens/SocialProfile.tsx | 4 ++-- fe1-web/src/features/social/screens/SocialSearch.tsx | 2 +- fe1-web/src/features/social/screens/SocialTopChirps.tsx | 4 ++-- fe1-web/src/features/social/screens/SocialUserProfile.tsx | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fe1-web/src/core/components/ScreenWrapper.tsx b/fe1-web/src/core/components/ScreenWrapper.tsx index bde16e4d59..6e7fbb1f23 100644 --- a/fe1-web/src/core/components/ScreenWrapper.tsx +++ b/fe1-web/src/core/components/ScreenWrapper.tsx @@ -1,6 +1,6 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { StyleSheet, View, ViewStyle } from 'react-native'; +import { StyleSheet, View, ViewProps, ViewStyle } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { Spacing } from 'core/styles'; @@ -20,8 +20,8 @@ const styles = StyleSheet.create({ * Wraps react components in a screen wrapper that adds a scroll view * and thus makes sure that all content can be accessed */ -const ScreenWrapper = ({ children, toolbarItems }: IPropTypes) => ( - +const ScreenWrapper = ({ children, toolbarItems, ...viewProps }: IPropTypes) => ( + {children} {toolbarItems && } @@ -37,6 +37,6 @@ ScreenWrapper.defaultProps = { toolbarItems: undefined, }; -type IPropTypes = PropTypes.InferProps; +type IPropTypes = PropTypes.InferProps & ViewProps; export default ScreenWrapper; diff --git a/fe1-web/src/features/social/screens/SocialHome.tsx b/fe1-web/src/features/social/screens/SocialHome.tsx index 12c48db90d..69c231b161 100644 --- a/fe1-web/src/features/social/screens/SocialHome.tsx +++ b/fe1-web/src/features/social/screens/SocialHome.tsx @@ -14,6 +14,7 @@ import { SocialHooks } from '../hooks'; import { Chirp } from '../objects'; import { makeChirpsList } from '../reducer'; + const SocialHome = () => { const laoId = SocialHooks.useCurrentLaoId(); const { currentUserPopTokenPublicKey } = useContext(SocialMediaContext); @@ -34,7 +35,7 @@ const SocialHome = () => { if (chirpList.length === 0) { return ( - + {STRINGS.social_media_create_chirps_yet} @@ -49,7 +50,7 @@ const SocialHome = () => { } return ( - + { if (!currentUserPopTokenPublicKey) { return ( - + {STRINGS.social_media_your_profile_unavailable} ); } return ( - + ); diff --git a/fe1-web/src/features/social/screens/SocialSearch.tsx b/fe1-web/src/features/social/screens/SocialSearch.tsx index 336033317a..c05bcbeeff 100644 --- a/fe1-web/src/features/social/screens/SocialSearch.tsx +++ b/fe1-web/src/features/social/screens/SocialSearch.tsx @@ -38,7 +38,7 @@ const SocialSearch = () => { if (!rollCallId) { return ( - + {STRINGS.social_media_user_list_unavailable} ); diff --git a/fe1-web/src/features/social/screens/SocialTopChirps.tsx b/fe1-web/src/features/social/screens/SocialTopChirps.tsx index 7c12f3d640..024fb55b9d 100644 --- a/fe1-web/src/features/social/screens/SocialTopChirps.tsx +++ b/fe1-web/src/features/social/screens/SocialTopChirps.tsx @@ -29,7 +29,7 @@ const SocialTopChirps = () => { if (topChirps.length === 0) { return ( - + {STRINGS.social_media_create_chirps_yet} @@ -38,7 +38,7 @@ const SocialTopChirps = () => { } return ( - + {topChirps.map((chirp, i) => ( { if (!userPublicKey) { return ( - + Impossible to load profile of user: public key not provided. @@ -52,7 +52,7 @@ const SocialUserProfile = () => { } return ( - + ); From 6be145b5363fc93d00bfc9c95922d4ec709c869d Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 10:41:52 +0200 Subject: [PATCH 06/20] Add basic social media tests --- .../src/test/java/fe/features/event.feature | 1 + .../src/test/java/fe/features/social.feature | 37 +++++++++++++++++++ .../src/test/java/fe/utils/constants.feature | 1 + .../karate/src/test/java/fe/utils/web.feature | 24 ++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 tests/karate/src/test/java/fe/features/social.feature diff --git a/tests/karate/src/test/java/fe/features/event.feature b/tests/karate/src/test/java/fe/features/event.feature index 6e823cf587..2739e17c04 100644 --- a/tests/karate/src/test/java/fe/features/event.feature +++ b/tests/karate/src/test/java/fe/features/event.feature @@ -29,3 +29,4 @@ Feature: Event And organizer.closeRollCall(lao, rollCall, [popToken]) Then waitForText(event_rollcall_first_attendee, popToken) And screenshot() + diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature new file mode 100644 index 0000000000..6a8b27edfa --- /dev/null +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -0,0 +1,37 @@ +Feature: Social Media + Background: + * call read('classpath:fe/utils/constants.feature') + * call read(MOCK_CLIENT_FEATURE) + * def organizer = createMockClient() + * def lao = organizer.createLao() + + @name=social_open_without_pop_token + Scenario: Open social media page without pop token + # Delay are added to give time for the menu to open/close + * call read(PLATFORM_FEATURE) { name: '#(JOIN_LAO)', params: { lao: '#(lao)' } } + Given waitFor(drawer_menu_button).click() + And delay(500) + When click(drawer_menu_social) + Then waitFor(social_home_page) + And delay(500) + And screenshot() + + @name=social_send_message + Scenario: Open social media page with pop token + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And waitFor(drawer_menu_button).click() + And delay(500) + And click(drawer_menu_social) + And waitFor(social_home_page) + And delay(500) + When def social_chirp_message = 'Hello from the test' + And waitFor(social_chirp_input).input(social_chirp_message) + And screenshot() + And click(social_chirp_publish_button) + And delay(500) + Then waitFor('{}' + social_chirp_message) + And screenshot() + + + + diff --git a/tests/karate/src/test/java/fe/utils/constants.feature b/tests/karate/src/test/java/fe/utils/constants.feature index fd4d787ffe..ab6cf28ff2 100644 --- a/tests/karate/src/test/java/fe/utils/constants.feature +++ b/tests/karate/src/test/java/fe/utils/constants.feature @@ -14,3 +14,4 @@ Feature: Constants * def CREATE_LAO = 'lao_create' # Event * def CLICK_CREATE_ROLLCALL = 'click_rollcall_create' + * def JOIN_ROLLCALL = 'join_rollcall' diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index 303b5e47bd..fd1b347db8 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -37,6 +37,18 @@ Feature: web page object # Drawer menu * def drawer_menu_button = "[data-testid='drawer_menu_button']" * def drawer_menu_container = "[data-testid='drawer_menu_container']" + * def drawer_menu_social = "[data-testid='drawer_menu_social_media']" + * def drawer_menu_disconnect = "[data-testid='drawer_menu_disconnect_button']" + * def drawer_menu_digital_cash = "[data-testid='drawer_menu_digital_cash']" + + # Social screen + * def social_home_page = "[data-testid='social_home_page']" + * def social_profile_page = "[data-testid='social_profile_page']" + * def social_search_page = "[data-testid='social_search_page']" + * def social_top_chirps_page = "[data-testid='social_top_chirps_page']" + * def social_user_profile_page = "[data-testid='social_user_profile_page']" + * def social_chirp_input = "textarea[data-testid='new_chirp_input']" + * def social_chirp_publish_button = "[data-testid='new_chirp_publish']" @name=open_app Scenario: @@ -79,3 +91,15 @@ Feature: web page object @name=click_rollcall_create Scenario: * actionSheetClick(event_create_rollcall) + + @name=join_rollcall + Scenario: + And def rollCall = params.organizer.createRollCall(lao) + And organizer.openRollCall(lao, rollCall) + And call read(PLATFORM_FEATURE) { name: '#(JOIN_LAO)', params: { lao: '#(params.lao)' } } + When waitFor(event_first_current_event).click() + And waitFor(event_rollcall_pop_token) + And delay(1000) + And def popToken = text(event_rollcall_pop_token) + And organizer.closeRollCall(lao, rollCall, [popToken]) + Then waitForText(event_rollcall_first_attendee, popToken) From 23676f0a9ebac90407e598224441d539ad4fa5d6 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 10:55:53 +0200 Subject: [PATCH 07/20] Test social media send --- fe1-web/src/features/social/components/ChirpCard.tsx | 2 +- tests/karate/src/test/java/fe/features/social.feature | 7 +++---- tests/karate/src/test/java/fe/utils/web.feature | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fe1-web/src/features/social/components/ChirpCard.tsx b/fe1-web/src/features/social/components/ChirpCard.tsx index 5f65197f62..86817822a6 100644 --- a/fe1-web/src/features/social/components/ChirpCard.tsx +++ b/fe1-web/src/features/social/components/ChirpCard.tsx @@ -208,7 +208,7 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { - + {chirp.isDeleted ? ( {STRINGS.deleted_chirp} ) : ( diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 6a8b27edfa..4c6406d666 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -19,17 +19,16 @@ Feature: Social Media @name=social_send_message Scenario: Open social media page with pop token Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And def message = 'Hello from the test' And waitFor(drawer_menu_button).click() And delay(500) And click(drawer_menu_social) And waitFor(social_home_page) And delay(500) - When def social_chirp_message = 'Hello from the test' - And waitFor(social_chirp_input).input(social_chirp_message) + And waitFor(social_chirp_input).input(message) And screenshot() And click(social_chirp_publish_button) - And delay(500) - Then waitFor('{}' + social_chirp_message) + Then waitForText(social_chirp_message, message) And screenshot() diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index fd1b347db8..57caf6a174 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -49,6 +49,11 @@ Feature: web page object * def social_user_profile_page = "[data-testid='social_user_profile_page']" * def social_chirp_input = "textarea[data-testid='new_chirp_input']" * def social_chirp_publish_button = "[data-testid='new_chirp_publish']" + * def social_chirp_message = "[data-testid='chirp_message']" + * def social_chirp_like_button = "[data-testid='thumbs-up']" + * def social_chirp_dislike_button = "[data-testid='thumbs-down']" + * def social_chirp_love_button = "[data-testid='heart']" + * def social_chirp_delete = "[data-testid='delete_chirp']" @name=open_app Scenario: From 6d0f843b25e636f40ac3a32c316897021123c2f6 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 12:13:03 +0200 Subject: [PATCH 08/20] Add receive message test --- .../src/test/java/common/utils/MockClient.java | 11 +++++++++++ .../src/test/java/fe/features/social.feature | 16 +++++++++------- .../src/test/java/fe/utils/constants.feature | 1 + tests/karate/src/test/java/fe/utils/web.feature | 9 ++++++++- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/tests/karate/src/test/java/common/utils/MockClient.java b/tests/karate/src/test/java/common/utils/MockClient.java index 18c9ec6031..23475ac7b6 100644 --- a/tests/karate/src/test/java/common/utils/MockClient.java +++ b/tests/karate/src/test/java/common/utils/MockClient.java @@ -207,4 +207,15 @@ public void closeRollCall(Lao lao, RollCall rollCall, List attendees) { this.publish(request, lao.channel); this.getBackendResponse(request); } + + public void sendChirp(Lao lao, String text) { + Map request = new HashMap<>(); + request.put("object", "chirp"); + request.put("action", "add"); + request.put("text", text); + request.put("timestamp", Instant.now().getEpochSecond()); + + this.publish(request, lao.channel + "/social/" + publicKey); + this.getBackendResponse(request); + } } diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 4c6406d666..8751fe05d4 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -19,18 +19,20 @@ Feature: Social Media @name=social_send_message Scenario: Open social media page with pop token Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } And def message = 'Hello from the test' - And waitFor(drawer_menu_button).click() - And delay(500) - And click(drawer_menu_social) - And waitFor(social_home_page) - And delay(500) And waitFor(social_chirp_input).input(message) And screenshot() And click(social_chirp_publish_button) Then waitForText(social_chirp_message, message) And screenshot() - - + @name=social_receive_message + Scenario: Open social media page with pop token + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } + And def message = 'Hello from the test' + When organizer.sendChirp(lao, message) + Then waitForText(social_chirp_message, message) + And screenshot() diff --git a/tests/karate/src/test/java/fe/utils/constants.feature b/tests/karate/src/test/java/fe/utils/constants.feature index ab6cf28ff2..daf6d3a25b 100644 --- a/tests/karate/src/test/java/fe/utils/constants.feature +++ b/tests/karate/src/test/java/fe/utils/constants.feature @@ -15,3 +15,4 @@ Feature: Constants # Event * def CLICK_CREATE_ROLLCALL = 'click_rollcall_create' * def JOIN_ROLLCALL = 'join_rollcall' + * def SWITCH_TO_SOCIAL_PAGE = 'switch_to_social_page' diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index 57caf6a174..521847a5ef 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -106,5 +106,12 @@ Feature: web page object And waitFor(event_rollcall_pop_token) And delay(1000) And def popToken = text(event_rollcall_pop_token) - And organizer.closeRollCall(lao, rollCall, [popToken]) + And organizer.closeRollCall(lao, rollCall, [popToken, organizer.publicKey]) Then waitForText(event_rollcall_first_attendee, popToken) + + @name=switch_to_social_page + Scenario: + Given waitFor(drawer_menu_button).click() + And waitFor(drawer_menu_social).click() + And waitFor(social_home_page) + And delay(500) From dbdda10131ae60529efd50d9319a17b703b056e4 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 12:22:41 +0200 Subject: [PATCH 09/20] Add react message test --- .../features/social/components/ChirpCard.tsx | 6 +++--- .../src/test/java/fe/features/social.feature | 17 +++++++++++++++-- tests/karate/src/test/java/fe/utils/web.feature | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/fe1-web/src/features/social/components/ChirpCard.tsx b/fe1-web/src/features/social/components/ChirpCard.tsx index 86817822a6..3a74c91c10 100644 --- a/fe1-web/src/features/social/components/ChirpCard.tsx +++ b/fe1-web/src/features/social/components/ChirpCard.tsx @@ -228,7 +228,7 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { buttonStyle={reacted['👍'] ? 'primary' : 'secondary'} toolbar /> - + {thumbsUp} @@ -242,7 +242,7 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { buttonStyle={reacted['👎'] ? 'primary' : 'secondary'} toolbar /> - + {thumbsDown} @@ -258,7 +258,7 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { buttonStyle={reacted['❤️'] ? 'primary' : 'secondary'} toolbar /> - + {heart} diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 8751fe05d4..0b5dd5c91c 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -17,7 +17,7 @@ Feature: Social Media And screenshot() @name=social_send_message - Scenario: Open social media page with pop token + Scenario: Send chirp message Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } And def message = 'Hello from the test' @@ -28,7 +28,7 @@ Feature: Social Media And screenshot() @name=social_receive_message - Scenario: Open social media page with pop token + Scenario: Receive chirp message Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } And def message = 'Hello from the test' @@ -36,3 +36,16 @@ Feature: Social Media Then waitForText(social_chirp_message, message) And screenshot() + @name=social_react_message + Scenario: React to chirp message + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } + And def message = 'Hello from the test' + When organizer.sendChirp(lao, message) + And waitFor(social_chirp_like_button).click() + And waitFor(social_chirp_dislike_button).click() + And waitFor(social_chirp_love_button).click() + Then waitForText(social_chirp_like_count, '1') + And waitForText(social_chirp_dislike_count, '1') + And waitForText(social_chirp_love_count, '1') + And screenshot() diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index 521847a5ef..6296015d2a 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -51,8 +51,11 @@ Feature: web page object * def social_chirp_publish_button = "[data-testid='new_chirp_publish']" * def social_chirp_message = "[data-testid='chirp_message']" * def social_chirp_like_button = "[data-testid='thumbs-up']" + * def social_chirp_like_count = "[data-testid='thumbs-up-count']" * def social_chirp_dislike_button = "[data-testid='thumbs-down']" + * def social_chirp_dislike_count = "[data-testid='thumbs-down-count']" * def social_chirp_love_button = "[data-testid='heart']" + * def social_chirp_love_count = "[data-testid='heart-count']" * def social_chirp_delete = "[data-testid='delete_chirp']" @name=open_app From 21375cb3672fc902dc84428d3adae5f53beb6a63 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 12:38:45 +0200 Subject: [PATCH 10/20] Add social top chirps test --- .../social/navigation/SocialMediaNavigation.tsx | 8 ++++---- tests/karate/src/test/java/fe/features/social.feature | 11 +++++++++++ tests/karate/src/test/java/fe/utils/web.feature | 4 ++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx b/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx index ad3bbd37d6..39e1ab121a 100644 --- a/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx +++ b/fe1-web/src/features/social/navigation/SocialMediaNavigation.tsx @@ -21,10 +21,10 @@ import SocialSearchNavigation from './SocialSearchNavigation'; const Tab = createBottomTabNavigator(); -const homeIcon = makeIcon('home'); -const searchIcon = makeIcon('userList'); -const topChirpsIcon = makeIcon('topItems'); -const profileIcon = makeIcon('profile'); +const homeIcon = makeIcon('home', 'social_menu_home_button'); +const searchIcon = makeIcon('userList', 'social_menu_search_button'); +const topChirpsIcon = makeIcon('topItems', 'social_menu_top_chirps_button'); +const profileIcon = makeIcon('profile', 'social_menu_profile_button'); type NavigationProps = CompositeScreenProps< StackScreenProps, diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 0b5dd5c91c..cdb6451eba 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -49,3 +49,14 @@ Feature: Social Media And waitForText(social_chirp_dislike_count, '1') And waitForText(social_chirp_love_count, '1') And screenshot() + + @name=social_top_chirps_page + Scenario: Open top chirps page + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } + And def message = 'Hello from the test' + And organizer.sendChirp(lao, message) + When waitFor(social_menu_top_chirps_button).click() + Then waitFor(social_top_chirps_page) + And waitForText(social_chirp_message, message) + And screenshot() diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index 6296015d2a..aef71e26e2 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -43,9 +43,13 @@ Feature: web page object # Social screen * def social_home_page = "[data-testid='social_home_page']" + * def social_menu_home_button = "[data-testid='social_menu_home_button']" * def social_profile_page = "[data-testid='social_profile_page']" + * def social_menu_profile_button = "[data-testid='social_menu_profile_button']" * def social_search_page = "[data-testid='social_search_page']" + * def social_menu_search_button = "[data-testid='social_menu_search_button']" * def social_top_chirps_page = "[data-testid='social_top_chirps_page']" + * def social_menu_top_chirps_button = "[data-testid='social_menu_top_chirps_button']" * def social_user_profile_page = "[data-testid='social_user_profile_page']" * def social_chirp_input = "textarea[data-testid='new_chirp_input']" * def social_chirp_publish_button = "[data-testid='new_chirp_publish']" From de8196581859dd65195e24ea6b88c685f4830f33 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 12:41:02 +0200 Subject: [PATCH 11/20] Sort attendees in roll call close --- tests/karate/src/test/java/common/utils/MockClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/karate/src/test/java/common/utils/MockClient.java b/tests/karate/src/test/java/common/utils/MockClient.java index 23475ac7b6..6a763c4de5 100644 --- a/tests/karate/src/test/java/common/utils/MockClient.java +++ b/tests/karate/src/test/java/common/utils/MockClient.java @@ -201,7 +201,9 @@ public void closeRollCall(Lao lao, RollCall rollCall, List attendees) { request.put("update_id", closeRollCall.updateId); request.put("closes", closeRollCall.closes); request.put("closed_at", closeRollCall.closedAt); - request.put("attendees", attendees); + List sortedAttendees = new ArrayList<>(attendees); + Collections.sort(sortedAttendees); + request.put("attendees", sortedAttendees); this.publish(request, lao.channel); From 6fca871bfda14a45f16a72090f1370c8ad45b008 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 13:03:42 +0200 Subject: [PATCH 12/20] Add social search page test --- tests/karate/src/test/java/fe/features/social.feature | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index cdb6451eba..294e606a2a 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -60,3 +60,12 @@ Feature: Social Media Then waitFor(social_top_chirps_page) And waitForText(social_chirp_message, message) And screenshot() + + @name=social_search_page + Scenario: Open search page + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } + When waitFor(social_menu_search_button).click() + Then waitFor('{}' + popToken) + And waitFor('{}' + organizer.publicKey) + And screenshot() From bbb7674d7f6e83a3a92b02a6d1d1201f184af74e Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 13:26:21 +0200 Subject: [PATCH 13/20] Add social profile tests --- .../features/social/components/UserListItem.tsx | 2 +- .../src/test/java/fe/features/social.feature | 17 +++++++++++++++++ tests/karate/src/test/java/fe/utils/web.feature | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fe1-web/src/features/social/components/UserListItem.tsx b/fe1-web/src/features/social/components/UserListItem.tsx index f80505605d..32739785cd 100644 --- a/fe1-web/src/features/social/components/UserListItem.tsx +++ b/fe1-web/src/features/social/components/UserListItem.tsx @@ -62,7 +62,7 @@ const UserListItem = ({ publicKey, isFirstItem, isLastItem }: IPropTypes) => { style={listStyle} bottomDivider onPress={goToUserProfile} - testID={`user_list_item_${publicKey.toString()}`}> + testID='user_list_item'> diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 294e606a2a..13abf3be00 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -69,3 +69,20 @@ Feature: Social Media Then waitFor('{}' + popToken) And waitFor('{}' + organizer.publicKey) And screenshot() + + @name=social_user_profile_page + Scenario: Open user profile page + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } + When waitFor(social_menu_search_button).click() + And waitFor(user_list_item).click() + Then waitFor('{}' + organizer.publicKey) + And screenshot() + + @name=social_own_user_profile_page + Scenario: Open user profile page + Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } + And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } + When waitFor(social_menu_profile_button).click() + Then waitFor('{}' + popToken) + And screenshot() diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index aef71e26e2..b520f67155 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -3,6 +3,7 @@ Feature: web page object Background: # Functions * def actionSheetClick = (text) => script("setTimeout(() => document.evaluate('//div[text()=\\'" + text + "\\']', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click(), 1000)") + * def user_list_item = "[data-testid=user_list_item]" # Wallet screen * def wallet_seed_wallet_text = "[data-testid='seed_wallet_text']" From f5ebb39fa87cdaf027abbe01d051d597112a5929 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 13:28:12 +0200 Subject: [PATCH 14/20] Add android scenario placeholder --- tests/karate/src/test/java/fe/utils/android.feature | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/karate/src/test/java/fe/utils/android.feature b/tests/karate/src/test/java/fe/utils/android.feature index dc6c47ed8e..a35d5c26d4 100644 --- a/tests/karate/src/test/java/fe/utils/android.feature +++ b/tests/karate/src/test/java/fe/utils/android.feature @@ -73,3 +73,13 @@ Feature: android page object @name=click_rollcall_create Scenario: * waitFor(event_create_rollcall).click() + + @name=join_rollcall + Scenario: + # Not implemented yet + * assert false + + @name=switch_to_social_page + Scenario: + # Not implemented yet + * assert false From 24d935d4a98a3e8657f865bbe7ecce89a0b6ed76 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 13:34:10 +0200 Subject: [PATCH 15/20] Lint --- fe1-web/src/core/components/PoPIcon.tsx | 4 ++-- fe1-web/src/core/components/ScreenWrapper.tsx | 11 +++++++---- .../src/features/lao/navigation/LaoNavigation.tsx | 8 +++++--- fe1-web/src/features/social/components/ChirpCard.tsx | 12 +++++++++--- .../src/features/social/components/UserListItem.tsx | 2 +- fe1-web/src/features/social/screens/SocialHome.tsx | 5 ++--- .../src/features/social/screens/SocialProfile.tsx | 4 ++-- fe1-web/src/features/social/screens/SocialSearch.tsx | 2 +- .../src/features/social/screens/SocialTopChirps.tsx | 4 ++-- .../features/social/screens/SocialUserProfile.tsx | 4 ++-- 10 files changed, 33 insertions(+), 23 deletions(-) diff --git a/fe1-web/src/core/components/PoPIcon.tsx b/fe1-web/src/core/components/PoPIcon.tsx index 66c1a5da0e..c2b1c6b77c 100644 --- a/fe1-web/src/core/components/PoPIcon.tsx +++ b/fe1-web/src/core/components/PoPIcon.tsx @@ -264,8 +264,8 @@ export const makeIcon = (name: PopIconName, defaultTestID?: string) => { throw new Error(`Unkown icon name ${name}`); } - return ({ color, size, focused, ...props }: Omit) => ( - + return ({ color, size, focused, testID }: Omit) => ( + ); diff --git a/fe1-web/src/core/components/ScreenWrapper.tsx b/fe1-web/src/core/components/ScreenWrapper.tsx index 6e7fbb1f23..75236202fa 100644 --- a/fe1-web/src/core/components/ScreenWrapper.tsx +++ b/fe1-web/src/core/components/ScreenWrapper.tsx @@ -1,6 +1,6 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { StyleSheet, View, ViewProps, ViewStyle } from 'react-native'; +import { StyleSheet, View, ViewStyle } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { Spacing } from 'core/styles'; @@ -20,8 +20,8 @@ const styles = StyleSheet.create({ * Wraps react components in a screen wrapper that adds a scroll view * and thus makes sure that all content can be accessed */ -const ScreenWrapper = ({ children, toolbarItems, ...viewProps }: IPropTypes) => ( - +const ScreenWrapper = ({ children, toolbarItems, containerTestID }: IPropTypes) => ( + {children} {toolbarItems && } @@ -35,8 +35,11 @@ const propTypes = { ScreenWrapper.propTypes = propTypes; ScreenWrapper.defaultProps = { toolbarItems: undefined, + containerTestID: undefined, }; -type IPropTypes = PropTypes.InferProps & ViewProps; +type IPropTypes = PropTypes.InferProps & { + containerTestID?: string; +}; export default ScreenWrapper; diff --git a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx index 39bc2ba09f..38b5fe7328 100644 --- a/fe1-web/src/features/lao/navigation/LaoNavigation.tsx +++ b/fe1-web/src/features/lao/navigation/LaoNavigation.tsx @@ -71,7 +71,7 @@ const wrapWithOfflineHeader = (Component: React.ComponentType) => () => ); }; -const DisconnectIcon = makeIcon('logout'); +const DisconnectIcon = makeIcon('logout', 'menu_drawer_disconnect_button'); const LaoDrawerContent = ({ descriptors, navigation, state }: DrawerContentComponentProps) => { const lao = LaoHooks.useCurrentLao(); @@ -80,7 +80,9 @@ const LaoDrawerContent = ({ descriptors, navigation, state }: DrawerContentCompo - {lao.name} + + {lao.name} + } + icon={DisconnectIcon} style={drawerNavigationOptions.drawerItemStyle} labelStyle={drawerNavigationOptions.drawerLabelStyle} activeTintColor={drawerNavigationOptions.drawerActiveTintColor} diff --git a/fe1-web/src/features/social/components/ChirpCard.tsx b/fe1-web/src/features/social/components/ChirpCard.tsx index 3a74c91c10..a538db8040 100644 --- a/fe1-web/src/features/social/components/ChirpCard.tsx +++ b/fe1-web/src/features/social/components/ChirpCard.tsx @@ -228,7 +228,9 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { buttonStyle={reacted['👍'] ? 'primary' : 'secondary'} toolbar /> - + {thumbsUp} @@ -242,7 +244,9 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { buttonStyle={reacted['👎'] ? 'primary' : 'secondary'} toolbar /> - + {thumbsDown} @@ -258,7 +262,9 @@ const ChirpCard = ({ chirp, isFirstItem, isLastItem }: IPropTypes) => { buttonStyle={reacted['❤️'] ? 'primary' : 'secondary'} toolbar /> - + {heart} diff --git a/fe1-web/src/features/social/components/UserListItem.tsx b/fe1-web/src/features/social/components/UserListItem.tsx index 32739785cd..e9996bd504 100644 --- a/fe1-web/src/features/social/components/UserListItem.tsx +++ b/fe1-web/src/features/social/components/UserListItem.tsx @@ -62,7 +62,7 @@ const UserListItem = ({ publicKey, isFirstItem, isLastItem }: IPropTypes) => { style={listStyle} bottomDivider onPress={goToUserProfile} - testID='user_list_item'> + testID="user_list_item"> diff --git a/fe1-web/src/features/social/screens/SocialHome.tsx b/fe1-web/src/features/social/screens/SocialHome.tsx index 69c231b161..3241139243 100644 --- a/fe1-web/src/features/social/screens/SocialHome.tsx +++ b/fe1-web/src/features/social/screens/SocialHome.tsx @@ -14,7 +14,6 @@ import { SocialHooks } from '../hooks'; import { Chirp } from '../objects'; import { makeChirpsList } from '../reducer'; - const SocialHome = () => { const laoId = SocialHooks.useCurrentLaoId(); const { currentUserPopTokenPublicKey } = useContext(SocialMediaContext); @@ -35,7 +34,7 @@ const SocialHome = () => { if (chirpList.length === 0) { return ( - + {STRINGS.social_media_create_chirps_yet} @@ -50,7 +49,7 @@ const SocialHome = () => { } return ( - + { if (!currentUserPopTokenPublicKey) { return ( - + {STRINGS.social_media_your_profile_unavailable} ); } return ( - + ); diff --git a/fe1-web/src/features/social/screens/SocialSearch.tsx b/fe1-web/src/features/social/screens/SocialSearch.tsx index c05bcbeeff..15a784dae4 100644 --- a/fe1-web/src/features/social/screens/SocialSearch.tsx +++ b/fe1-web/src/features/social/screens/SocialSearch.tsx @@ -38,7 +38,7 @@ const SocialSearch = () => { if (!rollCallId) { return ( - + {STRINGS.social_media_user_list_unavailable} ); diff --git a/fe1-web/src/features/social/screens/SocialTopChirps.tsx b/fe1-web/src/features/social/screens/SocialTopChirps.tsx index 024fb55b9d..85580f54d4 100644 --- a/fe1-web/src/features/social/screens/SocialTopChirps.tsx +++ b/fe1-web/src/features/social/screens/SocialTopChirps.tsx @@ -29,7 +29,7 @@ const SocialTopChirps = () => { if (topChirps.length === 0) { return ( - + {STRINGS.social_media_create_chirps_yet} @@ -38,7 +38,7 @@ const SocialTopChirps = () => { } return ( - + {topChirps.map((chirp, i) => ( { if (!userPublicKey) { return ( - + Impossible to load profile of user: public key not provided. @@ -52,7 +52,7 @@ const SocialUserProfile = () => { } return ( - + ); From 16ca700da0800a128497745b747f0df9de008922 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 13:48:05 +0200 Subject: [PATCH 16/20] Fix user list bug --- fe1-web/src/features/social/components/UserListItem.tsx | 2 +- tests/karate/src/test/java/fe/features/social.feature | 2 +- tests/karate/src/test/java/fe/utils/constants.feature | 1 + tests/karate/src/test/java/fe/utils/web.feature | 7 +++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fe1-web/src/features/social/components/UserListItem.tsx b/fe1-web/src/features/social/components/UserListItem.tsx index e9996bd504..f80505605d 100644 --- a/fe1-web/src/features/social/components/UserListItem.tsx +++ b/fe1-web/src/features/social/components/UserListItem.tsx @@ -62,7 +62,7 @@ const UserListItem = ({ publicKey, isFirstItem, isLastItem }: IPropTypes) => { style={listStyle} bottomDivider onPress={goToUserProfile} - testID="user_list_item"> + testID={`user_list_item_${publicKey.toString()}`}> diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 13abf3be00..890b70b536 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -75,7 +75,7 @@ Feature: Social Media Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } When waitFor(social_menu_search_button).click() - And waitFor(user_list_item).click() + And call read(PLATFORM_FEATURE) { name: '#(CLICK_USER)', params: { token: '#(organizer.publicKey)' } } Then waitFor('{}' + organizer.publicKey) And screenshot() diff --git a/tests/karate/src/test/java/fe/utils/constants.feature b/tests/karate/src/test/java/fe/utils/constants.feature index daf6d3a25b..dc391ac195 100644 --- a/tests/karate/src/test/java/fe/utils/constants.feature +++ b/tests/karate/src/test/java/fe/utils/constants.feature @@ -12,6 +12,7 @@ Feature: Constants # Lao * def JOIN_LAO = 'lao_join' * def CREATE_LAO = 'lao_create' + * def CLICK_USER = 'user_click' # Event * def CLICK_CREATE_ROLLCALL = 'click_rollcall_create' * def JOIN_ROLLCALL = 'join_rollcall' diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index b520f67155..2b4b4c9d3e 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -3,7 +3,6 @@ Feature: web page object Background: # Functions * def actionSheetClick = (text) => script("setTimeout(() => document.evaluate('//div[text()=\\'" + text + "\\']', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click(), 1000)") - * def user_list_item = "[data-testid=user_list_item]" # Wallet screen * def wallet_seed_wallet_text = "[data-testid='seed_wallet_text']" @@ -105,6 +104,11 @@ Feature: web page object Scenario: * actionSheetClick(event_create_rollcall) + @name=user_click + Scenario: + + * waitFor("[data-testid='user_list_item_" + params.token + "']").click() + @name=join_rollcall Scenario: And def rollCall = params.organizer.createRollCall(lao) @@ -121,5 +125,4 @@ Feature: web page object Scenario: Given waitFor(drawer_menu_button).click() And waitFor(drawer_menu_social).click() - And waitFor(social_home_page) And delay(500) From 34d62b495537fa00291822eaadf4bac8de34640f Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 13:48:16 +0200 Subject: [PATCH 17/20] Update snapshots --- .../EventsNavigation.test.tsx.snap | 1 + .../__snapshots__/LaoNavigation.test.tsx.snap | 12 ++++++++-- .../__snapshots__/EventsScreen.test.tsx.snap | 1 + .../__snapshots__/ChirpCard.test.tsx.snap | 22 ++++++++++++++----- .../SocialTopChirps.test.tsx.snap | 15 ++++++++++--- 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/EventsNavigation.test.tsx.snap b/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/EventsNavigation.test.tsx.snap index 6ff6683ec7..621174bf2e 100644 --- a/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/EventsNavigation.test.tsx.snap +++ b/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/EventsNavigation.test.tsx.snap @@ -507,6 +507,7 @@ exports[`OrganizerNavigation renders correctly 1`] = ` "opacity": 1, } } + testID="drawer_menu_button" > {"name":"ios-menu","size":25,"color":"#8E8E8E"} diff --git a/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/LaoNavigation.test.tsx.snap b/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/LaoNavigation.test.tsx.snap index 615a48ff69..acb7659ff1 100644 --- a/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/LaoNavigation.test.tsx.snap +++ b/fe1-web/src/features/lao/navigation/__tests__/__snapshots__/LaoNavigation.test.tsx.snap @@ -632,6 +632,7 @@ exports[`LaoNavigation renders correctly 1`] = ` "opacity": 1, } } + testID="drawer_menu_button" > {"name":"ios-menu","size":25,"color":"#8E8E8E"} @@ -998,6 +999,7 @@ exports[`LaoNavigation renders correctly 1`] = ` "margin": 16, } } + testID="drawer_menu_container" > MyLao @@ -1195,7 +1198,9 @@ exports[`LaoNavigation renders correctly 1`] = ` ] } > - + {"name":"adduser","size":24,"color":"#8E8E8E"} {"name":"ios-calendar","size":24,"color":"#3742fa"} @@ -1473,7 +1479,9 @@ exports[`LaoNavigation renders correctly 1`] = ` ] } > - + {"name":"logout","size":24,"color":"#8E8E8E"} {"name":"ios-menu","size":25,"color":"#8E8E8E"} diff --git a/fe1-web/src/features/social/components/__tests__/__snapshots__/ChirpCard.test.tsx.snap b/fe1-web/src/features/social/components/__tests__/__snapshots__/ChirpCard.test.tsx.snap index 0884102472..0179c26528 100644 --- a/fe1-web/src/features/social/components/__tests__/__snapshots__/ChirpCard.test.tsx.snap +++ b/fe1-web/src/features/social/components/__tests__/__snapshots__/ChirpCard.test.tsx.snap @@ -511,7 +511,7 @@ exports[`ChirpCard for deletion render correct for a deleted chirp 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 0 @@ -1270,6 +1271,7 @@ exports[`ChirpCard for deletion renders correctly for non-sender 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -1341,6 +1343,7 @@ exports[`ChirpCard for deletion renders correctly for non-sender 1`] = ` }, ] } + testID="heart-count" > 0 @@ -1913,7 +1916,7 @@ exports[`ChirpCard for deletion renders correctly for sender 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 0 @@ -2075,6 +2079,7 @@ exports[`ChirpCard for deletion renders correctly for sender 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -2146,6 +2151,7 @@ exports[`ChirpCard for deletion renders correctly for sender 1`] = ` }, ] } + testID="heart-count" > 0 @@ -2774,7 +2780,7 @@ exports[`ChirpCard for reaction renders correctly with reaction 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 1 @@ -2936,6 +2943,7 @@ exports[`ChirpCard for reaction renders correctly with reaction 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -3007,6 +3015,7 @@ exports[`ChirpCard for reaction renders correctly with reaction 1`] = ` }, ] } + testID="heart-count" > 0 @@ -3579,7 +3588,7 @@ exports[`ChirpCard for reaction renders correctly without reaction 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 0 @@ -3741,6 +3751,7 @@ exports[`ChirpCard for reaction renders correctly without reaction 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -3812,6 +3823,7 @@ exports[`ChirpCard for reaction renders correctly without reaction 1`] = ` }, ] } + testID="heart-count" > 0 diff --git a/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialTopChirps.test.tsx.snap b/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialTopChirps.test.tsx.snap index 1204987cb4..daa9a9c69b 100644 --- a/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialTopChirps.test.tsx.snap +++ b/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialTopChirps.test.tsx.snap @@ -558,7 +558,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 1 @@ -720,6 +721,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -791,6 +793,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` }, ] } + testID="heart-count" > 1 @@ -1029,7 +1032,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 1 @@ -1191,6 +1195,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -1262,6 +1267,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` }, ] } + testID="heart-count" > 0 @@ -1506,7 +1512,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` "overflow": "hidden", } } - testID="listItemTitle" + testID="chirp_message" > 0 @@ -1668,6 +1675,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` }, ] } + testID="thumbs-down-count" > 0 @@ -1739,6 +1747,7 @@ exports[`SocialTopChirps renders correctly 1`] = ` }, ] } + testID="heart-count" > 0 From 8587dee2fd2bc42fd07bd86c12e5b2ebf15c1a07 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 14:00:08 +0200 Subject: [PATCH 18/20] Rename container test id --- fe1-web/src/features/social/screens/SocialHome.tsx | 4 ++-- fe1-web/src/features/social/screens/SocialProfile.tsx | 4 ++-- fe1-web/src/features/social/screens/SocialSearch.tsx | 2 +- fe1-web/src/features/social/screens/SocialTopChirps.tsx | 4 ++-- fe1-web/src/features/social/screens/SocialUserProfile.tsx | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fe1-web/src/features/social/screens/SocialHome.tsx b/fe1-web/src/features/social/screens/SocialHome.tsx index 3241139243..ff87bc76c8 100644 --- a/fe1-web/src/features/social/screens/SocialHome.tsx +++ b/fe1-web/src/features/social/screens/SocialHome.tsx @@ -34,7 +34,7 @@ const SocialHome = () => { if (chirpList.length === 0) { return ( - + {STRINGS.social_media_create_chirps_yet} @@ -49,7 +49,7 @@ const SocialHome = () => { } return ( - + { if (!currentUserPopTokenPublicKey) { return ( - + {STRINGS.social_media_your_profile_unavailable} ); } return ( - + ); diff --git a/fe1-web/src/features/social/screens/SocialSearch.tsx b/fe1-web/src/features/social/screens/SocialSearch.tsx index 15a784dae4..9a1b1d86c0 100644 --- a/fe1-web/src/features/social/screens/SocialSearch.tsx +++ b/fe1-web/src/features/social/screens/SocialSearch.tsx @@ -38,7 +38,7 @@ const SocialSearch = () => { if (!rollCallId) { return ( - + {STRINGS.social_media_user_list_unavailable} ); diff --git a/fe1-web/src/features/social/screens/SocialTopChirps.tsx b/fe1-web/src/features/social/screens/SocialTopChirps.tsx index 85580f54d4..50d374614c 100644 --- a/fe1-web/src/features/social/screens/SocialTopChirps.tsx +++ b/fe1-web/src/features/social/screens/SocialTopChirps.tsx @@ -29,7 +29,7 @@ const SocialTopChirps = () => { if (topChirps.length === 0) { return ( - + {STRINGS.social_media_create_chirps_yet} @@ -38,7 +38,7 @@ const SocialTopChirps = () => { } return ( - + {topChirps.map((chirp, i) => ( { if (!userPublicKey) { return ( - + Impossible to load profile of user: public key not provided. @@ -52,7 +52,7 @@ const SocialUserProfile = () => { } return ( - + ); From ada78b9c41429065bf7e974d38d3fc9085d2a760 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Wed, 1 May 2024 14:07:35 +0200 Subject: [PATCH 19/20] Fix tests --- tests/karate/src/test/java/fe/features/social.feature | 2 +- tests/karate/src/test/java/fe/utils/web.feature | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/karate/src/test/java/fe/features/social.feature b/tests/karate/src/test/java/fe/features/social.feature index 890b70b536..b68d1839f2 100644 --- a/tests/karate/src/test/java/fe/features/social.feature +++ b/tests/karate/src/test/java/fe/features/social.feature @@ -80,7 +80,7 @@ Feature: Social Media And screenshot() @name=social_own_user_profile_page - Scenario: Open user profile page + Scenario: Open own profile page Given call read(PLATFORM_FEATURE) { name: '#(JOIN_ROLLCALL)', params: { lao: '#(lao)', organizer: '#(organizer)' } } And call read(PLATFORM_FEATURE) { name: '#(SWITCH_TO_SOCIAL_PAGE)' } When waitFor(social_menu_profile_button).click() diff --git a/tests/karate/src/test/java/fe/utils/web.feature b/tests/karate/src/test/java/fe/utils/web.feature index 2b4b4c9d3e..87f0263940 100644 --- a/tests/karate/src/test/java/fe/utils/web.feature +++ b/tests/karate/src/test/java/fe/utils/web.feature @@ -106,12 +106,11 @@ Feature: web page object @name=user_click Scenario: - * waitFor("[data-testid='user_list_item_" + params.token + "']").click() @name=join_rollcall Scenario: - And def rollCall = params.organizer.createRollCall(lao) + Given def rollCall = params.organizer.createRollCall(lao) And organizer.openRollCall(lao, rollCall) And call read(PLATFORM_FEATURE) { name: '#(JOIN_LAO)', params: { lao: '#(params.lao)' } } When waitFor(event_first_current_event).click() @@ -119,7 +118,7 @@ Feature: web page object And delay(1000) And def popToken = text(event_rollcall_pop_token) And organizer.closeRollCall(lao, rollCall, [popToken, organizer.publicKey]) - Then waitForText(event_rollcall_first_attendee, popToken) + And delay(1000) @name=switch_to_social_page Scenario: From 77656860c8a28f768e135e050c057d3df3350c21 Mon Sep 17 00:00:00 2001 From: Brice Theurillat Date: Sat, 4 May 2024 13:39:46 +0200 Subject: [PATCH 20/20] Update jest snapshots --- .../screens/__tests__/__snapshots__/SocialHome.test.tsx.snap | 1 + .../__tests__/__snapshots__/SocialTopChirps.test.tsx.snap | 1 + 2 files changed, 2 insertions(+) diff --git a/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialHome.test.tsx.snap b/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialHome.test.tsx.snap index 62e0d14409..0a8b7bd08e 100644 --- a/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialHome.test.tsx.snap +++ b/fe1-web/src/features/social/screens/__tests__/__snapshots__/SocialHome.test.tsx.snap @@ -7,6 +7,7 @@ exports[`SocialHome renders correctly 1`] = ` "flex": 1, } } + testID="social_home_page" >