From 1a61ae4b734d333cf47c1a34555e147e318c8c07 Mon Sep 17 00:00:00 2001 From: Serhy Date: Thu, 19 Dec 2019 11:19:01 +0200 Subject: [PATCH] Fix e2e update Dapps tp Browser Signed-off-by: Serhy --- .../atomic/account_management/test_profile.py | 1 - .../dapps_and_browsing/test_browsing.py | 2 +- test/appium/views/base_view.py | 19 ++++++++++++++----- test/appium/views/profile_view.py | 1 - 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 95d01d02b2..7f042117c4 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -299,7 +299,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase): home.share_via_messenger() home.find_text_part("Get Status at http://status.im") - @marks.testrail_id(5431) @marks.medium def test_add_custom_network(self): diff --git a/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py b/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py index 6461e28f5d..5a2fd10eb1 100644 --- a/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py +++ b/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py @@ -28,7 +28,7 @@ class TestBrowsing(SingleDeviceTestCase): browsing_view = daap_view.open_url('invalid.takoe') browsing_view.find_text_part('Unable to load page') browsing_view.cross_icon.click() - if home_view.element_by_text('Browser').is_element_displayed(): + if home_view.element_by_text('Recent').is_element_displayed(): self.driver.fail('Browser entity is shown for an invalid link') @marks.testrail_id(6210) diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 3be9933ce3..61871090a4 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -359,10 +359,11 @@ class BaseView(object): 'text': BaseText } - def accept_agreements(self): iterations = int() - while iterations <= 2 and (self.ok_button.is_element_displayed(2) or + self.close_native_device_dialog("Messages") + self.close_native_device_dialog("Youtube") + while iterations <= 1 and (self.ok_button.is_element_displayed(2) or self.continue_button.is_element_displayed(2)): for button in self.ok_button, self.continue_button: try: @@ -372,6 +373,16 @@ class BaseView(object): pass iterations += 1 + def close_native_device_dialog(self, alert_text_part): + element = self.element_by_text_part(alert_text_part) + if element.is_element_present(1): + self.driver.info("Dismissing %s alert" % alert_text_part) + self.dismiss_alert() + + def dismiss_alert(self): + self.driver.info("Dismiss alert") + self.driver.switch_to.alert().dismiss() + @property def logcat(self): logcat = self.driver.get_log("logcat") @@ -619,9 +630,7 @@ class BaseView(object): def toggle_airplane_mode(self): self.airplane_mode_button.click() - mms_service = self.element_by_text_part("MmsService") - if mms_service.is_element_displayed(): - self.driver.switch_to.alert().dismiss() + self.close_native_device_dialog("MmsService") def toggle_mobile_data(self): self.driver.start_activity(app_package='com.android.settings', app_activity='.Settings') diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index dbac9776fe..502dddea9b 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -657,7 +657,6 @@ class ProfileView(BaseView): def add_custom_network(self): self.advanced_button.click() - self.debug_mode_toggle.click() self.network_settings_button.scroll_to_element() self.network_settings_button.click() self.plus_button.click_until_presence_of_element(self.ropsten_chain_button)