e2e: android14

This commit is contained in:
Yevheniia Berdnyk 2023-12-09 02:25:19 +02:00
parent 602b27105b
commit 711e64bc75
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
16 changed files with 82 additions and 88 deletions

View File

@ -27,11 +27,12 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
@marks.testrail_id(702850)
def test_activity_center_contact_request_decline(self):
app_package = self.device_1.driver.current_package
self.device_1.put_app_to_background()
self.device_2.just_fyi('Device2 sends a contact request to Device1 via Paste button and check user details')
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.new_chat_button.click_until_presence_of_element(self.home_2.add_a_contact_chat_bottom_sheet_button)
self.home_2.add_a_contact_chat_bottom_sheet_button.click()
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.element_by_translation_id("paste").click()
self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10)
if self.home_2.user_name_text.is_element_displayed(30):
@ -52,7 +53,8 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.device_1.open_notification_bar()
if self.home_1.element_by_text_part("Please add me to your contacts").is_element_displayed():
self.errors.append("Push notification with text was received for new message in activity centre")
self.device_1.click_system_back_button(2)
self.device_1.click_system_back_button()
self.device_1.driver.activate_app(app_package)
self.device_1.just_fyi('Device1 verifies pending contact request')
self.home_1.contacts_tab.click()
@ -93,10 +95,10 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.device_2.create_user(username=new_username, first_user=False)
self.device_2.just_fyi('Device2 sends a contact request to Device1 via Paste button and check user details')
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.chats_tab.click()
self.home_2.new_chat_button.click_until_presence_of_element(self.home_2.add_a_contact_chat_bottom_sheet_button)
self.home_2.add_a_contact_chat_bottom_sheet_button.click()
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.element_by_translation_id("paste").click()
self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10)
chat = self.home_2.get_chat_view()
@ -119,7 +121,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_1.just_fyi("Check that can accept contact request from read notifications")
self.home_1.activity_unread_filter_button.click()
cr_element.swipe_right_on_element()
cr_element.message_body.swipe_right_on_element()
self.home_1.activity_notification_swipe_button.click_inside_element_by_coordinate(rel_x=0.5, rel_y=0.5)
self.home_1.close_activity_centre.click()
self.home_1.contacts_tab.click()
@ -145,10 +147,10 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.device_2.create_user(username=new_username_2, first_user=False)
self.device_2.just_fyi('Device2 sends a contact request to Device1 using his profile link')
self.home_2.driver.set_clipboard_text("https://status.app/u#" + self.public_key_1)
self.home_2.chats_tab.click()
self.home_2.new_chat_button.click_until_presence_of_element(self.home_2.add_a_contact_chat_bottom_sheet_button)
self.home_2.add_a_contact_chat_bottom_sheet_button.click()
self.home_2.driver.set_clipboard_text("https://status.app/u#" + self.public_key_1)
self.home_2.element_by_translation_id("paste").click()
self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10)
if self.home_2.user_name_text.is_element_displayed(30):
@ -168,9 +170,9 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.just_fyi("Device 2 checks that can find already added contact using public key")
self.home_2.navigate_back_to_home_view()
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.new_chat_button.click_until_presence_of_element(self.home_2.add_a_contact_chat_bottom_sheet_button)
self.home_2.add_a_contact_chat_bottom_sheet_button.click()
self.home_2.driver.set_clipboard_text(self.public_key_1)
self.home_2.element_by_translation_id("paste").click()
self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10)
if self.home_2.user_name_text.is_element_displayed(30):
@ -251,17 +253,15 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
@marks.testrail_id(702936)
def test_navigation_jump_to(self):
self.community_1.just_fyi("Check Jump to screen and redirect on tap")
self.community_1.jump_to_button.click()
self.community_1.click_on_floating_jump_to()
for card in (self.community_name, self.username_2):
if not self.community_1.element_by_text_part(card).is_element_displayed(20):
self.errors.append("Card %s is not shown on Jump to screen!" % card)
self.community_1.element_by_translation_id("community-channel").click()
if not self.channel_1.chat_element_by_text(self.text_message).is_element_displayed(20):
self.errors.append("User was not redirected to community channel after tapping on community channel card!")
element = self.channel_1.jump_to_button.find_element()
self.channel_1.click_system_back_button()
self.channel_1.wait_for_staleness_of_element(element)
self.community_1.jump_to_button.click()
self.community_1.click_on_floating_jump_to()
self.community_1.element_by_text_part(self.username_2).click()
if not self.chat_1.chat_element_by_text(self.one_to_one_message).is_element_displayed(20):
self.errors.append("User was not redirected to 1-1 chat after tapping card!")
@ -315,7 +315,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_2.chats_tab.is_element_displayed() # just saving device 2 session from expiration
self.home_1.just_fyi("Mark it as read and check filter")
reply_element.swipe_right_on_element()
reply_element.title.swipe_right_on_element(width_percentage=6)
self.home_1.activity_notification_swipe_button.click()
if reply_element.is_element_displayed(2):
self.errors.append("Message is not marked as read!")
@ -326,7 +326,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_2.chats_tab.is_element_displayed() # just saving device 2 session from expiration
self.home_1.just_fyi("Mark it as unread and check filter via right swipe")
reply_element.swipe_right_on_element()
reply_element.title.swipe_right_on_element(width_percentage=6)
self.home_1.activity_notification_swipe_button.click()
if not reply_element.unread_indicator.is_element_displayed():
self.errors.append("No unread dot is shown on activity center element after marking it as unread!")
@ -462,7 +462,7 @@ class TestActivityMultipleDevicePRTwo(MultipleSharedDeviceTestCase):
self.errors.append("Expected title is not shown, '%s' is instead!" % reply_element.title)
if not reply_element.unread_indicator.is_element_displayed():
self.errors.append("No unread dot is shown on activity center element!")
reply_element.swipe_right_on_element()
reply_element.title.swipe_right_on_element(width_percentage=2.5)
self.home_1.activity_notification_swipe_button.click()
self.home_1.close_activity_centre.click()

