mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-25 09:10:53 +01:00
Merge pull request #5259 from vector-im/michaelk/reliable_ui_tests
Improve reliability of sanity tests.
This commit is contained in:
commit
4b3749673e
3
.github/workflows/sanity_test.yml
vendored
3
.github/workflows/sanity_test.yml
vendored
@ -69,9 +69,10 @@ jobs:
|
||||
touch emulator.log
|
||||
chmod 777 emulator.log
|
||||
adb logcat >> emulator.log &
|
||||
./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest || adb pull storage/emulated/0/Pictures/failure_screenshots
|
||||
./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest || (adb pull storage/emulated/0/Pictures/failure_screenshots && exit 1 )
|
||||
- name: Upload Test Report Log
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: sanity-error-results
|
||||
path: |
|
||||
|
@ -40,7 +40,7 @@ private val deviceLanguage = Locale.getDefault().language
|
||||
|
||||
class ScreenshotFailureRule : TestWatcher() {
|
||||
override fun failed(e: Throwable?, description: Description) {
|
||||
val screenShotName = "$deviceLanguage-${description.methodName}-${SimpleDateFormat("EEE-MMMM-dd-HH:mm:ss").format(Date())}"
|
||||
val screenShotName = "$deviceLanguage-${description.methodName}-${SimpleDateFormat("EEE-MMMM-dd-HHmmss").format(Date())}"
|
||||
val bitmap = getInstrumentation().uiAutomation.takeScreenshot()
|
||||
storeFailureScreenshot(bitmap, screenShotName)
|
||||
}
|
||||
|
@ -16,10 +16,12 @@
|
||||
|
||||
package im.vector.app.ui
|
||||
|
||||
import android.Manifest
|
||||
import androidx.test.espresso.IdlingPolicies
|
||||
import androidx.test.ext.junit.rules.ActivityScenarioRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.ScreenshotFailureRule
|
||||
import im.vector.app.features.MainActivity
|
||||
@ -43,6 +45,7 @@ class UiAllScreensSanityTest {
|
||||
@get:Rule
|
||||
val testRule = RuleChain
|
||||
.outerRule(ActivityScenarioRule(MainActivity::class.java))
|
||||
.around(GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE))
|
||||
.around(ScreenshotFailureRule())
|
||||
|
||||
private val elementRobot = ElementRobot()
|
||||
|
Loading…
Reference in New Issue
Block a user