Skip to content

Commit

Permalink
Fix some API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Oct 3, 2023
1 parent f4eccee commit 93c5aaf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/smoke-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.number }}
STREAM_VIDEO_SECRET: ${{ secrets.STREAM_VIDEO_SECRET }}
IOS_SIMULATOR_DEVICE: "iPhone 14 Pro (16.4)" # TODO: delete this line as soon as Xcode 15 is stable on CI
XCODE_VERSION: "14.3.1" # TODO: delete this line as soon as Xcode 15 is stable on CI
steps:
- uses: actions/[email protected]
with:
Expand Down
36 changes: 18 additions & 18 deletions StreamVideoTests/IntegrationTests/CallCRUDTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class CallCRUDTest: IntegrationTest {
_ capability: OwnCapability,
on call: Call,
granted: Bool = true,
timeout: Double = defaultTimeout
timeout: Double = 20
) async -> Bool {
let endTime = Date().timeIntervalSince1970 * 1000 + timeout * 1000
var userHasRequiredCapability = !granted
Expand Down Expand Up @@ -52,7 +52,7 @@ final class CallCRUDTest: IntegrationTest {
on call: Call,
timeout: Double = 20
) async -> Bool {
let endTime = Date().timeIntervalSince1970 * 1000 + timeout * 1000
let endTime = Date().timeIntervalSince1970 * 1000 + timeout * 100000
var usersLostAudio = false
while !usersLostAudio && endTime > Date().timeIntervalSince1970 * 1000 {
let u1 = await call.state.participants.first!.hasAudio
Expand Down Expand Up @@ -382,20 +382,20 @@ final class CallCRUDTest: IntegrationTest {
try await secondUserCall.microphone.enable()
try await customWait()

var firstParticipantHasAudio = await waitForAudio(on: firstUserCall)
var secondParticipantHasAudio = await waitForAudio(on: firstUserCall)
XCTAssertTrue(firstParticipantHasAudio, "Call creator should have audio enabled")
XCTAssertTrue(secondParticipantHasAudio, "Participant should have audio enabled")
let everyoneIsUnmutedOnTheFirstCall = await waitForAudio(on: firstUserCall)
let everyoneIsUnmutedOnTheSecondCall = await waitForAudio(on: secondUserCall)
XCTAssertTrue(everyoneIsUnmutedOnTheFirstCall, "Everyone should be unmuted on creator's call")
XCTAssertTrue(everyoneIsUnmutedOnTheSecondCall, "Everyone should be unmuted on participant's call")

for userId in [user1, user2] {
try await firstUserCall.mute(userId: userId)
}
try await customWait()

firstParticipantHasAudio = await waitForAudio(on: firstUserCall)
secondParticipantHasAudio = await waitForAudio(on: firstUserCall)
XCTAssertFalse(firstParticipantHasAudio, "Call creator should be muted")
XCTAssertFalse(secondParticipantHasAudio, "Participant should be muted")
let everyoneIsMutedOnTheFirstCall = await waitForAudioLoss(on: firstUserCall)
let everyoneIsMutedOnTheSecondCall = await waitForAudioLoss(on: secondUserCall)
XCTAssertTrue(everyoneIsMutedOnTheFirstCall, "Everyone should be muted on creator's call")
XCTAssertTrue(everyoneIsMutedOnTheSecondCall, "Everyone should be muted on participant's call")
}

func test_muteAllUsers() async throws {
Expand Down Expand Up @@ -426,18 +426,18 @@ final class CallCRUDTest: IntegrationTest {
try await secondUserCall.microphone.enable()
try await customWait()

var firstParticipantHasAudio = await waitForAudio(on: firstUserCall)
var secondParticipantHasAudio = await waitForAudio(on: firstUserCall)
XCTAssertTrue(firstParticipantHasAudio, "Call creator should have audio enabled")
XCTAssertTrue(secondParticipantHasAudio, "Participant should have audio enabled")
let everyoneIsUnmutedOnTheFirstCall = await waitForAudio(on: firstUserCall)
let everyoneIsUnmutedOnTheSecondCall = await waitForAudio(on: secondUserCall)
XCTAssertTrue(everyoneIsUnmutedOnTheFirstCall, "Everyone should be unmuted on creator's call")
XCTAssertTrue(everyoneIsUnmutedOnTheSecondCall, "Everyone should be unmuted on participant's call")

try await firstUserCall.muteAllUsers()
try await customWait()

firstParticipantHasAudio = await waitForAudioLoss(on: firstUserCall)
secondParticipantHasAudio = await waitForAudioLoss(on: firstUserCall)
XCTAssertFalse(firstParticipantHasAudio, "Call creator should be muted")
XCTAssertFalse(secondParticipantHasAudio, "Participant should be muted")
let everyoneIsMutedOnTheFirstCall = await waitForAudioLoss(on: firstUserCall)
let everyoneIsMutedOnTheSecondCall = await waitForAudioLoss(on: secondUserCall)
XCTAssertTrue(everyoneIsMutedOnTheFirstCall, "Everyone should be muted on creator's call")
XCTAssertTrue(everyoneIsMutedOnTheSecondCall, "Everyone should be muted on participant's call")
}

func test_blockAndUnblockUser() async throws {
Expand Down

0 comments on commit 93c5aaf

Please sign in to comment.