diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 75d0ae780c50..4cc403f8eaab 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -1,6 +1,7 @@ import json import requests import logging +import itertools import emoji import base64 from os import environ @@ -73,8 +74,11 @@ def add_run(self, run_name): run = self.post('add_run/%s' % self.project_id, request_body) self.run_id = run['id'] - def get_cases(self, section_id): - return self.get('get_cases/%s&suite_id=%s§ion_id=%s' % (self.project_id, self.suite_id, section_id)) + def get_cases(self, section_ids): + test_cases = list() + for section_id in section_ids: + test_cases.append(self.get('get_cases/%s&suite_id=%s§ion_id=%s' % (self.project_id, self.suite_id, section_id))) + return itertools.chain.from_iterable(test_cases) def get_regression_cases(self, is_pr=False): test_cases = dict() @@ -84,7 +88,7 @@ def get_regression_cases(self, is_pr=False): test_cases['low'] = 737 case_ids = list() if is_pr: - case_ids = [case['id'] for case in self.get_cases(test_cases['critical'])] + case_ids = [case['id'] for case in self.get_cases([test_cases['critical'], test_cases['high']])] else: for phase in test_cases: for case in self.get_cases(test_cases[phase]): diff --git a/test/appium/tests/atomic/account_management/test_sign_in.py b/test/appium/tests/atomic/account_management/test_sign_in.py index 77bd9633499e..39f922778407 100644 --- a/test/appium/tests/atomic/account_management/test_sign_in.py +++ b/test/appium/tests/atomic/account_management/test_sign_in.py @@ -51,18 +51,14 @@ def test_password_in_logcat_sign_in(self): if values_in_logcat: self.driver.fail(values_in_logcat) - -@marks.all -@marks.sign_in -class TestSignInOffline(MultipleDeviceTestCase): - @marks.testrail_id(5327) @marks.medium def test_offline_login(self): - self.create_drivers(1) - sign_in = SignInView(self.drivers[0]) + sign_in = SignInView(self.driver) sign_in.create_user() + self.driver.close_app() sign_in.toggle_airplane_mode() + self.driver.launch_app() sign_in.accept_agreements() home = sign_in.sign_in() home.home_button.wait_for_visibility_of_element() diff --git a/test/appium/tests/atomic/chats/test_one_to_one.py b/test/appium/tests/atomic/chats/test_one_to_one.py index 4825a4af33a8..acfb1bce1568 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -46,7 +46,7 @@ def test_offline_messaging_1_1_chat(self): public_key_1 = home_1.get_public_key() home_1.home_button.click() - home_1.airplane_mode_button.click() # airplane mode on primary device + home_1.toggle_airplane_mode() # airplane mode on primary device profile_2 = home_2.profile_button.click() username_2 = profile_2.default_username_text.text @@ -55,9 +55,9 @@ def test_offline_messaging_1_1_chat(self): message_1 = 'test message' chat_2.chat_message_input.send_keys(message_1) chat_2.send_message_button.click() - chat_2.airplane_mode_button.click() # airplane mode on secondary device + chat_2.toggle_airplane_mode() # airplane mode on secondary device - home_1.airplane_mode_button.click() # turning on WiFi connection on primary device + home_1.toggle_airplane_mode() # turning on WiFi connection on primary device home_1.connection_status.wait_for_invisibility_of_element(30) chat_element = home_1.get_chat_with_user(username_2) @@ -65,8 +65,8 @@ def test_offline_messaging_1_1_chat(self): chat_1 = chat_element.click() chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element(2) - chat_2.airplane_mode_button.click() # turning on WiFi connection on secondary device - home_1.airplane_mode_button.click() # airplane mode on primary device + chat_2.toggle_airplane_mode() # turning on WiFi connection on secondary device + home_1.toggle_airplane_mode() # airplane mode on primary device chat_2.element_by_text('Connecting to peers...').wait_for_invisibility_of_element(60) chat_2.connection_status.wait_for_invisibility_of_element(60) @@ -74,7 +74,7 @@ def test_offline_messaging_1_1_chat(self): chat_2.chat_message_input.send_keys(message_2) chat_2.send_message_button.click() - home_1.airplane_mode_button.click() # turning on WiFi connection on primary device + home_1.toggle_airplane_mode() # turning on WiFi connection on primary device chat_1 = chat_element.click() chat_1.chat_element_by_text(message_2).wait_for_visibility_of_element(180) diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index ae9b00ff7be4..4f1c4e970d4d 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -608,16 +608,10 @@ def asset_by_name(self, asset_name): return AssetButton(self.driver, asset_name) def toggle_airplane_mode(self): - # opening android settings - self.driver.start_activity(app_package='com.android.settings', app_activity='.Settings') - network_and_internet = self.element_by_text('Network & Internet') - network_and_internet.wait_for_visibility_of_element() - network_and_internet.click() - airplane_mode = self.element_by_xpath('//*[@resource-id="android:id/switch_widget"]') - airplane_mode.wait_for_visibility_of_element() - airplane_mode.click() - # opening Status app - self.driver.launch_app() + 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() def toggle_mobile_data(self): self.driver.start_activity(app_package='com.android.settings', app_activity='.Settings')