Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
82 changes: 41 additions & 41 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@ on:
push:
branches: [main]
pull_request:
branches: [main, dev]
branches: [main, dev, joao/opus_config]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Run unit and stack tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/install
with:
NODE_VERSION: ${{ matrix.node-version }}
- name: Build SDKs
uses: ./.github/actions/build
with:
NODE_VERSION: ${{ matrix.node-version }}
- name: Unit Tests
run: npm test
- name: Stack Tests
run: npm run -w=@sw-internal/stack-tests dev
env:
RELAY_HOST: ${{ secrets.RELAY_HOST }}
RELAY_PROJECT: ${{ secrets.RELAY_PROJECT }}
RELAY_TOKEN: ${{ secrets.RELAY_TOKEN }}
run-browser-js-staging:
name: Browser SDK staging
needs: tests
uses: ./.github/workflows/browser-js-staging.yml
secrets: inherit
# tests:
# name: Run unit and stack tests
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [20.x]
# steps:
# - uses: actions/checkout@v4
# - name: Install deps
# uses: ./.github/actions/install
# with:
# NODE_VERSION: ${{ matrix.node-version }}
# - name: Build SDKs
# uses: ./.github/actions/build
# with:
# NODE_VERSION: ${{ matrix.node-version }}
# - name: Unit Tests
# run: npm test
# - name: Stack Tests
# run: npm run -w=@sw-internal/stack-tests dev
# env:
# RELAY_HOST: ${{ secrets.RELAY_HOST }}
# RELAY_PROJECT: ${{ secrets.RELAY_PROJECT }}
# RELAY_TOKEN: ${{ secrets.RELAY_TOKEN }}
# run-browser-js-staging:
# name: Browser SDK staging
# needs: tests
# uses: ./.github/workflows/browser-js-staging.yml
# secrets: inherit
run-browser-js-production:
name: Browser SDK production
needs: tests
# needs: tests
uses: ./.github/workflows/browser-js-production.yml
secrets: inherit
run-realtime-api-staging:
name: RealtimeAPI SDK staging
needs: tests
uses: ./.github/workflows/realtime-api-staging.yml
secrets: inherit
run-realtime-api-production:
name: RealtimeAPI SDK production
needs: tests
uses: ./.github/workflows/realtime-api-production.yml
secrets: inherit
# run-realtime-api-staging:
# name: RealtimeAPI SDK staging
# needs: tests
# uses: ./.github/workflows/realtime-api-staging.yml
# secrets: inherit
# run-realtime-api-production:
# name: RealtimeAPI SDK production
# needs: tests
# uses: ./.github/workflows/realtime-api-production.yml
# secrets: inherit
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
Loading
Loading