-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1732 from dhis2/release/2.3
feat: v2.3 release
- Loading branch information
Showing
403 changed files
with
12,612 additions
and
4,768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/androidTest/java/org/dhis2/common/idlingresources/FragmentIdlingResource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.dhis2.common.idlingresources | ||
|
||
import androidx.fragment.app.FragmentManager | ||
import androidx.test.espresso.IdlingResource | ||
|
||
class FragmentIdlingResource( | ||
private val manager: FragmentManager, | ||
private val tag: String) : IdlingResource { | ||
|
||
private var resourceCallback: IdlingResource.ResourceCallback? = null | ||
|
||
override fun getName() = "fragment idling resource" | ||
override fun registerIdleTransitionCallback( | ||
callback: IdlingResource.ResourceCallback? | ||
) { | ||
resourceCallback = callback | ||
} | ||
|
||
override fun isIdleNow(): Boolean { | ||
val fragmentAbout = manager.findFragmentByTag(tag) | ||
|
||
val idle = (fragmentAbout == null) | ||
if (idle) { | ||
resourceCallback?.onTransitionToIdle() | ||
} | ||
return idle | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/src/androidTest/java/org/dhis2/common/rules/RetryRule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.dhis2.common.rules | ||
|
||
import android.util.Log | ||
import org.junit.rules.TestRule | ||
import org.junit.runner.Description | ||
import org.junit.runners.model.Statement | ||
|
||
class RetryRule(val retryCount: Int = 3) : TestRule { | ||
|
||
private val TAG = RetryRule::class.java.simpleName | ||
|
||
override fun apply(base: Statement, description: Description): Statement { | ||
return statement(base, description) | ||
} | ||
|
||
private fun statement(base: Statement, description: Description): Statement { | ||
return object : Statement() { | ||
@Throws(Throwable::class) | ||
override fun evaluate() { | ||
var caughtThrowable: Throwable? = null | ||
|
||
for (i in 0 until retryCount) { | ||
try { | ||
base.evaluate() | ||
return | ||
} catch (t: Throwable) { | ||
caughtThrowable = t | ||
Log.e(TAG, description.displayName + ": run " + (i + 1) + " failed") | ||
} | ||
} | ||
|
||
Log.e(TAG, description.displayName + ": giving up after " + retryCount + " failures") | ||
throw caughtThrowable!! | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.