e2e: test for sending image with camera

This commit is contained in:
Yevheniia Berdnyk 2023-10-20 19:56:42 +03:00
parent 4a874ce48d
commit 25381b601f
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
3 changed files with 33 additions and 6 deletions

View File

@ -172,11 +172,12 @@
[edit] [edit]
(let [images-count (count (vals (rf/sub [:chats/sending-image])))] (let [images-count (count (vals (rf/sub [:chats/sending-image])))]
[quo/composer-button [quo/composer-button
{:on-press (if edit {:on-press (if edit
#(js/alert "This feature is temporarily unavailable in edit mode.") #(js/alert "This feature is temporarily unavailable in edit mode.")
#(go-to-camera images-count)) #(go-to-camera images-count))
:icon :i/camera :accessibility-label :camera-button
:container-style {:margin-right 12}}])) :icon :i/camera
:container-style {:margin-right 12}}]))
(defn open-photo-selector (defn open-photo-selector

View File

@ -548,6 +548,22 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase
self.message_1, self.message_2, self.message_3, self.message_4 = \ self.message_1, self.message_2, self.message_3, self.message_4 = \
"Message 1", "Message 2", "Message 3", "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.testrail_id(702783)
@marks.xfail(reason="Data delivery issue") @marks.xfail(reason="Data delivery issue")
def test_1_1_chat_is_shown_message_sent_delivered_from_offline(self): def test_1_1_chat_is_shown_message_sent_delivered_from_offline(self):

View File

@ -801,7 +801,8 @@ class ChatView(BaseView):
# Images # Images
self.show_images_button = Button(self.driver, accessibility_id="open-images-button") 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.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_confirm_selection_button = Button(self.driver, accessibility_id="confirm-selection")
self.images_area_in_gallery = Button(self.driver, self.images_area_in_gallery = Button(self.driver,
@ -1231,6 +1232,15 @@ class ChatView(BaseView):
self.chat_message_input.send_keys(description) self.chat_message_input.send_keys(description)
self.send_message_button.click() 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 @staticmethod
def get_resolved_chat_key(username, chat_key): def get_resolved_chat_key(username, chat_key):
return '%s%s%s' % (username, chat_key[:6], chat_key[-4:]) return '%s%s%s' % (username, chat_key[:6], chat_key[-4:])