1
0
Fork 0

sync-integration-tests-fix-paths (#8931)

* sync-integration-tests-fix-paths

* fix Jenkins file to store the report

* address reviewer comments
master
isabelrios 2020-03-04 16:56:56 +01:00 committed by GitHub
parent 8296b3e9ff
commit a4d93002a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 12 deletions

2
Jenkinsfile vendored
View File

@ -27,7 +27,7 @@ pipeline {
allowMissing: false, allowMissing: false,
alwaysLinkToLastBuild: true, alwaysLinkToLastBuild: true,
keepAll: 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', reportFiles: 'index.html',
reportName: 'HTML Report']) reportName: 'HTML Report'])
} }

View File

@ -2,6 +2,7 @@ import io
import json import json
import os import os
import time import time
import os.path as path
from mozdownload import DirectScraper, FactoryScraper from mozdownload import DirectScraper, FactoryScraper
from mozprofile import Profile from mozprofile import Profile
@ -58,12 +59,24 @@ def tps_addon(pytestconfig, tmpdir_factory):
def tps_config(fxa_account, monkeypatch): def tps_config(fxa_account, monkeypatch):
monkeypatch.setenv('FXA_EMAIL', fxa_account.email) monkeypatch.setenv('FXA_EMAIL', fxa_account.email)
monkeypatch.setenv('FXA_PASSWORD', fxa_account.password) 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) 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) 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': { yield {'fx_account': {
'username': fxa_account.email, 'username': fxa_account.email,
'password': fxa_account.password} 'password': fxa_account.password}

View File

@ -18,11 +18,13 @@ class GradlewBuild(object):
def test(self, identifier): def test(self, identifier):
self.adbrun.launch() self.adbrun.launch()
# Change path accordingly to go to root folder to run gradlew # Change path accordingly to go to root folder to run gradlew
os.chdir('../../../../../../../..') os.chdir('../../../../../../../..')
args = './gradlew ' + 'app:connectedGeckoNightlyDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=org.mozilla.fenix.syncintegration.SyncIntegrationTest#{}'.format(identifier) args = './gradlew ' + 'app:connectedGeckoNightlyDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=org.mozilla.fenix.syncintegration.SyncIntegrationTest#{}'.format(identifier)
self.logger.info('Running: {}'.format(' '.join(args))) self.logger.info('Running: {}'.format(' '.join(args)))
try: try:
out = subprocess.check_output( out = subprocess.check_output(
args, shell=True) args, shell=True)
@ -30,6 +32,9 @@ class GradlewBuild(object):
out = e.output out = e.output
raise raise
finally: finally:
#Set the path correctly
testsPath = "app/src/androidTest/java/org/mozilla/fenix/syncintegration/"
os.chdir(testsPath)
with open(self.log, 'w') as f: with open(self.log, 'w') as f:
f.writelines(out) f.writelines(out)

View File

@ -5,27 +5,22 @@ def test_sync_account_settings(tps, gradlewbuild):
gradlewbuild.test('checkAccountSettings') gradlewbuild.test('checkAccountSettings')
def test_sync_history_from_desktop(tps, gradlewbuild): def test_sync_history_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
tps.run('test_history.js') tps.run('test_history.js')
gradlewbuild.test('checkHistoryFromDesktopTest') gradlewbuild.test('checkHistoryFromDesktopTest')
''' '''
def test_sync_bookmark_from_desktop(tps, gradlewbuild): def test_sync_bookmark_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
tps.run('test_bookmark.js') tps.run('test_bookmark.js')
gradlewbuild.test('checkBookmarkFromDesktopTest') gradlewbuild.test('checkBookmarkFromDesktopTest')
def test_sync_logins_from_desktop(tps, gradlewbuild): def test_sync_logins_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
tps.run('test_logins.js') tps.run('test_logins.js')
gradlewbuild.test('checkLoginsFromDesktopTest') gradlewbuild.test('checkLoginsFromDesktopTest')
def test_sync_bookmark_from_device(tps, gradlewbuild): def test_sync_bookmark_from_device(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
gradlewbuild.test('checkBookmarkFromDeviceTest') 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): def test_sync_history_from_device(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
gradlewbuild.test('checkHistoryFromDeviceTest') gradlewbuild.test('checkHistoryFromDeviceTest')
tps.run('app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_history_desktop.js') tps.run('test_history_desktop.js')
''' '''