diff --git a/front/package-lock.json b/front/package-lock.json index 29a32037010..52c71fbf29c 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -102,7 +102,7 @@ }, "devDependencies": { "@apidevtools/swagger-parser": "^10.1.1", - "@playwright/test": "^1.41.2", + "@playwright/test": "^1.50.1", "@rtk-query/codegen-openapi": "^2.0.0", "@testing-library/dom": "^10.4.0", "@testing-library/react": "^16.2.0", @@ -2308,19 +2308,19 @@ } }, "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.50.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.50.1.tgz", + "integrity": "sha512-Jii3aBg+CEDpgnuDxEp/h7BimHcUTDlpEtce89xEumlJ5ef2hqepZ+PWp1DDpYC/VO9fmWVI1IlEaoI5fK9FXQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.43.1" + "playwright": "1.50.1" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/@react-pdf/fns": { @@ -16380,35 +16380,35 @@ } }, "node_modules/playwright": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.1.tgz", - "integrity": "sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA==", + "version": "1.50.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.50.1.tgz", + "integrity": "sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.43.1" + "playwright-core": "1.50.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.50.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.50.1.tgz", + "integrity": "sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==", "dev": true, "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/playwright/node_modules/fsevents": { diff --git a/front/package.json b/front/package.json index 4717666c31e..5f7315184b6 100644 --- a/front/package.json +++ b/front/package.json @@ -98,7 +98,7 @@ }, "devDependencies": { "@apidevtools/swagger-parser": "^10.1.1", - "@playwright/test": "^1.41.2", + "@playwright/test": "^1.50.1", "@rtk-query/codegen-openapi": "^2.0.0", "@testing-library/dom": "^10.4.0", "@testing-library/react": "^16.2.0", diff --git a/front/tests/assets/constants/project-const.ts b/front/tests/assets/constants/project-const.ts index 460bbe40e1b..6db648d3142 100644 --- a/front/tests/assets/constants/project-const.ts +++ b/front/tests/assets/constants/project-const.ts @@ -1,3 +1,4 @@ +export const BASE_URL = 'http://localhost:4000'; export const electricRollingStockName = 'ELECTRIC_RS_E2E'; export const dualModeRollingStockName = 'DUAL-MODE_RS_E2E'; export const slowRollingStockName = 'SLOW_RS_E2E'; diff --git a/front/tests/utils/api-utils.ts b/front/tests/utils/api-utils.ts index ebc578671f2..376c53b9294 100644 --- a/front/tests/utils/api-utils.ts +++ b/front/tests/utils/api-utils.ts @@ -25,6 +25,7 @@ import type { } from 'common/api/osrdEditoastApi'; import { + BASE_URL, globalProjectName, globalStudyName, infrastructureName, @@ -39,7 +40,7 @@ import readJsonFile from './file-utils'; */ export const getApiContext = async (): Promise => request.newContext({ - baseURL: 'http://localhost:4000', + baseURL: BASE_URL, }); /** @@ -98,16 +99,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', + }, + }); }; /**