diff --git a/ci/tests/Jenkinsfile.e2e-nightly b/ci/tests/Jenkinsfile.e2e-nightly index 0758471d6b..96dd3183c6 100644 --- a/ci/tests/Jenkinsfile.e2e-nightly +++ b/ci/tests/Jenkinsfile.e2e-nightly @@ -48,6 +48,7 @@ pipeline { dir('test/appium/tests') { sh """ python3 -m pytest -m testrail_id \ + -m "not upgrade" \ -n24 --rerun_count=2 \ --testrail_report=True \ --network=${params.NETWORK} \ diff --git a/ci/tests/Jenkinsfile.e2e-upgrade b/ci/tests/Jenkinsfile.e2e-upgrade new file mode 100644 index 0000000000..27ccfc04c8 --- /dev/null +++ b/ci/tests/Jenkinsfile.e2e-upgrade @@ -0,0 +1,84 @@ +pipeline { + + agent { label 'linux' } + + parameters { + string( + name: 'NETWORK', + description: 'Name of test network to use', + defaultValue: 'ropsten', + ) + string( + name: 'APK_NAME', + description: 'Filename of APK uploaded to SauceLabs (base for upgrade, usually release build)', + ) + string( + name: 'APK_NAME_UPGRADE', + description: 'Filename of APK of upgraded application (installed on top of base)', + ) + } + + options { + disableConcurrentBuilds() + } + + + stages { + stage('Setup') { + steps { script { + dir('test/appium') { + sh 'pip3 install --user -r requirements.txt' + } + } } + } + stage('Test') { + steps { + withCredentials([ + usernamePassword( + credentialsId: 'test-rail-api', + usernameVariable: 'TESTRAIL_USER', + passwordVariable: 'TESTRAIL_PASS' + ), + usernamePassword( + credentialsId: 'sauce-labs-api', + usernameVariable: 'SAUCE_USERNAME', + passwordVariable: 'SAUCE_ACCESS_KEY' + ), + string( + credentialsId: 'etherscan-api-key', + variable: 'ETHERSCAN_API_KEY' + ), + ]) { + dir('test/appium/tests') { + sh """ + python3 -m pytest -m upgrade \ + -n24 --rerun_count=2 \ + --testrail_report=True \ + --network=${params.NETWORK} \ + --apk=${params.APK_NAME} \ + --apk_upgrade=${params.APK_NAME_UPGRADE} + """ + } + } + } + } + } + + post { + always { + script { + sauce('sauce-labs-cred') { + saucePublisher() + } + } + } + success { + script { + junit( + testDataPublishers: [[$class: 'SauceOnDemandReportPublisher', jobVisibility: 'public']], + testResults: 'test/appium/tests/*.xml' + ) + } + } + } +} diff --git a/test/appium/tests/atomic/test_upgrade.py b/test/appium/tests/atomic/test_upgrade.py index 475ab6042f..68576c8643 100644 --- a/test/appium/tests/atomic/test_upgrade.py +++ b/test/appium/tests/atomic/test_upgrade.py @@ -1,33 +1,25 @@ -import pytest -from tests import marks, pytest_config_global +from tests import marks from tests.base_test_case import SingleDeviceTestCase from views.sign_in_view import SignInView - +@marks.all +@marks.upgrade class TestUpgradeApplication(SingleDeviceTestCase): - def setup_method(self, method, **kwargs): - super(TestUpgradeApplication, self).setup_method(method, app='sauce-storage:app-release.apk') - self.apk_name = ([i for i in [i for i in pytest_config_global['apk'].split('/') if '.apk' in i]])[0] - - @marks.testrail_id(5713) - @marks.upgrade - @marks.skip - # skipped as no support for upgrade now + @marks.testrail_id(6284) def test_apk_upgrade(self): sign_in = SignInView(self.driver) home = sign_in.create_user() profile = home.profile_button.click() - about = profile.about_button.click() - old_version = about.version.text + profile.about_button.click() + old_version = profile.app_version_text.text + profile.upgrade_app() - profile.driver.install_app('https://status-im.ams3.digitaloceanspaces.com/' + - self.apk_name, replace=True) sign_in.driver.launch_app() home = sign_in.sign_in() profile = home.profile_button.click() - about = profile.about_button.click() - new_version = about.version.text - print(new_version, old_version) + profile.about_button.click() + new_version = profile.app_version_text.text + print('Upgraded app version is %s vs base version is %s ' % (new_version, old_version)) assert new_version != old_version diff --git a/test/appium/tests/conftest.py b/test/appium/tests/conftest.py index f30c566bc2..6d3a60681c 100644 --- a/test/appium/tests/conftest.py +++ b/test/appium/tests/conftest.py @@ -67,6 +67,11 @@ def pytest_addoption(parser): metavar="NAME", default=None, help="only run tests matching the environment NAME.") + parser.addoption("--apk_upgrade", + action="store", + metavar="NAME", + default=None, + help='Url or local path to apk for upgrade') # chat bot diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 5a9297b7e9..59f8d0713c 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -1,7 +1,6 @@ import time import base64 -import pytest import random import re import string @@ -14,7 +13,7 @@ from io import BytesIO from selenium.common.exceptions import NoSuchElementException, TimeoutException, StaleElementReferenceException from support.device_apps import start_web_browser -from tests import common_password +from tests import common_password, pytest_config_global from views.base_element import BaseButton, BaseElement, BaseEditBox, BaseText @@ -688,6 +687,10 @@ class BaseView(object): start_web_browser(self.driver) self.driver.get(deep_link) + def upgrade_app(self): + self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True) + self.driver.info('Upgrading apk to apk_upgrade') + # Method-helper def write_page_source_to_file(self, full_path_to_file): string_source = self.driver.page_source