fix: earpiece overlay not showing + playwright test!
This commit is contained in:
@@ -38,6 +38,7 @@ export default defineConfig({
|
|||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: "chromium",
|
name: "chromium",
|
||||||
|
testIgnore: "**/mobile/**",
|
||||||
use: {
|
use: {
|
||||||
...devices["Desktop Chrome"],
|
...devices["Desktop Chrome"],
|
||||||
permissions: [
|
permissions: [
|
||||||
@@ -56,9 +57,9 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "firefox",
|
name: "firefox",
|
||||||
|
testIgnore: "**/mobile/**",
|
||||||
use: {
|
use: {
|
||||||
...devices["Desktop Firefox"],
|
...devices["Desktop Firefox"],
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
@@ -70,6 +71,27 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "mobile",
|
||||||
|
testMatch: "**/mobile/**",
|
||||||
|
use: {
|
||||||
|
...devices["Pixel 7"],
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
permissions: [
|
||||||
|
"clipboard-write",
|
||||||
|
"clipboard-read",
|
||||||
|
"microphone",
|
||||||
|
"camera",
|
||||||
|
],
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
"--use-fake-ui-for-media-stream",
|
||||||
|
"--use-fake-device-for-media-stream",
|
||||||
|
"--mute-audio",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
// No safari for now, until I find a solution to fix `Not allowed to request resource` due to calling
|
// No safari for now, until I find a solution to fix `Not allowed to request resource` due to calling
|
||||||
// clear http to the homeserver
|
// clear http to the homeserver
|
||||||
|
|||||||
112
playwright/mobile/create-call-mobile.spec.ts
Normal file
112
playwright/mobile/create-call-mobile.spec.ts
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 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 { mobileTest } from "./fixture-mobile-create.ts";
|
||||||
|
|
||||||
|
test("@mobile Start a new call then leave and show the feedback screen", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await page.goto("/");
|
||||||
|
|
||||||
|
await page.getByTestId("home_callName").click();
|
||||||
|
await page.getByTestId("home_callName").fill("HelloCall");
|
||||||
|
await page.getByTestId("home_displayName").click();
|
||||||
|
await page.getByTestId("home_displayName").fill("John Doe");
|
||||||
|
await page.getByTestId("home_go").click();
|
||||||
|
|
||||||
|
// await page.pause();
|
||||||
|
await expect(page.locator("video")).toBeVisible();
|
||||||
|
await expect(page.getByTestId("lobby_joinCall")).toBeVisible();
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: "Continue in browser" }).click();
|
||||||
|
// Join the call
|
||||||
|
await page.getByTestId("lobby_joinCall").click();
|
||||||
|
|
||||||
|
// Ensure that the call is connected
|
||||||
|
await page
|
||||||
|
.locator("div")
|
||||||
|
.filter({ hasText: /^HelloCall$/ })
|
||||||
|
.click();
|
||||||
|
// Check the number of participants
|
||||||
|
await expect(page.locator("div").filter({ hasText: /^1$/ })).toBeVisible();
|
||||||
|
// The tooltip with the name should be visible
|
||||||
|
await expect(page.getByTestId("name_tag")).toContainText("John Doe");
|
||||||
|
|
||||||
|
// leave the call
|
||||||
|
await page.getByTestId("incall_leave").click();
|
||||||
|
await expect(page.getByRole("heading")).toContainText(
|
||||||
|
"John Doe, your call has ended. How did it go?",
|
||||||
|
);
|
||||||
|
await expect(page.getByRole("main")).toContainText(
|
||||||
|
"Why not finish by setting up a password to keep your account?",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole("link", { name: "Not now, return to home screen" }),
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
mobileTest("Start a new call as widget", async ({ asMobile, browser }) => {
|
||||||
|
test.slow(); // Triples the timeout
|
||||||
|
const { creatorPage, inviteLink } = asMobile;
|
||||||
|
|
||||||
|
// test("Show earpiece overlay when output is earpiece", async ({ browser }) => {
|
||||||
|
// Use reduce motion to disable animations that are making the tests a bit flaky
|
||||||
|
|
||||||
|
// ========
|
||||||
|
// ACT: The other user use the invite link to join the call as a guest
|
||||||
|
// ========
|
||||||
|
const guestInviteeContext = await browser.newContext({
|
||||||
|
reducedMotion: "reduce",
|
||||||
|
});
|
||||||
|
const guestPage = await guestInviteeContext.newPage();
|
||||||
|
await guestPage.goto(inviteLink + "&controlledAudioDevices=true");
|
||||||
|
|
||||||
|
await guestPage.getByRole("button", { name: "Continue in browser" }).click();
|
||||||
|
|
||||||
|
await guestPage.getByTestId("joincall_displayName").fill("Invitee");
|
||||||
|
await expect(guestPage.getByTestId("joincall_joincall")).toBeVisible();
|
||||||
|
await guestPage.getByTestId("joincall_joincall").click();
|
||||||
|
await guestPage.getByTestId("lobby_joinCall").click();
|
||||||
|
|
||||||
|
// ========
|
||||||
|
// ASSERT: check that there are two members in the call
|
||||||
|
// ========
|
||||||
|
|
||||||
|
// There should be two participants now
|
||||||
|
await expect(
|
||||||
|
guestPage.getByTestId("roomHeader_participants_count"),
|
||||||
|
).toContainText("2");
|
||||||
|
expect(await guestPage.getByTestId("videoTile").count()).toBe(2);
|
||||||
|
|
||||||
|
// Same in creator page
|
||||||
|
await expect(
|
||||||
|
creatorPage.getByTestId("roomHeader_participants_count"),
|
||||||
|
).toContainText("2");
|
||||||
|
expect(await creatorPage.getByTestId("videoTile").count()).toBe(2);
|
||||||
|
|
||||||
|
// TEST: control audio devices from the invitee page
|
||||||
|
|
||||||
|
await guestPage.evaluate(() => {
|
||||||
|
window.controls.setAvailableAudioDevices([
|
||||||
|
{ id: "speaker", name: "Speaker", isSpeaker: true },
|
||||||
|
{ id: "earpiece", name: "Handset", isEarpiece: true },
|
||||||
|
{ id: "headphones", name: "Headphones" },
|
||||||
|
]);
|
||||||
|
window.controls.setAudioDevice("earpiece");
|
||||||
|
});
|
||||||
|
await expect(
|
||||||
|
guestPage.getByRole("heading", { name: "Handset Mode" }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
guestPage.getByRole("button", { name: "Back to Speaker Mode" }),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// await guestPage.pause();
|
||||||
|
});
|
||||||
73
playwright/mobile/fixture-mobile-create.ts
Normal file
73
playwright/mobile/fixture-mobile-create.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { type Browser, type Page, test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
export interface MobileCreateFixtures {
|
||||||
|
asMobile: {
|
||||||
|
creatorPage: Page;
|
||||||
|
inviteLink: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mobileTest = test.extend<MobileCreateFixtures>({
|
||||||
|
asMobile: async ({ browser }, puse) => {
|
||||||
|
const fixtures = await createCallAndInvite(browser);
|
||||||
|
await puse({
|
||||||
|
creatorPage: fixtures.page,
|
||||||
|
inviteLink: fixtures.inviteLink,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a call and generate an invite link
|
||||||
|
*/
|
||||||
|
async function createCallAndInvite(
|
||||||
|
browser: Browser,
|
||||||
|
): Promise<{ page: Page; inviteLink: string }> {
|
||||||
|
const creatorContext = await browser.newContext({ reducedMotion: "reduce" });
|
||||||
|
const creatorPage = await creatorContext.newPage();
|
||||||
|
|
||||||
|
await creatorPage.goto("/");
|
||||||
|
|
||||||
|
// ========
|
||||||
|
// ARRANGE: The first user creates a call as guest, join it, then click the invite button to copy the invite link
|
||||||
|
// ========
|
||||||
|
await creatorPage.getByTestId("home_callName").click();
|
||||||
|
await creatorPage.getByTestId("home_callName").fill("Welcome");
|
||||||
|
await creatorPage.getByTestId("home_displayName").click();
|
||||||
|
await creatorPage.getByTestId("home_displayName").fill("Inviter");
|
||||||
|
await creatorPage.getByTestId("home_go").click();
|
||||||
|
await expect(creatorPage.locator("video")).toBeVisible();
|
||||||
|
|
||||||
|
await creatorPage
|
||||||
|
.getByRole("button", { name: "Continue in browser" })
|
||||||
|
.click();
|
||||||
|
// join
|
||||||
|
await creatorPage.getByTestId("lobby_joinCall").click();
|
||||||
|
|
||||||
|
// Get the invite link
|
||||||
|
await creatorPage.getByRole("button", { name: "Invite" }).click();
|
||||||
|
await expect(
|
||||||
|
creatorPage.getByRole("heading", { name: "Invite to this call" }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(creatorPage.getByRole("img", { name: "QR Code" })).toBeVisible();
|
||||||
|
await expect(creatorPage.getByTestId("modal_inviteLink")).toBeVisible();
|
||||||
|
await expect(creatorPage.getByTestId("modal_inviteLink")).toBeVisible();
|
||||||
|
await creatorPage.getByTestId("modal_inviteLink").click();
|
||||||
|
|
||||||
|
const inviteLink = (await creatorPage.evaluate(
|
||||||
|
"navigator.clipboard.readText()",
|
||||||
|
)) as string;
|
||||||
|
expect(inviteLink).toContain("room/#/");
|
||||||
|
|
||||||
|
return {
|
||||||
|
page: creatorPage,
|
||||||
|
inviteLink,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
@keyframes fade-in {
|
@keyframes fade-in {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
display: flex;
|
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@@ -20,6 +19,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.overlay[data-show="true"] {
|
.overlay[data-show="true"] {
|
||||||
|
display: flex;
|
||||||
animation: fade-in 200ms;
|
animation: fade-in 200ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user