Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/e2e-test-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
fail-fast: false
env:
ANDROID_API_LEVEL: ${{ matrix.android_api_level }}
STREAM_SDK_TEST_APP: ${{ vars.STREAM_SDK_TEST_APP }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
env:
ANDROID_API_LEVEL: 34
LAUNCH_ID: ${{ needs.allure_testops_launch.outputs.launch_id }}
STREAM_SDK_TEST_APP: ${{ vars.STREAM_SDK_TEST_APP }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CallPage {
val cameraDisabled = By.res("Stream_ParticipantsListUserCamera_Enabled_false")
val microphoneEnabled = By.res("Stream_ParticipantsListUserMicrophone_Enabled_true")
val microphoneDisabled = By.res("Stream_ParticipantsListUserMicrophone_Enabled_false")
val closeButton = LobbyPage.closeButton
val closeButton = By.res("Stream_ParticipantsListCloseButton")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.test.uiautomator.BySelector
class LobbyPage {

companion object {
val closeButton = By.res("Stream_CloseButton")
val closeButton = By.res("Stream_LobbyCloseButton")
val cameraEnabledToggle = By.res("Stream_CameraToggle_Enabled_true")
val cameraDisabledToggle = By.res("Stream_CameraToggle_Enabled_false")
val microphoneEnabledToggle = By.res("Stream_MicrophoneToggle_Enabled_true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import io.getstream.video.android.uiautomator.defaultTimeout
import io.getstream.video.android.uiautomator.device
import io.getstream.video.android.uiautomator.findObject
import io.getstream.video.android.uiautomator.findObjects
import io.getstream.video.android.uiautomator.seconds
import io.getstream.video.android.uiautomator.typeText
import io.getstream.video.android.uiautomator.waitForText
import io.getstream.video.android.uiautomator.waitToAppear

class UserRobot {
Expand Down Expand Up @@ -55,9 +57,20 @@ class UserRobot {
return this
}

fun joinCall(callId: String? = null, camera: Boolean = true, mic: Boolean = true): UserRobot {
fun joinCall(
callId: String? = null,
camera: UserControls? = null,
microphone: UserControls? = null,
): UserRobot {
enterLobby(callId)
joinCallFromLobby(camera = camera, mic = mic)
if (camera != null) {
camera(camera, hard = true)
}
if (microphone != null) {
microphone(microphone, hard = true)
}
joinCallFromLobby()
waitForCallToStart()
return this
}

Expand All @@ -66,29 +79,20 @@ class UserRobot {
CallDetailsPage.callIdInputField.waitToAppear().typeText(callId)
}
CallDetailsPage.joinCallButton.waitToAppear().click()
waitForLobbyToOpen()
return this
}

// LobbyPage actions

fun joinCallFromLobby(camera: Boolean = true, mic: Boolean = true): UserRobot {
LobbyPage.joinCallButton.waitToAppear()
val cameraIsEnabled = LobbyPage.cameraEnabledToggle.findObjects().isNotEmpty()
val micIsEnabled = LobbyPage.microphoneEnabledToggle.findObjects().isNotEmpty()

if (camera && !cameraIsEnabled) {
LobbyPage.cameraDisabledToggle.findObject().click()
} else if (!camera && cameraIsEnabled) {
LobbyPage.cameraEnabledToggle.findObject().click()
}

if (mic && !micIsEnabled) {
LobbyPage.microphoneDisabledToggle.findObject().click()
} else if (!mic && micIsEnabled) {
LobbyPage.microphoneEnabledToggle.findObject().click()
}

fun joinCallFromLobby(): UserRobot {
LobbyPage.joinCallButton.findObject().click()
waitForCallToStart()
return this
}

private fun waitForLobbyToOpen(): UserRobot {
LobbyPage.closeButton.waitToAppear()
return this
}

Expand All @@ -107,34 +111,79 @@ class UserRobot {
return this
}

fun camera(action: UserControls): UserRobot {
CallPage.callInfoView.waitToAppear()
fun camera(
action: UserControls,
hard: Boolean = false, // When true, hard-toggles to ensure server state syncs properly
): UserRobot {
val isEnabled = CallPage.cameraEnabledToggle.findObjects().isNotEmpty()

if (action == UserControls.ENABLE && !isEnabled) {
CallPage.cameraDisabledToggle.findObject().click()
} else if (action == UserControls.DISABLE && isEnabled) {
CallPage.cameraEnabledToggle.findObject().click()
when {
hard -> when (action) {
UserControls.ENABLE -> {
if (isEnabled) {
CallPage.cameraEnabledToggle.findObject().click()
CallPage.cameraDisabledToggle.waitToAppear().click()
} else {
CallPage.cameraDisabledToggle.findObject().click()
}
}
UserControls.DISABLE -> {
if (isEnabled) {
CallPage.cameraEnabledToggle.findObject().click()
} else {
CallPage.cameraDisabledToggle.findObject().click()
CallPage.cameraEnabledToggle.waitToAppear().click()
}
}
}
action == UserControls.ENABLE && !isEnabled -> {
CallPage.cameraDisabledToggle.findObject().click()
}
action == UserControls.DISABLE && isEnabled -> {
CallPage.cameraEnabledToggle.findObject().click()
}
}

return this
}

fun microphone(action: UserControls): UserRobot {
CallPage.callInfoView.waitToAppear()
fun microphone(
action: UserControls,
hard: Boolean = false, // When true, hard-toggles to ensure server state syncs properly
): UserRobot {
val isEnabled = CallPage.microphoneEnabledToggle.findObjects().isNotEmpty()

if (action == UserControls.ENABLE && !isEnabled) {
CallPage.microphoneDisabledToggle.findObject().click()
} else if (action == UserControls.DISABLE && isEnabled) {
CallPage.microphoneEnabledToggle.findObject().click()
when {
hard -> when (action) {
UserControls.ENABLE -> {
if (isEnabled) {
CallPage.microphoneEnabledToggle.findObject().click()
CallPage.microphoneDisabledToggle.waitToAppear().click()
} else {
CallPage.microphoneDisabledToggle.findObject().click()
}
}
UserControls.DISABLE -> {
if (isEnabled) {
CallPage.microphoneEnabledToggle.findObject().click()
} else {
CallPage.microphoneDisabledToggle.findObject().click()
CallPage.microphoneEnabledToggle.waitToAppear().click()
}
}
}
action == UserControls.ENABLE && !isEnabled -> {
CallPage.microphoneDisabledToggle.findObject().click()
}
action == UserControls.DISABLE && isEnabled -> {
CallPage.microphoneEnabledToggle.findObject().click()
}
}

return this
}

fun settings(action: UserControls): UserRobot {
CallPage.callInfoView.waitToAppear()
val isEnabled = CallPage.callSettingsOpenToggle.findObjects().isNotEmpty()

if (action == UserControls.ENABLE && !isEnabled) {
Expand Down Expand Up @@ -175,6 +224,20 @@ class UserRobot {
CallPage.cornerDraggableView.waitToAppear().swipe(direction, 1.0f)
return this
}

fun waitForParticipantsToJoin(count: Int, timeOutMillis: Long = 20.seconds): UserRobot {
val user = 1
val participants = user + count
CallPage.participantsCountBadge
.waitToAppear()
.waitForText(expectedText = participants.toString(), timeOutMillis = timeOutMillis)
return this
}

private fun waitForCallToStart(): UserRobot {
CallPage.callInfoView.waitToAppear()
return this
}
}

enum class UserControls {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2014-2024 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.getstream.video.android.robots

import io.getstream.video.android.pages.CallPage
import io.getstream.video.android.uiautomator.isDisplayed
import io.getstream.video.android.uiautomator.waitForText
import io.getstream.video.android.uiautomator.waitToAppear
import org.junit.Assert.assertTrue

fun UserRobot.assertCallControls(microphone: Boolean, camera: Boolean): UserRobot {
assertTrue(CallPage.callSettingsClosedToggle.waitToAppear().isDisplayed())
assertTrue(CallPage.hangUpButton.isDisplayed())
assertTrue(CallPage.chatButton.isDisplayed())
assertTrue(CallPage.cameraPositionToggleFront.isDisplayed())

if (microphone) {
assertTrue(CallPage.microphoneEnabledToggle.isDisplayed())
} else {
assertTrue(CallPage.microphoneDisabledToggle.isDisplayed())
}

if (camera) {
assertTrue(CallPage.cameraEnabledToggle.isDisplayed())
} else {
assertTrue(CallPage.cameraDisabledToggle.isDisplayed())
}

return this
}

fun UserRobot.assertParticipantsCountOnCall(count: Int): UserRobot {
val user = 1
val participants = user + count
CallPage.participantsCountBadge
.waitToAppear()
.waitForText(expectedText = participants.toString())
return this
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2014-2024 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.getstream.video.android.robots

import io.getstream.video.android.pages.LobbyPage
import io.getstream.video.android.uiautomator.isDisplayed
import io.getstream.video.android.uiautomator.waitToAppear
import org.junit.Assert.assertTrue

fun UserRobot.assertLobby(microphone: Boolean, camera: Boolean): UserRobot {
assertTrue(LobbyPage.closeButton.waitToAppear().isDisplayed())
assertTrue(LobbyPage.joinCallButton.isDisplayed())

if (microphone) {
assertTrue(LobbyPage.microphoneEnabledToggle.waitToAppear().isDisplayed())
assertTrue(LobbyPage.microphoneEnabledIcon.isDisplayed())
} else {
assertTrue(LobbyPage.microphoneDisabledToggle.waitToAppear().isDisplayed())
assertTrue(LobbyPage.microphoneDisabledIcon.isDisplayed())
}

if (camera) {
assertTrue(LobbyPage.cameraEnabledToggle.waitToAppear().isDisplayed())
assertTrue(LobbyPage.cameraEnabledView.isDisplayed())
} else {
assertTrue(LobbyPage.cameraDisabledToggle.waitToAppear().isDisplayed())
assertTrue(LobbyPage.cameraDisabledView.isDisplayed())
}

return this
}

fun UserRobot.assertParticipantsCountInLobby(count: Int): UserRobot {
assertTrue(LobbyPage.callParticipantsCount(count).waitToAppear().isDisplayed())
return this
}
Loading