Skip to content

Commit

Permalink
Merge branch 'develop' into jc/opensea-share
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 authored Jun 9, 2024
2 parents 21f7870 + 3634eda commit 8422de0
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 99 deletions.
9 changes: 4 additions & 5 deletions src/status_im/contexts/chat/messenger/composer/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@
(reset! gesture-enabled? false)))

(defn empty-effect
[{:keys [empty-input?]}
{:keys [input-text images link-previews? reply audio]}]
[{:keys [empty-input?]} subscriptions]
(reanimated/set-shared-value
empty-input?
(utils/empty-input? input-text images link-previews? reply audio)))
(utils/empty-input? subscriptions)))

(defn component-will-unmount
[{:keys [keyboard-show-listener keyboard-hide-listener keyboard-frame-listener]}]
Expand All @@ -90,7 +89,7 @@

(defn initialize
[props state animations {:keys [max-height] :as dimensions}
{:keys [chat-input audio input-text images link-previews? reply] :as subscriptions}]
{:keys [chat-input audio input-text images link-previews? reply edit] :as subscriptions}]
(rn/use-effect
(fn []
(maximized-effect state animations dimensions chat-input)
Expand All @@ -105,7 +104,7 @@
(rn/use-effect
(fn []
(empty-effect animations subscriptions))
[input-text images link-previews? reply])
[input-text images link-previews? reply edit audio])
(rn/use-mount #(reenter-screen-effect state dimensions subscriptions animations)))

(defn use-edit
Expand Down
8 changes: 2 additions & 6 deletions src/status_im/contexts/chat/messenger/composer/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,8 @@
(calc-bottom-content-height images link-previews?))))

(defn empty-input?
[text images link-previews? reply? audio?]
(and (empty? text)
(empty? images)
(not link-previews?)
(not reply?)
(not audio?)))
[{:keys [input-text images link-previews? reply audio edit]}]
(not (or (not-empty input-text) images link-previews? reply audio edit)))

