Skip to content

Commit

Permalink
sync-integration-tests-fix-paths (mozilla-mobile#8931)
Browse files Browse the repository at this point in the history
* sync-integration-tests-fix-paths

* fix Jenkins file to store the report

* address reviewer comments
  • Loading branch information
isabelrios authored Mar 4, 2020
1 parent 8296b3e commit a4d9300
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline {
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: '/Users/synctesting/.jenkins/workspace/fenix/app/src/androidTest/java/org/mozilla/fenix/syncintegration/results',
reportDir: 'app/src/androidTest/java/org/mozilla/fenix/syncintegration/results',
reportFiles: 'index.html',
reportName: 'HTML Report'])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os
import time
import os.path as path

from mozdownload import DirectScraper, FactoryScraper
from mozprofile import Profile
Expand Down Expand Up @@ -58,12 +59,24 @@ def tps_addon(pytestconfig, tmpdir_factory):
def tps_config(fxa_account, monkeypatch):
monkeypatch.setenv('FXA_EMAIL', fxa_account.email)
monkeypatch.setenv('FXA_PASSWORD', fxa_account.password)
with open ("/Users/synctesting/.jenkins/workspace/fenix/app/src/androidTest/resources/email.txt", "w") as f:

# Go to resources folder
os.chdir('../../../../..')
resources = r'resources'
resourcesDir = os.path.join(os.getcwd(), resources)

with open (os.path.join(resourcesDir, 'email.txt'), "w") as f:
f.write(fxa_account.email)

with open ("/Users/synctesting/.jenkins/workspace/fenix/app/src/androidTest/resources/password.txt", "w") as f:
with open (os.path.join(resourcesDir, 'password.txt'), "w") as f:
f.write(fxa_account.password)

# Set the path where tests are
os.chdir('../')
currentDir = os.getcwd()
testsDir = currentDir + "/androidTest/java/org/mozilla/fenix/syncintegration"
os.chdir(testsDir)

yield {'fx_account': {
'username': fxa_account.email,
'password': fxa_account.password}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@ def __init__(self, log):

def test(self, identifier):
self.adbrun.launch()

# Change path accordingly to go to root folder to run gradlew
os.chdir('../../../../../../../..')
args = './gradlew ' + 'app:connectedGeckoNightlyDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=org.mozilla.fenix.syncintegration.SyncIntegrationTest#{}'.format(identifier)

self.logger.info('Running: {}'.format(' '.join(args)))

try:
out = subprocess.check_output(
args, shell=True)
except subprocess.CalledProcessError as e:
out = e.output
raise
finally:
#Set the path correctly
testsPath = "app/src/androidTest/java/org/mozilla/fenix/syncintegration/"
os.chdir(testsPath)

with open(self.log, 'w') as f:
f.writelines(out)

Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@ def test_sync_account_settings(tps, gradlewbuild):
gradlewbuild.test('checkAccountSettings')

def test_sync_history_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
tps.run('test_history.js')
gradlewbuild.test('checkHistoryFromDesktopTest')
'''
def test_sync_bookmark_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
tps.run('test_bookmark.js')
gradlewbuild.test('checkBookmarkFromDesktopTest')
def test_sync_logins_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
tps.run('test_logins.js')
gradlewbuild.test('checkLoginsFromDesktopTest')
def test_sync_bookmark_from_device(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
gradlewbuild.test('checkBookmarkFromDeviceTest')
tps.run('app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_bookmark_desktop.js')
tps.run('test_bookmark_desktop.js')
def test_sync_history_from_device(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
gradlewbuild.test('checkHistoryFromDeviceTest')
tps.run('app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_history_desktop.js')
'''
tps.run('test_history_desktop.js')
'''

0 comments on commit a4d9300

Please sign in to comment.