diff --git a/.github/github-bot.yml b/.github/github-bot.yml index 2f85fac2a7c0..7cc39517159d 100644 --- a/.github/github-bot.yml +++ b/.github/github-bot.yml @@ -10,7 +10,7 @@ project-board: automated-tests: repo-full-name: 'status-im/status-react' - job-full-name: 'end-to-end-tests/status-app-end-to-end-tests' + job-full-name: 'end-to-end-tests/status-app-prs' kickoff-column-name: 'E2E Tests' github-team: diff --git a/ci/Jenkinsfile.nightly-end-to-end b/ci/tests/Jenkinsfile.e2e-nightly similarity index 100% rename from ci/Jenkinsfile.nightly-end-to-end rename to ci/tests/Jenkinsfile.e2e-nightly diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs new file mode 100644 index 000000000000..7bc96ea6087f --- /dev/null +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -0,0 +1,72 @@ +pipeline { + + agent { label 'linux1' } + + parameters { + string( + name: 'BRANCH_NAME', + description: 'Name of the branch to checkout and build.', + defaultValue: 'develop', + ) + string( + name: 'NETWORK', + description: 'Name of test network to use.', + defaultValue: 'ropsten', + ) + string( + name: 'TEST_MARKERS', + description: 'Marker expression for matching tests to run.', + defaultValue: 'critical or high', + ) + string( + name: 'APK_NAME', + description: 'Filename of APK uploaded to SauceLabs, path, or URL.', + ) + string( + name: 'PR_ID', + description: 'ID of the Pull Request triggering this build.', + ) + } + + options { + disableConcurrentBuilds() + } + + stages { + stage('Test') { + steps { script { + currentBuild.displayName = "PR-${params.PR_ID}" + + withCredentials([ + string( + credentialsId: 'GIT_HUB_TOKEN', + variable: 'GIT_HUB_TOKEN' + ), + usernamePassword( + credentialsId: 'test-rail-api', + usernameVariable: 'TESTRAIL_USER', + passwordVariable: 'TESTRAIL_PASS' + ), + usernamePassword( + credentialsId: 'sauce-labs-api', + usernameVariable: 'SAUCE_USERNAME', + passwordVariable: 'SAUCE_ACCESS_KEY' + ), + ]) { + dir('test/appium/tests') { + sh """ + python3 -m pytest -n24 \ + --rerun_count=2 \ + --testrail_report=True \ + -m "${params.TEST_MARKERS}" \ + --network=${params.NETWORK} \ + --apk=${params.APK_NAME} \ + --build=PR-${params.PR_ID} \ + --pr_number=${params.PR_ID} + """ + } + } + } } + } + } +} 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_create_account.py b/test/appium/tests/atomic/account_management/test_create_account.py index 9a0e25bb62e6..539024dd0978 100644 --- a/test/appium/tests/atomic/account_management/test_create_account.py +++ b/test/appium/tests/atomic/account_management/test_create_account.py @@ -71,7 +71,6 @@ def test_home_view(self): sign_in.confirm_your_password_input.set_value(common_password) sign_in.next_button.click() sign_in.maybe_later_button.click() - sign_in.maybe_later_button.click() home_view = sign_in.get_home_view() text = 'There are no recent chats here yet. \nUse the (+) button to discover people \nto chat with' if not home_view.element_by_text(text).is_element_displayed(): 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 f59847218e3c..bd698445535c 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')