Skip to content

Commit 9a51e02

Browse files
committed
🚨(e2e) upgrade eslint to v9 with e2e app
We upgraded ESLint to version 9 in the e2e app, which includes several improvements and fixes. This change also involves updating the ESLint configuration files to the new format and ensuring compatibility with the latest ESLint features.
1 parent 4184c33 commit 9a51e02

17 files changed

+54
-46
lines changed

src/frontend/apps/e2e/.eslintrc.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/frontend/apps/e2e/__tests__/app-impress/auth.setup.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ import { keyCloakSignIn } from './utils-common';
55
const saveStorageState = async (
66
browserConfig: FullProject<unknown, unknown>,
77
) => {
8-
const browserName = browserConfig?.name || 'chromium';
8+
if (!browserConfig) {
9+
throw new Error('No browser config found');
10+
}
11+
12+
const browserName = browserConfig.name || 'chromium';
913

10-
const { storageState, ...useConfig } = browserConfig?.use;
14+
const { storageState, ...useConfig } = browserConfig.use;
1115
const browser = await chromium.launch();
1216
const context = await browser.newContext(useConfig);
1317
const page = await context.newPage();
1418

1519
try {
20+
// eslint-disable-next-line playwright/no-networkidle
1621
await page.goto('/', { waitUntil: 'networkidle' });
1722
await page.content();
1823
await expect(page.getByText('Docs').first()).toBeVisible();
@@ -45,11 +50,9 @@ const saveStorageState = async (
4550
};
4651

4752
async function globalSetup(config: FullConfig) {
48-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
4953
const chromeConfig = config.projects.find((p) => p.name === 'chromium')!;
5054
const firefoxConfig = config.projects.find((p) => p.name === 'firefox')!;
5155
const webkitConfig = config.projects.find((p) => p.name === 'webkit')!;
52-
/* eslint-enable @typescript-eslint/no-non-null-assertion */
5356

5457
await saveStorageState(chromeConfig);
5558
await saveStorageState(webkitConfig);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test.describe('Config', () => {
5050
await expect(image).toBeVisible();
5151

5252
// Wait for the media-check to be processed
53-
// eslint-disable-next-line playwright/no-wait-for-timeout
53+
5454
await page.waitForTimeout(1000);
5555

5656
// Check src of image

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable playwright/no-conditional-expect */
12
import path from 'path';
23

34
import { chromium, expect, test } from '@playwright/test';
@@ -214,7 +215,6 @@ test.describe('Doc Editor', () => {
214215
});
215216

216217
test('it saves the doc when we quit pages', async ({ page, browserName }) => {
217-
// eslint-disable-next-line playwright/no-skipped-test
218218
test.skip(browserName === 'webkit', 'This test is very flaky with webkit');
219219

220220
// Check the first doc
@@ -279,7 +279,7 @@ test.describe('Doc Editor', () => {
279279
await expect(image).toBeVisible();
280280

281281
// Wait for the media-check to be processed
282-
// eslint-disable-next-line playwright/no-wait-for-timeout
282+
283283
await page.waitForTimeout(1000);
284284

285285
// Check src of image
@@ -397,8 +397,6 @@ test.describe('Doc Editor', () => {
397397
const editor = page.locator('.ProseMirror');
398398
await editor.getByText('Hello').selectText();
399399

400-
/* eslint-disable playwright/no-conditional-expect */
401-
/* eslint-disable playwright/no-conditional-in-test */
402400
if (!ai_transform && !ai_translate) {
403401
await expect(page.getByRole('button', { name: 'AI' })).toBeHidden();
404402
return;
@@ -425,8 +423,6 @@ test.describe('Doc Editor', () => {
425423
page.getByRole('menuitem', { name: 'Language' }),
426424
).toBeHidden();
427425
}
428-
/* eslint-enable playwright/no-conditional-expect */
429-
/* eslint-enable playwright/no-conditional-in-test */
430426
});
431427
});
432428

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ test.describe('Doc grid dnd', () => {
3636
expect(draggableBoundingBox).toBeDefined();
3737
expect(dropZoneBoundingBox).toBeDefined();
3838

39-
// eslint-disable-next-line playwright/no-conditional-in-test
4039
if (!draggableBoundingBox || !dropZoneBoundingBox) {
41-
throw new Error('Impossible de déterminer la position des éléments');
40+
throw new Error('Unable to determine the position of the elements');
4241
}
4342

4443
await page.mouse.move(
@@ -86,9 +85,8 @@ test.describe('Doc grid dnd', () => {
8685

8786
const noDropAndNoDragBoundigBox = await noDropAndNoDrag.boundingBox();
8887

89-
// eslint-disable-next-line playwright/no-conditional-in-test
9088
if (!canDropAndDragBoundigBox || !noDropAndNoDragBoundigBox) {
91-
throw new Error('Impossible de déterminer la position des éléments');
89+
throw new Error('Unable to determine the position of the elements');
9290
}
9391

9492
await page.mouse.move(
@@ -137,9 +135,8 @@ test.describe('Doc grid dnd', () => {
137135

138136
const noDropAndNoDragBoundigBox = await noDropAndNoDrag.boundingBox();
139137

140-
// eslint-disable-next-line playwright/no-conditional-in-test
141138
if (!canDropAndDragBoundigBox || !noDropAndNoDragBoundigBox) {
142-
throw new Error('Impossible de déterminer la position des éléments');
139+
throw new Error('Unable to determine the position of the elements');
143140
}
144141

145142
await page.mouse.move(

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ test.describe('Doc Header', () => {
316316
page,
317317
browserName,
318318
}) => {
319-
// eslint-disable-next-line playwright/no-skipped-test
320319
test.skip(
321320
browserName === 'webkit',
322321
'navigator.clipboard is not working with webkit and playwright',
@@ -351,7 +350,6 @@ test.describe('Doc Header', () => {
351350
});
352351

353352
test('It checks the copy as HTML button', async ({ page, browserName }) => {
354-
// eslint-disable-next-line playwright/no-skipped-test
355353
test.skip(
356354
browserName === 'webkit',
357355
'navigator.clipboard is not working with webkit and playwright',
@@ -386,7 +384,6 @@ test.describe('Doc Header', () => {
386384
});
387385

388386
test('it checks the copy link button', async ({ page, browserName }) => {
389-
// eslint-disable-next-line playwright/no-skipped-test
390387
test.skip(
391388
browserName === 'webkit',
392389
'navigator.clipboard is not working with webkit and playwright',

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ test.describe('Document list members', () => {
151151
await expect(soloOwner).toBeVisible();
152152

153153
await list.click({
154-
// eslint-disable-next-line playwright/no-force-option
155154
force: true, // Force click to close the dropdown
156155
});
157156
const newUserEmail = await addNewMember(page, 0, 'Owner');
@@ -163,13 +162,11 @@ test.describe('Document list members', () => {
163162
await currentUserRole.click();
164163
await expect(soloOwner).toBeHidden();
165164
await list.click({
166-
// eslint-disable-next-line playwright/no-force-option
167165
force: true, // Force click to close the dropdown
168166
});
169167

170168
await newUserRoles.click();
171169
await list.click({
172-
// eslint-disable-next-line playwright/no-force-option
173170
force: true, // Force click to close the dropdown
174171
});
175172

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ test.describe('Doc Routing', () => {
4040
});
4141

4242
test('checks 404 on docs/[id] page', async ({ page }) => {
43-
// eslint-disable-next-line playwright/no-wait-for-timeout
4443
await page.waitForTimeout(300);
4544

4645
await page.goto('/docs/some-unknown-doc');

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable playwright/no-conditional-in-test */
21
import { expect, test } from '@playwright/test';
32

43
import {

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ test.describe('Doc Visibility', () => {
1515
});
1616

1717
test('It checks the copy link button', async ({ page, browserName }) => {
18-
// eslint-disable-next-line playwright/no-skipped-test
1918
test.skip(
2019
browserName === 'webkit',
2120
'navigator.clipboard is not working with webkit and playwright',
@@ -119,8 +118,11 @@ test.describe('Doc Visibility: Restricted', () => {
119118
.click();
120119

121120
const otherBrowser = BROWSERS.find((b) => b !== browserName);
121+
if (!otherBrowser) {
122+
throw new Error('No alternative browser found');
123+
}
122124

123-
await keyCloakSignIn(page, otherBrowser!);
125+
await keyCloakSignIn(page, otherBrowser);
124126

125127
await expect(page.getByTestId('header-logo-link')).toBeVisible({
126128
timeout: 10000,
@@ -151,6 +153,9 @@ test.describe('Doc Visibility: Restricted', () => {
151153
});
152154

153155
const otherBrowser = BROWSERS.find((b) => b !== browserName);
156+
if (!otherBrowser) {
157+
throw new Error('No alternative browser found');
158+
}
154159
const username = `user@${otherBrowser}.test`;
155160
await inputSearch.fill(username);
156161
await page.getByRole('option', { name: username }).click();
@@ -174,7 +179,7 @@ test.describe('Doc Visibility: Restricted', () => {
174179
})
175180
.click();
176181

177-
await keyCloakSignIn(page, otherBrowser!);
182+
await keyCloakSignIn(page, otherBrowser);
178183

179184
await expect(page.getByTestId('header-logo-link')).toBeVisible();
180185

@@ -449,7 +454,10 @@ test.describe('Doc Visibility: Authenticated', () => {
449454
.click();
450455

451456
const otherBrowser = BROWSERS.find((b) => b !== browserName);
452-
await keyCloakSignIn(page, otherBrowser!);
457+
if (!otherBrowser) {
458+
throw new Error('No alternative browser found');
459+
}
460+
await keyCloakSignIn(page, otherBrowser);
453461

454462
await expect(page.getByTestId('header-logo-link')).toBeVisible({
455463
timeout: 10000,
@@ -538,7 +546,10 @@ test.describe('Doc Visibility: Authenticated', () => {
538546
.click();
539547

540548
const otherBrowser = BROWSERS.find((b) => b !== browserName);
541-
await keyCloakSignIn(page, otherBrowser!);
549+
if (!otherBrowser) {
550+
throw new Error('No alternative browser found');
551+
}
552+
await keyCloakSignIn(page, otherBrowser);
542553

543554
await expect(page.getByTestId('header-logo-link')).toBeVisible({
544555
timeout: 10000,

0 commit comments

Comments
 (0)