upgrade e2e

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-04-21 10:39:45 +02:00
parent eb194acce6
commit d9862e2cef
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
5 changed files with 105 additions and 20 deletions

View File

@ -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} \

View File

@ -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'
)
}
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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