Skip to content

Commit

Permalink
Enable high priority tests in PRs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Serhy authored and jakubgs committed Oct 14, 2019
1 parent 09be822 commit c872c5c
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/github-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes.
72 changes: 72 additions & 0 deletions ci/tests/Jenkinsfile.e2e-prs
Original file line number Diff line number Diff line change
@@ -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}
"""
}
}
} }
}
}
}
12 changes: 8 additions & 4 deletions test/appium/support/testrail_report.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import requests
import logging
import itertools
import emoji
import base64
from os import environ
Expand Down Expand Up @@ -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&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()
Expand All @@ -84,10 +88,10 @@ 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]):
for case in self.get_cases([test_cases[phase]]):
case_ids.append(case['id'])
return case_ids

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
10 changes: 3 additions & 7 deletions test/appium/tests/atomic/account_management/test_sign_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 6 additions & 6 deletions test/appium/tests/atomic/chats/test_one_to_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -55,26 +55,26 @@ 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)
chat_element.wait_for_visibility_of_element(20)
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)
message_2 = 'one more message'
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)
Expand Down
14 changes: 4 additions & 10 deletions test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit c872c5c

Please sign in to comment.