diff --git a/front/package-lock.json b/front/package-lock.json index 994950aee80..eb1f25e3369 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -107,7 +107,7 @@ "@apidevtools/swagger-parser": "^10.1.0", "@import-meta-env/prepare": "^0.2.1", "@import-meta-env/unplugin": "^0.6.2", - "@playwright/test": "^1.41.2", + "@playwright/test": "^1.49.1", "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.1.0", @@ -2377,19 +2377,18 @@ } }, "node_modules/@playwright/test": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.1.tgz", - "integrity": "sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", + "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright": "1.43.1" + "playwright": "1.49.1" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/@react-pdf/fns": { @@ -16053,35 +16052,33 @@ } }, "node_modules/playwright": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.1.tgz", - "integrity": "sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.43.1" + "playwright-core": "1.49.1" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" }, "optionalDependencies": { "fsevents": "2.3.2" } }, "node_modules/playwright-core": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.1.tgz", - "integrity": "sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", "dev": true, - "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/playwright/node_modules/fsevents": { @@ -16090,7 +16087,6 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, - "license": "MIT", "optional": true, "os": [ "darwin" diff --git a/front/package.json b/front/package.json index c25f66bec9b..ac041bee77b 100644 --- a/front/package.json +++ b/front/package.json @@ -102,7 +102,7 @@ "@apidevtools/swagger-parser": "^10.1.0", "@import-meta-env/prepare": "^0.2.1", "@import-meta-env/unplugin": "^0.6.2", - "@playwright/test": "^1.41.2", + "@playwright/test": "^1.49.1", "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.1.0", diff --git a/front/tests/assets/project-const.ts b/front/tests/assets/project-const.ts index b582ffe601c..dbcec5f0840 100644 --- a/front/tests/assets/project-const.ts +++ b/front/tests/assets/project-const.ts @@ -1,3 +1,4 @@ +export const BASE_URL = 'http://localhost:4000'; export const electricRollingStockName = 'electric_rolling_stock_test_e2e'; export const dualModeRollingStockName = 'dual-mode_rolling_stock_test_e2e'; export const slowRollingStockName = 'slow_rolling_stock_test_e2e'; diff --git a/front/tests/utils/api-setup.ts b/front/tests/utils/api-setup.ts index 7bc923eee05..e93bf4227a2 100644 --- a/front/tests/utils/api-setup.ts +++ b/front/tests/utils/api-setup.ts @@ -25,7 +25,12 @@ import type { } from 'common/api/osrdEditoastApi'; import electricalProfileSet from '../assets/operationStudies/simulationSettings/electricalProfiles/electricalProfile.json'; -import { globalProjectName, globalStudyName, infrastructureName } from '../assets/project-const'; +import { + BASE_URL, + globalProjectName, + globalStudyName, + infrastructureName, +} from '../assets/project-const'; import towedRollingStockData from '../assets/stdcm/towedRollingStock/towedRollingStock.json'; import { logger } from '../test-logger'; @@ -36,7 +41,7 @@ import { logger } from '../test-logger'; */ export const getApiContext = async (): Promise => request.newContext({ - baseURL: 'http://localhost:4000', + baseURL: BASE_URL, }); /** @@ -93,16 +98,18 @@ export const postApiRequest = async ( * Send a DELETE request to the specified API endpoint. * * @param url - The API endpoint URL. - * @returns {Promise} - The response from the API. + * @returns {Promise} - The API response. */ -export const deleteApiRequest = async ( - url: string, - errorMessage?: string -): Promise => { - const apiContext = await getApiContext(); - const response = await apiContext.delete(url); - handleErrorResponse(response, errorMessage); - return response; +export const deleteApiRequest = async (urlExtend: string): Promise => { + const fullUrl = `${BASE_URL}${urlExtend}`; + + return fetch(fullUrl, { + method: 'DELETE', + headers: { + Accept: '*/*', + 'Content-Type': 'application/json', + }, + }); }; /**