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:
@@ -60,7 +60,7 @@ test.describe("Event List Summary", () => {
|
||||
await app.client.sendMessage(roomId, "Saying something");
|
||||
|
||||
// When we ban the bot
|
||||
await app.client.ban(roomId, bot.credentials.userId);
|
||||
await app.client.ban(roomId, bot.credentials!.userId);
|
||||
|
||||
// Then we say that, but the name is hidden
|
||||
await expect(
|
||||
@@ -92,8 +92,8 @@ test.describe("Event List Summary", () => {
|
||||
).toBeVisible();
|
||||
|
||||
// When we perform multiple actions on it
|
||||
await app.client.kick(roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials.userId);
|
||||
await app.client.kick(roomId, bot.credentials!.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials!.userId);
|
||||
await bot.joinRoom(roomId);
|
||||
|
||||
// Then those actions are gathered into a single summary
|
||||
@@ -126,9 +126,9 @@ test.describe("Event List Summary", () => {
|
||||
).toBeVisible();
|
||||
|
||||
// When we perform multiple actions on it, including a ban
|
||||
await app.client.ban(roomId, bot.credentials.userId);
|
||||
await app.client.unban(roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials.userId);
|
||||
await app.client.ban(roomId, bot.credentials!.userId);
|
||||
await app.client.unban(roomId, bot.credentials!.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials!.userId);
|
||||
await bot.joinRoom(roomId);
|
||||
|
||||
// Then those actions are gathered into a single summary, with the name hidden
|
||||
@@ -158,7 +158,7 @@ test.describe("Event List Summary", () => {
|
||||
autoAcceptInvites: false,
|
||||
});
|
||||
await bot2.prepareClient();
|
||||
await app.client.inviteUser(roomId, bot2.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot2.credentials!.userId);
|
||||
await app.client.sendMessage(roomId, "I invited MyBot2...");
|
||||
await bot.joinRoom(roomId);
|
||||
await bot2.joinRoom(roomId);
|
||||
@@ -169,10 +169,10 @@ test.describe("Event List Summary", () => {
|
||||
).toBeVisible();
|
||||
|
||||
// When we perform multiple actions on both bots
|
||||
await app.client.kick(roomId, bot.credentials.userId);
|
||||
await app.client.kick(roomId, bot2.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot2.credentials.userId);
|
||||
await app.client.kick(roomId, bot.credentials!.userId);
|
||||
await app.client.kick(roomId, bot2.credentials!.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials!.userId);
|
||||
await app.client.inviteUser(roomId, bot2.credentials!.userId);
|
||||
await bot.joinRoom(roomId);
|
||||
await bot2.joinRoom(roomId);
|
||||
|
||||
@@ -227,7 +227,7 @@ test.describe("Event List Summary", () => {
|
||||
autoAcceptInvites: false,
|
||||
});
|
||||
await bot2.prepareClient();
|
||||
await app.client.inviteUser(roomId, bot2.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot2.credentials!.userId);
|
||||
await app.client.sendMessage(roomId, "I invited MyBot2...");
|
||||
await bot.joinRoom(roomId);
|
||||
await bot2.joinRoom(roomId);
|
||||
@@ -238,11 +238,11 @@ test.describe("Event List Summary", () => {
|
||||
).toBeVisible();
|
||||
|
||||
// When we ban bot1 but not bot2
|
||||
await app.client.ban(roomId, bot.credentials.userId);
|
||||
await app.client.unban(roomId, bot.credentials.userId);
|
||||
await app.client.kick(roomId, bot2.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot2.credentials.userId);
|
||||
await app.client.ban(roomId, bot.credentials!.userId);
|
||||
await app.client.unban(roomId, bot.credentials!.userId);
|
||||
await app.client.kick(roomId, bot2.credentials!.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials!.userId);
|
||||
await app.client.inviteUser(roomId, bot2.credentials!.userId);
|
||||
await bot.joinRoom(roomId);
|
||||
await bot2.joinRoom(roomId);
|
||||
|
||||
@@ -318,7 +318,7 @@ async function setupRoom(app: ElementAppPage, homeserver: StartedHomeserverConta
|
||||
autoAcceptInvites: false,
|
||||
});
|
||||
await bot.prepareClient();
|
||||
await app.client.inviteUser(roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(roomId, bot.credentials!.userId);
|
||||
await app.client.sendMessage(roomId, "I invited MyBot...");
|
||||
|
||||
return { bot, roomId };
|
||||
@@ -336,11 +336,11 @@ async function replaceBotIds(page: Page, bot: Bot, bot2?: Bot) {
|
||||
const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
|
||||
while (walker.nextNode()) {
|
||||
const node = walker.currentNode;
|
||||
node.textContent = node.textContent.replaceAll(bot1UserId, "<<replaced_bot1_id>>");
|
||||
node.textContent = node.textContent!.replaceAll(bot1UserId, "<<replaced_bot1_id>>");
|
||||
node.textContent = node.textContent.replaceAll(bot2UserId, "<<replaced_bot2_id>>");
|
||||
}
|
||||
}
|
||||
},
|
||||
[bot.credentials.userId, bot2?.credentials?.userId ?? "no_bot_2_to_replace"],
|
||||
[bot.credentials!.userId, bot2?.credentials?.userId ?? "no_bot_2_to_replace"],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ const expectAvatar = async (cli: Client, e: Locator, avatarUrl: string): Promise
|
||||
},
|
||||
{ avatarUrl, size, resizeMethod: AVATAR_RESIZE_METHOD },
|
||||
);
|
||||
await expect(e.locator(".mx_BaseAvatar img")).toHaveAttribute("src", url);
|
||||
await expect(e.locator(".mx_BaseAvatar img")).toHaveAttribute("src", url!);
|
||||
};
|
||||
|
||||
const sendEvent = async (client: Client, roomId: string, html = false): Promise<ISendEventResponse> => {
|
||||
@@ -917,7 +917,7 @@ test.describe("Timeline", () => {
|
||||
|
||||
const bot = new Bot(page, homeserver, {});
|
||||
await bot.prepareClient();
|
||||
await app.client.inviteUser(room.roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(room.roomId, bot.credentials!.userId);
|
||||
|
||||
await sendImage(bot, room.roomId, NEW_AVATAR);
|
||||
await app.timeline.scrollToBottom();
|
||||
@@ -936,7 +936,7 @@ test.describe("Timeline", () => {
|
||||
|
||||
const bot = new Bot(page, homeserver, {});
|
||||
await bot.prepareClient();
|
||||
await app.client.inviteUser(room.roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(room.roomId, bot.credentials!.userId);
|
||||
|
||||
const upload = await bot.uploadContent(VIDEO_FILE, { name: "bbb.webm", type: "video/webm" });
|
||||
await bot.sendEvent(room.roomId, null, "m.room.message" as EventType, {
|
||||
@@ -970,7 +970,7 @@ test.describe("Timeline", () => {
|
||||
autoAcceptInvites: false,
|
||||
});
|
||||
await bot.prepareClient();
|
||||
await app.client.inviteUser(room.roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(room.roomId, bot.credentials!.userId);
|
||||
await bot.joinRoom(room.roomId);
|
||||
await bot.sendMessage(room.roomId, messageFromSender);
|
||||
|
||||
@@ -1100,7 +1100,7 @@ test.describe("Timeline", () => {
|
||||
autoAcceptInvites: false,
|
||||
});
|
||||
await bot.prepareClient();
|
||||
await app.client.inviteUser(room.roomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(room.roomId, bot.credentials!.userId);
|
||||
await bot.joinRoom(room.roomId);
|
||||
|
||||
// Make sure the bot joined the room
|
||||
@@ -1228,7 +1228,7 @@ test.describe("Timeline", () => {
|
||||
|
||||
// Create another room with a long name, invite the bot, and open the room
|
||||
const testRoomId = await app.client.createRoom({ name: LONG_STRING });
|
||||
await app.client.inviteUser(testRoomId, bot.credentials.userId);
|
||||
await app.client.inviteUser(testRoomId, bot.credentials!.userId);
|
||||
await bot.joinRoom(testRoomId);
|
||||
await page.goto(`/#/room/${testRoomId}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user