[Calling][BugFix] Fix UI test for CustomButton (#1067)
This commit is contained in:
Родитель
f5e8e80909
Коммит
e64ba2e968
|
@ -6,7 +6,6 @@ package com.azure.android.communication.ui.calling
|
|||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.azure.android.communication.BaseUiTest
|
||||
import com.azure.android.communication.assertTextDisplayed
|
||||
import com.azure.android.communication.assertTextNotDisplayed
|
||||
import com.azure.android.communication.common.CommunicationTokenCredential
|
||||
import com.azure.android.communication.common.CommunicationTokenRefreshOptions
|
||||
import com.azure.android.communication.tapWhenDisplayed
|
||||
|
@ -43,24 +42,25 @@ internal class CustomButtons : BaseUiTest() {
|
|||
var button2Clicked = false
|
||||
|
||||
val controlBarOptions = CallCompositeCallScreenControlBarOptions()
|
||||
.addCustomButton(
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 1"
|
||||
) {
|
||||
button1Clicked = true
|
||||
}
|
||||
)
|
||||
.addCustomButton(
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 2"
|
||||
) {
|
||||
button2Clicked = true
|
||||
}
|
||||
.setCustomButtons(
|
||||
listOf(
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 1"
|
||||
) {
|
||||
button1Clicked = true
|
||||
},
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 2"
|
||||
) {
|
||||
button2Clicked = true
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
val callScreenOptions = CallCompositeCallScreenOptions().setControlBarOptions(controlBarOptions)
|
||||
val callScreenOptions =
|
||||
CallCompositeCallScreenOptions().setControlBarOptions(controlBarOptions)
|
||||
val localOptions = CallCompositeLocalOptions().setCallScreenOptions(callScreenOptions)
|
||||
|
||||
callComposite.launchTest(
|
||||
|
@ -103,14 +103,16 @@ internal class CustomButtons : BaseUiTest() {
|
|||
var button1Clicked = false
|
||||
|
||||
val controlBarOptions = CallCompositeCallScreenControlBarOptions()
|
||||
.addCustomButton(
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 1",
|
||||
) {
|
||||
button1Clicked = true
|
||||
}
|
||||
.setEnabled(false)
|
||||
.setCustomButtons(
|
||||
listOf(
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 1",
|
||||
) {
|
||||
button1Clicked = true
|
||||
}
|
||||
.setEnabled(false)
|
||||
)
|
||||
)
|
||||
|
||||
val callScreenOptions =
|
||||
|
@ -132,46 +134,4 @@ internal class CustomButtons : BaseUiTest() {
|
|||
|
||||
assert(button1Clicked == false)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@Test
|
||||
fun testCustomButtonsHiddenIsNotVisible() = runTest {
|
||||
injectDependencies(testScheduler)
|
||||
|
||||
// Launch the UI.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
val communicationTokenRefreshOptions =
|
||||
CommunicationTokenRefreshOptions({ "token" }, true)
|
||||
val communicationTokenCredential =
|
||||
CommunicationTokenCredential(communicationTokenRefreshOptions)
|
||||
val callComposite = CallCompositeBuilder()
|
||||
.applicationContext(appContext)
|
||||
.credential(communicationTokenCredential)
|
||||
.build()
|
||||
|
||||
val controlBarOptions = CallCompositeCallScreenControlBarOptions()
|
||||
.addCustomButton(
|
||||
CallCompositeCustomButtonOptions(
|
||||
R.drawable.azure_communication_ui_calling_ic_fluent_speaker_bluetooth_24_regular_primary,
|
||||
"Custom button 1",
|
||||
) {}
|
||||
.setVisible(false)
|
||||
)
|
||||
|
||||
val callScreenOptions =
|
||||
CallCompositeCallScreenOptions().setControlBarOptions(controlBarOptions)
|
||||
val localOptions = CallCompositeLocalOptions().setCallScreenOptions(callScreenOptions)
|
||||
|
||||
callComposite.launchTest(
|
||||
appContext,
|
||||
CallCompositeTeamsMeetingLinkLocator("https:teams.meeting"),
|
||||
localOptions
|
||||
)
|
||||
|
||||
tapWhenDisplayed(joinCallId)
|
||||
waitUntilDisplayed(endCallId)
|
||||
tapWhenDisplayed(moreOptionsId)
|
||||
|
||||
assertTextNotDisplayed("Custom button 1")
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче