mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-13 06:07:04 +00:00
75 lines
2.3 KiB
TypeScript
75 lines
2.3 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("Put call in PIP", 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();
|
|
|
|
const valere = await addUser("Valere", HOST1);
|
|
const timo = await addUser("Timo", HOST1);
|
|
|
|
const callRoom = "TeamRoom";
|
|
await TestHelpers.createRoom(callRoom, valere.page, [timo.mxId]);
|
|
|
|
await TestHelpers.createRoom("DoubleTask", valere.page);
|
|
|
|
await TestHelpers.acceptRoomInvite(callRoom, timo.page);
|
|
|
|
await TestHelpers.switchToRoomNamed(valere.page, callRoom);
|
|
|
|
// Start the call as Valere
|
|
await TestHelpers.startCallInCurrentRoom(valere.page, false);
|
|
await expect(
|
|
valere.page.locator('iframe[title="Element Call"]'),
|
|
).toBeVisible();
|
|
|
|
await TestHelpers.joinCallFromLobby(valere.page);
|
|
|
|
await TestHelpers.joinCallInCurrentRoom(timo.page);
|
|
|
|
{
|
|
const frame = timo.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
|
|
const videoButton = frame.getByTestId("incall_videomute");
|
|
await expect(videoButton).toBeVisible();
|
|
// check that the video is on
|
|
await expect(videoButton).toHaveAttribute("aria-label", /^Stop video$/);
|
|
}
|
|
|
|
// Switch to the other room, the call should go to PIP
|
|
await TestHelpers.switchToRoomNamed(valere.page, "DoubleTask");
|
|
|
|
// We should see the PIP overlay
|
|
await expect(valere.page.locator(".mx_WidgetPip_overlay")).toBeVisible();
|
|
|
|
{
|
|
// wait a bit so that the PIP has rendered the video
|
|
await valere.page.waitForTimeout(600);
|
|
|
|
// Check for a bug where the video had the wrong fit in PIP
|
|
const frame = valere.page
|
|
.locator('iframe[title="Element Call"]')
|
|
.contentFrame();
|
|
const videoElements = await frame.locator("video").all();
|
|
expect(videoElements.length).toBe(1);
|
|
|
|
const pipVideo = videoElements[0];
|
|
await expect(pipVideo).toHaveCSS("object-fit", "cover");
|
|
}
|
|
});
|