View File

@ -67,7 +67,7 @@ def get_capabilities_sauce_lab():
caps['appium:app'] = 'sauce-storage:' + test_suite_data.apk_name
caps['appium:deviceName'] = 'Android GoogleAPI Emulator'
caps['appium:deviceOrientation'] = 'portrait'
caps['appium:platformVersion'] = '10.0'
caps['appium:platformVersion'] = '14.0'
caps['appium:automationName'] = 'UiAutomator2'
caps['appium:newCommandTimeout'] = 600
caps['appium:idleTimeout'] = 1000
@ -319,7 +319,7 @@ def create_shared_drivers(quantity):
test_suite_data.current_test.testruns[-1].error = "Not all %s drivers are created" % quantity
return drivers, loop
except (MaxRetryError, AttributeError) as e:
test_suite_data.current_test.testruns[-1].error += str(e)
test_suite_data.current_test.testruns[-1].error = str(e)
raise e

View File

@ -3,6 +3,7 @@ import random
import emoji
import pytest
from _pytest.outcomes import Failed
from appium.webdriver.connectiontype import ConnectionType
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from tests import marks, run_in_parallel, transl
@ -268,7 +269,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self):
self.home_1.jump_to_messages_home()
self.home_1.profile_button.click()
self.profile_1.edit_profile_picture('sauce_logo.png')
self.profile_1.edit_profile_picture(image_index=2)
self.profile_1.navigate_back_to_home_view()
self.profile_1.chats_tab.click()
@ -321,6 +322,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.home_1.chats_tab.click()
self.device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text")
app_package = self.device_2.driver.current_package
self.device_2.put_app_to_background()
self.device_2.open_notification_bar()
if not self.chat_1.chat_message_input.is_element_displayed():
@ -334,7 +336,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.device_2.just_fyi("Check text push notification and tap it")
if not self.home_2.get_pn(message):
self.device_2.click_system_back_button()
self.device_2.status_in_background_button.click()
self.device_2.driver.activate_app(app_package)
self.device_2.driver.fail("Push notification with text was not received")
chat_2 = self.device_2.click_upon_push_notification_by_text(message)
@ -348,7 +350,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.device_1.just_fyi("Device 1 checks PN with emoji")
if not self.device_1.element_by_text_part(emoji_unicode).is_element_displayed(60):
self.device_1.click_system_back_button()
self.device_1.status_in_background_button.click()
self.device_2.driver.activate_app(app_package)
self.device_1.driver.fail("Push notification with emoji was not received")
chat_1 = self.device_1.click_upon_push_notification_by_text(emoji_unicode)
@ -416,9 +418,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
chat.hide_keyboard_if_shown()
chat.chat_element_by_text(image_description).image_in_message.click()
chat.share_image_icon_button.click()
chat.element_starts_with_text("Gmail").click()
chat.element_starts_with_text("Drive").click()
try:
chat.wait_for_current_package_to_be('com.google.android.gm')
chat.wait_for_current_package_to_be('com.google.android.apps.docs')
except TimeoutException:
self.errors.append(
"%s can't share an image via Gmail." % ("Sender" if chat is self.chat_1 else "Receiver"))
@ -444,7 +446,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
for chat in self.chat_1, self.chat_2:
chat.just_fyi("Check that image is saved in gallery")
chat.show_images_button.click()
chat.allow_button.click_if_shown()
chat.allow_all_button.click_if_shown()
if not chat.get_image_by_index(0).is_element_image_similar_to_template("saucelabs_sauce_gallery.png"):
self.errors.append(
"Image is not saved to gallery for %s." % ("sender" if chat is self.chat_1 else "receiver"))
@ -458,6 +460,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.chat_2.jump_to_card_by_text(self.username_1)
if not self.chat_1.chat_message_input.is_element_displayed():
self.chat_1.jump_to_card_by_text(self.username_2)
app_package = self.chat_1.driver.current_package
self.device_2.just_fyi("Verify Device1 can not edit and delete received message from Device2")
message_after_edit_1_1 = 'smth I should edit'
@ -504,15 +507,13 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.chat_2.chat_element_by_text(message_to_delete).wait_for_sent_state()
if not self.home_1.get_pn(message_to_delete):
self.home_1.click_system_back_button()
self.home_1.status_in_background_button.click()
self.device_2.driver.activate_app(app_package)
self.errors.append("Push notification doesn't appear")
self.chat_2.delete_message_in_chat(message_to_delete)
pn_to_disappear = self.home_1.get_pn(message_to_delete)
if pn_to_disappear:
if not pn_to_disappear.is_element_disappeared(90):
self.errors.append("Push notification was not removed after initial message deletion")
self.device_1.navigate_back_to_home_view()
self.device_2.navigate_back_to_home_view()
self.errors.verify_no_errors()
@ -573,12 +574,8 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase
# self.chat_2.jump_to_card_by_text(self.username_1)
# self.chat_1.jump_to_card_by_text(self.username_2)
self.home_1.just_fyi('Turn on airplane mode and check that offline status is shown on home view')
app_package = self.home_1.driver.current_package
for home in self.homes:
home.toggle_airplane_mode()
if not home.chats_tab.is_element_displayed() and not home.chat_floating_screen.is_element_displayed():
home.driver.activate_app(app_package)
SignInView(home.driver).sign_in()
home.driver.set_network_connection(ConnectionType.AIRPLANE_MODE)
# Not implemented yet
# self.home_1.connection_offline_icon.wait_and_click(20)
@ -600,13 +597,8 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase
self.errors.append('Message status is not "Sending", it is "%s"!' % status)
self.home_2.just_fyi('Device2 goes back online and checks that status of the message is changed to "delivered"')
for i, home in enumerate(self.homes):
home.toggle_airplane_mode()
if not home.chats_tab.is_element_displayed() and not home.chat_floating_screen.is_element_displayed():
home.driver.activate_app(app_package)
SignInView(home.driver).sign_in()
home.chats_tab.click()
home.get_chat(self.username_2 if i == 0 else self.username_1).click()
for home in self.homes:
home.driver.set_network_connection(ConnectionType.ALL_NETWORK_ON)
self.home_1.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched')
if not self.chat_1.chat_element_by_text(message_1).is_element_displayed(120):

