Browse Source

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

* sync-integration-tests-fix-paths

* fix Jenkins file to store the report

* address reviewer comments
master
isabelrios 2 years ago
committed by GitHub
parent
commit
a4d93002a9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Jenkinsfile
  2. 17
      app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py
  3. 7
      app/src/androidTest/java/org/mozilla/fenix/syncintegration/gradlewbuild.py
  4. 11
      app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py

2
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'])
}

17
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}

7
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)

11
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')
'''
tps.run('test_history_desktop.js')
'''

Loading…
Cancel
Save