diff --git a/Jenkinsfile b/Jenkinsfile index 96190f6e48..00bf890d98 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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']) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py index 0b62f48d31..6be1c3e740 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py +++ b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py @@ -2,6 +2,7 @@ import io import json import os import time +import os.path as path from mozdownload import DirectScraper, FactoryScraper from mozprofile import Profile @@ -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} diff --git a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/gradlewbuild.py b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/gradlewbuild.py index a02d8743ed..0a0ab3cd66 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/gradlewbuild.py +++ b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/gradlewbuild.py @@ -18,11 +18,13 @@ class GradlewBuild(object): 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) @@ -30,6 +32,9 @@ class GradlewBuild(object): 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) - diff --git a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py index 195b1dfce9..3320af5970 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py +++ b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py @@ -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') -''' \ No newline at end of file + tps.run('test_history_desktop.js') +'''