🚨(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.
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
extends: ['impress/playwright'],
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
project: ['./tsconfig.json'],
|
|
||||||
},
|
|
||||||
ignorePatterns: ['node_modules'],
|
|
||||||
};
|
|
||||||
@@ -5,14 +5,19 @@ import { keyCloakSignIn } from './utils-common';
|
|||||||
const saveStorageState = async (
|
const saveStorageState = async (
|
||||||
browserConfig: FullProject<unknown, unknown>,
|
browserConfig: FullProject<unknown, unknown>,
|
||||||
) => {
|
) => {
|
||||||
const browserName = browserConfig?.name || 'chromium';
|
if (!browserConfig) {
|
||||||
|
throw new Error('No browser config found');
|
||||||
|
}
|
||||||
|
|
||||||
const { storageState, ...useConfig } = browserConfig?.use;
|
const browserName = browserConfig.name || 'chromium';
|
||||||
|
|
||||||
|
const { storageState, ...useConfig } = browserConfig.use;
|
||||||
const browser = await chromium.launch();
|
const browser = await chromium.launch();
|
||||||
const context = await browser.newContext(useConfig);
|
const context = await browser.newContext(useConfig);
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line playwright/no-networkidle
|
||||||
await page.goto('/', { waitUntil: 'networkidle' });
|
await page.goto('/', { waitUntil: 'networkidle' });
|
||||||
await page.content();
|
await page.content();
|
||||||
await expect(page.getByText('Docs').first()).toBeVisible();
|
await expect(page.getByText('Docs').first()).toBeVisible();
|
||||||
@@ -45,11 +50,9 @@ const saveStorageState = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function globalSetup(config: FullConfig) {
|
async function globalSetup(config: FullConfig) {
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
||||||
const chromeConfig = config.projects.find((p) => p.name === 'chromium')!;
|
const chromeConfig = config.projects.find((p) => p.name === 'chromium')!;
|
||||||
const firefoxConfig = config.projects.find((p) => p.name === 'firefox')!;
|
const firefoxConfig = config.projects.find((p) => p.name === 'firefox')!;
|
||||||
const webkitConfig = config.projects.find((p) => p.name === 'webkit')!;
|
const webkitConfig = config.projects.find((p) => p.name === 'webkit')!;
|
||||||
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
||||||
|
|
||||||
await saveStorageState(chromeConfig);
|
await saveStorageState(chromeConfig);
|
||||||
await saveStorageState(webkitConfig);
|
await saveStorageState(webkitConfig);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ test.describe('Config', () => {
|
|||||||
await expect(image).toBeVisible();
|
await expect(image).toBeVisible();
|
||||||
|
|
||||||
// Wait for the media-check to be processed
|
// Wait for the media-check to be processed
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
// Check src of image
|
// Check src of image
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable playwright/no-conditional-expect */
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { chromium, expect, test } from '@playwright/test';
|
import { chromium, expect, test } from '@playwright/test';
|
||||||
@@ -214,7 +215,6 @@ test.describe('Doc Editor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('it saves the doc when we quit pages', async ({ page, browserName }) => {
|
test('it saves the doc when we quit pages', async ({ page, browserName }) => {
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
|
||||||
test.skip(browserName === 'webkit', 'This test is very flaky with webkit');
|
test.skip(browserName === 'webkit', 'This test is very flaky with webkit');
|
||||||
|
|
||||||
// Check the first doc
|
// Check the first doc
|
||||||
@@ -279,7 +279,7 @@ test.describe('Doc Editor', () => {
|
|||||||
await expect(image).toBeVisible();
|
await expect(image).toBeVisible();
|
||||||
|
|
||||||
// Wait for the media-check to be processed
|
// Wait for the media-check to be processed
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
// Check src of image
|
// Check src of image
|
||||||
@@ -397,8 +397,6 @@ test.describe('Doc Editor', () => {
|
|||||||
const editor = page.locator('.ProseMirror');
|
const editor = page.locator('.ProseMirror');
|
||||||
await editor.getByText('Hello').selectText();
|
await editor.getByText('Hello').selectText();
|
||||||
|
|
||||||
/* eslint-disable playwright/no-conditional-expect */
|
|
||||||
/* eslint-disable playwright/no-conditional-in-test */
|
|
||||||
if (!ai_transform && !ai_translate) {
|
if (!ai_transform && !ai_translate) {
|
||||||
await expect(page.getByRole('button', { name: 'AI' })).toBeHidden();
|
await expect(page.getByRole('button', { name: 'AI' })).toBeHidden();
|
||||||
return;
|
return;
|
||||||
@@ -425,8 +423,6 @@ test.describe('Doc Editor', () => {
|
|||||||
page.getByRole('menuitem', { name: 'Language' }),
|
page.getByRole('menuitem', { name: 'Language' }),
|
||||||
).toBeHidden();
|
).toBeHidden();
|
||||||
}
|
}
|
||||||
/* eslint-enable playwright/no-conditional-expect */
|
|
||||||
/* eslint-enable playwright/no-conditional-in-test */
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,8 @@ test.describe('Doc grid dnd', () => {
|
|||||||
expect(draggableBoundingBox).toBeDefined();
|
expect(draggableBoundingBox).toBeDefined();
|
||||||
expect(dropZoneBoundingBox).toBeDefined();
|
expect(dropZoneBoundingBox).toBeDefined();
|
||||||
|
|
||||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
|
||||||
if (!draggableBoundingBox || !dropZoneBoundingBox) {
|
if (!draggableBoundingBox || !dropZoneBoundingBox) {
|
||||||
throw new Error('Impossible de déterminer la position des éléments');
|
throw new Error('Unable to determine the position of the elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.mouse.move(
|
await page.mouse.move(
|
||||||
@@ -86,9 +85,8 @@ test.describe('Doc grid dnd', () => {
|
|||||||
|
|
||||||
const noDropAndNoDragBoundigBox = await noDropAndNoDrag.boundingBox();
|
const noDropAndNoDragBoundigBox = await noDropAndNoDrag.boundingBox();
|
||||||
|
|
||||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
|
||||||
if (!canDropAndDragBoundigBox || !noDropAndNoDragBoundigBox) {
|
if (!canDropAndDragBoundigBox || !noDropAndNoDragBoundigBox) {
|
||||||
throw new Error('Impossible de déterminer la position des éléments');
|
throw new Error('Unable to determine the position of the elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.mouse.move(
|
await page.mouse.move(
|
||||||
@@ -137,9 +135,8 @@ test.describe('Doc grid dnd', () => {
|
|||||||
|
|
||||||
const noDropAndNoDragBoundigBox = await noDropAndNoDrag.boundingBox();
|
const noDropAndNoDragBoundigBox = await noDropAndNoDrag.boundingBox();
|
||||||
|
|
||||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
|
||||||
if (!canDropAndDragBoundigBox || !noDropAndNoDragBoundigBox) {
|
if (!canDropAndDragBoundigBox || !noDropAndNoDragBoundigBox) {
|
||||||
throw new Error('Impossible de déterminer la position des éléments');
|
throw new Error('Unable to determine the position of the elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.mouse.move(
|
await page.mouse.move(
|
||||||
|
|||||||
@@ -316,7 +316,6 @@ test.describe('Doc Header', () => {
|
|||||||
page,
|
page,
|
||||||
browserName,
|
browserName,
|
||||||
}) => {
|
}) => {
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
|
||||||
test.skip(
|
test.skip(
|
||||||
browserName === 'webkit',
|
browserName === 'webkit',
|
||||||
'navigator.clipboard is not working with webkit and playwright',
|
'navigator.clipboard is not working with webkit and playwright',
|
||||||
@@ -351,7 +350,6 @@ test.describe('Doc Header', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('It checks the copy as HTML button', async ({ page, browserName }) => {
|
test('It checks the copy as HTML button', async ({ page, browserName }) => {
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
|
||||||
test.skip(
|
test.skip(
|
||||||
browserName === 'webkit',
|
browserName === 'webkit',
|
||||||
'navigator.clipboard is not working with webkit and playwright',
|
'navigator.clipboard is not working with webkit and playwright',
|
||||||
@@ -386,7 +384,6 @@ test.describe('Doc Header', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('it checks the copy link button', async ({ page, browserName }) => {
|
test('it checks the copy link button', async ({ page, browserName }) => {
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
|
||||||
test.skip(
|
test.skip(
|
||||||
browserName === 'webkit',
|
browserName === 'webkit',
|
||||||
'navigator.clipboard is not working with webkit and playwright',
|
'navigator.clipboard is not working with webkit and playwright',
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ test.describe('Document list members', () => {
|
|||||||
await expect(soloOwner).toBeVisible();
|
await expect(soloOwner).toBeVisible();
|
||||||
|
|
||||||
await list.click({
|
await list.click({
|
||||||
// eslint-disable-next-line playwright/no-force-option
|
|
||||||
force: true, // Force click to close the dropdown
|
force: true, // Force click to close the dropdown
|
||||||
});
|
});
|
||||||
const newUserEmail = await addNewMember(page, 0, 'Owner');
|
const newUserEmail = await addNewMember(page, 0, 'Owner');
|
||||||
@@ -163,13 +162,11 @@ test.describe('Document list members', () => {
|
|||||||
await currentUserRole.click();
|
await currentUserRole.click();
|
||||||
await expect(soloOwner).toBeHidden();
|
await expect(soloOwner).toBeHidden();
|
||||||
await list.click({
|
await list.click({
|
||||||
// eslint-disable-next-line playwright/no-force-option
|
|
||||||
force: true, // Force click to close the dropdown
|
force: true, // Force click to close the dropdown
|
||||||
});
|
});
|
||||||
|
|
||||||
await newUserRoles.click();
|
await newUserRoles.click();
|
||||||
await list.click({
|
await list.click({
|
||||||
// eslint-disable-next-line playwright/no-force-option
|
|
||||||
force: true, // Force click to close the dropdown
|
force: true, // Force click to close the dropdown
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ test.describe('Doc Routing', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('checks 404 on docs/[id] page', async ({ page }) => {
|
test('checks 404 on docs/[id] page', async ({ page }) => {
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
|
|
||||||
await page.goto('/docs/some-unknown-doc');
|
await page.goto('/docs/some-unknown-doc');
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable playwright/no-conditional-in-test */
|
|
||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ test.describe('Doc Visibility', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('It checks the copy link button', async ({ page, browserName }) => {
|
test('It checks the copy link button', async ({ page, browserName }) => {
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
|
||||||
test.skip(
|
test.skip(
|
||||||
browserName === 'webkit',
|
browserName === 'webkit',
|
||||||
'navigator.clipboard is not working with webkit and playwright',
|
'navigator.clipboard is not working with webkit and playwright',
|
||||||
@@ -119,8 +118,11 @@ test.describe('Doc Visibility: Restricted', () => {
|
|||||||
.click();
|
.click();
|
||||||
|
|
||||||
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
||||||
|
if (!otherBrowser) {
|
||||||
|
throw new Error('No alternative browser found');
|
||||||
|
}
|
||||||
|
|
||||||
await keyCloakSignIn(page, otherBrowser!);
|
await keyCloakSignIn(page, otherBrowser);
|
||||||
|
|
||||||
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
@@ -151,6 +153,9 @@ test.describe('Doc Visibility: Restricted', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
||||||
|
if (!otherBrowser) {
|
||||||
|
throw new Error('No alternative browser found');
|
||||||
|
}
|
||||||
const username = `user@${otherBrowser}.test`;
|
const username = `user@${otherBrowser}.test`;
|
||||||
await inputSearch.fill(username);
|
await inputSearch.fill(username);
|
||||||
await page.getByRole('option', { name: username }).click();
|
await page.getByRole('option', { name: username }).click();
|
||||||
@@ -174,7 +179,7 @@ test.describe('Doc Visibility: Restricted', () => {
|
|||||||
})
|
})
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
await keyCloakSignIn(page, otherBrowser!);
|
await keyCloakSignIn(page, otherBrowser);
|
||||||
|
|
||||||
await expect(page.getByTestId('header-logo-link')).toBeVisible();
|
await expect(page.getByTestId('header-logo-link')).toBeVisible();
|
||||||
|
|
||||||
@@ -449,7 +454,10 @@ test.describe('Doc Visibility: Authenticated', () => {
|
|||||||
.click();
|
.click();
|
||||||
|
|
||||||
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
||||||
await keyCloakSignIn(page, otherBrowser!);
|
if (!otherBrowser) {
|
||||||
|
throw new Error('No alternative browser found');
|
||||||
|
}
|
||||||
|
await keyCloakSignIn(page, otherBrowser);
|
||||||
|
|
||||||
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
@@ -538,7 +546,10 @@ test.describe('Doc Visibility: Authenticated', () => {
|
|||||||
.click();
|
.click();
|
||||||
|
|
||||||
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
const otherBrowser = BROWSERS.find((b) => b !== browserName);
|
||||||
await keyCloakSignIn(page, otherBrowser!);
|
if (!otherBrowser) {
|
||||||
|
throw new Error('No alternative browser found');
|
||||||
|
}
|
||||||
|
await keyCloakSignIn(page, otherBrowser);
|
||||||
|
|
||||||
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
await expect(page.getByTestId('header-logo-link')).toBeVisible({
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ test.describe('Header', () => {
|
|||||||
* La gaufre load a js file from a remote server,
|
* La gaufre load a js file from a remote server,
|
||||||
* it takes some time to load the file and have the interaction available
|
* it takes some time to load the file and have the interaction available
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
||||||
await page.waitForTimeout(1500);
|
await page.waitForTimeout(1500);
|
||||||
|
|
||||||
await header
|
await header
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ test.describe('Home page', () => {
|
|||||||
await page.waitForLoadState('domcontentloaded');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait a bit more for the responsive store to be initialized
|
// Wait a bit more for the responsive store to be initialized
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
||||||
await page.waitForTimeout(500);
|
await page.waitForTimeout(500);
|
||||||
|
|
||||||
// Check header content
|
// Check header content
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const CONFIG = {
|
|||||||
|
|
||||||
export const overrideConfig = async (
|
export const overrideConfig = async (
|
||||||
page: Page,
|
page: Page,
|
||||||
newConfig: { [K in keyof typeof CONFIG]?: unknown },
|
newConfig: { [_K in keyof typeof CONFIG]?: unknown },
|
||||||
) =>
|
) =>
|
||||||
await page.route('**/api/v1.0/config/', async (route) => {
|
await page.route('**/api/v1.0/config/', async (route) => {
|
||||||
const request = route.request();
|
const request = route.request();
|
||||||
|
|||||||
20
src/frontend/apps/e2e/eslint.config.mjs
Normal file
20
src/frontend/apps/e2e/eslint.config.mjs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { defineConfig } from '@eslint/config-helpers';
|
||||||
|
import docsPlugin from 'eslint-plugin-docs';
|
||||||
|
|
||||||
|
const eslintConfig = defineConfig([
|
||||||
|
{
|
||||||
|
files: ['**/*.ts', '**/*.mjs'],
|
||||||
|
plugins: {
|
||||||
|
docs: docsPlugin,
|
||||||
|
},
|
||||||
|
extends: ['docs/playwright'],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
export default eslintConfig;
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint",
|
||||||
"install-playwright": "playwright install --with-deps",
|
"install-playwright": "playwright install --with-deps",
|
||||||
"test": "playwright test",
|
"test": "playwright test",
|
||||||
"test:ui": "yarn test --ui",
|
"test:ui": "yarn test --ui",
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"incremental": true,
|
"incremental": true
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts", "**/*.d.ts"],
|
"include": ["**/*.ts", "**/*.d.ts", "**/*.mjs"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
declare module 'convert-stream' {
|
declare module 'convert-stream' {
|
||||||
export function toBuffer(
|
export function toBuffer(
|
||||||
readableStream: NodeJS.ReadableStream,
|
_readableStream: NodeJS.ReadableStream,
|
||||||
): Promise<Buffer>;
|
): Promise<Buffer>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user