View File

@ -2,6 +2,7 @@ import datetime
import pytest
from _pytest.outcomes import Failed
from appium.webdriver.connectiontype import ConnectionType
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from tests import marks, run_in_parallel, transl
@ -234,9 +235,9 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.chats[0].just_fyi("Admin opens the image and shares it")
self.chats[0].chat_element_by_text(image_description).image_in_message.click()
self.chats[0].share_image_icon_button.click()
self.chats[0].element_starts_with_text("Gmail").click()
self.chats[0].element_starts_with_text("Drive").click()
try:
self.chats[0].wait_for_current_package_to_be('com.google.android.gm')
self.chats[0].wait_for_current_package_to_be('com.google.android.apps.docs')
except TimeoutException:
self.errors.append("Admin can't share an image via Gmail.")
self.chats[0].navigate_back_to_chat_view()
@ -249,13 +250,13 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.chats[2].view_image_options_button.click()
self.chats[2].save_image_icon_button.click()
toast_element = self.chats[2].toast_content_element
if toast_element.is_element_displayed():
toast_element_text = toast_element.text
try:
toast_element_text = toast_element.wait_for_visibility_of_element().text
if toast_element_text != self.chats[2].get_translation_by_key("photo-saved"):
self.errors.append(
"Shown message '%s' doesn't match expected '%s' after saving an image for member_2." % (
toast_element_text, self.chats[2].get_translation_by_key("photo-saved")))
else:
except TimeoutException:
self.errors.append("Message about saving a photo is not shown for member_2.")
self.chats[2].navigate_back_to_chat_view()
@ -268,7 +269,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.chats[2].just_fyi("Member_2 checks that image was saved in gallery")
self.chats[2].show_images_button.click()
self.chats[2].allow_button.click_if_shown()
self.chats[2].allow_all_button.click_if_shown()
if not self.chats[2].get_image_by_index(0).is_element_image_similar_to_template("saucelabs_sauce_gallery.png"):
self.errors.append("Image is not saved to gallery for member_2.")
self.chats[2].navigate_back_to_chat_view()
@ -294,12 +295,12 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.homes[0].just_fyi("Put admin device to offline and send messages from members")
app_package = self.drivers[0].current_package
self.homes[0].toggle_airplane_mode()
self.homes[0].driver.set_network_connection(ConnectionType.AIRPLANE_MODE)
self.chats[1].send_message(message_1)
self.chats[2].send_message(message_2)
self.homes[0].just_fyi("Put admin device to online and check that messages and PNs will be fetched")
self.homes[0].toggle_airplane_mode()
self.homes[0].driver.set_network_connection(ConnectionType.ALL_NETWORK_ON)
self.homes[0].connection_offline_icon.wait_for_invisibility_of_element(60)
self.homes[0].open_notification_bar()
for message in (message_1, message_2):
@ -459,7 +460,8 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
if self.homes[1].element_starts_with_text("Muted until").is_element_displayed():
self.errors.append("Chat is still muted after timeout")
self.errors.verify_no_errors()
self.homes[1].click_system_back_button()
if self.homes[1].mute_chat_button.is_element_displayed():
self.homes[1].click_system_back_button()
unmuted_message = "Chat is unmuted now"
self.homes[2].just_fyi("Member 2 sends a message")

