-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Defer to Element Call for skipping the lobby when starting or joining a call #30833
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
Changes from all commits
09c139d
fdd6f6c
c8b0fb6
5194038
25ec93e
6c9255b
bc50fd1
511a180
4a2cd6d
873f8b7
26e51a7
236120c
5971342
85713e5
683daa4
c819529
2c591ce
4853966
844d546
b800c51
5ab9c04
086007c
ee6696e
2eaf20e
e1bbbac
532f361
7fe448b
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 |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| /* | ||
| Copyright 2025 New Vector Ltd. | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
| Please see LICENSE files in the repository root for full details. | ||
| */ | ||
|
|
||
| import type { EventType, Preset } from "matrix-js-sdk/src/matrix"; | ||
| import { SettingLevel } from "../../../src/settings/SettingLevel"; | ||
| import { test, expect } from "../../element-web-test"; | ||
| import type { Credentials } from "../../plugins/homeserver"; | ||
|
|
||
| function assertCommonCallParameters( | ||
| url: URLSearchParams, | ||
| hash: URLSearchParams, | ||
| user: Credentials, | ||
| room: { roomId: string }, | ||
| ): void { | ||
| expect(url.has("widgetId")).toEqual(true); | ||
| expect(url.has("parentUrl")).toEqual(true); | ||
|
|
||
| expect(hash.get("perParticipantE2EE")).toEqual("false"); | ||
| expect(hash.get("userId")).toEqual(user.userId); | ||
| expect(hash.get("deviceId")).toEqual(user.deviceId); | ||
| expect(hash.get("roomId")).toEqual(room.roomId); | ||
| expect(hash.get("preload")).toEqual("false"); | ||
|
|
||
| expect(hash.has("rageshakeSubmitUrl")).toEqual(true); | ||
| expect(hash.has("returnToLobby")).toEqual(false); | ||
| } | ||
|
|
||
| test.describe("Element Call", () => { | ||
| test.use({ | ||
| config: { | ||
| element_call: { | ||
| use_exclusively: true, | ||
| }, | ||
| }, | ||
| botCreateOpts: { | ||
| autoAcceptInvites: true, | ||
| displayName: "Bob", | ||
| }, | ||
| }); | ||
|
|
||
| test.beforeEach(async ({ page, user, app }) => { | ||
| // Mock a widget page. It doesn't need to actually be Element Call. | ||
| await page.route("/widget.html", async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| body: "<p> Hello world </p>", | ||
| }); | ||
| }); | ||
| await app.settings.setValue( | ||
| "Developer.elementCallUrl", | ||
| null, | ||
| SettingLevel.DEVICE, | ||
| new URL("/widget.html#", page.url()).toString(), | ||
| ); | ||
| }); | ||
|
|
||
| test.describe("Group Chat", () => { | ||
| test.use({ | ||
| room: async ({ page, app, user, bot }, use) => { | ||
| const roomId = await app.client.createRoom({ name: "TestRoom", invite: [bot.credentials.userId] }); | ||
| await use({ roomId }); | ||
| }, | ||
| }); | ||
| test("should be able to start a video call", async ({ page, user, room, app }) => { | ||
| await app.viewRoomById(room.roomId); | ||
| await expect(page.getByText("Bob joined the room")).toBeVisible(); | ||
|
|
||
| await page.getByRole("button", { name: "Video call" }).click(); | ||
| await page.getByRole("menuitem", { name: "Element Call" }).click(); | ||
|
Check failure on line 73 in playwright/e2e/voip/element-call.spec.ts
|
||
|
|
||
| const frameUrlStr = await page.locator("iframe").getAttribute("src"); | ||
| await expect(frameUrlStr).toBeDefined(); | ||
| // Ensure we set the correct parameters for ECall. | ||
| const url = new URL(frameUrlStr); | ||
| const hash = new URLSearchParams(url.hash.slice(1)); | ||
| assertCommonCallParameters(url.searchParams, hash, user, room); | ||
| expect(hash.get("sendNotificationType")).toEqual("notification"); | ||
| expect(hash.get("intent")).toEqual("start_call"); | ||
| expect(hash.get("skipLobby")).toEqual(null); | ||
| }); | ||
|
|
||
| test("should be able to skip lobby by holding down shift", async ({ page, user, bot, room, app }) => { | ||
| await app.viewRoomById(room.roomId); | ||
| await expect(page.getByText("Bob joined the room")).toBeVisible(); | ||
|
|
||
| await page.getByRole("button", { name: "Video call" }).click(); | ||
| await page.keyboard.down("Shift"); | ||
| await page.getByRole("menuitem", { name: "Element Call" }).click(); | ||
|
Check failure on line 92 in playwright/e2e/voip/element-call.spec.ts
|
||
| await page.keyboard.up("Shift"); | ||
|
|
||
| const frameUrlStr = await page.locator("iframe").getAttribute("src"); | ||
| await expect(frameUrlStr).toBeDefined(); | ||
| const url = new URL(frameUrlStr); | ||
| const hash = new URLSearchParams(url.hash.slice(1)); | ||
| assertCommonCallParameters(url.searchParams, hash, user, room); | ||
| expect(hash.get("sendNotificationType")).toEqual("notification"); | ||
| expect(hash.get("intent")).toEqual("start_call"); | ||
| expect(hash.get("skipLobby")).toEqual("true"); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe("DMs", () => { | ||
| test.use({ | ||
| room: async ({ page, app, user, bot }, use) => { | ||
| const roomId = await app.client.createRoom({ | ||
| name: "TestRoom", | ||
| preset: "trusted_private_chat" as Preset.TrustedPrivateChat, | ||
| invite: [bot.credentials.userId], | ||
| }); | ||
| await app.client.setAccountData("m.direct" as EventType.Direct, { | ||
| [bot.credentials.userId]: [roomId], | ||
| }); | ||
| await use({ roomId }); | ||
| }, | ||
| }); | ||
|
|
||
| test("should be able to start a video call", async ({ page, user, room, app }) => { | ||
| await app.viewRoomById(room.roomId); | ||
| await expect(page.getByText("Bob joined the room")).toBeVisible(); | ||
|
|
||
| await page.getByRole("button", { name: "Video call" }).click(); | ||
| await page.getByRole("menuitem", { name: "Element Call" }).click(); | ||
| const frameUrlStr = await page.locator("iframe").getAttribute("src"); | ||
|
|
||
| await expect(frameUrlStr).toBeDefined(); | ||
| const url = new URL(frameUrlStr); | ||
| const hash = new URLSearchParams(url.hash.slice(1)); | ||
| assertCommonCallParameters(url.searchParams, hash, user, room); | ||
| expect(hash.get("sendNotificationType")).toEqual("ring"); | ||
| expect(hash.get("intent")).toEqual("start_call_dm"); | ||
| expect(hash.get("skipLobby")).toEqual(null); | ||
| }); | ||
|
|
||
| test("should be able to skip lobby by holding down shift", async ({ page, user, room, app }) => { | ||
| await app.viewRoomById(room.roomId); | ||
| await expect(page.getByText("Bob joined the room")).toBeVisible(); | ||
|
|
||
| await page.getByRole("button", { name: "Video call" }).click(); | ||
| await page.keyboard.down("Shift"); | ||
| await page.getByRole("menuitem", { name: "Element Call" }).click(); | ||
| await page.keyboard.up("Shift"); | ||
| const frameUrlStr = await page.locator("iframe").getAttribute("src"); | ||
|
|
||
| await expect(frameUrlStr).toBeDefined(); | ||
| const url = new URL(frameUrlStr); | ||
| const hash = new URLSearchParams(url.hash.slice(1)); | ||
| assertCommonCallParameters(url.searchParams, hash, user, room); | ||
| expect(hash.get("sendNotificationType")).toEqual("ring"); | ||
| expect(hash.get("intent")).toEqual("start_call_dm"); | ||
| expect(hash.get("skipLobby")).toEqual("true"); | ||
| }); | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.