Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions playwright/widget/simple-create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Please see LICENSE in the repository root for full details.
import { expect, test } from "@playwright/test";

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

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

const { brooks, whistler } = asWidget;

await expect(
brooks.page.getByRole("button", { name: "Video call" }),
).toBeVisible();
await brooks.page.getByRole("button", { name: "Video call" }).click();

await expect(
brooks.page.getByRole("menuitem", { name: "Legacy Call" }),
).toBeVisible();
await expect(
brooks.page.getByRole("menuitem", { name: "Element Call" }),
).toBeVisible();

await brooks.page.getByRole("menuitem", { name: "Element Call" }).click();
await TestHelpers.startCallInCurrentRoom(brooks.page, false);

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

// Join from the other side
await expect(whistler.page.getByText("Video call started")).toBeVisible();
await expect(
whistler.page.getByRole("button", { name: "Join" }),
).toBeVisible();
await whistler.page.getByRole("button", { name: "Join" }).click();
await TestHelpers.joinCallInCurrentRoom(whistler.page);

// Currently disabled due to recent Element Web is bypassing Lobby
// await expect(
Expand Down
27 changes: 27 additions & 0 deletions playwright/widget/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class TestHelpers {
).toBeVisible();

await page.getByRole("menuitem", { name: "Element Call" }).click();

// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
await this.dismissFileDialogPermissionIfNeeded(page);
}

public static async joinCallFromLobby(page: Page): Promise<void> {
Expand All @@ -60,6 +63,9 @@ export class TestHelpers {
await expect(page.getByText(label)).toBeVisible();
await expect(page.getByRole("button", { name: "Join" })).toBeVisible();
await page.getByRole("button", { name: "Join" }).click();

// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
await this.dismissFileDialogPermissionIfNeeded(page);
}

/**
Expand Down Expand Up @@ -235,9 +241,30 @@ export class TestHelpers {
): Promise<void> {
await page.getByRole("button", { name: "Video call" }).click();
await page.getByRole("menuitem", { name: "Element Call" }).click();

// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
await this.dismissFileDialogPermissionIfNeeded(page);

await TestHelpers.setEmbeddedElementCallRtcMode(page, mode);
await page.getByRole("button", { name: "Close lobby" }).click();
}

// TODO: Remove as soon as web merges https://github.com/element-hq/element-web/pull/32755
public static async dismissFileDialogPermissionIfNeeded(
page: Page,
): Promise<void> {
const dialogHeading = page.getByRole("heading", {
name: "Approve widget permissions",
});

try {
await expect(dialogHeading).toBeVisible({ timeout: 3000 });
await page.getByRole("button", { name: "Approve" }).click();
} catch {
// Dialog did not appear, that's fine
}
}

/**
* Goes to the settings to set the RTC mode.
* then closes the settings modal.
Expand Down
4 changes: 4 additions & 0 deletions playwright/widget/voice-call-dm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ widgetTest(
await expect(whistler.page.getByText("Incoming voice call")).toBeVisible();
await whistler.page.getByRole("button", { name: "Accept" }).click();

await TestHelpers.dismissFileDialogPermissionIfNeeded(whistler.page);

await expect(
whistler.page.locator('iframe[title="Element Call"]'),
).toBeVisible();
Expand Down Expand Up @@ -138,6 +140,8 @@ widgetTest(
await expect(whistler.page.getByText("Incoming video call")).toBeVisible();
await whistler.page.getByRole("button", { name: "Accept" }).click();

await TestHelpers.dismissFileDialogPermissionIfNeeded(whistler.page);

await expect(
whistler.page.locator('iframe[title="Element Call"]'),
).toBeVisible();
Expand Down
Loading