Skip to content

Commit 76a0025

Browse files
dbkromitech
authored andcommitted
Fix jitsi widget popout (element-hq#30908)
* Fix jitsi widget popout Unfortunately I don't think playwright or jest can write a test for something successfully opening a new tab. Fixes element-hq/element-desktop#2527 * On second thoughts, this is probably overkill * Clarify * Add test * Unused import
1 parent 5543909 commit 76a0025

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Copyright 2025 New Vector Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import { test as base, expect } from "../../element-web-test";
9+
import { Bot } from "../../pages/bot";
10+
11+
const ROOM_NAME = "Jitsi Room";
12+
13+
const test = base.extend<{
14+
bot1: Bot;
15+
bot2: Bot;
16+
}>({
17+
bot2: async ({ page, homeserver }, use, testInfo) => {
18+
const bot = new Bot(page, homeserver, { displayName: `ByteBot_${testInfo.testId}` });
19+
await bot.prepareClient(); // eagerly register the bot
20+
await use(bot);
21+
},
22+
});
23+
24+
test.describe("Jitsi Calls", () => {
25+
test.use({
26+
displayName: "Jimmy",
27+
botCreateOpts: { displayName: "Bot", autoAcceptInvites: false },
28+
});
29+
30+
test("should be able to pop out a jitsi widget", async ({ page, app, bot, bot2, context }) => {
31+
const roomId = await app.client.createRoom({
32+
name: ROOM_NAME,
33+
invite: [bot.credentials.userId, bot2.credentials.userId],
34+
});
35+
36+
await bot.joinRoom(roomId);
37+
await bot2.joinRoom(roomId);
38+
39+
// open the room
40+
await app.viewRoomByName(ROOM_NAME);
41+
42+
await page.getByRole("button", { name: "Video call" }).click();
43+
44+
const pagePromise = context.waitForEvent("page");
45+
46+
await page.getByRole("button", { name: "Popout widget" }).click();
47+
48+
const newPage = await pagePromise;
49+
await expect(newPage.getByRole("button", { name: "Join Conference" })).toBeVisible();
50+
});
51+
});

src/components/views/elements/AppTile.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ export default class AppTile extends React.Component<IProps, IState> {
476476
}
477477

478478
// Delete the widget from the persisted store for good measure.
479+
// XXX: This removes persistent elements from the DOM entirely, which feels like
480+
// a lot more than this function claims to be doing.
479481
PersistedElement.destroyElement(this.persistKey);
480482
ActiveWidgetStore.instance.destroyPersistentWidget(
481483
this.props.app.id,
@@ -586,7 +588,7 @@ export default class AppTile extends React.Component<IProps, IState> {
586588
// reset messaging
587589
this.resetWidget(this.props);
588590
this.iframeParent?.querySelector("iframe")?.remove();
589-
this.startMessaging();
591+
// iframeParent will now be re-mounted, at which point startMessaging will be called
590592
}
591593

592594
// TODO replace with full screen interactions

0 commit comments

Comments
 (0)