Skip to content

Commit ce1cd9a

Browse files
authored
Merge pull request #3830 from element-hq/valere/tmp_fix_download_file_permission
Workaround: EW has not yet merged the download file permission for EC
2 parents 40fdef8 + d5ec3c3 commit ce1cd9a

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

playwright/widget/simple-create.spec.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Please see LICENSE in the repository root for full details.
88
import { expect, test } from "@playwright/test";
99

1010
import { widgetTest } from "../fixtures/widget-user.ts";
11+
import { TestHelpers } from "./test-helpers.ts";
1112

1213
// Skip test, including Fixtures
1314
widgetTest.skip(
@@ -20,19 +21,7 @@ widgetTest("Start a new call as widget", async ({ asWidget, browserName }) => {
2021

2122
const { brooks, whistler } = asWidget;
2223

23-
await expect(
24-
brooks.page.getByRole("button", { name: "Video call" }),
25-
).toBeVisible();
26-
await brooks.page.getByRole("button", { name: "Video call" }).click();
27-
28-
await expect(
29-
brooks.page.getByRole("menuitem", { name: "Legacy Call" }),
30-
).toBeVisible();
31-
await expect(
32-
brooks.page.getByRole("menuitem", { name: "Element Call" }),
33-
).toBeVisible();
34-
35-
await brooks.page.getByRole("menuitem", { name: "Element Call" }).click();
24+
await TestHelpers.startCallInCurrentRoom(brooks.page, false);
3625

3726
await expect(
3827
brooks.page
@@ -56,11 +45,7 @@ widgetTest("Start a new call as widget", async ({ asWidget, browserName }) => {
5645
).toBeVisible();
5746

5847
// Join from the other side
59-
await expect(whistler.page.getByText("Video call started")).toBeVisible();
60-
await expect(
61-
whistler.page.getByRole("button", { name: "Join" }),
62-
).toBeVisible();
63-
await whistler.page.getByRole("button", { name: "Join" }).click();
48+
await TestHelpers.joinCallInCurrentRoom(whistler.page);
6449

6550
// Currently disabled due to recent Element Web is bypassing Lobby
6651
// await expect(

playwright/widget/test-helpers.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export class TestHelpers {
3434
).toBeVisible();
3535

3636
await page.getByRole("menuitem", { name: "Element Call" }).click();
37+
38+
// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
39+
await this.dismissFileDialogPermissionIfNeeded(page);
3740
}
3841

3942
public static async joinCallFromLobby(page: Page): Promise<void> {
@@ -60,6 +63,9 @@ export class TestHelpers {
6063
await expect(page.getByText(label)).toBeVisible();
6164
await expect(page.getByRole("button", { name: "Join" })).toBeVisible();
6265
await page.getByRole("button", { name: "Join" }).click();
66+
67+
// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
68+
await this.dismissFileDialogPermissionIfNeeded(page);
6369
}
6470

6571
/**
@@ -235,9 +241,30 @@ export class TestHelpers {
235241
): Promise<void> {
236242
await page.getByRole("button", { name: "Video call" }).click();
237243
await page.getByRole("menuitem", { name: "Element Call" }).click();
244+
245+
// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
246+
await this.dismissFileDialogPermissionIfNeeded(page);
247+
238248
await TestHelpers.setEmbeddedElementCallRtcMode(page, mode);
239249
await page.getByRole("button", { name: "Close lobby" }).click();
240250
}
251+
252+
// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
253+
public static async dismissFileDialogPermissionIfNeeded(
254+
page: Page,
255+
): Promise<void> {
256+
const dialogHeading = page.getByRole("heading", {
257+
name: "Approve widget permissions",
258+
});
259+
260+
try {
261+
await expect(dialogHeading).toBeVisible({ timeout: 3000 });
262+
await page.getByRole("button", { name: "Approve" }).click();
263+
} catch {
264+
// Dialog did not appear, that's fine
265+
}
266+
}
267+
241268
/**
242269
* Goes to the settings to set the RTC mode.
243270
* then closes the settings modal.

playwright/widget/voice-call-dm.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ widgetTest(
4545
await expect(whistler.page.getByText("Incoming voice call")).toBeVisible();
4646
await whistler.page.getByRole("button", { name: "Accept" }).click();
4747

48+
await TestHelpers.dismissFileDialogPermissionIfNeeded(whistler.page);
49+
4850
await expect(
4951
whistler.page.locator('iframe[title="Element Call"]'),
5052
).toBeVisible();
@@ -138,6 +140,8 @@ widgetTest(
138140
await expect(whistler.page.getByText("Incoming video call")).toBeVisible();
139141
await whistler.page.getByRole("button", { name: "Accept" }).click();
140142

143+
await TestHelpers.dismissFileDialogPermissionIfNeeded(whistler.page);
144+
141145
await expect(
142146
whistler.page.locator('iframe[title="Element Call"]'),
143147
).toBeVisible();

0 commit comments

Comments
 (0)