{t('pathfindingNoState')}
@@ -103,7 +104,7 @@ const Pathfinding = ({ pathProperties, setPathProperties }: PathfindingProps) =>
-
+
{t('pathfindingMissingParams', { missingElements })}
diff --git a/front/tests/001-home-page.spec.ts b/front/tests/001-home-page.spec.ts
index 1a4aaa0c420..cacf4843316 100644
--- a/front/tests/001-home-page.spec.ts
+++ b/front/tests/001-home-page.spec.ts
@@ -1,56 +1,56 @@
import { test, expect } from '@playwright/test';
-import { PlaywrightHomePage } from './pages/home-page-model';
+import HomePage from './pages/home-page-model';
// Describe the test suite for the home page of OSRD
test.describe('Home page OSRD', () => {
- let playwrightHomePage: PlaywrightHomePage;
+ let homePage: HomePage;
test.beforeEach(async ({ page }) => {
- // Create an instance of the PlaywrightHomePage class
- playwrightHomePage = new PlaywrightHomePage(page);
+ // Create an instance of the HomePage class
+ homePage = new HomePage(page);
// Go to the home page of OSRD
- await playwrightHomePage.goToHomePage();
+ await homePage.goToHomePage();
});
test.afterEach(async () => {
// Navigate back to the home page of OSRD
- await playwrightHomePage.backToHomePage();
+ await homePage.backToHomePage();
});
// Test that the home page of OSRD displays links to other pages
test('should display links in the home page', async () => {
- await playwrightHomePage.getDisplayLinks();
+ await homePage.getDisplayLinks();
});
test('should be correctly redirected to the "Operational Studies" page after clicking on the link', async () => {
// Navigate to the "Operational Studies" page
- await playwrightHomePage.goToOperationalStudiesPage();
+ await homePage.goToOperationalStudiesPage();
// Check that the URL of the page matches the expected pattern
- await expect(playwrightHomePage.page).toHaveURL(/.*\/operational-studies/);
+ await expect(homePage.page).toHaveURL(/.*\/operational-studies/);
});
test('should be correctly redirected to the "Map" page after clicking on the link', async () => {
// Navigate to the "Map" page
- await playwrightHomePage.goToCartoPage();
+ await homePage.goToCartoPage();
// Check that the URL of the page matches the expected pattern
- await expect(playwrightHomePage.page).toHaveURL(/.*\/map/);
+ await expect(homePage.page).toHaveURL(/.*\/map/);
});
test('should be correctly redirected to the "Editor" page after clicking on the link', async () => {
// Navigate to the "Editor" page
- await playwrightHomePage.goToEditorPage();
+ await homePage.goToEditorPage();
// Check that the URL of the page matches the expected pattern
- await expect(playwrightHomePage.page).toHaveURL(/.*\/editor\/*/);
+ await expect(homePage.page).toHaveURL(/.*\/editor\/*/);
});
test('should be correctly redirected to the "STDCM" page after clicking on the link', async () => {
// Navigate to the "STDCM" page
- await playwrightHomePage.goToSTDCMPage();
+ await homePage.goToSTDCMPage();
// Check that the URL of the page matches the expected pattern
- await expect(playwrightHomePage.page).toHaveURL(/.*\/stdcm/);
+ await expect(homePage.page).toHaveURL(/.*\/stdcm/);
});
});
diff --git a/front/tests/002-project-management.spec.ts b/front/tests/002-project-management.spec.ts
index d7af2910fb1..219daa2bfc6 100644
--- a/front/tests/002-project-management.spec.ts
+++ b/front/tests/002-project-management.spec.ts
@@ -4,10 +4,10 @@ import { v4 as uuidv4 } from 'uuid';
import type { Project } from 'common/api/osrdEditoastApi';
import projectData from './assets/operationStudies/project.json';
+import CommonPage from './pages/common-page-model';
+import HomePage from './pages/home-page-model';
+import ProjectPage from './pages/project-page-model';
import { deleteApiRequest, getApiRequest, postApiRequest } from './utils/index';
-import PlaywrightCommonPage from './pages/common-page-model';
-import { PlaywrightHomePage } from './pages/home-page-model';
-import { ProjectPage } from './pages/project-page-model';
let project: Project;
@@ -25,12 +25,12 @@ test.afterEach(async () => {
test.describe('Test if operationnal study : project workflow is working properly', () => {
test('Create a new project', async ({ page }) => {
- const playwrightHomePage = new PlaywrightHomePage(page);
+ const homePage = new HomePage(page);
const projectPage = new ProjectPage(page);
- const commonPage = new PlaywrightCommonPage(page);
+ const commonPage = new CommonPage(page);
- await playwrightHomePage.goToHomePage();
- await playwrightHomePage.goToOperationalStudiesPage();
+ await homePage.goToHomePage();
+ await homePage.goToOperationalStudiesPage();
await expect(projectPage.getAddProjectBtn).toBeVisible();
await projectPage.openProjectModalCreation();
@@ -49,9 +49,9 @@ test.describe('Test if operationnal study : project workflow is working properly
await commonPage.setTag(projectData.tags[1]);
await commonPage.setTag(projectData.tags[2]);
- const createButton = playwrightHomePage.page.getByTestId('createProject');
+ const createButton = homePage.page.getByTestId('createProject');
await createButton.click();
- await playwrightHomePage.page.waitForURL('**/projects/*');
+ await homePage.page.waitForURL('**/projects/*');
expect(await projectPage.getProjectName.textContent()).toContain(projectName);
expect(await projectPage.getProjectDescription.textContent()).toContain(
projectData.description
@@ -79,9 +79,9 @@ test.describe('Test if operationnal study : project workflow is working properly
});
test(' update a project', async ({ page }) => {
- const playwrightHomePage = new PlaywrightHomePage(page);
+ const homePage = new HomePage(page);
const projectPage = new ProjectPage(page);
- const commonPage = new PlaywrightCommonPage(page);
+ const commonPage = new CommonPage(page);
await page.goto('/operational-studies/projects');
@@ -103,8 +103,8 @@ test.describe('Test if operationnal study : project workflow is working properly
await projectPage.clickProjectUpdateConfirmBtn();
- await playwrightHomePage.goToHomePage();
- await playwrightHomePage.goToOperationalStudiesPage();
+ await homePage.goToHomePage();
+ await homePage.goToOperationalStudiesPage();
await projectPage.openProjectByTestId(`${project.name} (updated)`);
diff --git a/front/tests/003-study-management.spec.ts b/front/tests/003-study-management.spec.ts
index 71e465a28e2..7add5986ab0 100644
--- a/front/tests/003-study-management.spec.ts
+++ b/front/tests/003-study-management.spec.ts
@@ -4,10 +4,10 @@ import { v4 as uuidv4 } from 'uuid';
import type { Project, Study } from 'common/api/osrdEditoastApi';
import studyData from './assets/operationStudies/study.json';
+import CommonPage from './pages/common-page-model';
+import HomePage from './pages/home-page-model';
+import StudyPage from './pages/study-page-model';
import { getProject, postApiRequest } from './utils/index';
-import PlaywrightCommonPage from './pages/common-page-model';
-import { PlaywrightHomePage } from './pages/home-page-model';
-import { StudyPage } from './pages/study-page-model';
let project: Project;
let study: Study;
@@ -27,9 +27,9 @@ test.beforeEach(async () => {
test.describe('Test if operationnal study: study creation workflow is working properly', () => {
test('Create a new study', async ({ page }) => {
- const playwrightHomePage = new PlaywrightHomePage(page);
+ const homePage = new HomePage(page);
const studyPage = new StudyPage(page);
- const commonPage = new PlaywrightCommonPage(page);
+ const commonPage = new CommonPage(page);
await page.goto(`/operational-studies/projects/${project.id}`);
@@ -62,9 +62,9 @@ test.describe('Test if operationnal study: study creation workflow is working pr
await commonPage.setTag(project.tags[1]);
await commonPage.setTag(project.tags[2]);
- const createButton = playwrightHomePage.page.getByTestId('createStudy');
+ const createButton = homePage.page.getByTestId('createStudy');
await createButton.click();
- await playwrightHomePage.page.waitForURL('**/studies/*');
+ await homePage.page.waitForURL('**/studies/*');
expect(await studyPage.getStudyName.textContent()).toContain(studyName);
expect(await studyPage.getStudyDescription.textContent()).toContain(studyData.description);
expect(await studyPage.getStudyType.textContent()).toContain(studyData.type);
@@ -85,7 +85,7 @@ test.describe('Test if operationnal study: study creation workflow is working pr
test(' update a study', async ({ page }) => {
const studyPage = new StudyPage(page);
- const commonPage = new PlaywrightCommonPage(page);
+ const commonPage = new CommonPage(page);
await page.goto(`/operational-studies/projects/${project.id}/studies/${study.id}`);
@@ -139,7 +139,7 @@ test.describe('Test if operationnal study: study creation workflow is working pr
});
test('Delete a study', async ({ page }) => {
- const playwrightHomePage = new PlaywrightHomePage(page);
+ const homePage = new HomePage(page);
const studyPage = new StudyPage(page);
await page.goto(`/operational-studies/projects/${project.id}/studies/${study.id}`);
@@ -148,8 +148,8 @@ test.describe('Test if operationnal study: study creation workflow is working pr
await studyPage.clickStudyDeleteConfirmBtn();
- await playwrightHomePage.goToHomePage();
- await playwrightHomePage.goToOperationalStudiesPage();
+ await homePage.goToHomePage();
+ await homePage.goToOperationalStudiesPage();
await expect(studyPage.getStudyByName(studyData.name)).not.toBeVisible();
});
diff --git a/front/tests/004-scenario-management.spec.ts b/front/tests/004-scenario-management.spec.ts
index ac28d486721..85998a3d447 100644
--- a/front/tests/004-scenario-management.spec.ts
+++ b/front/tests/004-scenario-management.spec.ts
@@ -4,10 +4,10 @@ import { v4 as uuidv4 } from 'uuid';
import type { Infra, Project, Scenario, Study } from 'common/api/osrdEditoastApi';
import scenarioData from './assets/operationStudies/scenario.json';
-import { getInfra, getProject, getStudy, postApiRequest } from './utils/index';
-import PlaywrightCommonPage from './pages/common-page-model';
-import { PlaywrightHomePage } from './pages/home-page-model';
+import CommonPage from './pages/common-page-model';
+import HomePage from './pages/home-page-model';
import ScenarioPage from './pages/scenario-page-model';
+import { getInfra, getProject, getStudy, postApiRequest } from './utils/index';
let smallInfra: Infra;
let project: Project;
@@ -31,9 +31,9 @@ test.beforeEach(async () => {
test.describe('Test if operationnal study : scenario creation workflow is working properly', () => {
test('Create a new scenario', async ({ page }) => {
- const playwrightHomePage = new PlaywrightHomePage(page);
+ const homePage = new HomePage(page);
const scenarioPage = new ScenarioPage(page);
- const commonPage = new PlaywrightCommonPage(page);
+ const commonPage = new CommonPage(page);
await page.goto(`/operational-studies/projects/${project.id}/studies/${study.id}`);
@@ -55,9 +55,9 @@ test.describe('Test if operationnal study : scenario creation workflow is workin
await commonPage.setTag(scenarioData.tags[2]);
await scenarioPage.setScenarioInfraByName('small_infra_test_e2e');
- const createButton = playwrightHomePage.page.getByTestId('createScenario');
+ const createButton = homePage.page.getByTestId('createScenario');
await createButton.click();
- await playwrightHomePage.page.waitForURL('**/scenarios/*');
+ await homePage.page.waitForURL('**/scenarios/*');
expect(await scenarioPage.getScenarioName.textContent()).toContain(scenarioName);
expect(await scenarioPage.getScenarioDescription.textContent()).toContain(
scenarioData.description
@@ -67,7 +67,7 @@ test.describe('Test if operationnal study : scenario creation workflow is workin
test('Update a scenario', async ({ page }) => {
const scenarioPage = new ScenarioPage(page);
- const commonPage = new PlaywrightCommonPage(page);
+ const commonPage = new CommonPage(page);
await page.goto(
`/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
diff --git a/front/tests/005-operational-studies.spec.ts b/front/tests/005-operational-studies.spec.ts
index 180c451b63b..643595ffa79 100644
--- a/front/tests/005-operational-studies.spec.ts
+++ b/front/tests/005-operational-studies.spec.ts
@@ -1,17 +1,13 @@
-import fs from 'fs';
-import path from 'path';
-
import { test, expect } from '@playwright/test';
import { v4 as uuidv4 } from 'uuid';
import type { Infra, Project, RollingStock, Scenario, Study } from 'common/api/osrdEditoastApi';
import scenarioData from './assets/operationStudies/scenario.json';
-import { getProject, getStudy, getRollingStock, postApiRequest, getInfra } from './utils/index';
-import { PlaywrightHomePage } from './pages/home-page-model';
-import PlaywrightOperationalStudiesPage from './pages/operationa-studies-page-model';
+import HomePage from './pages/home-page-model';
import RollingStockSelectorPage from './pages/rolling-stock-selector-page';
-import PlaywrightScenarioPage from './pages/scenario-page-model';
+import ScenarioPage from './pages/scenario-page-model';
+import { getProject, getStudy, getRollingStock, postApiRequest, getInfra } from './utils/index';
let smallInfra: Infra;
let project: Project;
@@ -19,18 +15,11 @@ let study: Study;
let scenario: Scenario;
let rollingStock: RollingStock;
-const rollingstockPath = path.resolve(
- __dirname,
- '../tests/assets/rollingStock/thermal-electric_rolling_stock.json'
-);
-const rollingStockJson = JSON.parse(fs.readFileSync(rollingstockPath, 'utf8'));
-const thermalElectricRollingStockName = 'thermal-electric_rolling_stock';
test.beforeAll(async () => {
smallInfra = (await getInfra()) as Infra;
project = await getProject();
study = await getStudy(project.id);
rollingStock = await getRollingStock();
- await findAndDeleteRollingStock(thermalElectricRollingStockName);
});
test.beforeEach(async () => {
@@ -40,20 +29,18 @@ test.beforeEach(async () => {
study_id: study.id,
infra_id: smallInfra.id,
});
- await findAndDeleteRollingStock(thermalElectricRollingStockName);
});
test.describe('Testing if all mandatory elements simulation configuration are loaded in operationnal studies app', () => {
test('Testing pathfinding with rollingstock and composition code', async ({ page }) => {
- const playwrightHomePage = new PlaywrightHomePage(page);
- const scenarioPage = new PlaywrightScenarioPage(page);
-
+ const homePage = new HomePage(page);
+ const scenarioPage = new ScenarioPage(page);
await page.goto(
`/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
);
await scenarioPage.checkInfraLoaded();
- await playwrightHomePage.page.getByTestId('scenarios-add-train-schedule-button').click();
+ await homePage.page.getByTestId('scenarios-add-train-schedule-button').click();
await scenarioPage.setTrainScheduleName('TrainSchedule');
const trainCount = '7';
@@ -61,16 +48,16 @@ test.describe('Testing if all mandatory elements simulation configuration are lo
// TODO: move this test in his own file
// ***************** Test Rolling Stock *****************
- const playwrightRollingstockModalPage = new RollingStockSelectorPage(playwrightHomePage.page);
+ const rollingstockModalPage = new RollingStockSelectorPage(homePage.page);
await expect(scenarioPage.getRollingStockSelector).toBeVisible();
- await playwrightRollingstockModalPage.openRollingstockModal();
- const rollingstockModal = playwrightRollingstockModalPage.rollingStockSelectorModal;
+ await rollingstockModalPage.openRollingstockModal();
+ const rollingstockModal = rollingstockModalPage.rollingStockSelectorModal;
await expect(rollingstockModal).toBeVisible();
// Voluntarily add spaces and capital letters so we also test the normalization of the search functionality
- await playwrightRollingstockModalPage.searchRollingstock(' rollingstock_1500_25000_test_E2E ');
+ await rollingstockModalPage.searchRollingstock(' rollingstock_1500_25000_test_E2E ');
- const rollingstockCard = playwrightRollingstockModalPage.getRollingstockCardByTestID(
+ const rollingstockCard = rollingstockModalPage.getRollingstockCardByTestID(
`rollingstock-${rollingStock.name}`
);
await expect(rollingstockCard).toHaveClass(/inactive/);
@@ -79,12 +66,12 @@ test.describe('Testing if all mandatory elements simulation configuration are lo
await rollingstockCard.locator('button').click();
- expect(
- await playwrightRollingstockModalPage.getRollingStockMiniCardInfo().first().textContent()
- ).toMatch(rollingStock.name);
- expect(
- await playwrightRollingstockModalPage.getRollingStockInfoComfort().textContent()
- ).toMatch(/ConfortSStandard/i);
+ expect(await rollingstockModalPage.getRollingStockMiniCardInfo().first().textContent()).toMatch(
+ rollingStock.name
+ );
+ expect(await rollingstockModalPage.getRollingStockInfoComfort().textContent()).toMatch(
+ /ConfortSStandard/i
+ );
// ***************** Test choice Origin/Destination *****************
await scenarioPage.openTabByDataId('tab-pathfinding');
@@ -115,103 +102,4 @@ test.describe('Testing if all mandatory elements simulation configuration are lo
await scenarioPage.returnSimulationResult();
await scenarioPage.checkNumberOfTrains(Number(trainCount));
});
-
- test('should correctly select a rolling stock for operational study', async ({ page }) => {
- const operationalStudiesPage = new PlaywrightOperationalStudiesPage(page);
- const scenarioPage = new PlaywrightScenarioPage(page);
- const rollingStockSelector = new RollingStockSelectorPage(page);
-
- // Add a rolling stock via postAPI
- await addRollingStock(thermalElectricRollingStockName, rollingStockJson);
-
- // Navigate to the created scenario page
- await page.goto(
- `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
- );
-
- // Verify that the infrastructure is correctly loaded
- await scenarioPage.checkInfraLoaded();
-
- // Click on add train button
- await operationalStudiesPage.clickOnAddScenarioTrainBtn();
-
- // Verify the presence of warnings in Rolling Stock and Route Tab
- await operationalStudiesPage.getTabWarningPresence();
-
- // Open Rolling Stock Selector and search for the added train
- await operationalStudiesPage.openEmptyRollingStockSelector();
- await rollingStockSelector.searchRollingstock(thermalElectricRollingStockName);
- const rollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
- `rollingstock-${thermalElectricRollingStockName}`
- );
-
- // Verify that the rolling stock card is inactive
- await expect(rollingstockCard).toHaveClass(/inactive/);
-
- // Verify that the rolling stock card is active after clicking on it
- await rollingstockCard.click();
- await expect(rollingstockCard).not.toHaveClass(/inactive/);
-
- // Select the comfort AC
- const comfortACRadioText = await rollingStockSelector.comfortACRadio.innerText();
- await rollingStockSelector.comfortACRadio.click();
-
- // Select the rolling stock
- await rollingstockCard.locator('button').click();
-
- // Verify that the correct comfort type is displayed
- const selectedComfortACText = await rollingStockSelector.getSelectedComfortType.innerText();
- expect(selectedComfortACText).toMatch(new RegExp(comfortACRadioText, 'i'));
- });
-
- test('should correctly modify a rolling stock for operational study', async ({ page }) => {
- const operationalStudiesPage = new PlaywrightOperationalStudiesPage(page);
- const scenarioPage = new PlaywrightScenarioPage(page);
- const rollingStockSelector = new RollingStockSelectorPage(page);
-
- // Add a rolling stock via postAPI
- await addRollingStock(thermalElectricRollingStockName, rollingStockJson);
-
- // Navigate to the created scenario page
- await page.goto(
- `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
- );
-
- // Verify that the infrastructure is correctly loaded
- await scenarioPage.checkInfraLoaded();
-
- // Click on add train button
- await operationalStudiesPage.clickOnAddScenarioTrainBtn();
-
- // Open Rolling Stock Selector, search for the added train, and select it
- await operationalStudiesPage.openEmptyRollingStockSelector();
- await rollingStockSelector.searchRollingstock('rollingstock_1500_25000_test_e2e');
- const fastRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
- `rollingstock-${rollingStock.name}`
- );
- await fastRollingstockCard.click();
- await fastRollingstockCard.locator('button').click();
- expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
- 'rollingstock_1500_25000_test_e2e'
- );
-
- // Reopen the Rolling Stock selector from the selected card
- await operationalStudiesPage.openRollingStockSelector();
-
- // Apply thermal and electrical filters
- await rollingStockSelector.thermalRollingStockFilter();
- await rollingStockSelector.electricRollingStockFilter();
-
- // Select the thermal electric rolling stock
- const thermalElectricRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
- `rollingstock-${thermalElectricRollingStockName}`
- );
- await thermalElectricRollingstockCard.click();
- await thermalElectricRollingstockCard.locator('button').click();
-
- // Verify that the correct rolling stock name is displayed
- expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
- thermalElectricRollingStockName
- );
- });
});
diff --git a/front/tests/006-stdcm-page.spec.ts b/front/tests/006-stdcm-page.spec.ts
index beb438dce49..c4f2911577d 100644
--- a/front/tests/006-stdcm-page.spec.ts
+++ b/front/tests/006-stdcm-page.spec.ts
@@ -3,7 +3,6 @@ import { test, expect } from '@playwright/test';
import project from './assets/operationStudies/project.json';
import scenario from './assets/operationStudies/scenario.json';
import study from './assets/operationStudies/study.json';
-import { PlaywrightHomePage } from './pages/home-page-model';
import StdcmPage from './pages/stdcm-page-model';
import manageTrainScheduleTranslation from '../public/locales/fr/operationalStudies/manageTrainSchedule.json';
@@ -17,12 +16,6 @@ const rollingStockTranslation = manageTrainScheduleTranslation.rollingstock;
test.describe('STDCM page', () => {
test('should configure and launch a stdcm', async ({ page }) => {
const stdcmPage = new StdcmPage(page);
-
- // TODO: DROP STDCMV1: remove this part
- const homePage = new PlaywrightHomePage(page);
- await homePage.goToHomePage();
- await stdcmPage.toggleStdcmV1();
-
await stdcmPage.navigateToPage();
await expect(stdcmPage.scenarioExplorerModal).not.toBeVisible();
await expect(stdcmPage.rollingStockSelectorModal).not.toBeVisible();
diff --git a/front/tests/007-operational-studies-tabs.spec.ts b/front/tests/007-operational-studies-tabs.spec.ts
new file mode 100644
index 00000000000..7c55e710c93
--- /dev/null
+++ b/front/tests/007-operational-studies-tabs.spec.ts
@@ -0,0 +1,340 @@
+import { test, expect } from '@playwright/test';
+import { v4 as uuidv4 } from 'uuid';
+
+import type { Infra, Project, Scenario, Study, Timetable } from 'common/api/osrdEditoastApi';
+
+import scenarioData from './assets/operationStudies/scenario.json';
+import HomePage from './pages/home-page-model';
+import OperationalStudiesPage from './pages/operational-studies-page-model';
+import RollingStockSelectorPage from './pages/rolling-stock-selector-page';
+import ScenarioPage from './pages/scenario-page-model';
+import { getProject, getStudy, postApiRequest, getInfra } from './utils/index';
+
+let smallInfra: Infra;
+let project: Project;
+let study: Study;
+let scenario: Scenario;
+let timetable: Timetable;
+
+const thermalElectricRollingStockName = 'thermal-electric_rolling_stock';
+const electricRollingStockName = 'rollingstock_1500_25000_test_e2e';
+
+test.beforeAll(async () => {
+ smallInfra = (await getInfra()) as Infra;
+ project = await getProject();
+ study = await getStudy(project.id);
+});
+
+test.beforeEach(async () => {
+ timetable = await postApiRequest(`/api/v2/timetable/`, {
+ electrical_profile_set_id: null,
+ });
+ scenario = await postApiRequest(`/api/v2/projects/${project.id}/studies/${study.id}/scenarios/`, {
+ ...scenarioData,
+ name: `${scenarioData.name} ${uuidv4()}`,
+ study_id: study.id,
+ infra_id: smallInfra.id,
+ timetable_id: timetable.id,
+ });
+});
+
+test.describe('Testing if all elements in the different tabs are loaded', () => {
+ test('should correctly select a rolling stock for operational study', async ({ page }) => {
+ const operationalStudiesPage = new OperationalStudiesPage(page);
+ const scenarioPage = new ScenarioPage(page);
+ const rollingStockSelector = new RollingStockSelectorPage(page);
+
+ // TODO: DROP TSV1: remove this part
+ const homePage = new HomePage(page);
+ await homePage.goToHomePage();
+ await homePage.toggleTSV2();
+
+ // Navigate to the created scenario page
+ await page.goto(
+ `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
+ );
+
+ // Verify that the infrastructure is correctly loaded
+ await scenarioPage.checkInfraLoaded();
+
+ // Click on add train button
+ await operationalStudiesPage.clickOnAddScenarioTrainBtn();
+
+ // Verify the presence of warnings in Rolling Stock and Route Tab
+ await operationalStudiesPage.verifyTabWarningPresence();
+
+ // Open Rolling Stock Selector and search for the added train
+ await operationalStudiesPage.openEmptyRollingStockSelector();
+ await rollingStockSelector.searchRollingstock(thermalElectricRollingStockName);
+ const rollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
+ `rollingstock-${thermalElectricRollingStockName}`
+ );
+
+ // Verify that the rolling stock card is inactive
+ await expect(rollingstockCard).toHaveClass(/inactive/);
+
+ // Verify that the rolling stock card is active after clicking on it
+ await rollingstockCard.click();
+ await expect(rollingstockCard).not.toHaveClass(/inactive/);
+
+ // Select the comfort AC
+ const comfortACRadioText = await rollingStockSelector.comfortACRadio.innerText();
+ await rollingStockSelector.comfortACRadio.click();
+
+ // Select the rolling stock
+ await rollingstockCard.locator('button').click();
+
+ // Verify that the correct comfort type is displayed
+ const selectedComfortACText = await rollingStockSelector.getSelectedComfortType.innerText();
+ expect(selectedComfortACText).toMatch(new RegExp(comfortACRadioText, 'i'));
+ });
+
+ test('should correctly modify a rolling stock for operational study', async ({ page }) => {
+ const operationalStudiesPage = new OperationalStudiesPage(page);
+ const scenarioPage = new ScenarioPage(page);
+ const rollingStockSelector = new RollingStockSelectorPage(page);
+ // TODO: DROP TSV1: remove this part
+ const homePage = new HomePage(page);
+ await homePage.goToHomePage();
+ await homePage.toggleTSV2();
+
+ // Navigate to the created scenario page
+ await page.goto(
+ `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
+ );
+
+ // Verify that the infrastructure is correctly loaded
+ await scenarioPage.checkInfraLoaded();
+
+ // Click on add train button
+ await operationalStudiesPage.clickOnAddScenarioTrainBtn();
+
+ // Open Rolling Stock Selector, search for the added train, and select it
+ await operationalStudiesPage.openEmptyRollingStockSelector();
+ await rollingStockSelector.searchRollingstock(electricRollingStockName);
+ const fastRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
+ `rollingstock-${electricRollingStockName}`
+ );
+ await fastRollingstockCard.click();
+ await fastRollingstockCard.locator('button').click();
+ expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
+ electricRollingStockName
+ );
+
+ // Reopen the Rolling Stock selector from the selected card
+ await operationalStudiesPage.openRollingStockSelector();
+
+ // Apply thermal and electrical filters
+ await rollingStockSelector.thermalRollingStockFilter();
+ await rollingStockSelector.electricRollingStockFilter();
+
+ // Select the thermal electric rolling stock
+ const thermalElectricRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
+ `rollingstock-${thermalElectricRollingStockName}`
+ );
+ await thermalElectricRollingstockCard.click();
+ await thermalElectricRollingstockCard.locator('button').click();
+
+ // Verify that the correct rolling stock name is displayed
+ expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
+ thermalElectricRollingStockName
+ );
+ });
+
+ test('should correctly select a route for operational study', async ({ page, browserName }) => {
+ const operationalStudiesPage = new OperationalStudiesPage(page);
+ const scenarioPage = new ScenarioPage(page);
+ const rollingStockSelector = new RollingStockSelectorPage(page);
+ // TODO: DROP TSV1: remove this part
+ const homePage = new HomePage(page);
+ await homePage.goToHomePage();
+ const selectedLanguage = await homePage.getOSRDLanguage();
+ await homePage.toggleTSV2();
+
+ // Navigate to the created scenario page
+ await page.goto(
+ `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
+ );
+
+ // Verify that the infrastructure is correctly loaded
+ await scenarioPage.checkInfraLoaded();
+
+ // Click on add train button
+ await operationalStudiesPage.clickOnAddScenarioTrainBtn();
+
+ // Verify the presence of warnings in Rolling Stock and Route Tab
+ await operationalStudiesPage.verifyTabWarningPresence();
+
+ // Open Rolling Stock Selector, search for the added train, and select it
+ await operationalStudiesPage.openEmptyRollingStockSelector();
+ await rollingStockSelector.searchRollingstock(electricRollingStockName);
+ const electricRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
+ `rollingstock-${electricRollingStockName}`
+ );
+ await electricRollingstockCard.click();
+ await electricRollingstockCard.locator('button').click();
+
+ // Verify the selected rolling stock name
+ expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
+ electricRollingStockName
+ );
+
+ // Perform pathfinding and verify no selected route
+ await scenarioPage.openTabByDataId('tab-pathfinding');
+ await operationalStudiesPage.verifyNoSelectedRoute(selectedLanguage);
+ await operationalStudiesPage.performPathfindingByTrigram('WS', 'NES', 'MES');
+
+ // Define expected map markers values
+ const expectedMapMarkersValues = ['West_station', 'North_East_station', 'Mid_East_station'];
+
+ // Verify map markers in Chromium browser
+ if (browserName === 'chromium') {
+ await operationalStudiesPage.verifyMapMarkers(...expectedMapMarkersValues);
+ }
+
+ // Verify absence of tab warning
+ await operationalStudiesPage.verifyTabWarningAbsence();
+ });
+
+ test('should correctly add waypoints in a route for operational study', async ({
+ page,
+ browserName,
+ }) => {
+ const operationalStudiesPage = new OperationalStudiesPage(page);
+ const scenarioPage = new ScenarioPage(page);
+ const rollingStockSelector = new RollingStockSelectorPage(page);
+ // TODO: DROP TSV1: remove this part
+ const homePage = new HomePage(page);
+ await homePage.goToHomePage();
+ await homePage.toggleTSV2();
+
+ // Navigate to the created scenario page
+ await page.goto(
+ `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
+ );
+
+ // Click on add train button
+ await operationalStudiesPage.clickOnAddScenarioTrainBtn();
+
+ // Open Rolling Stock Selector, search for the added train, and select it
+ await operationalStudiesPage.openEmptyRollingStockSelector();
+ await rollingStockSelector.searchRollingstock(electricRollingStockName);
+
+ const electricRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
+ `rollingstock-${electricRollingStockName}`
+ );
+ await electricRollingstockCard.click();
+ await electricRollingstockCard.locator('button').click();
+
+ // Verify selected rolling stock name
+ expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
+ electricRollingStockName
+ );
+
+ // Perform pathfinding
+ await scenarioPage.openTabByDataId('tab-pathfinding');
+ await operationalStudiesPage.performPathfindingByTrigram('WS', 'NES');
+
+ // Define expected waypoints and their values
+ const expectedViaValues = [
+ { name: 'Mid_West_station', ch: 'BV', uic: '3', km: 'KM 11.850' },
+ { name: 'Mid_East_station', ch: 'BV', uic: '4', km: 'KM 26.300' },
+ ];
+
+ // Add new waypoints
+ await operationalStudiesPage.addNewWaypoints(
+ 2,
+ ['Mid_West_station', 'Mid_East_station'],
+ expectedViaValues
+ );
+
+ // Define expected map markers values
+ const expectedMapMarkersValues = [
+ 'West_station',
+ 'Mid_West_station',
+ 'Mid_East_station',
+ 'North_East_station',
+ ];
+
+ // Verify map markers in Chromium browser
+ if (browserName === 'chromium') {
+ await operationalStudiesPage.verifyMapMarkers(...expectedMapMarkersValues);
+ }
+
+ // Verify absence of tab warning
+ await operationalStudiesPage.verifyTabWarningAbsence();
+ });
+
+ test('should correctly reverse and delete waypoints in a route for operational study', async ({
+ browserName,
+ page,
+ }) => {
+ const operationalStudiesPage = new OperationalStudiesPage(page);
+ const scenarioPage = new ScenarioPage(page);
+ const rollingStockSelector = new RollingStockSelectorPage(page);
+ // TODO: DROP TSV1: remove this part
+ const homePage = new HomePage(page);
+ await homePage.goToHomePage();
+ const selectedLanguage = await homePage.getOSRDLanguage();
+ await homePage.toggleTSV2();
+
+ // Navigate to the created scenario page
+ await page.goto(
+ `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
+ );
+
+ // Click on add train button
+ await operationalStudiesPage.clickOnAddScenarioTrainBtn();
+
+ // Open Rolling Stock Selector, search for the added train, and select it
+ await operationalStudiesPage.openEmptyRollingStockSelector();
+ await rollingStockSelector.searchRollingstock(electricRollingStockName);
+
+ const electricRollingstockCard = rollingStockSelector.getRollingstockCardByTestID(
+ `rollingstock-${electricRollingStockName}`
+ );
+ await electricRollingstockCard.click();
+ await electricRollingstockCard.locator('button').click();
+
+ // Verify selected rolling stock name
+ expect(await rollingStockSelector.getSelectedRollingStockName.innerText()).toEqual(
+ electricRollingStockName
+ );
+
+ // Perform pathfinding
+ await scenarioPage.openTabByDataId('tab-pathfinding');
+ await operationalStudiesPage.performPathfindingByTrigram('WS', 'SES', 'MWS');
+
+ // Define expected map markers values
+ const expectedMapMarkersValues = ['West_station', 'South_East_station', 'Mid_West_station'];
+
+ // Verify map markers in Chromium browser
+ if (browserName === 'chromium') {
+ await operationalStudiesPage.verifyMapMarkers(...expectedMapMarkersValues);
+ }
+
+ // Reverse the itinerary and verify the map markers
+ await operationalStudiesPage.clickOnReverseItinerary();
+
+ const reversedMapMarkersValues = [...expectedMapMarkersValues].reverse();
+
+ if (browserName === 'chromium') {
+ await operationalStudiesPage.verifyMapMarkers(...reversedMapMarkersValues);
+ }
+
+ // Delete operational points and verify no selected route
+ await operationalStudiesPage.clickOnDeleteOPButtons(selectedLanguage);
+ await operationalStudiesPage.verifyNoSelectedRoute(selectedLanguage);
+
+ // Search by trigram and verify map markers
+ await operationalStudiesPage.clickSearchByTrigramSubmitButton();
+
+ if (browserName === 'chromium') {
+ await operationalStudiesPage.verifyMapMarkers(...expectedMapMarkersValues);
+ }
+
+ // Delete itinerary and verify no selected route
+ await operationalStudiesPage.clickDeleteItineraryButton();
+ await operationalStudiesPage.verifyNoSelectedRoute(selectedLanguage);
+ });
+});
diff --git a/front/tests/008-allowances.spec.ts b/front/tests/008-allowances.spec.ts
index ed42048c6a7..45dbd87e6c1 100644
--- a/front/tests/008-allowances.spec.ts
+++ b/front/tests/008-allowances.spec.ts
@@ -1,15 +1,15 @@
import { test } from '@playwright/test';
import { v4 as uuidv4 } from 'uuid';
+import ScenarioPage from './pages/scenario-page-model';
import createCompleteScenario, { allowancesManagement } from './utils/scenario-utils';
-import PlaywrightScenarioPage from './pages/scenario-page-model';
let scenarioName: string;
-let scenarioPage: PlaywrightScenarioPage;
+let scenarioPage: ScenarioPage;
test.describe('Testing if all mandatory elements simulation configuration are loaded in operationnal studies app', () => {
test.beforeEach(async ({ page }) => {
- scenarioPage = new PlaywrightScenarioPage(page);
+ scenarioPage = new ScenarioPage(page);
scenarioName = `Train_Schedule_${uuidv4().slice(0, 5)}`;
await createCompleteScenario(page, scenarioName, '1', '15');
});
diff --git a/front/tests/009-rollingstock-editor.spec.ts b/front/tests/009-rollingstock-editor.spec.ts
index c3d87a481f5..6c412fe3875 100644
--- a/front/tests/009-rollingstock-editor.spec.ts
+++ b/front/tests/009-rollingstock-editor.spec.ts
@@ -3,29 +3,24 @@ import path from 'path';
import { test, expect } from '@playwright/test';
+import RollingStockSelectorPage from './pages/rolling-stock-selector-page';
+import RollingstockEditorPage from './pages/rollingstock-editor-page-model';
import {
findAndDeleteRollingStocks,
generateUniqueName,
verifyAndCheckInputById,
fillAndCheckInputById,
- addRollingStock,
} from './utils/index';
-import RollingStockSelectorPage from './pages/rolling-stock-selector-page';
-import PlaywrightRollingstockEditorPage from './pages/rollingstock-editor-page-model';
// Correct path to load rolling stock details from JSON
const rollingstockDetailsPath = path.resolve(
__dirname,
'../tests/assets/rollingStock/rollingstockDetails.json'
);
-// Correct path to load electrical and themal rolling stock from JSON
-const rollingstockPath = path.resolve(
- __dirname,
- '../tests/assets/rollingStock/thermal-electric_rolling_stock.json'
-);
+
const rollingstockDetails = JSON.parse(fs.readFileSync(rollingstockDetailsPath, 'utf-8'));
-const rollingStockJson = JSON.parse(fs.readFileSync(rollingstockPath, 'utf8'));
const thermalElectricRollingStockName = 'thermal-electric_rolling_stock';
+const electricRollingStockName = 'rollingstock_1500_25000_test_e2e';
test.describe('Rollingstock editor page', () => {
let uniqueRollingStockName: string;
@@ -42,7 +37,6 @@ test.describe('Rollingstock editor page', () => {
uniqueRollingStockName,
uniqueUpdatedRollingStockName,
uniqueDeletedRollingStockName,
- thermalElectricRollingStockName,
]);
});
@@ -52,12 +46,11 @@ test.describe('Rollingstock editor page', () => {
uniqueRollingStockName,
uniqueUpdatedRollingStockName,
uniqueDeletedRollingStockName,
- thermalElectricRollingStockName,
]);
});
test('should correctly create a new rolling stock', async ({ page }) => {
- const rollingStockEditorPage = new PlaywrightRollingstockEditorPage(page);
+ const rollingStockEditorPage = new RollingstockEditorPage(page);
// Navigate to the page
await rollingStockEditorPage.navigateToPage();
@@ -128,13 +121,12 @@ test.describe('Rollingstock editor page', () => {
});
test('should correctly duplicate and modify a rolling stock', async ({ page }) => {
- const rollingStockEditorPage = new PlaywrightRollingstockEditorPage(page);
- const addedRollingStockName = 'rollingstock_1500_25000_test_e2e';
+ const rollingStockEditorPage = new RollingstockEditorPage(page);
await rollingStockEditorPage.navigateToPage();
// Select the rolling stock from global-setup
- await rollingStockEditorPage.selectRollingStock(addedRollingStockName);
+ await rollingStockEditorPage.selectRollingStock(electricRollingStockName);
// Duplicate rolling stock
await rollingStockEditorPage.duplicateRollingStock();
@@ -158,8 +150,8 @@ test.describe('Rollingstock editor page', () => {
await rollingStockEditorPage.submitRollingStock();
// Confirm the presence of the original RS
- await rollingStockEditorPage.searchRollingStock(addedRollingStockName);
- expect(rollingStockEditorPage.page.getByTestId(addedRollingStockName)).toBeDefined();
+ await rollingStockEditorPage.searchRollingStock(electricRollingStockName);
+ expect(rollingStockEditorPage.page.getByTestId(electricRollingStockName)).toBeDefined();
await rollingStockEditorPage.clearSearchRollingStock();
// Get to details page of the new rolling stock
@@ -181,13 +173,12 @@ test.describe('Rollingstock editor page', () => {
);
});
test('should correctly duplicate and delete a rolling stock', async ({ page }) => {
- const rollingStockEditorPage = new PlaywrightRollingstockEditorPage(page);
- const addedRollingStockName = 'rollingstock_1500_25000_test_e2e';
+ const rollingStockEditorPage = new RollingstockEditorPage(page);
await rollingStockEditorPage.navigateToPage();
// Select the rolling stock from global-setup
- await rollingStockEditorPage.selectRollingStock(addedRollingStockName);
+ await rollingStockEditorPage.selectRollingStock(electricRollingStockName);
// Duplicate and change the rolling stock name
await rollingStockEditorPage.duplicateRollingStock();
@@ -205,7 +196,7 @@ test.describe('Rollingstock editor page', () => {
).toBeHidden();
});
test('should correctly filter a rolling stock', async ({ page }) => {
- const rollingStockEditorPage = new PlaywrightRollingstockEditorPage(page);
+ const rollingStockEditorPage = new RollingstockEditorPage(page);
const rollingStockSelectorPage = new RollingStockSelectorPage(page);
// Navigate to rolling stock editor page
await rollingStockEditorPage.navigateToPage();
@@ -252,10 +243,8 @@ test.describe('Rollingstock editor page', () => {
});
test('should correctly search for a rolling stock', async ({ page }) => {
- const rollingStockEditorPage = new PlaywrightRollingstockEditorPage(page);
+ const rollingStockEditorPage = new RollingstockEditorPage(page);
const rollingStockSelectorPage = new RollingStockSelectorPage(page);
- // Add a rolling stock via postAPI
- await addRollingStock(thermalElectricRollingStockName, rollingStockJson);
// Navigate to rolling stock editor page
await rollingStockEditorPage.navigateToPage();
diff --git a/front/tests/assets/scenario-utlis.ts b/front/tests/assets/scenario-utlis.ts
deleted file mode 100644
index 58f0899d17b..00000000000
--- a/front/tests/assets/scenario-utlis.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-import { type Page, expect } from '@playwright/test';
-import { v4 as uuidv4 } from 'uuid';
-
-import type { Infra } from 'common/api/osrdEditoastApi';
-
-import scenarioData from './operationStudies/scenario.json';
-import { getInfra, getProject, getRollingStock, getStudy, postApiRequest } from './utils';
-import { PlaywrightHomePage } from '../pages/home-page-model';
-import RollingStockSelectorPage from '../pages/rolling-stock-selector-page';
-import PlaywrightScenarioPage from '../pages/scenario-page-model';
-
-// Scenario creation
-export default async function createCompleteScenario(
- page: Page,
- trainScheduleName: string,
- trainCount: string,
- delta: string
-) {
- const smallInfra = (await getInfra()) as Infra;
- const project = await getProject();
- const study = await getStudy(project.id);
- const rollingStock = await getRollingStock();
-
- const scenario = await postApiRequest(
- `/api/projects/${project.id}/studies/${study.id}/scenarios`,
- {
- ...scenarioData,
- name: `${scenarioData.name} ${uuidv4()}`,
- study_id: study.id,
- infra_id: smallInfra.id,
- }
- );
-
- const playwrightHomePage = new PlaywrightHomePage(page);
- const scenarioPage = new PlaywrightScenarioPage(page);
-
- await page.goto(
- `/operational-studies/projects/${project.id}/studies/${study.id}/scenarios/${scenario.id}`
- );
-
- await playwrightHomePage.page.getByTestId('scenarios-add-train-schedule-button').click();
-
- await scenarioPage.setTrainScheduleName(trainScheduleName);
- await scenarioPage.setNumberOfTrains(trainCount);
- await scenarioPage.setDelta(delta);
-
- // ***************** Select Rolling Stock *****************
- const playwrightRollingstockModalPage = new RollingStockSelectorPage(playwrightHomePage.page);
- await playwrightRollingstockModalPage.openRollingstockModal();
-
- await playwrightRollingstockModalPage.searchRollingstock('rollingstock_1500_25000_test_e2e');
-
- const rollingstockCard = playwrightRollingstockModalPage.getRollingstockCardByTestID(
- `rollingstock-${rollingStock.name}`
- );
-
- await rollingstockCard.click();
- await rollingstockCard.locator('button').click();
-
- // ***************** Select Origin/Destination *****************
- await scenarioPage.openTabByDataId('tab-pathfinding');
- await scenarioPage.getPathfindingByTriGramSearch('MWS', 'NES');
-
- // ***************** Create train *****************
- await scenarioPage.addTrainSchedule();
- await scenarioPage.page.waitForSelector('.dots-loader', { state: 'hidden' });
- await scenarioPage.checkTrainHasBeenAdded();
- await scenarioPage.returnSimulationResult();
-}
-
-// Allowances management
-
-export async function allowancesManagement(
- scenarioPage: PlaywrightScenarioPage,
- scenarioName: string,
- allowanceType: 'standard' | 'engineering'
-) {
- await expect(scenarioPage.getTimetableList).toBeVisible();
-
- await scenarioPage.getBtnByName(scenarioName).hover();
- await scenarioPage.page.getByTestId('edit-train').click();
-
- await scenarioPage.openAllowancesModule();
- await expect(scenarioPage.getAllowancesModule).toBeVisible();
-
- if (allowanceType === 'standard') {
- await scenarioPage.setStandardAllowance();
- } else {
- await scenarioPage.setEngineeringAllowance();
- await scenarioPage.clickSuccessBtn();
- await expect(scenarioPage.getAllowancesEngineeringSettings).toHaveAttribute('disabled');
- }
-
- await scenarioPage.page.getByTestId('submit-edit-train-schedule').click();
- await scenarioPage.page.waitForSelector('.scenario-details-name');
- expect(await scenarioPage.isAllowanceWorking()).toEqual(true);
-}
diff --git a/front/tests/global-setup.ts b/front/tests/global-setup.ts
index 837d607eaa3..ada04bacf6c 100644
--- a/front/tests/global-setup.ts
+++ b/front/tests/global-setup.ts
@@ -24,6 +24,10 @@ async function createDataForTests() {
fs.readFileSync('../tests/data/rolling_stocks/electric_rolling_stock.json', 'utf8')
);
+ const thermalElectricRollingStockJson = JSON.parse(
+ fs.readFileSync('./tests/assets/rollingStock/thermal-electric_rolling_stock.json', 'utf8')
+ );
+
const createdInfra: PostInfraRailjsonApiResponse = await postApiRequest(
`/api/infra/railjson/`,
{
@@ -41,6 +45,10 @@ async function createDataForTests() {
...rollingStockJson,
name: 'rollingstock_1500_25000_test_e2e',
});
+ await postApiRequest('/api/rolling_stock/', {
+ ...thermalElectricRollingStockJson,
+ name: 'thermal-electric_rolling_stock',
+ });
const project = await postApiRequest('/api/projects/', {
...projectData,
diff --git a/front/tests/global-teardown.ts b/front/tests/global-teardown.ts
index 530ffb8a506..5b60461cf80 100644
--- a/front/tests/global-teardown.ts
+++ b/front/tests/global-teardown.ts
@@ -12,11 +12,14 @@ setup('teardown', async () => {
const project = projects.results.find((p: Project) => p.name === 'project_test_e2e');
const rollingStocks = await getApiRequest(`/api/light_rolling_stock/`, { page_size: 500 });
- const rollingStock: RollingStock = await rollingStocks.results.find(
+ const electricRollingStock: RollingStock = await rollingStocks.results.find(
(r: RollingStock) => r.name === 'rollingstock_1500_25000_test_e2e'
);
-
+ const thermalElectricRollingStock: RollingStock = await rollingStocks.results.find(
+ (r: RollingStock) => r.name === 'thermal-electric_rolling_stock'
+ );
await deleteApiRequest(`/api/infra/${infra.id}/`);
await deleteApiRequest(`/api/projects/${project.id}/`);
- await deleteApiRequest(`/api/rolling_stock/${rollingStock.id}/`);
+ await deleteApiRequest(`/api/rolling_stock/${electricRollingStock.id}/`);
+ await deleteApiRequest(`/api/rolling_stock/${thermalElectricRollingStock.id}/`);
});
diff --git a/front/tests/pages/base-page.ts b/front/tests/pages/base-page.ts
index 701842a0d3e..6d630496878 100644
--- a/front/tests/pages/base-page.ts
+++ b/front/tests/pages/base-page.ts
@@ -1,6 +1,6 @@
import { expect, type Locator, type Page } from '@playwright/test';
-export default class BasePage {
+class BasePage {
public page: Page;
private backToHomePageButton: Locator;
@@ -40,3 +40,4 @@ export default class BasePage {
await this.page.getByRole('button', { name }).click();
}
}
+export default BasePage;
diff --git a/front/tests/pages/common-page-model.ts b/front/tests/pages/common-page-model.ts
index 3d4deb18d50..ae9f07bbafd 100644
--- a/front/tests/pages/common-page-model.ts
+++ b/front/tests/pages/common-page-model.ts
@@ -1,10 +1,9 @@
-import { expect } from '@playwright/test';
-import type { Locator, Page } from '@playwright/test';
+import { expect, type Locator, type Page } from '@playwright/test';
import BasePage from './base-page';
import rollingstockTranslation from '../../public/locales/fr/rollingstock.json';
-class PlaywrightCommonPage extends BasePage {
+class CommonPage extends BasePage {
readonly rollingstockTranslation: typeof rollingstockTranslation;
readonly getToastSNCF: Locator;
@@ -33,4 +32,4 @@ class PlaywrightCommonPage extends BasePage {
}
}
-export default PlaywrightCommonPage;
+export default CommonPage;
diff --git a/front/tests/pages/home-page-model.ts b/front/tests/pages/home-page-model.ts
index cd578cb6b62..dd9bab4c1a1 100644
--- a/front/tests/pages/home-page-model.ts
+++ b/front/tests/pages/home-page-model.ts
@@ -3,7 +3,7 @@ import { expect, type Locator, type Page } from '@playwright/test';
import home from '../../public/locales/fr/home/home.json';
-export class PlaywrightHomePage {
+class HomePage {
// The current page object
readonly page: Page;
@@ -31,6 +31,14 @@ export class PlaywrightHomePage {
readonly getViteOverlay: Locator;
+ readonly TSV2Switch: Locator;
+
+ readonly dropDown: Locator;
+
+ readonly userSettings: Locator;
+
+ readonly OSRDLanguage: Locator;
+
constructor(page: Page) {
this.page = page;
// Initialize locators using roles and text content
@@ -46,6 +54,10 @@ export class PlaywrightHomePage {
this.getBody = page.locator('body');
this.translation = home;
this.getViteOverlay = page.locator('vite-plugin-checker-error-overlay');
+ this.TSV2Switch = page.getByTestId('train-schedule-version-switch');
+ this.dropDown = page.getByTestId('dropdown-sncf');
+ this.userSettings = page.getByTestId('user-settings-btn');
+ this.OSRDLanguage = page.getByTestId('language-info');
}
// Completly remove VITE button & sign
@@ -101,4 +113,23 @@ export class PlaywrightHomePage {
getTranslations(key: keyof typeof home) {
return this.translation[key];
}
+
+ // TODO : Delete after drop V1
+ // Check Stdcm Version
+ async toggleTSV2() {
+ await this.dropDown.click();
+ await this.userSettings.click();
+ if (!(await this.TSV2Switch.isChecked()) && (await this.TSV2Switch.isVisible())) {
+ await this.TSV2Switch.click();
+ }
+ }
+
+ // Get OSRD selected language
+ async getOSRDLanguage(): Promise