Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
linphone-android
Commits
95db80ba
Commit
95db80ba
authored
1 year ago
by
Sylvain Berfini
Browse files
Options
Download
Patches
Plain Diff
Updated build.gradle file & increased tests timeouts
parent
a1ef09ef
feature/call_uitests
1 merge request
!1192
Added automated UI tests
Pipeline
#60557
failed with stages
in 10 minutes and 49 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
app/build.gradle
+8
-8
app/build.gradle
app/src/androidTest/java/org/linphone/call/IncomingCallPushUITests.kt
+1
-1
...oidTest/java/org/linphone/call/IncomingCallPushUITests.kt
app/src/androidTest/java/org/linphone/methods/CallViewUITestsMethods.kt
+8
-7
...dTest/java/org/linphone/methods/CallViewUITestsMethods.kt
app/src/androidTest/java/org/linphone/methods/UITestsCoreManager.kt
+1
-1
...droidTest/java/org/linphone/methods/UITestsCoreManager.kt
app/src/androidTest/java/org/linphone/methods/UITestsUtils.kt
+1
-1
...src/androidTest/java/org/linphone/methods/UITestsUtils.kt
with
19 additions
and
18 deletions
app/build.gradle
+
8
−
8
View file @
95db80ba
...
@@ -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
i
mplementation
'
androidx.test:rules:1.5.0
'
androidTestI
mplementation
'
junit:junit:4.13.2
'
debug
Implementation
'androidx.test:ru
nner
:1.5.
2
'
androidTest
Implementation
'androidx.test:ru
les
:1.5.
0
'
debug
Implementation
'androidx.test:
core
:1.5.
0
'
androidTest
Implementation
'androidx.test:
runner
:1.5.
2
'
debug
Implementation
'androidx.test
.ext:junit-ktx:1.
1.5'
androidTest
Implementation
'androidx.test
:core:
1.5
.0
'
androidTestImplementation
'androidx.test.ext:junit-ktx:1.1.5'
debug
Implementation
'androidx.test.espresso:espresso-core:3.5.1'
androidTest
Implementation
'androidx.test.espresso:espresso-core:3.5.1'
debug
Implementation
'androidx.test.uiautomator:uiautomator:2.2.0'
androidTest
Implementation
'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 conf
l
icts 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
)
...
...
This diff is collapsed.
Click to expand it.
app/src/androidTest/java/org/linphone/call/IncomingCallPushUITests.kt
+
1
−
1
View file @
95db80ba
...
@@ -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"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
app/src/androidTest/java/org/linphone/methods/CallViewUITestsMethods.kt
+
8
−
7
View file @
95db80ba
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
app/src/androidTest/java/org/linphone/methods/UITestsCoreManager.kt
+
1
−
1
View file @
95db80ba
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
app/src/androidTest/java/org/linphone/methods/UITestsUtils.kt
+
1
−
1
View file @
95db80ba
...
@@ -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
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets