Updated build.gradle file & increased tests timeouts

This commit is contained in:
Sylvain Berfini 2023-04-03 15:35:39 +02:00
parent a1ef09efe5
commit 95db80ba5d
5 changed files with 19 additions and 18 deletions

View file

@ -256,13 +256,13 @@ dependencies {
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// UITests dependencies
implementation 'androidx.test:rules:1.5.0'
debugImplementation 'androidx.test:runner:1.5.2'
debugImplementation 'androidx.test:core:1.5.0'
debugImplementation 'androidx.test.ext:junit-ktx:1.1.5'
debugImplementation 'androidx.test.espresso:espresso-core:3.5.1'
debugImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
}
task generateContactsXml(type: Copy) {
@ -445,7 +445,7 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') {
def imagesrc = new File("failures", failedTestClassName + File.separator + failedTestName + File.separator + failedTestCaseDescription).toString()
screenshotReport += "display conficts detected with \'${name}\' line ${line}:\n<img src=\"${imagesrc}\" width =\"800\" />\n"
screenshotReport += "display conflicts detected with \'${name}\' line ${line}:\n<img src=\"${imagesrc}\" width =\"800\" />\n"
def insertIndex = failedTestJunitReportContent.indexOf("</pre>", failedTestIndex)
def firstPart = failedTestJunitReportContent.substring(0, insertIndex)

View file

@ -56,7 +56,7 @@ class IncomingCallPushUITests {
@Test
fun testDecline() {
methods.onPushAction("Decline", null)
methods.waitForCallNotification(false, 5.0)
methods.waitForCallNotification(false, 10.0)
takeScreenshot("dialer_view")
}

View file

@ -24,6 +24,7 @@ import org.linphone.methods.UITestsUtils.checkWithTimeout
import org.linphone.utils.AppUtils.Companion.getString
object CallViewUITestsMethods {
const val TIMEOUT = 10.0
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
val manager = UITestsCoreManager.instance
@ -42,8 +43,8 @@ object CallViewUITestsMethods {
ghostAccount.startCall(manager.createAddress(appAccountAuthInfo))
startCallTime = Date().time
ghostAccount.waitForCallState(Call.State.OutgoingRinging, 5.0)
waitForCallNotification(true, 5.0)
ghostAccount.waitForCallState(Call.State.OutgoingRinging, TIMEOUT)
waitForCallNotification(true, TIMEOUT)
}
fun startOutgoingCall() {
@ -53,8 +54,8 @@ object CallViewUITestsMethods {
onView(withContentDescription(R.string.content_description_start_call)).perform(click())
startCallTime = Date().time
UITestsView.outgoingCallView.checkWithTimeout(matches(isDisplayed()), 5.0)
ghostAccount.waitForCallState(Call.State.IncomingReceived, 5.0)
UITestsView.outgoingCallView.checkWithTimeout(matches(isDisplayed()), TIMEOUT)
ghostAccount.waitForCallState(Call.State.IncomingReceived, TIMEOUT)
}
fun endCall(currentView: ViewInteraction? = null) {
@ -67,7 +68,7 @@ object CallViewUITestsMethods {
}
fun checkCallTime(view: ViewInteraction, launchTime: Long = Date().time) = runBlocking {
view.checkWithTimeout(matches(isDisplayed()), 5.0)
view.checkWithTimeout(matches(isDisplayed()), TIMEOUT)
val firstValue = ((Date().time - launchTime) / 1000).toInt() + 1
val wait = launch(Dispatchers.Default) {
val timerArray = arrayListOf<Int>()
@ -85,7 +86,7 @@ object CallViewUITestsMethods {
wait.join()
}
fun onPushAction(label: String, resultingView: ViewInteraction?, timeout: Double = 5.0) {
fun onPushAction(label: String, resultingView: ViewInteraction?, timeout: Double = TIMEOUT) {
try {
val button = device.findObject(By.textContains(label))
button.click()
@ -103,7 +104,7 @@ object CallViewUITestsMethods {
) {
onView(withId(id)).checkWithTimeout(matches(isDisplayed()), timeout)
onView(withId(id)).perform(click())
resultingView?.checkWithTimeout(assertion, 5.0)
resultingView?.checkWithTimeout(assertion, TIMEOUT)
}
fun waitForCallNotification(exist: Boolean, timeout: Double) = runBlocking {

View file

@ -62,7 +62,7 @@ class UITestsCoreManager {
accountCreator.email = accountCreator.username + "@" + accountCreator.domain
accountCreator.transport = TransportType.Tcp
assert(accountCreator.createAccount() == AccountCreator.Status.RequestOk) { "[UITests] Unable to send a request to create an account on server" }
waitForAccountCreationStatus(AccountCreator.Status.AccountCreated, 5.0)
waitForAccountCreationStatus(AccountCreator.Status.AccountCreated, 10.0)
val authInfo = factory.createAuthInfo(accountCreator.username!!, "", accountCreator.password, "", "", accountCreator.domain)
core.addAuthInfo(authInfo)

View file

@ -131,7 +131,7 @@ object UITestsUtils {
connectAccount()
assert(accountIsConnected()) { "registration state on the Status Bar is still not : Connected after 10 seconds" }
}
UITestsView.dialerView.checkWithTimeout(matches(isDisplayed()), 5.0)
UITestsView.dialerView.checkWithTimeout(matches(isDisplayed()), 10.0)
}
fun launchApp() {