View File

@ -458,7 +458,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.channel_1.just_fyi("Check that image is saved in gallery")
self.channel_1.show_images_button.click()
self.channel_1.allow_button.click_if_shown()
self.channel_1.allow_all_button.click_if_shown()
if not self.channel_1.get_image_by_index(0).is_element_image_similar_to_template(
"sauce_dark_image_gallery.png"):
self.errors.append('Saved image is not shown in Recent')
@ -467,9 +467,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_2.just_fyi('Check share option on opened image')
self.channel_2.chat_element_by_text(image_description).image_in_message.click()
self.channel_2.share_image_icon_button.click()
self.channel_2.element_starts_with_text("Gmail").click()
self.channel_2.element_starts_with_text("Drive").click()
try:
self.channel_2.wait_for_current_package_to_be('com.google.android.gm')
self.channel_2.wait_for_current_package_to_be('com.google.android.apps.docs')
except TimeoutException:
self.errors.append("Can't share image")
self.channel_2.navigate_back_to_chat_view()
@ -661,20 +661,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_1.chats_tab.click()
if not self.home_1.element_by_translation_id("no-messages").is_element_displayed():
self.errors.append("1-1 chat from blocked user is not removed and messages home is not empty!")
self.chat_1.toggle_airplane_mode()
# workaround for app closed after airplane mode
if not self.home_1.chats_tab.is_element_displayed() and \
not self.chat_1.chat_floating_screen.is_element_displayed():
self.device_1.driver.activate_app(app_package)
self.device_1.sign_in()
self.chat_1.driver.set_network_connection(ConnectionType.AIRPLANE_MODE)
self.home_2.just_fyi('Send message to public chat while device 1 is offline')
message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked"
self.channel_2.send_message(message_blocked)
self.chat_1.just_fyi('Check that new messages from blocked user are not delivered')
self.chat_1.toggle_airplane_mode()
self.chat_1.driver.set_network_connection(ConnectionType.ALL_NETWORK_ON)
# self.home_1.jump_to_card_by_text('# %s' % self.channel_name)
self.home_1.communities_tab.click()
self.home_1.get_chat(self.community_name, community=True).click()
@ -1022,7 +1016,7 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
self.errors.append("Unread indicator is not shown in notifications on membership request")
self.home_1.open_activity_center_button.click()
reply_element = self.home_1.get_element_from_activity_center_view(self.username_2)
reply_element.swipe_right_on_element()
reply_element.title.swipe_right_on_element(width_percentage=2.5)
self.home_1.activity_notification_swipe_button.click()
self.home_1.close_activity_centre.click()

