Browse Source

Update UI Sync integration tests and fix TPS preference. (#8489)

master
isabelrios 2 years ago
committed by GitHub
parent
commit
b432f5c495
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      Jenkinsfile
  2. 29
      app/src/androidTest/java/org/mozilla/fenix/AppRequestInterceptor.kt
  3. 12
      app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt
  4. 2
      app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py
  5. 16
      app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py

13
Jenkinsfile

@ -9,6 +9,7 @@ pipeline {
}
stages {
stage('test') {
when { branch 'master' }
steps {
dir('app/src/androidTest/java/org/mozilla/fenix/syncIntegration') {
sh 'pipenv install'
@ -21,6 +22,7 @@ pipeline {
post {
always {
script {
if (env.BRANCH_NAME == 'master') {
publishHTML(target: [
allowMissing: false,
alwaysLinkToLastBuild: true,
@ -28,13 +30,18 @@ pipeline {
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 {

29
app/src/androidTest/java/org/mozilla/fenix/AppRequestInterceptor.kt

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

12
app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt

@ -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 { }
@ -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
@ -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() {
@ -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()
}

2
app/src/androidTest/java/org/mozilla/fenix/syncintegration/conftest.py

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

16
app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py

@ -1,7 +1,6 @@
import os
import sys
def test_sync_account_settings(tps, gradlewbuild):
gradlewbuild.test('checkAccountSettings')
@ -9,15 +8,24 @@ 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')
'''
Loading…
Cancel
Save