diff --git a/.gitlab-ci-files/job-uitests.yml b/.gitlab-ci-files/job-uitests.yml index 94c5a3853..1bf2eecf9 100644 --- a/.gitlab-ci-files/job-uitests.yml +++ b/.gitlab-ci-files/job-uitests.yml @@ -19,6 +19,7 @@ job-android-uitests: stage: uitests tags: [ "macos-xcode13" ] + allow_failure: true dependencies: - job-android @@ -38,7 +39,7 @@ job-android-uitests: #launch emulator - ${ANDROID_HOME}/platform-tools/adb start-server - - ${ANDROID_HOME}/emulator/emulator -avd $emulator_name -port $emulator_adb_port >> logs/emulator.log 2>&1 & + - ${ANDROID_HOME}/emulator/emulator -avd $emulator_name -port $emulator_adb_port -no-window -no-audio >> logs/emulator.log 2>&1 & - .gitlab-ci-files/wait-for-android-emulator -d emulator-$emulator_adb_port -m start - ${ANDROID_HOME}/platform-tools/adb -s emulator-$emulator_adb_port logcat -d > logs/logcats.log diff --git a/README.md b/README.md index 4e9908be8..770ffd48a 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ adb logcat -d | ndk-stack -sym ./libs-debug/arm64-v8a/ ``` If you don't know the CPU architecture, use the following instead: ``` -adb logcat -d | ndk-stack -sym ./libs-debug/`adb shell getprop ro.product.cpu.abi | tr -d '\r'` +adb logcat -d | ndk-stack -sym ./libs-debug/`adb shell getprop ro.product.cpu.abi | tr -d '\r'` ``` Warning: This command won't print anything until you reproduce the crash! @@ -173,6 +173,20 @@ Due to the full app rewrite we can't re-use previous translations, so we'll be v Translation status +# Instrumented UI tests + +Linphone-Android UI Tests include screenshot comparison with the git submodule [`screport`](https://gitlab.linphone.org/BC/public/screport/-/tree/main). The project must be cloned with the `--recursive` option. After updating or switching branches, never forget to checkout and update the submodules with: + + git submodule update --init + +If you have Android Studio, simply open the project and run Instrumented UI tests. + +If you don't have Android Studio, you can run : + + ./gradlew connectedAndroidTest + +Android Instrumented UI tests wiki : https://wiki.linphone.org/xwiki/wiki/public/view/Linphone/ + # CONTRIBUTIONS In order to submit a patch for inclusion in linphone's source code: diff --git a/app/src/androidTest/java/org/linphone/methods/CallViewUITestsMethods.kt b/app/src/androidTest/java/org/linphone/methods/CallViewUITestsMethods.kt index bc86d383f..4f853238f 100644 --- a/app/src/androidTest/java/org/linphone/methods/CallViewUITestsMethods.kt +++ b/app/src/androidTest/java/org/linphone/methods/CallViewUITestsMethods.kt @@ -30,6 +30,8 @@ object CallViewUITestsMethods { var appAccountAuthInfo: AuthInfo = UITestsCoreManager.instance.appAccountAuthInfo var ghostAccount: UITestsRegisteredLinphoneCore = UITestsCoreManager.instance.ghostAccounts[0] + var callTimeChecker: Job? = null + fun refreshAccountInfo() { appAccountAuthInfo = UITestsCoreManager.instance.appAccountAuthInfo ghostAccount = UITestsCoreManager.instance.ghostAccounts[0] @@ -51,10 +53,11 @@ object CallViewUITestsMethods { onView(withContentDescription(R.string.content_description_start_call)).perform(click()) onView(withId(R.id.outgoing_call_layout)).checkWithTimeout(matches(isDisplayed()), 5.0) - checkCallTime(onView(withId(R.id.outgoing_call_timer))) + callTimeChecker = checkCallTime(onView(withId(R.id.outgoing_call_timer))) } fun endCall(currentView: ViewInteraction? = null) { + runBlocking { callTimeChecker?.join() } if (ghostAccount.callState == Call.State.Released) { return } ghostAccount.terminateCall() @@ -75,7 +78,7 @@ object CallViewUITestsMethods { } delay(1000) } - assert(timerArray.distinct().size >= 2) { "[UITests] Call Time is not correctly incremented, less than 2 differents values are displayed in 3 seconds" } + assert(timerArray.distinct().size >= 2) { "[UITests] Call Time is not correctly incremented, less than 2 different values are displayed in 3 seconds" } assert(timerArray == timerArray.sorted()) { "[UITests] Call Time is not correctly incremented, it is not increasing" } assert(timerArray.first() <= firstValue + 3) { "[UITests] Call Time is not correctly initialized, it is at ${timerArray.first()}, $firstValue seconds after the start)" } }