(defn blur-input
[input-ref]
Expand Down
2 changes: 1 addition & 1 deletion test/appium/tests/activity_center/test_activity_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _device_2_sign_in():
self.home_2.just_fyi("Device 2 sign in, user name is " + self.username_2)
self.home_2.reopen_app(sign_in=False)
self.device_2.show_profiles_button.wait_and_click()
self.device_2.get_user(username=self.username_2).click()
self.device_2.get_user_profile_by_name(username=self.username_2).click()
self.device_2.sign_in()

self.loop.run_until_complete(run_in_parallel(((_device_1_creates_user, {}),
Expand Down
97 changes: 64 additions & 33 deletions test/appium/tests/critical/chats/test_group_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ def test_group_chat_reactions(self):
self.chats[2].add_remove_same_reaction(message=message, emoji="thumbs-up")
self.chats[2].set_reaction(message=message, emoji="laugh")

for i in range(3):
self.chats[i].just_fyi("Checking reactions count for each group member and admin")
message_element = self.chats[i].chat_element_by_text(message)
message_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2)
message_element.emojis_below_message(emoji="love").wait_for_element_text(1)
message_element.emojis_below_message(emoji="laugh").wait_for_element_text(1)
def _check_reactions_count(chat_view_index):
self.chats[chat_view_index].just_fyi("Checking reactions count for each group member and admin")
chat_element = self.chats[chat_view_index].chat_element_by_text(message)
chat_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2)
chat_element.emojis_below_message(emoji="love").wait_for_element_text(1)
chat_element.emojis_below_message(emoji="laugh").wait_for_element_text(1)

self.loop.run_until_complete(run_in_parallel((
(_check_reactions_count, {'chat_view_index': 0}),
(_check_reactions_count, {'chat_view_index': 1}),
(_check_reactions_count, {'chat_view_index': 2})
)))

self.chats[0].just_fyi("Admin checks info about voted users")
self.chats[0].chat_element_by_text(message).emojis_below_message(
Expand Down Expand Up @@ -163,15 +169,23 @@ def test_group_chat_reactions(self):
self.chats[2].add_remove_same_reaction(message=message, emoji="laugh")
self.chats[2].add_remove_same_reaction(message=message, emoji="sad")

for i in range(3):
self.chats[i].just_fyi("Checking reactions count for each group member and admin after they were changed")
message_element = self.chats[i].chat_element_by_text(message)
def _check_reactions_count_after_change(chat_view_index):
self.chats[chat_view_index].just_fyi(
"Checking reactions count for each group member and admin after they were changed")
chat_element = self.chats[chat_view_index].chat_element_by_text(message)
try:
message_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
message_element.emojis_below_message(emoji="love").wait_for_element_text(1)
message_element.emojis_below_message(emoji="sad").wait_for_element_text(2)
chat_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
chat_element.emojis_below_message(emoji="love").wait_for_element_text(1)
chat_element.emojis_below_message(emoji="sad").wait_for_element_text(2)
except (Failed, NoSuchElementException):
self.errors.append("Incorrect reactions count for %s after changing the reactions" % self.usernames[i])
self.errors.append(
"Incorrect reactions count for %s after changing the reactions" % self.usernames[chat_view_index])

self.loop.run_until_complete(run_in_parallel((
(_check_reactions_count_after_change, {'chat_view_index': 0}),
(_check_reactions_count_after_change, {'chat_view_index': 1}),
(_check_reactions_count_after_change, {'chat_view_index': 2})
)))

self.chats[0].just_fyi("Admin relogins")
self.chats[0].reopen_app()
Expand Down Expand Up @@ -286,11 +300,16 @@ def test_group_chat_send_image_save_and_share(self):

@marks.testrail_id(702808)
def test_group_chat_offline_pn(self):
for i in range(1, 3):
self.homes[i].navigate_back_to_home_view()
self.homes[i].chats_tab.click()
self.homes[i].groups_tab.click()
self.homes[i].get_chat(self.chat_name).click()
def _proceed_to_chat(index):
self.homes[index].navigate_back_to_home_view()
self.homes[index].chats_tab.click()
self.homes[index].groups_tab.click()
self.homes[index].get_chat(self.chat_name).click()

self.loop.run_until_complete(run_in_parallel((
(_proceed_to_chat, {'index': 1}),
(_proceed_to_chat, {'index': 2})
)))

message_1, message_2 = 'message from old member', 'message from new member'

Expand Down Expand Up @@ -318,11 +337,18 @@ def test_group_chat_offline_pn(self):
self.homes[0].chats_tab.click()
self.homes[0].get_chat(self.chat_name).click()

self.homes[0].just_fyi("check that messages are shown for every member")
for i in range(3):
for message in (message_1, message_2):
if not self.chats[i].chat_element_by_text(message).is_element_displayed(30):
self.errors.append('%s if not shown for device %s' % (message, str(i)))
def _check_messages(index):
self.chats[index].just_fyi("Check that messages are shown for user %s" % self.usernames[index])
for message_text in (message_1, message_2):
if not self.chats[index].chat_element_by_text(message_text).is_element_displayed(30):
self.errors.append('%s if not shown for device %s' % (message_text, index))

self.loop.run_until_complete(run_in_parallel((
(_check_messages, {'index': 0}),
(_check_messages, {'index': 1}),
(_check_messages, {'index': 2})
)))

self.errors.verify_no_errors()

@marks.testrail_id(702732)
Expand Down Expand Up @@ -381,28 +407,33 @@ def test_group_chat_pin_messages(self):
self.chats[1].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)):
self.errors.append("Message 4 is not pinned in group chat after unpinning previous one")

self.chats[0].just_fyi("Check pinned messages count and content")
for chat_number, group_chat in enumerate([self.chats[0], self.chats[1]]):
count = group_chat.pinned_messages_count.text
def _check_pinned_messages(index):
self.chats[index].just_fyi("Check pinned messages count and content for user %s" % self.usernames[index])
count = self.chats[index].pinned_messages_count.text
if count != '3':
self.errors.append(
"Pinned messages count %s doesn't match expected 3 for user %s" % (count, chat_number + 1))
group_chat.pinned_messages_count.click()
for message in self.message_1, self.message_3, self.message_4:
pinned_by = group_chat.pinned_messages_list.get_message_pinned_by_text(message)
"Pinned messages count %s doesn't match expected 3 for user %s" % (count, self.usernames[index]))
self.chats[index].pinned_messages_count.click()
for message_text in self.message_1, self.message_3, self.message_4:
pinned_by = self.chats[index].pinned_messages_list.get_message_pinned_by_text(message_text)
if pinned_by.is_element_displayed():
text = pinned_by.text.strip()
expected_text = "You" if chat_number == 0 else self.usernames[0]
expected_text = "You" if index == 0 else self.usernames[0]
if text != expected_text:
self.errors.append(
"Pinned by '%s' doesn't match expected '%s' for user %s" % (
text, expected_text, chat_number + 1)
text, expected_text, self.usernames[index])
)
else:
self.errors.append(
"Message '%s' is missed on Pinned messages list for user %s" % (message, chat_number + 1)
"Message '%s' is missed on Pinned messages list for user %s" % (message, self.usernames[index])
)

