mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
bug fix
This commit is contained in:
parent
5f76beb048
commit
d782422e4d
7 changed files with 24 additions and 29 deletions
|
|
@ -88,10 +88,8 @@ android {
|
|||
versionName "${project.version}"
|
||||
applicationId getPackageName()
|
||||
|
||||
//testInstrumentationRunnerArguments clearPackageData: 'true'
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
testOptions {
|
||||
//execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
||||
animationsDisabled = true
|
||||
}
|
||||
}
|
||||
|
|
@ -264,10 +262,9 @@ dependencies {
|
|||
debugImplementation 'androidx.test:core:1.5.0'
|
||||
debugImplementation 'androidx.test.ext:junit-ktx:1.1.4'
|
||||
|
||||
debugImplementation 'androidx.test.espresso:espresso-core:3.5.0'
|
||||
debugImplementation 'androidx.test.espresso:espresso-idling-resource:3.5.0'
|
||||
debugImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
debugImplementation 'androidx.test.espresso:espresso-idling-resource:3.4.0'
|
||||
debugImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
|
||||
//androidTestUtil 'androidx.test:orchestrator:1.4.2'
|
||||
}
|
||||
|
||||
task generateContactsXml(type: Copy) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package org.linphone.call
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import java.util.*
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
|
@ -43,39 +40,35 @@ class IncomingCallPushUITests {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun testDisplayCallPush() {
|
||||
fun testPushDisplay() {
|
||||
methods.endCall()
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNoAnswerCallPush() {
|
||||
fun testNoAnswer() {
|
||||
methods.waitForCallNotification(false, 30.0)
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testClickOnCallPush() {
|
||||
val time = Date().time
|
||||
fun testOnClick() {
|
||||
methods.onPushAction(getString(R.string.incoming_call_notification_title), UITestsView.incomingCallView)
|
||||
methods.checkCallTime(onView(withId(R.id.incoming_call_timer)), time)
|
||||
takeScreenshot("incoming_call_view")
|
||||
methods.endCall(UITestsView.incomingCallView)
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeclineCallPush() {
|
||||
fun testDecline() {
|
||||
methods.onPushAction("Decline", null)
|
||||
methods.waitForCallNotification(false, 5.0)
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAnswerCallPush() {
|
||||
val time = Date().time
|
||||
fun testAnswer() {
|
||||
methods.onPushAction(getString(R.string.incoming_call_notification_answer_action_label), UITestsView.singleCallView)
|
||||
methods.checkCallTime(onView(withId(R.id.active_call_timer)), time)
|
||||
takeScreenshot("single_call_view")
|
||||
methods.endCall(UITestsView.singleCallView)
|
||||
takeScreenshot("dialer_view")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
package org.linphone.call
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import java.util.*
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
|
@ -22,6 +25,7 @@ import org.linphone.utils.AppUtils.Companion.getString
|
|||
class IncomingCallUITests {
|
||||
|
||||
val methods = CallViewUITestsMethods
|
||||
var time = Date().time // to pass time value between setup and test function for call timer check
|
||||
|
||||
@get:Rule
|
||||
val screenshotsRule = ScreenshotsRule(true)
|
||||
|
|
@ -35,6 +39,7 @@ class IncomingCallUITests {
|
|||
methods.refreshAccountInfo()
|
||||
takeScreenshot("dialer_view")
|
||||
methods.startIncomingCall()
|
||||
time = Date().time
|
||||
methods.onPushAction(getString(R.string.incoming_call_notification_title), UITestsView.incomingCallView)
|
||||
takeScreenshot("incoming_call_view")
|
||||
}
|
||||
|
|
@ -45,25 +50,26 @@ class IncomingCallUITests {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun testOpenIncomingCallView() {
|
||||
fun testViewDisplay() {
|
||||
methods.checkCallTime(onView(ViewMatchers.withId(R.id.outgoing_call_timer)), time)
|
||||
methods.endCall(UITestsView.incomingCallView)
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNoAnswerIncomingCallView() {
|
||||
fun testNoAnswer() {
|
||||
UITestsView.incomingCallView.checkWithTimeout(doesNotExist(), 30.0)
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeclineIncomingCallView() {
|
||||
fun testDecline() {
|
||||
methods.onCallAction(R.id.hangup, UITestsView.incomingCallView, doesNotExist())
|
||||
takeScreenshot("dialer_view")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAcceptIncomingCallView() {
|
||||
fun testAccept() {
|
||||
methods.onCallAction(R.id.answer, UITestsView.singleCallView, matches(isDisplayed()))
|
||||
takeScreenshot("single_call_view")
|
||||
methods.endCall(UITestsView.singleCallView)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class OutgoingCallUITests {
|
|||
|
||||
@Test
|
||||
fun testViewDisplay() {
|
||||
methods.checkCallTime(onView(withId(R.id.outgoing_call_timer)))
|
||||
methods.endCall(UITestsView.outgoingCallView)
|
||||
takeScreenshot("dialer_view", "declined")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ 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]
|
||||
|
|
@ -52,12 +50,10 @@ object CallViewUITestsMethods {
|
|||
onView(withId(R.id.sip_uri_input)).perform(typeText(ghostAccount.mAuthInfo.username))
|
||||
onView(withContentDescription(R.string.content_description_start_call)).perform(click())
|
||||
|
||||
onView(withId(R.id.outgoing_call_layout)).checkWithTimeout(matches(isDisplayed()), 5.0)
|
||||
callTimeChecker = checkCallTime(onView(withId(R.id.outgoing_call_timer)))
|
||||
UITestsView.outgoingCallView.checkWithTimeout(matches(isDisplayed()), 5.0)
|
||||
}
|
||||
|
||||
fun endCall(currentView: ViewInteraction? = null) {
|
||||
runBlocking { callTimeChecker?.join() }
|
||||
if (ghostAccount.callState == Call.State.Released) { return }
|
||||
|
||||
ghostAccount.terminateCall()
|
||||
|
|
@ -69,7 +65,7 @@ object CallViewUITestsMethods {
|
|||
fun checkCallTime(view: ViewInteraction, launchTime: Long = Date().time) = runBlocking {
|
||||
view.checkWithTimeout(matches(isDisplayed()), 2.0)
|
||||
val firstValue = ((Date().time - launchTime) / 1000).toInt() + 1
|
||||
launch(Dispatchers.Default) {
|
||||
val wait = launch(Dispatchers.Default) {
|
||||
val timerArray = arrayListOf<Int>()
|
||||
repeat(3) {
|
||||
view.check { view, _ ->
|
||||
|
|
@ -82,6 +78,7 @@ object CallViewUITestsMethods {
|
|||
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)" }
|
||||
}
|
||||
wait.join()
|
||||
}
|
||||
|
||||
fun onPushAction(label: String, resultingView: ViewInteraction?, timeout: Double = 5.0) {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,6 @@ class UITestsRegisteredLinphoneCore(authInfo: AuthInfo) {
|
|||
mCore.addAccount(account)
|
||||
mAccount = account
|
||||
mCore.defaultAccount = mAccount
|
||||
waitForRegistrationState(RegistrationState.Ok, 5.0)
|
||||
}
|
||||
|
||||
fun startCall(address: Address) {
|
||||
|
|
|
|||
|
|
@ -152,8 +152,9 @@ object UITestsUtils {
|
|||
}
|
||||
|
||||
fun ViewInteraction.checkWithTimeout(viewAssert: ViewAssertion, timeout: Double): ViewInteraction = runBlocking {
|
||||
val time = Date().time
|
||||
val wait = launch(Dispatchers.Default) {
|
||||
repeat(timeout.toInt() * 10) {
|
||||
repeat((timeout * 10).toInt()) {
|
||||
try {
|
||||
check(viewAssert)
|
||||
cancel()
|
||||
|
|
@ -164,6 +165,7 @@ object UITestsUtils {
|
|||
}
|
||||
}
|
||||
wait.join()
|
||||
check { view, noViewFoundException -> Log.i("[UITests] $view (found in ${(Date().time - time).toFloat() / 1000} sec)") }
|
||||
check(viewAssert)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue