Skip to content

Commit 50b90f9

Browse files
committed
✅(e2e) fix some flaky tests
Some tests were flaky, causing them to fail intermittently. This commit aims to address this issue.
1 parent 65ddf7f commit 50b90f9

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts

+5-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path';
22

33
import { expect, test } from '@playwright/test';
44

5-
import { createDoc, verifyDocName } from './common';
5+
import { createDoc } from './common';
66

77
const config = {
88
AI_FEATURE_ENABLED: true,
@@ -100,22 +100,13 @@ test.describe('Config', () => {
100100
page,
101101
browserName,
102102
}) => {
103-
const webSocketPromise = page.waitForEvent('websocket', (webSocket) => {
104-
return webSocket.url().includes('ws://localhost:4444/collaboration/ws/');
105-
});
106-
107103
await page.goto('/');
108104

109-
const randomDoc = await createDoc(
110-
page,
111-
'doc-collaboration',
112-
browserName,
113-
1,
114-
);
105+
void createDoc(page, 'doc-collaboration', browserName, 1);
115106

116-
await verifyDocName(page, randomDoc[0]);
117-
118-
const webSocket = await webSocketPromise;
107+
const webSocket = await page.waitForEvent('websocket', (webSocket) => {
108+
return webSocket.url().includes('ws://localhost:4444/collaboration/ws/');
109+
});
119110
expect(webSocket.url()).toContain('ws://localhost:4444/collaboration/ws/');
120111
});
121112

src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ test.describe('Doc Editor', () => {
5858
* - signal of the backend to the collaborative server (connection should close)
5959
* - reconnection to the collaborative server
6060
*/
61-
test('checks the connection with collaborative server', async ({
62-
page,
63-
browserName,
64-
}) => {
61+
test('checks the connection with collaborative server', async ({ page }) => {
6562
let webSocketPromise = page.waitForEvent('websocket', (webSocket) => {
6663
return webSocket
6764
.url()
6865
.includes('ws://localhost:4444/collaboration/ws/?room=');
6966
});
7067

71-
const randomDoc = await createDoc(page, 'doc-editor', browserName, 1);
72-
await verifyDocName(page, randomDoc[0]);
68+
await page
69+
.getByRole('button', {
70+
name: 'New doc',
71+
})
72+
.click();
7373

7474
let webSocket = await webSocketPromise;
7575
expect(webSocket.url()).toContain(
@@ -99,7 +99,7 @@ test.describe('Doc Editor', () => {
9999
const wsClose = await wsClosePromise;
100100
expect(wsClose.isClosed()).toBeTruthy();
101101

102-
// Checkt the ws is connected again
102+
// Check the ws is connected again
103103
webSocketPromise = page.waitForEvent('websocket', (webSocket) => {
104104
return webSocket
105105
.url()

src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ test.describe('Document grid item options', () => {
190190

191191
test.describe('Documents filters', () => {
192192
test('it checks the prebuild left panel filters', async ({ page }) => {
193-
await page.goto('/');
193+
void page.goto('/');
194194

195195
// All Docs
196196
const response = await page.waitForResponse(
@@ -263,7 +263,7 @@ test.describe('Documents filters', () => {
263263

264264
test.describe('Documents Grid', () => {
265265
test('checks all the elements are visible', async ({ page }) => {
266-
await page.goto('/');
266+
void page.goto('/');
267267

268268
let docs: SmallDoc[] = [];
269269
const response = await page.waitForResponse(

0 commit comments

Comments
 (0)