self.loop.run_until_complete(run_in_parallel((
(_check_pinned_messages, {'index': 0}),
(_check_pinned_messages, {'index': 1})
)))

self.errors.verify_no_errors()

@marks.testrail_id(703495)
Expand Down
108 changes: 68 additions & 40 deletions test/appium/tests/critical/chats/test_public_chat_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,6 @@ def prepare_devices(self):
self.community_view = self.home.get_community_view()
self.channel = self.community_view.get_channel(self.channel_name).click()

@marks.testrail_id(703503)
@marks.xfail(reason="Curated communities not loading, https://github.com/status-im/status-mobile/issues/17852",
run=False)
def test_community_discovery(self):
self.home.navigate_back_to_home_view()
self.home.communities_tab.click()
self.home.discover_communities_button.click()
self.home.community_card_item.wait_for_visibility_of_element(30)

if len(self.home.community_card_item.find_elements()) > 1:
contributors_test_community_attributes = "Test Community", 'Open for anyone', 'Web3', 'Software dev'
for text in contributors_test_community_attributes:
if not self.home.element_by_text(text).is_element_displayed(10):
self.errors.append("'%s' text is not in Discovery!" % text)
self.home.element_by_text(contributors_test_community_attributes[0]).click()
element_templates = {
self.community_view.join_button: 'discovery_join_button.png',
self.community_view.get_channel_avatar(): 'discovery_general_channel.png',
}
for element, template in element_templates.items():
if element.is_element_differs_from_template(template):
element.save_new_screenshot_of_element('%s_different.png' % template.split('.')[0])
self.errors.append(
"Element %s is different from expected template %s!" % (element.locator, template))
self.community_view.navigate_back_to_home_view()
self.home.communities_tab.click()
self.home.discover_communities_button.click()
self.home.community_card_item.wait_for_visibility_of_element(30)
self.home.swipe_up()

status_ccs_community_attributes = '(old) Status CCs', 'Community for Status CCs', 'Ethereum', \
'Software dev', 'Web3'
for text in status_ccs_community_attributes:
if not self.community_view.element_by_text(text).is_element_displayed(10):
self.errors.append("'%s' text is not shown for (old) Status CCs!" % text)
self.errors.verify_no_errors()

@marks.testrail_id(702846)
def test_community_navigate_to_channel_when_relaunch(self):
text_message = 'some_text'
Expand Down Expand Up @@ -261,7 +224,7 @@ def test_restore_multiaccount_with_waku_backup_remove_switch(self):
self.home.just_fyi("Check that can remove user from logged out state")
self.home.reopen_app(sign_in=False)
self.sign_in.show_profiles_button.wait_and_click()
user_card = self.sign_in.get_user(username=self.username)
user_card = self.sign_in.get_user_profile_by_name(username=self.username)
user_card.open_user_options()
self.sign_in.remove_profile_button.click()
if not self.sign_in.element_by_translation_id("remove-profile-confirm-message").is_element_displayed(30):
Expand All @@ -276,6 +239,67 @@ def test_restore_multiaccount_with_waku_backup_remove_switch(self):

self.errors.verify_no_errors()

@marks.testrail_id(703503)
def test_community_discovery(self):
try:
# workaround for case if a user is logged out in the previous test
self.sign_in.get_user_profile_by_index(index=1).click()
self.sign_in.sign_in()
except NoSuchElementException:
pass
self.home.navigate_back_to_home_view()
self.home.just_fyi("Turn off testnet in the profile settings")
profile = self.home.profile_button.click()
profile.advanced_button.scroll_and_click()
profile.testnet_mode_toggle.click()
profile.ok_button.click()
self.sign_in.sign_in()

self.home.just_fyi("Check Discover Communities content")
self.home.communities_tab.click()
self.home.discover_communities_button.click()
self.home.community_card_item.wait_for_elements(seconds=120)

