From 25381b601f0f3d743ef36575cacdc618b2b3decc Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Fri, 20 Oct 2023 19:56:42 +0300 Subject: [PATCH] e2e: test for sending image with camera --- .../contexts/chat/composer/actions/view.cljs | 11 ++++++----- .../critical/chats/test_1_1_public_chats.py | 16 ++++++++++++++++ test/appium/views/chat_view.py | 12 +++++++++++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/status_im2/contexts/chat/composer/actions/view.cljs b/src/status_im2/contexts/chat/composer/actions/view.cljs index e492ff4980..10614140b2 100644 --- a/src/status_im2/contexts/chat/composer/actions/view.cljs +++ b/src/status_im2/contexts/chat/composer/actions/view.cljs @@ -172,11 +172,12 @@ [edit] (let [images-count (count (vals (rf/sub [:chats/sending-image])))] [quo/composer-button - {:on-press (if edit - #(js/alert "This feature is temporarily unavailable in edit mode.") - #(go-to-camera images-count)) - :icon :i/camera - :container-style {:margin-right 12}}])) + {:on-press (if edit + #(js/alert "This feature is temporarily unavailable in edit mode.") + #(go-to-camera images-count)) + :accessibility-label :camera-button + :icon :i/camera + :container-style {:margin-right 12}}])) (defn open-photo-selector diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index aaeffa6f70..6ed2ce5b7e 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -548,6 +548,22 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase self.message_1, self.message_2, self.message_3, self.message_4 = \ "Message 1", "Message 2", "Message 3", "Message 4" + @marks.skip # ToDo: can't be implemented with current SauceLabs emulators screen resolution + def test_1_1_chat_send_image_with_camera(self): + self.chat_1.just_fyi("Device 1 sends a camera image") + image_description = "camera test" + self.chat_1.send_image_with_camera(description=image_description) + for chat in self.chat_1, self.chat_2: + chat_name = "sender" if chat.driver.number == 0 else "receiver" + chat.just_fyi("%s checks image message" % chat_name.capitalize()) + chat_element = chat.chat_element_by_text(image_description) + if chat_element.is_element_displayed(30): + if not chat_element.image_in_message.is_element_image_similar_to_template('saucelabs_camera_image.png'): + self.errors.append("Not expected image is shown to the %s." % chat_name) + else: + self.errors.append("Message with camera image is not shown in chat for %s" % chat_name) + self.errors.verify_no_errors() + @marks.testrail_id(702783) @marks.xfail(reason="Data delivery issue") def test_1_1_chat_is_shown_message_sent_delivered_from_offline(self): diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 041602913e..a0e0bcd43f 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -801,7 +801,8 @@ class ChatView(BaseView): # Images self.show_images_button = Button(self.driver, accessibility_id="open-images-button") - self.take_photo_button = Button(self.driver, accessibility_id="take-picture") + self.take_photo_button = Button(self.driver, accessibility_id="camera-button") + self.snap_button = Button(self.driver, accessibility_id="snap") self.image_from_gallery_button = Button(self.driver, accessibility_id="open-gallery") self.images_confirm_selection_button = Button(self.driver, accessibility_id="confirm-selection") self.images_area_in_gallery = Button(self.driver, @@ -1231,6 +1232,15 @@ class ChatView(BaseView): self.chat_message_input.send_keys(description) self.send_message_button.click() + def send_image_with_camera(self, description=None): + self.take_photo_button.click() + self.allow_button.click_if_shown() + self.snap_button.click() + self.element_by_translation_id("use-photo").click() + if description: + self.chat_message_input.send_keys(description) + self.send_message_button.click() + @staticmethod def get_resolved_chat_key(username, chat_key): return '%s • %s…%s' % (username, chat_key[:6], chat_key[-4:])