View File

@ -47,7 +47,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.device_1.just_fyi('Edit profile picture')
self.home_1.profile_button.double_click()
self.profile_1.edit_profile_picture('sauce_logo.png')
self.profile_1.edit_profile_picture(image_index=2)
self.profile_1.privacy_and_security_button.click()

View File

@ -59,7 +59,7 @@ class TestProfileGapsCommunityMediumMultipleDevicesMerged(MultipleSharedDeviceTe
profile_1 = self.home_1.profile_button.click()
profile_1.just_fyi("Set user Profile image from Gallery")
profile_1.edit_profile_picture(file_name=logo_default)
profile_1.edit_profile_picture(image_index=2)
self.home_1.profile_button.click()
profile_1.swipe_down()

View File

@ -144,7 +144,7 @@ class TestPairingSyncMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.device_1.just_fyi('Add profile picture')
self.home_1.profile_button.double_click()
self.profile_1.edit_profile_picture('sauce_logo.png')
self.profile_1.edit_profile_picture(image_index=2)
self.home_1.just_fyi("Main device adds a website to bookmarks")
dapp = self.home_1.dapp_tab_button.click()

View File

@ -500,7 +500,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
chat_1.send_message(message)
device_2.just_fyi("Set profile photo")
profile_2.edit_profile_picture(file_name='sauce_logo.png')
profile_2.edit_profile_picture(image_index=2)
device_1.just_fyi('Upgrading apps')
for device in (device_1, device_2):
device.upgrade_app()

View File

@ -295,7 +295,7 @@ class BaseElement(object):
width, height = size['width'], size['height']
self.driver.swipe(start_x=x + width * 0.75, start_y=y + height / 2, end_x=x, end_y=y + height / 2)
def swipe_right_on_element(self, width_percentage=0.75):
def swipe_right_on_element(self, width_percentage=0.9):
self.driver.info("Swiping right on element %s" % self.name)
location, size = self.get_element_coordinates()
x, y = location['x'], location['y']

View File

@ -277,6 +277,7 @@ class BaseView(object):
self.no_button = Button(self.driver, translation_id="no")
self.back_button = BackButton(self.driver)
self.allow_button = AllowButton(self.driver)
self.allow_all_button = Button(self.driver, xpath="//*[@text='Allow all']")
self.allow_all_the_time = Button(self.driver, xpath="//*[@text='Allow all the time']")
self.deny_button = Button(self.driver, translation_id="deny", uppercase=True)
self.continue_button = Button(self.driver, translation_id="continue", uppercase=True)
@ -843,7 +844,7 @@ class BaseView(object):
"Device %s: expected element is not stale after %s seconds" % (self.driver.number, seconds)) from None
def open_link_from_google_search_app(self, link_text: str, app_package: str):
Button(self.driver, xpath="//*[contains(@resource-id,'search_container_all_apps')]").click()
Button(self.driver, accessibility_id="Search").click()
EditBox(self.driver, xpath="//android.widget.EditText").send_keys(link_text)
self.driver.press_keycode(66)
text_to_click = "Status PR" if app_package.endswith(".pr") else "Status"

View File

@ -222,9 +222,12 @@ class ChatElementByText(Text):
break
else:
Text(self.driver, xpath=self.locator).click()
if status_element.is_element_displayed(2):
status = status_element.text
break
try:
if status_element.is_element_displayed(2):
status = status_element.text
break
except StaleElementReferenceException:
pass
time.sleep(2)
return status
@ -1044,7 +1047,8 @@ class ChatView(BaseView):
delete_button = self.element_by_translation_id("delete-for-everyone")
else:
delete_button = self.element_by_translation_id("delete-for-me")
self.chat_element_by_text(message).message_body.long_press_until_element_is_shown(delete_button)
# self.chat_element_by_text(message).message_body.long_press_until_element_is_shown(delete_button)
self.chat_element_by_text(message).message_body.long_press_element()
delete_button.click()
def copy_message_text(self, message_text):
@ -1227,6 +1231,7 @@ class ChatView(BaseView):
indexes = [0]
self.show_images_button.click()
self.allow_button.click_if_shown()
self.allow_all_button.click_if_shown()
[self.get_image_by_index(i).click() for i in indexes]
self.images_confirm_selection_button.click()
self.chat_message_input.send_keys(description)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 250 KiB