expected_communities = {
' 0xUX': ['Design', 'Ethereum', 'Collaboration'],
'Status': ['Web3', 'Blockchain', 'Ethereum'],
'Status Inu': ['News', 'Social', 'Web3'],
}
for community_name, tags in expected_communities.items():
self.home.just_fyi("Check %s community tags in the Discover communities screen" % community_name)
card = self.home.get_discover_community_card_by_name(community_name=community_name)
try:
card.wait_for_visibility_of_element(30)
if community_name == 'Status':
card.swipe_to_web_element()
missing_tags = list()
for text in tags:
try:
card.get_child_element_by_text(text=text).wait_for_element()
except TimeoutException:
missing_tags.append(text)
if missing_tags:
self.errors.append("Community '%s' is missing tag(s) %s." % (community_name, ','.join(tags)))

if community_name == 'Status':
self.home.just_fyi("Check Status community screen")
card.click()
if self.community_view.join_button.is_element_differs_from_template(
'status_community_join_button.png'):
self.errors.append("Status community Join button is different from expected template.")
if self.community_view.community_logo.is_element_differs_from_template('status_community_logo.png'):
self.errors.append("Status community logo is different from expected template.")

self.community_view.close_community_view_button.click()
self.home.discover_communities_button.click()
self.home.swipe_up()

except TimeoutException:
self.errors.append("Community '%s' is not in the Discover Communities list." % community_name)

self.errors.verify_no_errors()
# Note: this test should always be the LAST ONE in the group because it turns on mainnet in the app!


@pytest.mark.xdist_group(name="new_three_2")
@marks.new_ui_critical
Expand Down Expand Up @@ -998,6 +1022,8 @@ def test_community_leave(self):
self.errors.verify_no_errors()

@marks.testrail_id(702948)
@marks.xfail(reason="Can't enter channel after community is fetched for the first time, " \
"https://github.com/status-im/status-mobile/issues/20395")
def test_community_hashtag_links_to_community_channels(self):
for home in self.homes:
home.navigate_back_to_home_view()
Expand Down Expand Up @@ -1098,6 +1124,8 @@ def test_community_hashtag_links_to_community_channels(self):
self.errors.verify_no_errors()

@marks.testrail_id(703629)
@marks.xfail(reason="Can't enter channel after community is fetched for the first time, " \
"https://github.com/status-im/status-mobile/issues/20395")
def test_community_join_when_node_owner_offline(self):
for home in self.homes:
home.navigate_back_to_home_view()
Expand Down Expand Up @@ -1143,8 +1171,8 @@ def test_community_join_when_node_owner_offline(self):
general_channel.click()
if not self.channel_2.chat_element_by_text(control_message_general_chat).is_element_displayed(30):
self.errors.append(
"Message in community channel is not visible for user before join, it was indicated as" \
"%s sent for the sender before he went offline" % "" if message_sent else "not")
"Message in community channel is not visible for user before join, it was indicated as " \
"%s sent for the sender before he went offline" % ("" if message_sent else "not"))
else:
self.errors.append("Community channel is not displayed for user before join")
self.community_2.toast_content_element.wait_for_invisibility_of_element(30)
Expand Down
3 changes: 3 additions & 0 deletions test/appium/views/base_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ def get_translation_by_key(key):
def exclude_emoji(value):
return 'emoji' if value in emoji.UNICODE_EMOJI else value

def get_child_element_by_text(self, text: str):
return BaseElement(self.driver, prefix=self.locator, xpath="//*[@text='%s']" % text)


class EditBox(BaseElement):

Expand Down
6 changes: 3 additions & 3 deletions test/appium/views/chat_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,10 @@ def __init__(self, driver):

#### NEW UI
# Communities initial page
self.close_community_view_button = Button(
self.driver,
xpath="//*[@content-desc='community-options-for-community']/../*[1]//android.widget.ImageView")
self.close_community_view_button = Button(self.driver, accessibility_id="back-button")
self.community_title = Text(self.driver, accessibility_id="community-title")
self.community_logo = BaseElement(
self.driver, xpath="//*[@content-desc='community-title']/preceding-sibling::*/android.widget.ImageView")
self.community_description_text = Text(self.driver, accessibility_id="community-description-text")
self.community_status_joined = Text(self.driver, accessibility_id="status-tag-positive")
self.community_status_pending = Text(self.driver, accessibility_id="status-tag-pending")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8422de0

Please sign in to comment.