Skip to content

Commit 1c3c88a

Browse files
committed
test updates
1 parent 256e5f7 commit 1c3c88a

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

apps/meteor/tests/e2e/messaging.spec.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,28 @@ test.describe('Messaging', () => {
107107
});
108108

109109
await test.step('stress test on message editions', async () => {
110-
for (const element of ['edited msg2 a', 'edited msg2 b', 'edited msg2 c']) {
110+
for (const element of ['edited msg2 a', 'edited msg2 b', 'edited msg2 c', 'a', 'b', 'c']) {
111111
// eslint-disable-next-line no-await-in-loop
112112
await page.keyboard.press('ArrowUp');
113113
// eslint-disable-next-line no-await-in-loop
114-
await poHomeChannel.content.updateMessage(element);
114+
await poHomeChannel.content.updateMessage(element, false);
115115
}
116116

117-
await expect(await poHomeChannel.content.lastUserMessageBody).toHaveText('edited msg2 c');
117+
let timeoutOccurred = false;
118+
119+
try {
120+
await page.waitForSelector('.rcx-toastbar.rcx-toastbar--error', { timeout: 5000 });
121+
122+
timeoutOccurred = false;
123+
} catch (error: unknown) {
124+
if ((error as { name: string }).name === 'TimeoutError') {
125+
timeoutOccurred = true;
126+
} else {
127+
throw error;
128+
}
129+
}
130+
131+
expect(timeoutOccurred).toBe(true);
118132
});
119133
});
120134

apps/meteor/tests/e2e/page-objects/fragments/home-content.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,17 @@ export class HomeContent {
106106
}
107107
}
108108

109-
async updateMessage(text: string): Promise<void> {
109+
async updateMessage(text: string, waitResponse = true): Promise<void> {
110110
await this.page.waitForSelector('[name="msg"]:not([disabled])');
111111
await this.page.locator('[name="msg"]').fill(text);
112112
await this.page.getByRole('button', { name: 'Send', exact: true }).click();
113113

114-
await this.page.waitForResponse(
115-
(response) =>
116-
/api\/v1\/method.call\/updateMessage/.test(response.url()) && response.status() === 200 && response.request().method() === 'POST',
117-
);
114+
if (waitResponse) {
115+
await this.page.waitForResponse(
116+
(response) =>
117+
/api\/v1\/method.call\/updateMessage/.test(response.url()) && response.status() === 200 && response.request().method() === 'POST',
118+
);
119+
}
118120
}
119121

120122
async dispatchSlashCommand(text: string): Promise<void> {

0 commit comments

Comments
 (0)