From 69209107ca1879d4c116b85a62336658d62b3065 Mon Sep 17 00:00:00 2001 From: Anton Danchenko Date: Tue, 15 Jan 2019 16:53:05 +0200 Subject: [PATCH] added upgrade test, changed apk name on sauce Signed-off-by: Anton Danchenko --- ci/android.groovy | 3 +- .../atomic/account_management/test_profile.py | 42 ++++++++++++++++ test/appium/tests/atomic/test_upgrade.py | 31 ++++++++++++ test/appium/tests/base_test_case.py | 21 ++------ test/appium/tests/marks.py | 4 +- test/appium/tests/test_chatbot.py | 4 +- .../tests/test_general_verifications.py | 48 ------------------- test/appium/views/about_view.py | 6 +-- 8 files changed, 87 insertions(+), 72 deletions(-) create mode 100644 test/appium/tests/atomic/test_upgrade.py delete mode 100644 test/appium/tests/test_general_verifications.py diff --git a/ci/android.groovy b/ci/android.groovy index b07fdf9a29..f4a436eaba 100644 --- a/ci/android.groovy +++ b/ci/android.groovy @@ -40,7 +40,8 @@ def uploadToSauceLabs() { if (changeId != null) { env.SAUCE_LABS_NAME = "${changeId}.apk" } else { - env.SAUCE_LABS_NAME = "im.status.ethereum-e2e-${GIT_COMMIT.take(6)}.apk" + def pkg = cmn.pkgFilename(type, 'apk') + env.SAUCE_LABS_NAME = "${pkg}" } withCredentials([ string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'), diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 912d6eddd8..20a1bbc96b 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -338,3 +338,45 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): chat_2.chat_message_input.send_keys(message_1) chat_2.send_message_button.click() chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element() + + @marks.testrail_id(5453) + @marks.medium + def test_privacy_policy_is_accessible(self): + signin_view = SignInView(self.driver) + no_link_found_error_msg = 'Could not find privacy policy link at' + no_link_open_error_msg = 'Could not open our privacy policy from' + + if not signin_view.privacy_policy_link.is_element_displayed(): + self.driver.fail('{} Sign in view!'.format(no_link_found_error_msg)) + + base_web_view = signin_view.privacy_policy_link.click() + base_web_view.open_in_webview() + if not base_web_view.policy_summary.is_element_displayed(): + self.errors.append('{} Sign in view!'.format(no_link_open_error_msg)) + + base_web_view.click_system_back_button() + signin_view = SignInView(self.driver) + home_view = signin_view.create_user() + profile = home_view.profile_button.click() + about_view = profile.about_button.click() + base_web_view = about_view.privacy_policy_button.click() + + if not base_web_view.policy_summary.is_element_displayed(): + self.errors.append('{} Profile about view!'.format(no_link_open_error_msg)) + + base_web_view.click_system_back_button() + if about_view.privacy_policy_button.is_element_displayed(): + base_web_view.click_system_back_button() + signin_view = profile.logout() + if signin_view.ok_button.is_element_displayed(): + signin_view.ok_button.click() + signin_view.other_accounts_button.click() + + if not signin_view.privacy_policy_link.is_element_displayed(): + self.driver.fail('{} Sign in view!'.format(no_link_found_error_msg)) + + base_web_view = signin_view.privacy_policy_link.click() + if not base_web_view.policy_summary.is_element_displayed(): + self.errors.append('{} Sign in view!'.format(no_link_open_error_msg)) + + self.verify_no_errors() diff --git a/test/appium/tests/atomic/test_upgrade.py b/test/appium/tests/atomic/test_upgrade.py new file mode 100644 index 0000000000..8f26c5ae22 --- /dev/null +++ b/test/appium/tests/atomic/test_upgrade.py @@ -0,0 +1,31 @@ +import pytest +from tests import marks +from tests.base_test_case import SingleDeviceTestCase +from views.sign_in_view import SignInView + + +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.getoption('apk').split('/') if '.apk' in i]])[0] + + @marks.testrail_id(5713) + @marks.upgrade + 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.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) + assert new_version != old_version diff --git a/test/appium/tests/base_test_case.py b/test/appium/tests/base_test_case.py index f6df9d4144..a018c9d32c 100644 --- a/test/appium/tests/base_test_case.py +++ b/test/appium/tests/base_test_case.py @@ -72,6 +72,7 @@ class AbstractTestCase: desired_caps['setWebContentDebuggingEnabled'] = True desired_caps['ignoreUnimportantViews'] = False desired_caps['enableNotificationListener'] = True + desired_caps['maxDuration'] = 1800 return desired_caps def update_capabilities_sauce_lab(self, new_capabilities: dict): @@ -157,14 +158,15 @@ class Driver(webdriver.Remote): class SingleDeviceTestCase(AbstractTestCase): - def setup_method(self, method, max_duration=1800): + def setup_method(self, method, **kwargs): if pytest.config.getoption('docker'): appium_container.start_appium_container(pytest.config.getoption('docker_shared_volume')) appium_container.connect_device(pytest.config.getoption('device_ip')) (executor, capabilities) = (self.executor_sauce_lab, self.capabilities_sauce_lab) if \ self.environment == 'sauce' else (self.executor_local, self.capabilities_local) - capabilities['maxDuration'] = max_duration + for key, value in kwargs.items(): + capabilities[key] = value self.driver = Driver(executor, capabilities) test_suite_data.current_test.testruns[-1].jobs[self.driver.session_id] = 1 self.driver.implicitly_wait(self.implicitly_wait) @@ -252,18 +254,3 @@ environment = LocalMultipleDeviceTestCase if pytest.config.getoption('env') == ' class MultipleDeviceTestCase(environment): pass - - -class MessageReliabilityTestCase(MultipleDeviceTestCase): - - def setup_method(self, method): - super(MessageReliabilityTestCase, self).setup_method(method) - self.one_to_one_chat_data = dict() - self.public_chat_data = dict() - - def teardown_method(self, method): - if self.one_to_one_chat_data: - create_one_to_one_chat_report(self.one_to_one_chat_data) - if self.public_chat_data: - create_public_chat_report(self.public_chat_data) - super(MultipleDeviceTestCase, self).teardown_method(method) diff --git a/test/appium/tests/marks.py b/test/appium/tests/marks.py index 6862229aa6..71feda5ade 100644 --- a/test/appium/tests/marks.py +++ b/test/appium/tests/marks.py @@ -9,8 +9,9 @@ medium = pytest.mark.medium low = pytest.mark.low account = pytest.mark.account -all = pytest.mark.all +upgrade = pytest.mark.upgrade api = pytest.mark.api +all = pytest.mark.all chat = pytest.mark.chat chat_management = pytest.mark.chat_management dapps = pytest.mark.dapps @@ -22,4 +23,5 @@ sign_in = pytest.mark.sign_in skip = pytest.mark.skip logcat = pytest.mark.logcat + battery_consumption = pytest.mark.battery_consumption diff --git a/test/appium/tests/test_chatbot.py b/test/appium/tests/test_chatbot.py index 321ab1ce63..f2e00f680b 100644 --- a/test/appium/tests/test_chatbot.py +++ b/test/appium/tests/test_chatbot.py @@ -15,8 +15,8 @@ repeats = 24 / len(public_keys) if public_keys else 0 @pytest.mark.chatbot class TestChatBot(SingleDeviceTestCase): - def setup_method(self, method, max_duration=10800): - super(TestChatBot, self).setup_method(method, max_duration=10800) + def setup_method(self, method, **kwargs): + super(TestChatBot, self).setup_method(method, maxDuration=10800) @pytest.mark.parametrize('key', numpy.repeat(public_keys, repeats)) def test_one_to_one_chatbot(self, key): diff --git a/test/appium/tests/test_general_verifications.py b/test/appium/tests/test_general_verifications.py deleted file mode 100644 index 5a107de2fe..0000000000 --- a/test/appium/tests/test_general_verifications.py +++ /dev/null @@ -1,48 +0,0 @@ -from tests import marks -from tests.base_test_case import SingleDeviceTestCase -from views.sign_in_view import SignInView - - -class TestLinksVerifications(SingleDeviceTestCase): - - @marks.testrail_id(5453) - @marks.medium - def test_privacy_policy_is_accessible(self): - signin_view = SignInView(self.driver) - no_link_found_error_msg = 'Could not find privacy policy link at' - no_link_open_error_msg = 'Could not open our privacy policy from' - - if not signin_view.privacy_policy_link.is_element_displayed(): - self.driver.fail('{} Sign in view!'.format(no_link_found_error_msg)) - - base_web_view = signin_view.privacy_policy_link.click() - base_web_view.open_in_webview() - if not base_web_view.policy_summary.is_element_displayed(): - self.errors.append('{} Sign in view!'.format(no_link_open_error_msg)) - - base_web_view.click_system_back_button() - signin_view = SignInView(self.driver) - home_view = signin_view.create_user() - profile = home_view.profile_button.click() - about_view = profile.about_button.click() - base_web_view = about_view.privacy_policy_button.click() - - if not base_web_view.policy_summary.is_element_displayed(): - self.errors.append('{} Profile about view!'.format(no_link_open_error_msg)) - - base_web_view.click_system_back_button() - if about_view.privacy_policy_button.is_element_displayed(): - base_web_view.click_system_back_button() - signin_view = profile.logout() - if signin_view.ok_button.is_element_displayed(): - signin_view.ok_button.click() - signin_view.other_accounts_button.click() - - if not signin_view.privacy_policy_link.is_element_displayed(): - self.driver.fail('{} Sign in view!'.format(no_link_found_error_msg)) - - base_web_view = signin_view.privacy_policy_link.click() - if not base_web_view.policy_summary.is_element_displayed(): - self.errors.append('{} Sign in view!'.format(no_link_open_error_msg)) - - self.verify_no_errors() diff --git a/test/appium/views/about_view.py b/test/appium/views/about_view.py index a7ea95e388..4a2f0458ae 100644 --- a/test/appium/views/about_view.py +++ b/test/appium/views/about_view.py @@ -13,9 +13,9 @@ class PrivacyPolicyButton(BaseButton): return BaseWebView(self.driver) -class VersionInfo(BaseText): +class VersionText(BaseText): def __init__(self, driver): - super(VersionInfo, self).__init__(driver) + super(VersionText, self).__init__(driver) self.locator = self.Locator.xpath_selector( '//*[@content-desc="version"]//android.widget.TextView') @@ -25,4 +25,4 @@ class AboutView(BaseView): super(AboutView, self).__init__(driver) self.privacy_policy_button = PrivacyPolicyButton(self.driver) - self.version_info = VersionInfo(self.driver) + self.version = VersionText(self.driver)