Skip to content
Open
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
33 changes: 13 additions & 20 deletions internal/e2e-js/tests/buildVideoWithVideoSDK.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
SERVER_URL,
createTestRoomSession,
expectMCUVisible,
expectRoomJoined,
expectRoomJoinWithDefaults,
randomizeRoomName,
} from '../utils'

Expand Down Expand Up @@ -62,7 +62,7 @@ test.describe('buildVideoElement with Video SDK', () => {
})

// Join a video room without passing the rootElement
await expectRoomJoined(page)
await expectRoomJoinWithDefaults(page)

expect(await page.$$('div[id^="sw-sdk-"] > video')).toHaveLength(0)
expect(await page.$$('div[id^="sw-overlay-"]')).toHaveLength(0)
Expand All @@ -82,7 +82,7 @@ test.describe('buildVideoElement with Video SDK', () => {
})

// Join a video room without passing the rootElement
await expectRoomJoined(page)
await expectRoomJoinWithDefaults(page)

// Build a video element
const { element } = await page.evaluate(async () => {
Expand Down Expand Up @@ -154,7 +154,7 @@ test.describe('buildVideoElement with Video SDK', () => {
})

// Join a video room and expect both video and member overlays
await expectRoomJoined(page)
await expectRoomJoinWithDefaults(page)

await expectMCUVisible(page)

Expand Down Expand Up @@ -287,9 +287,7 @@ test.describe('buildVideoElement with Video SDK', () => {

const roomName = randomizeRoomName('build-video-element')

await createRoomSession(page, {
roomName,
})
await createRoomSession(page, { roomName })

// Create a video element
await page.evaluate(async () => {
Expand All @@ -306,7 +304,7 @@ test.describe('buildVideoElement with Video SDK', () => {
})

// Join a video room
await expectRoomJoined(page)
await expectRoomJoinWithDefaults(page)

await expectMCUVisible(page)

Expand All @@ -326,12 +324,11 @@ test.describe('buildVideoElement with Video SDK', () => {

const roomName = randomizeRoomName('build-video-element')

await createRoomSession(page, {
roomName,
})
await createRoomSession(page, { roomName })

// Join a video room with rootElement
await expectRoomJoined(page)
await expectRoomJoinWithDefaults(page)
await expectRoomJoinWithDefaults(page)

// Create a video element with the same rootElement
await page.evaluate(async () => {
Expand Down Expand Up @@ -365,12 +362,10 @@ test.describe('buildVideoElement with Video SDK', () => {

const roomName = randomizeRoomName('build-video-element')

await createRoomSession(pageOne, {
roomName,
})
await createRoomSession(pageOne, { roomName })

// Join a video room from pageOne
await expectRoomJoined(pageOne)
await expectRoomJoinWithDefaults(pageOne)
await expectMCUVisible(pageOne)

await test.step('should have correct DOM elements and overlayMap with one member', async () => {
Expand All @@ -381,12 +376,10 @@ test.describe('buildVideoElement with Video SDK', () => {
expect(await getLocalVideoOverlay(pageOne)).toBeDefined()
})

await createRoomSession(pageTwo, {
roomName,
})
await createRoomSession(pageTwo, { roomName })

// Join a video room from pageTwo
await expectRoomJoined(pageTwo)
await expectRoomJoinWithDefaults(pageTwo)
await expectMCUVisible(pageTwo)

await test.step('should have correct DOM elements and overlayMap with two members', async () => {
Expand Down
8 changes: 4 additions & 4 deletions internal/e2e-js/tests/roomSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
randomizeRoomName,
setLayoutOnPage,
expectLayoutChanged,
expectRoomJoined,
expectMCUVisible,
expectRoomJoinWithDefaults,
} from '../utils'

test.describe('RoomSession', () => {
Expand Down Expand Up @@ -62,7 +62,7 @@ test.describe('RoomSession', () => {
})

// --------------- Joining the room ---------------
const joinParams = await expectRoomJoined(page)
const joinParams = await expectRoomJoinWithDefaults(page)

expect(joinParams.room).toBeDefined()
expect(joinParams.room_session).toBeDefined()
Expand Down Expand Up @@ -628,7 +628,7 @@ test.describe('RoomSession', () => {
])

// --------------- Joining the 1st room ---------------
await expectRoomJoined(pageOne)
await expectRoomJoinWithDefaults(pageOne)

// Checks that the video is visible
await expectMCUVisible(pageOne)
Expand Down Expand Up @@ -668,7 +668,7 @@ test.describe('RoomSession', () => {
)

// --------------- Joining the 2nd room ---------------
await expectRoomJoined(pageTwo)
await expectRoomJoinWithDefaults(pageTwo)

// Checks that the video is visible
await expectMCUVisible(pageTwo)
Expand Down
14 changes: 10 additions & 4 deletions internal/e2e-js/tests/roomSessionAudienceCount.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SERVER_URL,
createTestRoomSession,
randomizeRoomName,
expectRoomJoined,
expectRoomJoinWithDefaults,
} from '../utils'

test.describe('RoomSession Audience Count', () => {
Expand Down Expand Up @@ -94,21 +94,27 @@ test.describe('RoomSession Audience Count', () => {
expectedAudienceCount
)

await expectRoomJoined(pageOne)
await expectRoomJoinWithDefaults(pageOne)

const expectorPageTwo = expectAudienceCount(pageTwo)
const audienceCountPageTwoPromise = expectorPageTwo.waitFor(
expectedAudienceCount
)

// join as audience on pageTwo and resolve on `room.joined`
const joinTwoParams: any = await expectRoomJoined(pageTwo)
const joinTwoParams: any = await expectRoomJoinWithDefaults(pageTwo, {
joinAs: 'audience',
})
// expect to have only 1 audience in the room at the moment
expect(joinTwoParams.room_session.audience_count).toBe(1)

const [_, ...pageThreeToFive] = audiencePages
// join as audiences on pageThree to pageFive and resolve on `room.joined`
await Promise.all(pageThreeToFive.map((page) => expectRoomJoined(page)))
await Promise.all(
pageThreeToFive.map((page) =>
expectRoomJoinWithDefaults(page, { joinAs: 'audience' })
)
)

// wait for all the room.audienceCount
await Promise.all([
Expand Down
7 changes: 3 additions & 4 deletions internal/e2e-js/tests/roomSessionAutomaticStream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import type { Video } from '@signalwire/js'
import {
SERVER_URL,
createTestRoomSession,
expectRoomJoined,
expectMCUVisible,
createRoom,
createStreamForRoom,
randomizeRoomName,
deleteRoom,
expectRoomJoinWithDefaults,
} from '../utils'

test.describe('Room Session Auto Stream', () => {
const streamingURL = `${process.env.RTMP_SERVER}${process.env.RTMP_STREAM_NAME}`

test('Should Join a Room with existing stream', async ({
test('should join a room with existing stream', async ({
createCustomPage,
}) => {
const roomName = randomizeRoomName('auto-stream-e2e')
Expand All @@ -36,8 +36,7 @@ test.describe('Room Session Auto Stream', () => {
await createStreamForRoom(roomName, streamingURL)

await createTestRoomSession(pageOne, connectionSettings)

await expectRoomJoined(pageOne)
await expectRoomJoinWithDefaults(pageOne)

await expectMCUVisible(pageOne)

Expand Down
6 changes: 4 additions & 2 deletions internal/e2e-js/tests/roomSessionBadNetwork.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {
SERVER_URL,
createTestRoomSession,
randomizeRoomName,
expectRoomJoined,
expectMCUVisible,
expectMCUVisibleForAudience,
expectPageReceiveMedia,
expectMediaEvent,
expectRoomJoinWithDefaults,
} from '../utils'

type Test = {
Expand Down Expand Up @@ -54,7 +54,9 @@ test.describe('roomSessionBadNetwork', () => {
)

// --------------- Joining the room ---------------
const joinParams: any = await expectRoomJoined(page)
const joinParams: any = await expectRoomJoinWithDefaults(page, {
joinAs: row.join_as,
})

expect(joinParams.room).toBeDefined()
expect(joinParams.room_session).toBeDefined()
Expand Down
11 changes: 7 additions & 4 deletions internal/e2e-js/tests/roomSessionCleanup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Video } from '@signalwire/js'
import { test, expect } from '../fixtures'
import {
createTestRoomSession,
expectRoomJoined,
expectRoomJoinWithDefaults,
leaveRoom,
randomizeRoomName,
SERVER_URL,
Expand All @@ -25,11 +26,12 @@ test.describe('RoomSession', () => {
attachSagaMonitor: true,
})

await expectRoomJoined(page)
await expectRoomJoinWithDefaults(page)

await test.step('the room should have workers and listeners attached', async () => {
const watchers: Record<string, number> = await page.evaluate(() => {
const roomObj = window._roomObj
// @ts-expect-error
const roomObj: Video.RoomSession = window._roomObj

return {
// @ts-expect-error
Expand All @@ -53,7 +55,8 @@ test.describe('RoomSession', () => {

await test.step('the room should not have any workers and listeners attached', async () => {
const watchers: Record<string, number> = await page.evaluate(() => {
const roomObj = window._roomObj
// @ts-expect-error
const roomObj: Video.RoomSession = window._roomObj

return {
// @ts-expect-error
Expand Down
23 changes: 11 additions & 12 deletions internal/e2e-js/tests/roomSessionDemote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import type { Video } from '@signalwire/js'
import {
SERVER_URL,
createTestRoomSession,
expectSDPDirection,
expectInteractivityMode,
expectMemberId,
expectRoomJoined,
expectMCUVisible,
expectPageReceiveAudio,
expectRoomJoinWithDefaults,
} from '../utils'

test.describe('RoomSession demote participant', () => {
Expand Down Expand Up @@ -43,17 +41,22 @@ test.describe('RoomSession demote participant', () => {
createTestRoomSession(pageTwo, participant2Settings),
])

await expectRoomJoined(pageOne)
await expectRoomJoinWithDefaults(pageOne)
await expectMCUVisible(pageOne)

const pageTwoRoomJoined = await expectRoomJoined(pageTwo)
const pageTwoRoomJoined = await expectRoomJoinWithDefaults(pageTwo)
const participant2Id = pageTwoRoomJoined.member_id
await expectMemberId(pageTwo, participant2Id)
await expectMCUVisible(pageTwo)

// Wait five seconds before demoting
await pageOne.waitForTimeout(5000)

const promiseAudienceRoomJoined = expectRoomJoinWithDefaults(pageTwo, {
invokeJoin: false,
joinAs: 'audience',
})

// Demote participant on pageTwo to audience from pageOne
// and resolve on `member.left` amd `layout.changed` with
// position off-canvas
Expand Down Expand Up @@ -108,15 +111,11 @@ test.describe('RoomSession demote participant', () => {
{ demoteMemberId: participant2Id }
)

const promiseAudienceRoomJoined = await expectRoomJoined(pageTwo, {
invokeJoin: false,
})

// Expect same member ID as before demote
await expectMemberId(pageTwo, participant2Id)
await expectMemberId(pageTwo, promiseAudienceRoomJoined.member_id)
await expectInteractivityMode(pageTwo, 'audience')
await expectSDPDirection(pageTwo, 'recvonly', true)

// Make sure the demoted user received room.joined with correct states
await promiseAudienceRoomJoined

await expectPageReceiveAudio(pageTwo)
})
Expand Down
8 changes: 5 additions & 3 deletions internal/e2e-js/tests/roomSessionDemoteAudience.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
createTestRoomSession,
expectSDPDirection,
expectInteractivityMode,
expectRoomJoined,
expectMCUVisible,
expectMCUVisibleForAudience,
expectRoomJoinWithDefaults,
} from '../utils'

test.describe('RoomSession demote method', () => {
Expand Down Expand Up @@ -46,13 +46,15 @@ test.describe('RoomSession demote method', () => {
])

// --------------- Joining from the 1st tab as member and resolve on 'room.joined' ---------------
await expectRoomJoined(pageOne)
await expectRoomJoinWithDefaults(pageOne)

// Checks that the video is visible on pageOne
await expectMCUVisible(pageOne)

// --------------- Joining from the 2st tab as audience and resolve on 'room.joined' ---------------
const pageTwoRoomJoined: any = await expectRoomJoined(pageTwo)
const pageTwoRoomJoined: any = await expectRoomJoinWithDefaults(pageTwo, {
joinAs: 'audience',
})

// Checks that the video is visible on pageTwo
await expectMCUVisibleForAudience(pageTwo)
Expand Down
Loading
Loading