Enable high priority tests in PRs

Also:
- add ci/tests/Jenkinsfile.e2e-prs
- remove maybe_later_button click after new onboarding
- update job name for e2e tests
- Fix testrail checklist creationg for nightly builds

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Serhy 2019-10-10 20:38:50 +03:00 committed by Jakub Sokołowski
parent 09be82272a
commit c872c5c487
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
8 changed files with 94 additions and 29 deletions

View File

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

View File

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

View File

@ -1,6 +1,7 @@
import json
import requests
import logging
import itertools
import emoji
import base64
from os import environ
@ -73,8 +74,11 @@ class TestrailReport(BaseTestReport):
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&section_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&section_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,10 +88,10 @@ class TestrailReport(BaseTestReport):
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]):
for case in self.get_cases([test_cases[phase]]):
case_ids.append(case['id'])
return case_ids

View File

@ -71,7 +71,6 @@ class TestCreateAccount(SingleDeviceTestCase):
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():

View File

@ -51,18 +51,14 @@ class TestSignIn(SingleDeviceTestCase):
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()

View File

@ -46,7 +46,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
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 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
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 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
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 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
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)

View File

@ -608,16 +608,10 @@ class BaseView(object):
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')