Skip to content

Commit

Permalink
Update UI Sync integration tests and fix TPS preference. (mozilla-mob…
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelrios authored Feb 27, 2020
1 parent f7aec4c commit b432f5c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 11 deletions.
13 changes: 10 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pipeline {
}
stages {
stage('test') {
when { branch 'master' }
steps {
dir('app/src/androidTest/java/org/mozilla/fenix/syncIntegration') {
sh 'pipenv install'
Expand All @@ -21,20 +22,26 @@ pipeline {
post {
always {
script {
if (env.BRANCH_NAME == 'master') {
publishHTML(target: [
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: '/Users/synctesting/.jenkins/workspace/fenix/app/src/androidTest/java/org/mozilla/fenix/syncintegration/results',
reportFiles: 'index.html',
reportName: 'HTML Report'])
}
}
}

failure {
slackSend(
color: 'danger',
message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
script {
if (env.BRANCH_NAME == 'master') {
slackSend(
color: 'danger',
message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}

fixed {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.fenix

import android.content.Context
import mozilla.components.concept.engine.EngineSession
import mozilla.components.concept.engine.request.RequestInterceptor
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ui.robots.appContext

/**
* This class overrides the application's request interceptor to
* deactivate the FxA web channel
* which is not supported on the staging servers.
*/

class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
override fun onLoadRequest(
engineSession: EngineSession,
uri: String,
hasUserGesture: Boolean,
isSameDomain: Boolean
): RequestInterceptor.InterceptionResponse? {
return appContext.components.services.accountsAuthFeature.interceptor.onLoadRequest(
engineSession, uri, hasUserGesture, isSameDomain)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class SyncIntegrationTest {
fun checkHistoryFromDesktopTest() {
signInFxSync()
tapReturnToPreviousApp()
// Let's wait until homescreen is shown to go to three dot menu
mDevice.waitNotNull(Until.findObjects(By.text("Open tabs")), TestAssetHelper.waitingTime)
homeScreen {
}.openThreeDotMenu {
}.openHistory { }
Expand All @@ -82,7 +84,7 @@ class SyncIntegrationTest {
@Test
fun checkAccountSettings() {
signInFxSync()
mDevice.waitNotNull(Until.findObjects(By.text("Settings")), TestAssetHelper.waitingTime)
mDevice.waitNotNull(Until.findObjects(By.text("Account")), TestAssetHelper.waitingTime)

goToAccountSettings()
// This function to be added to the robot once the status of checkboxes can be checked
Expand Down Expand Up @@ -207,8 +209,7 @@ class SyncIntegrationTest {
}

fun historyAfterSyncIsShown() {
val historyEntry = mDevice.findObject(By.text("http://www.example.com/"))
historyEntry.isEnabled()
mDevice.waitNotNull(Until.findObjects(By.text("http://www.example.com/")), TestAssetHelper.waitingTime)
}

fun bookmarkAfterSyncIsShown() {
Expand All @@ -217,7 +218,12 @@ class SyncIntegrationTest {
}

fun tapReturnToPreviousApp() {
mDevice.waitNotNull(Until.findObjects(By.text("Save")), TestAssetHelper.waitingTime)
mDevice.waitNotNull(Until.findObjects(By.text("Settings")), TestAssetHelper.waitingTime)

// Wait until the Settings shows the account synced
mDevice.waitNotNull(Until.findObjects(By.text("Account")), TestAssetHelper.waitingTime)
// Go to Homescreen
mDevice.pressBack()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def tps_profile(pytestconfig, tps_addon, tps_config, tps_log, fxa_urls):
# 'devtools.debugger.remote-enabled': True,
'engine.bookmarks.repair.enabled': False,
'extensions.autoDisableScopes': 10,
'extensions.legacy.enabled': True,
'extensions.experiments.enabled': True,
'extensions.update.enabled': False,
'extensions.update.notifyUser': False,
# While this line is commented prod is launched instead of stage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
import os
import sys


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_device(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')
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('test_bookmark_desktop.js')
tps.run('app/src/androidTest/java/org/mozilla/fenix/syncintegration/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')
'''

0 comments on commit b432f5c

Please sign in to comment.