View File

@ -1,5 +1,7 @@
import time
from selenium.common import NoSuchElementException
from tests import common_password
from tests.base_test_case import AbstractTestCase
from views.base_element import Text, Button, EditBox, SilentButton
@ -205,8 +207,8 @@ class ProfileView(BaseView):
self.accept_photo_button = Button(self.driver, accessibility_id="Done")
# ENS
self.username_in_ens_chat_settings_text = EditBox(self.driver,
xpath="//*[@content-desc='chat-icon']/../../android.widget.TextView[2]")
self.username_in_ens_chat_settings_text = EditBox(
self.driver, xpath="//*[@content-desc='chat-icon']/../../android.widget.TextView[2]")
self.ens_usernames_button = ENSusernames(self.driver)
self.ens_name_in_share_chat_key_text = Text(self.driver, accessibility_id="ens-username")
@ -247,8 +249,8 @@ class ProfileView(BaseView):
self.profile_notifications_button = Button(self.driver, accessibility_id="notifications-settings-button")
self.profile_notifications_toggle_button = Button(self.driver,
accessibility_id="local-notifications-settings-button")
self.push_notification_toggle = Button(self.driver,
xpath="//*[@content-desc='notifications-button']//*[@content-desc='switch']")
self.push_notification_toggle = Button(
self.driver, xpath="//*[@content-desc='notifications-button']//*[@content-desc='switch']")
self.wallet_push_notifications = Button(self.driver, accessibility_id="notifications-button")
# Sync settings
@ -426,15 +428,14 @@ class ProfileView(BaseView):
self.driver.info("## Seed phrase is backed up!", device=False)
return recovery_phrase
def edit_profile_picture(self, file_name: str, update_by="Gallery"):
def edit_profile_picture(self, image_index: int, update_by="Gallery"):
self.driver.info("## Setting custom profile image", device=False)
if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
self.profile_picture.click()
self.profile_picture.template = file_name
if update_by == "Gallery":
self.select_from_gallery_button.click()
self.select_photo_from_gallery(file_name)
self.select_photo_from_gallery_by_index(image_index)
else:
## take by Photo
self.take_photo()
@ -455,15 +456,14 @@ class ProfileView(BaseView):
self.element_by_text("NEXT").click()
self.shutter_button.click()
def select_photo_from_gallery(self, file_name: str):
if self.allow_button.is_element_displayed(sec=5):
self.allow_button.click()
image_full_content = self.get_image_in_storage_by_name(file_name)
if not image_full_content.is_element_displayed(2):
self.show_roots_button.click()
for element_text in 'Images', 'DCIM':
self.element_by_text(element_text).click()
image_full_content.click()
def select_photo_from_gallery_by_index(self, image_index: int):
self.allow_button.click_if_shown()
self.allow_all_button.click_if_shown()
image_element = Button(self.driver, class_name="androidx.cardview.widget.CardView")
try:
image_element.find_elements()[image_index].click()
except IndexError:
raise NoSuchElementException("Image with index %s was not found" % image_index) from None
def logout(self):
self.driver.info("Logging out")
@ -474,13 +474,11 @@ class ProfileView(BaseView):
def mail_server_by_name(self, server_name):
return MailServerElement(self.driver, server_name)
def get_image_in_storage_by_name(self, image_name=str()):
return SilentButton(self.driver, xpath="//*[contains(@content-desc,'%s')]" % image_name)
def get_toggle_device_by_name(self, device_name):
self.driver.info("Selecting device '%s' for sync" % device_name)
return SilentButton(self.driver,
xpath="//android.widget.TextView[contains(@text,'%s')]/..//android.widget.CheckBox" % device_name)
return SilentButton(
self.driver,
xpath="//android.widget.TextView[contains(@text,'%s')]/..//android.widget.CheckBox" % device_name)
def discover_and_advertise_device(self, device_name):
self.driver.info("Discovering and advertising '%s'" % device_name)

View File

@ -249,6 +249,8 @@ class SignInView(BaseView):
self.identifiers_button.wait_and_click(30)
if enable_notifications:
self.enable_notifications_button.click_until_presence_of_element(self.start_button)
if self.allow_button.is_element_displayed():
self.allow_button.click()
else:
self.maybe_later_button.click_until_presence_of_element(self.start_button)
self.start_button.click()