Commit 95db80ba authored by Sylvain Berfini's avatar Sylvain Berfini :cow:
Browse files

Updated build.gradle file & increased tests timeouts

1 merge request!1192Added automated UI tests
Pipeline #60557 failed with stages
in 10 minutes and 49 seconds
Showing with 19 additions and 18 deletions
...@@ -256,13 +256,13 @@ dependencies { ...@@ -256,13 +256,13 @@ dependencies {
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4' //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// UITests dependencies // UITests dependencies
implementation 'androidx.test:rules:1.5.0' androidTestImplementation 'junit:junit:4.13.2'
debugImplementation 'androidx.test:runner:1.5.2' androidTestImplementation 'androidx.test:rules:1.5.0'
debugImplementation 'androidx.test:core:1.5.0' androidTestImplementation 'androidx.test:runner:1.5.2'
debugImplementation 'androidx.test.ext:junit-ktx:1.1.5' androidTestImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.5'
debugImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
debugImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
} }
task generateContactsXml(type: Copy) { task generateContactsXml(type: Copy) {
...@@ -445,7 +445,7 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') { ...@@ -445,7 +445,7 @@ def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') {
def imagesrc = new File("failures", failedTestClassName + File.separator + failedTestName + File.separator + failedTestCaseDescription).toString() 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 insertIndex = failedTestJunitReportContent.indexOf("</pre>", failedTestIndex)
def firstPart = failedTestJunitReportContent.substring(0, insertIndex) def firstPart = failedTestJunitReportContent.substring(0, insertIndex)
......
...@@ -56,7 +56,7 @@ class IncomingCallPushUITests { ...@@ -56,7 +56,7 @@ class IncomingCallPushUITests {
@Test @Test
fun testDecline() { fun testDecline() {
methods.onPushAction("Decline", null) methods.onPushAction("Decline", null)
methods.waitForCallNotification(false, 5.0) methods.waitForCallNotification(false, 10.0)
takeScreenshot("dialer_view") takeScreenshot("dialer_view")
} }
......
...@@ -24,6 +24,7 @@ import org.linphone.methods.UITestsUtils.checkWithTimeout ...@@ -24,6 +24,7 @@ import org.linphone.methods.UITestsUtils.checkWithTimeout
import org.linphone.utils.AppUtils.Companion.getString import org.linphone.utils.AppUtils.Companion.getString
object CallViewUITestsMethods { object CallViewUITestsMethods {
const val TIMEOUT = 10.0
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
val manager = UITestsCoreManager.instance val manager = UITestsCoreManager.instance
...@@ -42,8 +43,8 @@ object CallViewUITestsMethods { ...@@ -42,8 +43,8 @@ object CallViewUITestsMethods {
ghostAccount.startCall(manager.createAddress(appAccountAuthInfo)) ghostAccount.startCall(manager.createAddress(appAccountAuthInfo))
startCallTime = Date().time startCallTime = Date().time
ghostAccount.waitForCallState(Call.State.OutgoingRinging, 5.0) ghostAccount.waitForCallState(Call.State.OutgoingRinging, TIMEOUT)
waitForCallNotification(true, 5.0) waitForCallNotification(true, TIMEOUT)
} }
fun startOutgoingCall() { fun startOutgoingCall() {
...@@ -53,8 +54,8 @@ object CallViewUITestsMethods { ...@@ -53,8 +54,8 @@ object CallViewUITestsMethods {
onView(withContentDescription(R.string.content_description_start_call)).perform(click()) onView(withContentDescription(R.string.content_description_start_call)).perform(click())
startCallTime = Date().time startCallTime = Date().time
UITestsView.outgoingCallView.checkWithTimeout(matches(isDisplayed()), 5.0) UITestsView.outgoingCallView.checkWithTimeout(matches(isDisplayed()), TIMEOUT)
ghostAccount.waitForCallState(Call.State.IncomingReceived, 5.0) ghostAccount.waitForCallState(Call.State.IncomingReceived, TIMEOUT)
} }
fun endCall(currentView: ViewInteraction? = null) { fun endCall(currentView: ViewInteraction? = null) {
...@@ -67,7 +68,7 @@ object CallViewUITestsMethods { ...@@ -67,7 +68,7 @@ object CallViewUITestsMethods {
} }
fun checkCallTime(view: ViewInteraction, launchTime: Long = Date().time) = runBlocking { 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 firstValue = ((Date().time - launchTime) / 1000).toInt() + 1
val wait = launch(Dispatchers.Default) { val wait = launch(Dispatchers.Default) {
val timerArray = arrayListOf<Int>() val timerArray = arrayListOf<Int>()
...@@ -85,7 +86,7 @@ object CallViewUITestsMethods { ...@@ -85,7 +86,7 @@ object CallViewUITestsMethods {
wait.join() wait.join()
} }
fun onPushAction(label: String, resultingView: ViewInteraction?, timeout: Double = 5.0) { fun onPushAction(label: String, resultingView: ViewInteraction?, timeout: Double = TIMEOUT) {
try { try {
val button = device.findObject(By.textContains(label)) val button = device.findObject(By.textContains(label))
button.click() button.click()
...@@ -103,7 +104,7 @@ object CallViewUITestsMethods { ...@@ -103,7 +104,7 @@ object CallViewUITestsMethods {
) { ) {
onView(withId(id)).checkWithTimeout(matches(isDisplayed()), timeout) onView(withId(id)).checkWithTimeout(matches(isDisplayed()), timeout)
onView(withId(id)).perform(click()) onView(withId(id)).perform(click())
resultingView?.checkWithTimeout(assertion, 5.0) resultingView?.checkWithTimeout(assertion, TIMEOUT)
} }
fun waitForCallNotification(exist: Boolean, timeout: Double) = runBlocking { fun waitForCallNotification(exist: Boolean, timeout: Double) = runBlocking {
......
...@@ -62,7 +62,7 @@ class UITestsCoreManager { ...@@ -62,7 +62,7 @@ class UITestsCoreManager {
accountCreator.email = accountCreator.username + "@" + accountCreator.domain accountCreator.email = accountCreator.username + "@" + accountCreator.domain
accountCreator.transport = TransportType.Tcp accountCreator.transport = TransportType.Tcp
assert(accountCreator.createAccount() == AccountCreator.Status.RequestOk) { "[UITests] Unable to send a request to create an account on server" } 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) val authInfo = factory.createAuthInfo(accountCreator.username!!, "", accountCreator.password, "", "", accountCreator.domain)
core.addAuthInfo(authInfo) core.addAuthInfo(authInfo)
......
...@@ -131,7 +131,7 @@ object UITestsUtils { ...@@ -131,7 +131,7 @@ object UITestsUtils {
connectAccount() connectAccount()
assert(accountIsConnected()) { "registration state on the Status Bar is still not : Connected after 10 seconds" } 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() { fun launchApp() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment