-
Notifications
You must be signed in to change notification settings - Fork 18
Call start time performance tests #1278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ jobs: | |
| callfabric, | ||
| renegotiation, | ||
| videoElement, | ||
| performance, | ||
| v2WebRTC, | ||
| ] | ||
| steps: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ jobs: | |
| callfabric, | ||
| renegotiation, | ||
| videoElement, | ||
| performance, | ||
| v2WebRTC, | ||
| ] | ||
| steps: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import { uuid } from '@signalwire/core' | ||
| import { test, expect } from '../../fixtures' | ||
| import { SERVER_URL, createCFClient } from '../../utils' | ||
| import { SignalWireContract } from '@signalwire/js' | ||
|
|
||
| export const MAX_CALL_SETUP_TIME_MS = 5000 | ||
|
|
||
| export const logCallStartTime = (ms: number) => { | ||
| if (ms < MAX_CALL_SETUP_TIME_MS) { | ||
| console.log(`\x1b[1;32m✅ call.start(): ${ms.toFixed(0)} ms\x1b[0m`) | ||
| } else { | ||
| console.log(`\x1b[1;31m❌ call.start(): ${ms.toFixed(0)} ms\x1b[0m`) | ||
| } | ||
| } | ||
|
|
||
| test.describe('CallFabric Start Time', () => { | ||
| test('should join a video room within 5 seconds', async ({ | ||
| createCustomPage, | ||
| resource, | ||
| }) => { | ||
| const page = await createCustomPage({ name: '[page]' }) | ||
| await page.goto(SERVER_URL) | ||
|
|
||
| const roomName = `e2e_${uuid()}` | ||
| await resource.createVideoRoomResource(roomName) | ||
|
|
||
| await createCFClient(page) | ||
|
|
||
| // Dial an address and join a video room | ||
| const ms = await page.evaluate( | ||
| async ({ address }) => { | ||
| // @ts-expect-error | ||
| const client: SignalWireContract = window._client | ||
|
|
||
| const call = await client.dial({ | ||
| to: address, | ||
| rootElement: document.getElementById('rootElement'), | ||
| }) | ||
| // @ts-expect-error | ||
| window._roomObj = call | ||
|
|
||
| const t0 = performance.now() | ||
| await call.start() | ||
|
|
||
| return performance.now() - t0 | ||
| }, | ||
| { | ||
| address: `/public/${roomName}?channel=video`, | ||
| } | ||
| ) | ||
|
|
||
| logCallStartTime(ms) | ||
|
|
||
| expect(ms).toBeLessThan(MAX_CALL_SETUP_TIME_MS) | ||
|
Check failure on line 54 in internal/e2e-js/tests/callfabric/callStartTime.spec.ts
|
||
| }) | ||
|
|
||
| test('should join an audio-only room within 5 seconds', async ({ | ||
| createCustomPage, | ||
| resource, | ||
| }) => { | ||
| const page = await createCustomPage({ name: '[page]' }) | ||
| await page.goto(SERVER_URL) | ||
|
|
||
| const roomName = `e2e_${uuid()}` | ||
| await resource.createVideoRoomResource(roomName) | ||
|
|
||
| await createCFClient(page) | ||
|
|
||
| // Dial an address and join a video room | ||
| const ms = await page.evaluate( | ||
| async ({ address }) => { | ||
| // @ts-expect-error | ||
| const client: SignalWireContract = window._client | ||
|
|
||
| const call = await client.dial({ | ||
| to: address, | ||
| }) | ||
|
Comment on lines
+75
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above comment: just wondering if we also want to have seperate measurements that include |
||
| // @ts-expect-error | ||
| window._roomObj = call | ||
|
|
||
| const t0 = performance.now() | ||
| await call.start() | ||
|
|
||
| return performance.now() - t0 | ||
| }, | ||
| { | ||
| address: `/public/${roomName}?channel=audio`, | ||
| } | ||
| ) | ||
|
|
||
| logCallStartTime(ms) | ||
|
|
||
| expect(ms).toBeLessThan(MAX_CALL_SETUP_TIME_MS) | ||
|
Check failure on line 93 in internal/e2e-js/tests/callfabric/callStartTime.spec.ts
|
||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import type { Video } from '@signalwire/js' | ||
| import { test, expect } from '../fixtures' | ||
| import { SERVER_URL, createTestRoomSession, randomizeRoomName } from '../utils' | ||
|
|
||
| export const MAX_CALL_SETUP_TIME_MS = 5000 | ||
|
|
||
| export const logCallStartTime = (ms: number) => { | ||
| if (ms < MAX_CALL_SETUP_TIME_MS) { | ||
| console.log(`\x1b[1;32m✅ call.start(): ${ms.toFixed(0)} ms\x1b[0m`) | ||
| } else { | ||
| console.log(`\x1b[1;31m❌ call.start(): ${ms.toFixed(0)} ms\x1b[0m`) | ||
| } | ||
| } | ||
|
|
||
| test.describe('RoomSession Start Time', () => { | ||
| test('should join a room room within 5 seconds', async ({ | ||
| createCustomPage, | ||
| }) => { | ||
| const page = await createCustomPage({ name: 'raise-lower' }) | ||
| await page.goto(SERVER_URL) | ||
|
|
||
| const roomName = randomizeRoomName('raise-lower-e2e') | ||
| const memberSettings = { | ||
| vrt: { | ||
| room_name: roomName, | ||
| user_name: 'e2e_participant_meta', | ||
| auto_create_room: true, | ||
| permissions: ['room.prioritize_handraise'], | ||
| }, | ||
| initialEvents: ['room.updated'], | ||
| } | ||
|
|
||
| await createTestRoomSession(page, memberSettings) | ||
|
|
||
| // --------------- Joining the room --------------- | ||
| const ms = await page.evaluate(() => { | ||
| return new Promise<number>(async (resolve, reject) => { | ||
| // @ts-expect-error | ||
| const roomObj: Video.RoomSession = window._roomObj | ||
|
|
||
| roomObj.once('room.joined', () => { | ||
| console.log('Room joined!') | ||
| resolve(performance.now() - t0) | ||
| }) | ||
|
|
||
| const t0 = performance.now() | ||
| await roomObj.join().catch(reject) | ||
| }) | ||
| }) | ||
|
|
||
| logCallStartTime(ms) | ||
|
|
||
| expect(ms).toBeLessThan(MAX_CALL_SETUP_TIME_MS) | ||
|
Check failure on line 53 in internal/e2e-js/tests/roomSessionStartTime.spec.ts
|
||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,12 @@ | ||
| import express, { Express, Request, Response } from 'express' | ||
| import { spawn, ChildProcessWithoutNullStreams } from 'child_process' | ||
| import path from 'path' | ||
| import { EventEmitter } from 'events' | ||
| import { v4 as uuid } from 'uuid' | ||
| import { clearInterval } from 'timers' | ||
| import { Server } from 'http' | ||
| import { createServer } from 'vite' | ||
| import { Page } from '@playwright/test' | ||
| import type { | ||
| DialParams, | ||
| FabricRoomSession, | ||
|
|
@@ -7,16 +16,8 @@ | |
| Video, | ||
| } from '@signalwire/js' | ||
| import type { MediaEventNames } from '@signalwire/webrtc' | ||
| import { createServer } from 'vite' | ||
| import path from 'path' | ||
| import { expect } from './fixtures' | ||
| import { Page } from '@playwright/test' | ||
| import { v4 as uuid } from 'uuid' | ||
| import { clearInterval } from 'timers' | ||
| import express, { Express, Request, Response } from 'express' | ||
| import { Server } from 'http' | ||
| import { spawn, ChildProcessWithoutNullStreams } from 'child_process' | ||
| import { EventEmitter } from 'events' | ||
|
|
||
| declare global { | ||
| interface Window { | ||
| _SWJS: { | ||
|
|
@@ -668,7 +669,7 @@ | |
| // #region Utilities for the MCU | ||
|
|
||
| export const expectMCUVisible = async (page: Page) => { | ||
| await page.waitForSelector('div[id^="sw-sdk-"] > video') | ||
|
Check failure on line 672 in internal/e2e-js/utils.ts
|
||
| } | ||
|
|
||
| export const expectMCUNotVisible = async (page: Page) => { | ||
|
|
@@ -1680,7 +1681,7 @@ | |
| // #region Utilities for Events assertion | ||
|
|
||
| export const expectMemberTalkingEvent = (page: Page) => { | ||
| return page.evaluate(async () => { | ||
|
Check failure on line 1684 in internal/e2e-js/utils.ts
|
||
| return new Promise((resolve) => { | ||
| // @ts-expect-error | ||
| const roomObj: Video.RoomSession = window._roomObj | ||
|
|
@@ -1775,7 +1776,7 @@ | |
| page: Page, | ||
| options: { invokeJoin: boolean } = { invokeJoin: true } | ||
| ) => { | ||
| return page.evaluate(({ invokeJoin }) => { | ||
|
Check failure on line 1779 in internal/e2e-js/utils.ts
|
||
| return new Promise<any>(async (resolve, reject) => { | ||
| // @ts-expect-error | ||
| const roomObj: Video.RoomSession = window._roomObj | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to measure the
dial()as well?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure,
dial()is a sync method, which just initiates the JS class and some Saga workers. Maybe we can write a different test for that? Or maybe one more test including bothdialandstart? 👀