Make apps/web/playwright comply with strict mode (#34403)
* Make apps/web/playwright comply with strict mode Otherwise it sometimes fails to compile matrix-js-sdk as strict mode & noImplicitAny both impact how overloads are asserted * Iterate
This commit is contained in:
@@ -63,7 +63,7 @@ async function sendRTCState(bot: Bot, roomId: string, notification?: "ring" | "n
|
||||
},
|
||||
"scope": "m.room",
|
||||
},
|
||||
`_@${bot.credentials.userId}_OiDFxsZrjz_m.call`,
|
||||
`_@${bot.credentials!.userId}_OiDFxsZrjz_m.call`,
|
||||
);
|
||||
if (!notification) {
|
||||
return;
|
||||
@@ -140,7 +140,7 @@ test.describe("Element Call", () => {
|
||||
await charlie.prepareClient();
|
||||
const roomId = await app.client.createRoom({
|
||||
name: "TestRoom",
|
||||
invite: [bot.credentials.userId, charlie.credentials.userId],
|
||||
invite: [bot.credentials!.userId, charlie.credentials!.userId],
|
||||
});
|
||||
await use({ roomId });
|
||||
},
|
||||
@@ -155,7 +155,7 @@ test.describe("Element Call", () => {
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
// Ensure we set the correct parameters for ECall.
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
expect(hash.get("intent")).toEqual("start_call");
|
||||
@@ -180,7 +180,7 @@ test.describe("Element Call", () => {
|
||||
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
expect(hash.get("intent")).toEqual("start_call");
|
||||
@@ -192,7 +192,7 @@ test.describe("Element Call", () => {
|
||||
await app.viewRoomById(room.roomId);
|
||||
// Allow bob to create a call
|
||||
await expect(page.getByText("Bob and one other were invited and joined")).toBeVisible();
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials.userId, 50);
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials!.userId, 50);
|
||||
// Fake a start of a call
|
||||
await sendRTCState(bot, room.roomId, undefined, callType === "voice" ? "audio" : "video");
|
||||
const button = page.getByTestId("join-call-button");
|
||||
@@ -205,7 +205,7 @@ test.describe("Element Call", () => {
|
||||
await button.click();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
|
||||
@@ -237,7 +237,7 @@ test.describe("Element Call", () => {
|
||||
await app.viewRoomById(room.roomId);
|
||||
// Allow bob to create a call
|
||||
await expect(page.getByText("Bob and one other were invited and joined")).toBeVisible();
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials.userId, 50);
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials!.userId, 50);
|
||||
// Fake a start of a call
|
||||
await sendRTCState(bot, room.roomId, "notification", "video");
|
||||
const toast = page.locator(".mx_Toast_toast");
|
||||
@@ -255,7 +255,7 @@ test.describe("Element Call", () => {
|
||||
await button.click();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
|
||||
@@ -272,7 +272,7 @@ test.describe("Element Call", () => {
|
||||
await app.viewRoomById(room.roomId);
|
||||
// Allow bob to create a call
|
||||
await expect(page.getByText("Bob and one other were invited and joined")).toBeVisible();
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials.userId, 50);
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials!.userId, 50);
|
||||
// Fake a start of a call
|
||||
await sendRTCState(bot, room.roomId, "notification", "audio");
|
||||
const toast = page.locator(".mx_Toast_toast");
|
||||
@@ -284,7 +284,7 @@ test.describe("Element Call", () => {
|
||||
await button.click();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
|
||||
@@ -299,11 +299,11 @@ test.describe("Element Call", () => {
|
||||
room: async ({ page, app, user, bot }, use) => {
|
||||
const roomId = await app.client.createRoom({
|
||||
preset: "trusted_private_chat" as Preset.TrustedPrivateChat,
|
||||
invite: [bot.credentials.userId],
|
||||
invite: [bot.credentials!.userId],
|
||||
});
|
||||
await bot.awaitRoomMembership(roomId);
|
||||
await app.client.setAccountData("m.direct" as EventType.Direct, {
|
||||
[bot.credentials.userId]: [roomId],
|
||||
[bot.credentials!.userId]: [roomId],
|
||||
});
|
||||
await use({ roomId });
|
||||
},
|
||||
@@ -318,7 +318,7 @@ test.describe("Element Call", () => {
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
expect(hash.get("intent")).toEqual("start_call_dm");
|
||||
@@ -336,7 +336,7 @@ test.describe("Element Call", () => {
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
expect(hash.get("intent")).toEqual("start_call_dm");
|
||||
@@ -370,7 +370,7 @@ test.describe("Element Call", () => {
|
||||
await button.click();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
|
||||
@@ -410,7 +410,7 @@ test.describe("Element Call", () => {
|
||||
await button.click();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
|
||||
@@ -444,7 +444,7 @@ test.describe("Element Call", () => {
|
||||
await button.click();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, room);
|
||||
|
||||
@@ -477,7 +477,7 @@ test.describe("Element Call", () => {
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
expect(frameUrlStr).toBeDefined();
|
||||
// Ensure we set the correct parameters for ECall.
|
||||
const url = new URL(frameUrlStr);
|
||||
const url = new URL(frameUrlStr!);
|
||||
const hash = new URLSearchParams(url.hash.slice(1));
|
||||
assertCommonCallParameters(url.searchParams, hash, user, { roomId });
|
||||
expect(hash.get("intent")).toEqual("join_existing");
|
||||
@@ -494,7 +494,7 @@ test.describe("Element Call", () => {
|
||||
await charlie.prepareClient();
|
||||
const roomId = await app.client.createRoom({
|
||||
name: "TestRoom",
|
||||
invite: [bot.credentials.userId, charlie.credentials.userId],
|
||||
invite: [bot.credentials!.userId, charlie.credentials!.userId],
|
||||
});
|
||||
await app.client.createRoom({
|
||||
name: "OtherRoom",
|
||||
@@ -514,7 +514,7 @@ test.describe("Element Call", () => {
|
||||
const iframe = page.locator("iframe");
|
||||
await expect(iframe).toBeVisible();
|
||||
const frameUrlStr = await page.locator("iframe").getAttribute("src");
|
||||
const callFrame = page.frame({ url: frameUrlStr });
|
||||
const callFrame = page.frame({ url: frameUrlStr! })!;
|
||||
await callFrame.getByRole("button", { name: "Join Call" }).click();
|
||||
await expect(callFrame.getByText("In call", { exact: true })).toBeVisible();
|
||||
|
||||
@@ -608,7 +608,7 @@ test.describe("Element Call", () => {
|
||||
}) => {
|
||||
await app.viewRoomById(room.roomId);
|
||||
await expect(page.getByText("Bob and one other were invited and joined")).toBeVisible();
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials.userId, 50);
|
||||
await app.client.setPowerLevel(room.roomId, bot.credentials!.userId, 50);
|
||||
|
||||
await sendRTCState(bot, room.roomId);
|
||||
await openAndJoinCall(page, true);
|
||||
@@ -654,7 +654,7 @@ test.describe("Element Call", () => {
|
||||
await charlie.prepareClient();
|
||||
const roomId = await app.client.createRoom({
|
||||
name: "VideoRoom",
|
||||
invite: [bot.credentials.userId, charlie.credentials.userId],
|
||||
invite: [bot.credentials!.userId, charlie.credentials!.userId],
|
||||
creation_content: {
|
||||
type: "org.matrix.msc3417.call",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user