During a screenshare the spotlight carousel now holds the shares first, then the host-pinned camera (as before), then every other remote camera that is on, in join order. Viewers use the same arrows/dots as between shares. With no share nothing changes (upstream speaker-follows). SpotlightTile gets a small lotus hook that keeps the share as the default view when a share starts and falls back to the first item when the visible camera turns off or its owner leaves (the IntersectionObserver alone leaves visibleId stale when the target is already in view). Indicator dots get data-kind so tests can tell shares from cameras. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
159 lines
4.7 KiB
TypeScript
159 lines
4.7 KiB
TypeScript
/*
|
|
Copyright 2026 Element Creations Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import { expect, test } from "@playwright/test";
|
|
|
|
import { widgetTest } from "../fixtures/widget-user.ts";
|
|
import { HOST1, TestHelpers } from "./test-helpers.ts";
|
|
|
|
widgetTest("Sharing screen in group call", async ({ addUser, browserName }) => {
|
|
test.skip(
|
|
browserName === "firefox",
|
|
"The is test is not working on firefox CI environment. No mic/audio device inputs so cam/mic are disabled",
|
|
);
|
|
|
|
test.slow(); // We are registering multiple users here, give it more time
|
|
|
|
const [alice, bob, carol] = await Promise.all([
|
|
addUser("Alice", HOST1),
|
|
addUser("Bob", HOST1),
|
|
addUser("Carol", HOST1),
|
|
]);
|
|
|
|
const roomName = "Meeting Room";
|
|
await TestHelpers.createRoom(roomName, alice.page, [bob.mxId, carol.mxId]);
|
|
|
|
for (const user of [bob, carol]) {
|
|
// Accept the invite
|
|
// This isn't super stable to get this as this super generic locator,
|
|
// but it works for now.
|
|
await TestHelpers.acceptRoomInvite(roomName, user.page);
|
|
}
|
|
|
|
await TestHelpers.startCallInCurrentRoom(alice.page, false);
|
|
await expect(
|
|
alice.page.locator('iframe[title="Element Call"]'),
|
|
).toBeVisible();
|
|
|
|
await TestHelpers.joinCallFromLobby(alice.page);
|
|
|
|
for (const user of [bob, carol]) {
|
|
await TestHelpers.joinCallInCurrentRoom(user.page);
|
|
}
|
|
|
|
for (const user of [alice, bob, carol]) {
|
|
const frame = user.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
|
|
// Expect 3 video tiles
|
|
await expect(frame.locator("video")).toHaveCount(3, {
|
|
timeout: 10000,
|
|
});
|
|
}
|
|
|
|
// await alice.page.pause();
|
|
|
|
await alice.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame()
|
|
.getByRole("switch", { name: "Share screen" })
|
|
.click();
|
|
|
|
// await alice.page.pause();
|
|
|
|
for (const user of [alice, bob, carol]) {
|
|
const frame = user.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
|
|
// Expect 6 video tiles: 3 cameras in the grid, plus the spotlight
|
|
// carousel's screen share and the 2 remote cameras (lotus #67)
|
|
await expect(frame.locator("video")).toHaveCount(6, {
|
|
timeout: 5000,
|
|
});
|
|
|
|
await expect(
|
|
frame.locator('video[data-lk-source="screen_share"]'),
|
|
).toHaveCount(1);
|
|
}
|
|
|
|
// Alice should be in grid mode as she is local sharing
|
|
{
|
|
const frame = alice.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
await expect(frame.getByRole("radio", { name: "Grid" })).toBeChecked();
|
|
}
|
|
|
|
// Others should have switched to spotlight
|
|
for (const user of [bob, carol]) {
|
|
const frame = user.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
|
|
await expect(frame.getByRole("radio", { name: "Spotlight" })).toBeChecked();
|
|
}
|
|
// await alice.page.pause();
|
|
// await bob.page.pause();
|
|
|
|
// Let's start another screen share from bob
|
|
await bob.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame()
|
|
.getByRole("switch", { name: "Share screen" })
|
|
.click();
|
|
|
|
{
|
|
const frame = carol.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
|
|
// Expect 7 video tiles: 3 cameras in the grid, plus the spotlight
|
|
// carousel's 2 screen shares and 2 remote cameras (lotus #67)
|
|
await expect(frame.locator("video")).toHaveCount(7, {
|
|
timeout: 5000,
|
|
});
|
|
|
|
await expect(
|
|
frame.locator('video[data-lk-source="screen_share"]'),
|
|
).toHaveCount(2);
|
|
|
|
// Expect 4 indicators at the bottom: the 2 shares first, then the 2
|
|
// remote cameras (lotus #67)
|
|
await expect(frame.getByTestId("screenshare-indicator")).toHaveCount(4);
|
|
await expect(
|
|
frame.locator('[data-testid="screenshare-indicator"][data-kind="user"]'),
|
|
).toHaveCount(2);
|
|
|
|
// Check the first indicator is visible
|
|
await expect(
|
|
frame.getByTestId("screenshare-indicator").first(),
|
|
).toHaveAttribute("data-visible", "true");
|
|
|
|
await carol.page.pause();
|
|
|
|
// now click on next
|
|
await expect(frame.getByRole("button", { name: "Next" })).toBeVisible();
|
|
await frame.getByRole("button", { name: "Next" }).click();
|
|
|
|
// Check the second indicator is visible
|
|
await expect(
|
|
frame.getByTestId("screenshare-indicator").nth(1),
|
|
).toHaveAttribute("data-visible", "true");
|
|
// the first one should be grayed out
|
|
await expect(
|
|
frame.getByTestId("screenshare-indicator").first(),
|
|
).toHaveAttribute("data-visible", "false");
|
|
|
|
// There should be a prev button now
|
|
await expect(frame.getByRole("button", { name: "Back" })).toBeVisible();
|
|
|
|
// await carol.page.pause();
|
|
}
|
|
});
|