Skip to content

Commit

Permalink
front: fix stdcm towed rolling stock e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: maymanaf <[email protected]>
  • Loading branch information
Maymanaf authored and Wadjetz committed Jan 9, 2025
1 parent c27526a commit 6a5e2c0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions front/src/assets/rollingStock/freightRollingStocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const FREIGHT_ROLLING_STOCKS = [
'Y8000AP',
'Y9000US',
'electric_rolling_stock_test_e2e',
'FAST_ROLLING_STOCK_TEST_E2E',
];

export const ALLOWED_TOWED_ROLLING_STOCKS = [
Expand Down
21 changes: 13 additions & 8 deletions front/tests/006-stdcm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Infra, TowedRollingStock } from 'common/api/osrdEditoastApi';

import { electricRollingStockName } from './assets/project-const';
import { electricRollingStockName, fastRollingStockName } from './assets/project-const';
import HomePage from './pages/home-page-model';
import STDCMPage, { type ConsistFields } from './pages/stdcm-page-model';
import test from './test-logger';
Expand All @@ -20,7 +20,7 @@ test.describe('Verify train schedule elements and filters', () => {
let infra: Infra;
let OSRDLanguage: string;
let createdTowedRollingStock: TowedRollingStock;
const UPDATED_TONNAGE = '1061';
const UPDATED_ORIGIN_ARRIVAL_DATE = '18/10/24';
const consistDetails: ConsistFields = {
tractionEngine: electricRollingStockName,
tonnage: '950',
Expand All @@ -33,6 +33,11 @@ test.describe('Verify train schedule elements and filters', () => {
length: '400',
maxSpeed: '288',
};
const fastRollingStockPrefilledValues = {
tonnage: '190',
length: '45',
maxSpeed: '220',
};
const towedRollingStockPrefilledValues = {
tonnage: '46',
length: '26',
Expand Down Expand Up @@ -133,15 +138,15 @@ test.describe('Verify train schedule elements and filters', () => {
/** *************** Test 4 **************** */
test('Launch simulation with and without capacity for towed rolling stock', async ({ page }) => {
const towedConsistDetails: ConsistFields = {
tractionEngine: electricRollingStockName,
tractionEngine: fastRollingStockName,
towedRollingStock: createdTowedRollingStock.name,
};
const stdcmPage = new STDCMPage(page);
await stdcmPage.fillAndVerifyConsistDetails(
towedConsistDetails,
tractionEnginePrefilledValues.tonnage,
tractionEnginePrefilledValues.length,
tractionEnginePrefilledValues.maxSpeed,
fastRollingStockPrefilledValues.tonnage,
fastRollingStockPrefilledValues.length,
fastRollingStockPrefilledValues.maxSpeed,
towedRollingStockPrefilledValues.tonnage,
towedRollingStockPrefilledValues.length,
towedRollingStockPrefilledValues.maxSpeed
Expand All @@ -159,12 +164,12 @@ test.describe('Verify train schedule elements and filters', () => {
simulationNumber: 1,
});
// Update tonnage and launch a second simulation with capacity
await handleAndVerifyInput(stdcmPage.tonnageField, UPDATED_TONNAGE);
await handleAndVerifyInput(stdcmPage.dateOriginArrival, UPDATED_ORIGIN_ARRIVAL_DATE);
await stdcmPage.launchSimulation();
await stdcmPage.verifySimulationDetails({
language: OSRDLanguage,
simulationNumber: 2,
simulationLengthAndDuration: '51 km — 24min',
simulationLengthAndDuration: '51 km — 2h 35min',
});
await stdcmPage.verifyTableData(
'./tests/assets/stdcm/towedRollingStock/towedRollingStockTableResult.json'
Expand Down
2 changes: 1 addition & 1 deletion front/tests/assets/project-const.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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';
export const fastRollingStockName = 'fast_rolling_stock_test_e2e';
export const fastRollingStockName = 'FAST_ROLLING_STOCK_TEST_E2E';
export const improbableRollingStockName = 'improbable_rolling_stock_test_e2e';
export const infrastructureName = 'small_infra_test_e2e';
export const trainScheduleProjectName = 'TS_project_test_e2e';
Expand Down
6 changes: 3 additions & 3 deletions front/tests/assets/rollingStock/fast_rolling_stock.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@
"default_mode": "thermal"
},
"metadata": {
"detail": "fast_rolling_stock",
"detail": "",
"family": "",
"type": "",
"grouping": "",
"series": "",
"subseries": "",
"unit": "",
"number": "",
"reference": "fast_rolling_stock"
"reference": ""
},
"length": 45.56,
"max_speed": 61.111111111111114,
Expand All @@ -101,7 +101,7 @@
"const_gamma": 1.5,
"inertia_coefficient": 1.09,
"base_power_class": "9",
"mass": 190400.0,
"mass": 190000,
"rolling_resistance": {
"type": "davis",
"A": 2260.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"endStop": "",
"passageStop": "",
"startStop": "20:21",
"weight": "561t",
"weight": "236t",
"refEngine": ""
},
{
"index": 2,
"operationalPoint": "Mid_West_station",
"code": "BV",
"endStop": "",
"passageStop": "20:30",
"passageStop": "21:03",
"startStop": "",
"weight": "=",
"refEngine": "="
Expand All @@ -23,10 +23,10 @@
"index": 3,
"operationalPoint": "South_station",
"code": "BV",
"endStop": "20:46",
"endStop": "22:57",
"passageStop": "",
"startStop": "",
"weight": "561t",
"weight": "236t",
"refEngine": ""
}
]
2 changes: 1 addition & 1 deletion front/tests/assets/trainSchedule/train_schedules.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
{
"train_name": "Train 7",
"labels": ["Tag-7", "WS-NES"],
"rolling_stock_name": "fast_rolling_stock_test_e2e",
"rolling_stock_name": "FAST_ROLLING_STOCK_TEST_E2E",
"start_time": "2024-10-17T08:37:00Z",
"path": [
{ "id": "id2121", "deleted": false, "uic": 2, "secondary_code": "BV" },
Expand Down

0 comments on commit 6a5e2c0

Please sign in to comment.