Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update develop 2.10 #3617

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/build-release-candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This is a basic workflow that is manually triggered

name: Build Release Candidate

env:
# The name of the main module repository
main_project_module: app

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- uses: actions/checkout@v3

# Set Repository Name As Env Variable
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV

- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'

- name: Change wrapper permissions
run: chmod +x ./gradlew

- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
with:
fileName: 'dhis_keystore.jks'
encodedString: ${{ secrets.KEYSTORE }}
- name: build prod
run: ./gradlew app:assembleDhisRelease
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
SIGNING_KEYSTORE_PATH: ${{ steps.decode_keystore.outputs.filePath }}

- name: Read version name from file
working-directory: ./gradle
id: read-version
run: echo "::set-output name=vName::$(grep 'vName' libs.versions.toml | awk -F' = ' '{print $2}' | tr -d '"')"

# Upload Artifact Build
- name: Upload Android artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.repository_name }} - Android APK
path: ${{ env.main_project_module }}/build/outputs/apk/dhis/release/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-release.apk
32 changes: 32 additions & 0 deletions .github/workflows/publish-libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow that is manually triggered

name: Publish libraries

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Person to greet'
# Default value if no value is explicitly provided
default: 'World'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Hello ${{ inputs.name }}"
3 changes: 3 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pipeline {
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"){
Expand All @@ -71,6 +72,7 @@ pipeline {
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"){
Expand All @@ -89,6 +91,7 @@ pipeline {
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"){
Expand Down
14 changes: 13 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ android {
}
}

signingConfigs {
create("release"){
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
System.getenv("SIGNING_KEYSTORE_PATH")?.let {path->
storeFile = file(path)
}
storePassword = System.getenv("SIGNING_STORE_PASSWORD")
}
}

testOptions {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
unitTests {
Expand Down Expand Up @@ -143,6 +154,7 @@ android {
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
buildConfigField("int", "MATOMO_ID", "1")
buildConfigField("String", "BUILD_DATE", "\"" + getBuildDate() + "\"")
buildConfigField("String", "GIT_SHA", "\"" + getCommitHash() + "\"")
Expand Down Expand Up @@ -307,4 +319,4 @@ dependencies {
androidTestImplementation(libs.test.compose.ui.test)
androidTestImplementation(libs.test.hamcrest)
androidTestImplementation(libs.dispatcher.dispatchEspresso)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.dhis2.usescases.event
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performScrollTo
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
Expand Down Expand Up @@ -30,6 +31,7 @@ class EventRegistrationRobot : BaseRobot() {

fun checkEventDataEntryIsOpened(completion: Int, email: String, composeTestRule: ComposeTestRule) {
onView(withId(R.id.completion)).check(matches(hasCompletedPercentage(completion)))
composeTestRule.onNodeWithText(email).performScrollTo()
composeTestRule.onNodeWithText(email).assertIsDisplayed()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class FilterTest : BaseTest() {
eventWithoutRegistrationRobot(composeTestRule) {
clickOnEventAtPosition(0)
}
formRobot {
formRobot(composeTestRule) {
clickOnSelectOption(1, 1)
pressBack()
pressBack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class SyncFlowTest : BaseTest() {
prepareFacilityDataSetIntentAndLaunchActivity(ruleDataSet)

dataSetRobot {
composeTestRule.waitForIdle()
clickOnDataSetAtPosition(0)
}

Expand All @@ -166,7 +167,10 @@ class SyncFlowTest : BaseTest() {
clickOnDataSetToSync(0)
clickOnSyncButton()
workInfoStatusLiveData.postValue(arrayListOf(mockedGranularWorkInfo(WorkInfo.State.RUNNING)))
composeTestRule.waitForIdle()
workInfoStatusLiveData.postValue(arrayListOf(mockedGranularWorkInfo(WorkInfo.State.SUCCEEDED)))
composeTestRule.waitForIdle()
waitToDebounce(3000)
checkSyncWasSuccessfully() //sync failed
}
cleanLocalDatabase()
Expand Down
17 changes: 10 additions & 7 deletions app/src/androidTest/java/org/dhis2/usescases/form/FormRobot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package org.dhis2.usescases.form

import android.app.Activity
import android.view.MenuItem
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.onAllNodesWithTag
import androidx.compose.ui.test.onFirst
import androidx.compose.ui.test.onNodeWithText
import androidx.test.espresso.Espresso.onData
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
Expand Down Expand Up @@ -32,13 +34,16 @@ import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not


fun formRobot(formRobot: FormRobot.() -> Unit) {
FormRobot().apply {
fun formRobot(
composeTestRule: ComposeTestRule,
formRobot: FormRobot.() -> Unit
) {
FormRobot(composeTestRule).apply {
formRobot()
}
}

class FormRobot : BaseRobot() {
class FormRobot(val composeTestRule: ComposeTestRule) : BaseRobot() {

fun clickOnASpecificSection(sectionLabel: String) {
onView(withText(sectionLabel)).perform(click())
Expand Down Expand Up @@ -104,10 +109,8 @@ class FormRobot : BaseRobot() {
}

fun checkIndicatorIsDisplayed(name: String, value: String) {
onView(withId(R.id.indicator_name))
.check(matches(allOf(isDisplayed(), withText(name))))
onView(withId(R.id.indicator_value))
.check(matches(allOf(isDisplayed(), withText(value))))
composeTestRule.onNodeWithText(name).assertIsDisplayed()
composeTestRule.onNodeWithText(value).assertIsDisplayed()
}

fun checkLabel(label: String, position: Int) {
Expand Down
28 changes: 14 additions & 14 deletions app/src/androidTest/java/org/dhis2/usescases/form/FormTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FormTest : BaseTest() {
fun shouldApplyProgramRules() {
prepareIntentAndLaunchEventActivity(ruleEvent)

formRobot {
formRobot(composeTestRule) {
clickOnASpecificSection("Gamma Rules A")
}
applyHideField()
Expand All @@ -51,7 +51,7 @@ class FormTest : BaseTest() {
}

private fun applyHideField() {
formRobot {
formRobot(composeTestRule) {
clickOnSelectOption(
firstSectionPosition,
HIDE_FIELD_POSITION
Expand All @@ -61,7 +61,7 @@ class FormTest : BaseTest() {
}

private fun applyHideSection() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -72,7 +72,7 @@ class FormTest : BaseTest() {
}

private fun applyShowWarning() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -83,7 +83,7 @@ class FormTest : BaseTest() {
}

private fun applyShowError() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -94,7 +94,7 @@ class FormTest : BaseTest() {
}

private fun applySetMandatoryField() {
formRobot {
formRobot(composeTestRule) {
val nonMandatoryLabel = "ZZ TEST NUMBER"
val mandatoryLabel = "ZZ TEST NUMBER *"
val position = 5
Expand All @@ -109,7 +109,7 @@ class FormTest : BaseTest() {
}

private fun applyHideOption() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -120,7 +120,7 @@ class FormTest : BaseTest() {
}

private fun applyHideOptionGroup() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -132,7 +132,7 @@ class FormTest : BaseTest() {
}

private fun applyShowOptionGroup() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -146,7 +146,7 @@ class FormTest : BaseTest() {
}

private fun applyAssignValue() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -157,7 +157,7 @@ class FormTest : BaseTest() {
}

private fun applyDisplayText() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -171,7 +171,7 @@ class FormTest : BaseTest() {
}

private fun applyDisplayKeyValue() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -185,7 +185,7 @@ class FormTest : BaseTest() {
}

private fun applyWarningOnComplete() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand All @@ -200,7 +200,7 @@ class FormTest : BaseTest() {
}

private fun applyErrorOnComplete() {
formRobot {
formRobot(composeTestRule) {
resetToNoAction(firstSectionPosition)
clickOnSelectOption(
firstSectionPosition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.dhis2.usescases.programEventDetail.ProgramEventDetailActivity
import org.dhis2.usescases.programevent.robot.programEventsRobot
import org.dhis2.usescases.teidashboard.robot.eventRobot
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

Expand Down Expand Up @@ -76,6 +77,7 @@ class ProgramEventTest : BaseTest() {
}
}

@Ignore("Flaky test, will be look om issue ANDROAPP-6030")
@Test
fun shouldCompleteAnEventAndReopenIt() {
val eventDate = "15/3/2020"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ class ProgramEventsRobot(val composeTestRule: ComposeContentTestRule) : BaseRobo
).check(matches(isDisplayed()))
}

@OptIn(ExperimentalTestApi::class)
fun checkEventIsComplete(eventDate: String) {
composeTestRule.waitUntilAtLeastOneExists(hasText(eventDate))
composeTestRule.onNodeWithText(eventDate).assertIsDisplayed()
composeTestRule.onNodeWithText("Event completed").assertIsDisplayed()
}
Expand Down
Loading
Loading