Fix flaky playwright tests (#28989)
* Fix flaky playwright tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix flaky test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add slow Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e2bd040c88
commit
37f8d70d89
@@ -11,6 +11,7 @@ import { bootstrapCrossSigningForClient } from "../../pages/client.ts";
|
|||||||
|
|
||||||
/** Tests for the "invisible crypto" behaviour -- i.e., when the "exclude insecure devices" setting is enabled */
|
/** Tests for the "invisible crypto" behaviour -- i.e., when the "exclude insecure devices" setting is enabled */
|
||||||
test.describe("Invisible cryptography", () => {
|
test.describe("Invisible cryptography", () => {
|
||||||
|
test.slow();
|
||||||
test.use({
|
test.use({
|
||||||
displayName: "Alice",
|
displayName: "Alice",
|
||||||
botCreateOpts: { displayName: "Bob" },
|
botCreateOpts: { displayName: "Bob" },
|
||||||
|
|||||||
@@ -69,29 +69,13 @@ async function sendActionFromIntegrationManager(
|
|||||||
await iframe.getByRole("button", { name: "Press to send action" }).click();
|
await iframe.getByRole("button", { name: "Press to send action" }).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clickUntilGone(page: Page, selector: string, attempt = 0) {
|
|
||||||
if (attempt === 11) {
|
|
||||||
throw new Error("clickUntilGone attempt count exceeded");
|
|
||||||
}
|
|
||||||
|
|
||||||
await page.locator(selector).last().click();
|
|
||||||
|
|
||||||
const count = await page.locator(selector).count();
|
|
||||||
if (count > 0) {
|
|
||||||
return clickUntilGone(page, selector, ++attempt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function expectKickedMessage(page: Page, shouldExist: boolean) {
|
async function expectKickedMessage(page: Page, shouldExist: boolean) {
|
||||||
// Expand any event summaries, we can't use a click multiple here because clicking one might de-render others
|
await expect(async () => {
|
||||||
// This is quite horrible but seems the most stable way of clicking 0-N buttons,
|
await page.locator(".mx_GenericEventListSummary_toggle[aria-expanded=false]").last().click();
|
||||||
// one at a time with a full re-evaluation after each click
|
|
||||||
await clickUntilGone(page, ".mx_GenericEventListSummary_toggle[aria-expanded=false]");
|
|
||||||
|
|
||||||
// Check for the event message (or lack thereof)
|
|
||||||
await expect(page.getByText(`${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`)).toBeVisible({
|
await expect(page.getByText(`${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`)).toBeVisible({
|
||||||
visible: shouldExist,
|
visible: shouldExist,
|
||||||
});
|
});
|
||||||
|
}).toPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
test.describe("Integration Manager: Kick", () => {
|
test.describe("Integration Manager: Kick", () => {
|
||||||
|
|||||||
@@ -70,11 +70,7 @@ test.describe("Read receipts", { tag: "@mergequeue" }, () => {
|
|||||||
// Given a thread exists and I have marked it as read
|
// Given a thread exists and I have marked it as read
|
||||||
await util.goTo(room1);
|
await util.goTo(room1);
|
||||||
await util.assertRead(room2);
|
await util.assertRead(room2);
|
||||||
await util.receiveMessages(room2, [
|
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]);
|
||||||
"Msg1",
|
|
||||||
msg.threadedOff("Msg1", "Reply1"),
|
|
||||||
msg.reactionTo("Reply1", "🪿"),
|
|
||||||
]);
|
|
||||||
await util.assertUnread(room2, 1);
|
await util.assertUnread(room2, 1);
|
||||||
await util.markAsRead(room2);
|
await util.markAsRead(room2);
|
||||||
await util.assertRead(room2);
|
await util.assertRead(room2);
|
||||||
|
|||||||
@@ -603,7 +603,12 @@ test.describe("Timeline", () => {
|
|||||||
await messageEdit(page);
|
await messageEdit(page);
|
||||||
|
|
||||||
// Click timestamp to highlight hidden event line
|
// Click timestamp to highlight hidden event line
|
||||||
await page.locator(".mx_RoomView_body .mx_EventTile_info .mx_MessageTimestamp").click();
|
const timestamp = page.locator(".mx_RoomView_body .mx_EventTile_info a", {
|
||||||
|
has: page.locator(".mx_MessageTimestamp"),
|
||||||
|
});
|
||||||
|
// wait for the remote echo otherwise we get an error modal due to a 404 on the /event/ API
|
||||||
|
await expect(timestamp).not.toHaveAttribute("href", /~!/);
|
||||||
|
await timestamp.locator(".mx_MessageTimestamp").click();
|
||||||
|
|
||||||
// should not add inline start padding to a hidden event line on IRC layout
|
// should not add inline start padding to a hidden event line on IRC layout
|
||||||
await app.settings.setValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
|
await app.settings.setValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ export const test = base.extend<TestFixtures, Services & Options>({
|
|||||||
{ scope: "worker" },
|
{ scope: "worker" },
|
||||||
],
|
],
|
||||||
mailhogClient: async ({ mailhog: container }, use) => {
|
mailhogClient: async ({ mailhog: container }, use) => {
|
||||||
await use(container.client);
|
|
||||||
await container.client.deleteAll();
|
await container.client.deleteAll();
|
||||||
|
await use(container.client);
|
||||||
},
|
},
|
||||||
|
|
||||||
synapseConfig: [{}, { scope: "worker" }],
|
synapseConfig: [{}, { scope: "worker" }],
|
||||||
@@ -141,6 +141,5 @@ export const test = base.extend<TestFixtures, Services & Options>({
|
|||||||
await logger.onTestStarted(context);
|
await logger.onTestStarted(context);
|
||||||
await use(context);
|
await use(context);
|
||||||
await logger.onTestFinished(testInfo);
|
await logger.onTestFinished(testInfo);
|
||||||
await mailhogClient.deleteAll();
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ export class StartedSynapseContainer extends AbstractStartedContainer implements
|
|||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
return {
|
return {
|
||||||
homeServer: data.home_server,
|
homeServer: data.home_server || data.user_id.split(":").slice(1).join(":"),
|
||||||
accessToken: data.access_token,
|
accessToken: data.access_token,
|
||||||
userId: data.user_id,
|
userId: data.user_id,
|
||||||
deviceId: data.device_id,
|
deviceId: data.device_id,
|
||||||
@@ -310,7 +310,7 @@ export class StartedSynapseContainer extends AbstractStartedContainer implements
|
|||||||
accessToken: json.access_token,
|
accessToken: json.access_token,
|
||||||
userId: json.user_id,
|
userId: json.user_id,
|
||||||
deviceId: json.device_id,
|
deviceId: json.device_id,
|
||||||
homeServer: json.home_server,
|
homeServer: json.home_server || json.user_id.split(":").slice(1).join(":"),
|
||||||
username: userId.slice(1).split(":")[0],
|
username: userId.slice(1).split(":")[0],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user