From 130c8fe7ae14e7a66734f371e82aa9517d907791 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 11 Dec 2024 13:07:59 +0100 Subject: [PATCH 1/2] ci: [ANDROAPP-6713] add tablet on landscape for instrumentation testing Signed-off-by: andresmr --- Jenkinsfile | 20 ++++++++++---------- scripts/browserstackJenkins.sh | 5 +++-- scripts/config_jenkins.init | 4 +++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6eb3ac12de..63cbaeff2d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,15 +26,15 @@ pipeline { } } } - stage('Lint Check') { + /* stage('Lint Check') { steps { script { echo 'Running Ktlint' sh './gradlew ktlintCheck' } } - } - stage('Unit tests') { + } */ + /* stage('Unit tests') { environment { ANDROID_HOME = '/opt/android-sdk' } @@ -46,7 +46,7 @@ pipeline { sh './gradlew testDebugUnitTest --stacktrace --no-daemon' } } - } + } */ stage('Build Test APKs') { steps { script { @@ -56,8 +56,8 @@ pipeline { } } stage('Run tests') { - parallel { - stage('Deploy and run Form Tests') { +// parallel { + /* stage('Deploy and run Form Tests') { environment { BROWSERSTACK = credentials('android-browserstack') form_apk = sh(returnStdout: true, script: 'find form/build/outputs -iname "*.apk" | sed -n 1p') @@ -90,7 +90,7 @@ pipeline { } } } - } + } */ stage('Deploy and Run UI Tests') { environment { BROWSERSTACK = credentials('android-browserstack') @@ -110,9 +110,9 @@ pipeline { } } } - } +// } } - stage('JaCoCo report') { + /* stage('JaCoCo report') { steps { script { echo 'Running JaCoCo report on app module' @@ -135,7 +135,7 @@ pipeline { sh './scripts/sonarqube.sh' } } - } + } */ } post { diff --git a/scripts/browserstackJenkins.sh b/scripts/browserstackJenkins.sh index 9cd300663a..1b7eb3acf1 100644 --- a/scripts/browserstackJenkins.sh +++ b/scripts/browserstackJenkins.sh @@ -20,7 +20,7 @@ shards=$(jq -n \ json=$(jq -n \ --argjson app_url $app_url \ --argjson test_url $test_url \ - --argjson devices ["$browserstack_device_list"] \ + --argjson devices ["$browserstack_device_list_landscape"] \ --argjson class ["$browserstack_class"] \ --arg logs "$browserstack_device_logs" \ --arg video "$browserstack_video" \ @@ -33,7 +33,8 @@ json=$(jq -n \ --arg allowDeviceMockServer "$browserstack_allowDeviceMockServer" \ --argjson shards "$shards" \ --arg buildTag "$buildTag" \ - '{devices: $devices, app: $app_url, testSuite: $test_url, class: $class, logs: $logs, video: $video, local: $loc, localIdentifier: $locId, gpsLocation: $gpsLocation, language: $language, locale: $locale, deviceLogs: $deviceLogs, allowDeviceMockServer: $allowDeviceMockServer, shards: $shards, buildTag: $buildTag}') + --arg deviceOrientation "$browserstack_deviceOrientation" \ + '{devices: $devices, app: $app_url, testSuite: $test_url, class: $class, logs: $logs, video: $video, local: $loc, localIdentifier: $locId, gpsLocation: $gpsLocation, language: $language, locale: $locale, deviceLogs: $deviceLogs, allowDeviceMockServer: $allowDeviceMockServer, shards: $shards, buildTag: $buildTag, deviceOrientation: $deviceOrientation}') test_execution_response="$(curl -X POST https://api-cloud.browserstack.com/app-automate/espresso/v2/build -d \ "$json" -H "Content-Type: application/json" -u "$BROWSERSTACK_USR:$BROWSERSTACK_PSW")" diff --git a/scripts/config_jenkins.init b/scripts/config_jenkins.init index 90a8fc3e45..2e017a435e 100644 --- a/scripts/config_jenkins.init +++ b/scripts/config_jenkins.init @@ -1,6 +1,7 @@ build_time_average=660 polling_interval=10 browserstack_device_list="\"Samsung Galaxy S10-9.0\"" +browserstack_device_list_landscape="\"Samsung Galaxy Tab S6-9.0\"" browserstack_video=true browserstack_local=false browserstack_gps_location="40.730610,-73.935242" @@ -10,4 +11,5 @@ browserstack_deviceLogs=true browserstack_number_of_parallel_executions=2 bitrise_max_parallel_builds=3 browserstack_class="\"org.dhis2.usescases.UseCaseTestsSuite\",\"org.dhis2.usescases.FlowTestsSuite\"" -browserstack_allowDeviceMockServer=true \ No newline at end of file +browserstack_allowDeviceMockServer=true +browserstack_deviceOrientation="landscape" \ No newline at end of file From ffadd5968df5a0335ec21079a49cf245a6d28c3e Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 11 Dec 2024 13:13:19 +0100 Subject: [PATCH 2/2] ci: [ANDROAPP-6713] add tablet on landscape for instrumentation testing Signed-off-by: andresmr --- Jenkinsfile | 112 +++++++--------------------------------------------- 1 file changed, 15 insertions(+), 97 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 63cbaeff2d..386f7eee34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,27 +26,6 @@ pipeline { } } } - /* stage('Lint Check') { - steps { - script { - echo 'Running Ktlint' - sh './gradlew ktlintCheck' - } - } - } */ - /* stage('Unit tests') { - environment { - ANDROID_HOME = '/opt/android-sdk' - } - steps { - script { - echo 'Running unit tests on app module' - sh './gradlew :app:testDhisDebugUnitTest --stacktrace --no-daemon' - echo 'Running unit tests on all other modules' - sh './gradlew testDebugUnitTest --stacktrace --no-daemon' - } - } - } */ stage('Build Test APKs') { steps { script { @@ -55,87 +34,26 @@ pipeline { } } } - stage('Run tests') { -// parallel { - /* stage('Deploy and run Form Tests') { - environment { - BROWSERSTACK = credentials('android-browserstack') - form_apk = sh(returnStdout: true, script: 'find form/build/outputs -iname "*.apk" | sed -n 1p') - form_apk_path = "${env.WORKSPACE}/${form_apk}" - buildTag = "${env.GIT_BRANCH} - form" - } - steps { - dir("${env.WORKSPACE}/scripts"){ - script { - echo 'Browserstack deployment and running Form module tests' - sh 'chmod +x browserstackJenkinsForm.sh' - sh './browserstackJenkinsForm.sh' - } - } - } - } - stage('Deploy compose-table module Tests') { - environment { - BROWSERSTACK = credentials('android-browserstack') - compose_table_apk = sh(returnStdout: true, script: 'find compose-table/build/outputs -iname "*.apk" | sed -n 1p') - compose_table_apk_path = "${env.WORKSPACE}/${compose_table_apk}" - buildTag = "${env.GIT_BRANCH} - table" - } - steps { - dir("${env.WORKSPACE}/scripts"){ - script { - echo 'Browserstack deployment and running compose-table module tests' - sh 'chmod +x browserstackJenkinsCompose.sh' - sh './browserstackJenkinsCompose.sh' - } - } - } - } */ - stage('Deploy and Run UI Tests') { - environment { - BROWSERSTACK = credentials('android-browserstack') - app_apk = sh(returnStdout: true, script: 'find app/build/outputs -iname "*.apk" | sed -n 1p') - test_apk = sh(returnStdout: true, script: 'find app/build/outputs -iname "*.apk" | sed -n 2p') - app_apk_path = "${env.WORKSPACE}/${app_apk}" - test_apk_path = "${env.WORKSPACE}/${test_apk}" - buildTag = "${env.GIT_BRANCH}" - } - steps { - dir("${env.WORKSPACE}/scripts"){ - script { - echo 'Browserstack deployment and running tests' - sh 'chmod +x browserstackJenkins.sh' - sh './browserstackJenkins.sh' - } - } - } - } -// } - } - /* stage('JaCoCo report') { - steps { - script { - echo 'Running JaCoCo report on app module' - sh './gradlew jacocoReport --stacktrace --no-daemon' - } - } - } - stage('Sonarqube') { + + stage('Deploy and Run UI Tests') { environment { - GIT_BRANCH = "${env.GIT_BRANCH}" - // Jenkinsfile considers empty value ('') as null - GIT_BRANCH_DEST = "${env.CHANGE_TARGET == null ? '' : env.CHANGE_TARGET}" - PULL_REQUEST = "${env.CHANGE_ID == null ? '' : env.CHANGE_ID }" - SONAR_TOKEN = credentials('android-sonarcloud-token') + BROWSERSTACK = credentials('android-browserstack') + app_apk = sh(returnStdout: true, script: 'find app/build/outputs -iname "*.apk" | sed -n 1p') + test_apk = sh(returnStdout: true, script: 'find app/build/outputs -iname "*.apk" | sed -n 2p') + app_apk_path = "${env.WORKSPACE}/${app_apk}" + test_apk_path = "${env.WORKSPACE}/${test_apk}" + buildTag = "${env.GIT_BRANCH}" } steps { - script { - echo 'Running Sonarqube' - sh 'chmod +x ./scripts/sonarqube.sh' - sh './scripts/sonarqube.sh' + dir("${env.WORKSPACE}/scripts"){ + script { + echo 'Browserstack deployment and running tests' + sh 'chmod +x browserstackJenkins.sh' + sh './browserstackJenkins.sh' + } } } - } */ + } } post {