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:
@@ -184,7 +184,7 @@ test.describe("Composer", () => {
|
||||
// Set up a private room so we have another user to mention
|
||||
await app.client.createRoom({
|
||||
is_direct: true,
|
||||
invite: [bot.credentials.userId],
|
||||
invite: [bot.credentials!.userId],
|
||||
});
|
||||
await app.viewRoomByName("Bob");
|
||||
|
||||
@@ -194,7 +194,7 @@ test.describe("Composer", () => {
|
||||
|
||||
// Note that we include the user ID here as the room tile is also an 'option' role
|
||||
// with text 'Bob'
|
||||
await page.getByRole("option", { name: `Bob ${bot.credentials.userId}` }).click();
|
||||
await page.getByRole("option", { name: `Bob ${bot.credentials!.userId}` }).click();
|
||||
await expect(composer.getByText("Bob")).toBeVisible();
|
||||
await expect(composer).toMatchScreenshot("mention.png");
|
||||
await composer.press("Enter");
|
||||
|
||||
@@ -100,7 +100,7 @@ test.describe("Composer", () => {
|
||||
// Set up a private room so we have another user to mention
|
||||
await app.client.createRoom({
|
||||
is_direct: true,
|
||||
invite: [bob.credentials.userId],
|
||||
invite: [bob.credentials!.userId],
|
||||
});
|
||||
await app.viewRoomByName("Bob");
|
||||
|
||||
@@ -113,11 +113,11 @@ test.describe("Composer", () => {
|
||||
await expect(page.getByTestId("autocomplete-wrapper")).toBeEmpty();
|
||||
|
||||
// Entering the first letter of the other user's name opens the autocomplete...
|
||||
await page.getByRole("textbox").pressSequentially(bob.credentials.displayName.slice(0, 1));
|
||||
await page.getByRole("textbox").pressSequentially(bob.credentials!.displayName!.slice(0, 1));
|
||||
// ...with the other user name visible, and clicking that username...
|
||||
await page.getByTestId("autocomplete-wrapper").getByText(bob.credentials.displayName).click();
|
||||
await page.getByTestId("autocomplete-wrapper").getByText(bob.credentials!.displayName!).click();
|
||||
// ...inserts the username into the composer
|
||||
const pill = page.getByRole("textbox").getByText(bob.credentials.displayName, { exact: false });
|
||||
const pill = page.getByRole("textbox").getByText(bob.credentials!.displayName!, { exact: false });
|
||||
await expect(pill).toHaveAttribute("contenteditable", "false");
|
||||
await expect(pill).toHaveAttribute("data-mention-type", "user");
|
||||
|
||||
@@ -125,7 +125,7 @@ test.describe("Composer", () => {
|
||||
await page.getByRole("button", { name: "Send message" }).click();
|
||||
|
||||
// Typing an @, then other user's name, then trailing space closes the autocomplete
|
||||
await page.getByRole("textbox").pressSequentially(`@${bob.credentials.displayName} `);
|
||||
await page.getByRole("textbox").pressSequentially(`@${bob.credentials!.displayName!} `);
|
||||
await expect(page.getByTestId("autocomplete-wrapper")).toBeEmpty();
|
||||
|
||||
// Send the message to clear the composer
|
||||
@@ -134,7 +134,7 @@ test.describe("Composer", () => {
|
||||
// Moving the cursor back to an "incomplete" mention opens the autocomplete
|
||||
await page
|
||||
.getByRole("textbox")
|
||||
.pressSequentially(`initial text @${bob.credentials.displayName.slice(0, 1)} abc`);
|
||||
.pressSequentially(`initial text @${bob.credentials!.displayName!.slice(0, 1)} abc`);
|
||||
await expect(page.getByTestId("autocomplete-wrapper")).toBeEmpty();
|
||||
// Move the cursor left by 4 to put it to: `@B| abc`, check autocomplete displays
|
||||
await page.getByRole("textbox").press("ArrowLeft");
|
||||
@@ -145,7 +145,7 @@ test.describe("Composer", () => {
|
||||
|
||||
// Selecting the autocomplete option using Enter inserts it into the composer
|
||||
await page.getByRole("textbox").press("Enter");
|
||||
const pill2 = page.getByRole("textbox").getByText(bob.credentials.displayName, { exact: false });
|
||||
const pill2 = page.getByRole("textbox").getByText(bob.credentials!.displayName!, { exact: false });
|
||||
await expect(pill2).toHaveAttribute("contenteditable", "false");
|
||||
await expect(pill2).toHaveAttribute("data-mention-type", "user");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user