Skip to content

Commit

Permalink
fixup! front: add speed space chart e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Maymanaf committed Nov 28, 2024
1 parent 0706f18 commit 9695162
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 8 deletions.
34 changes: 26 additions & 8 deletions front/tests/012-op-simulation-settings-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import OperationalStudiesTimetablePage from './pages/op-timetable-page-model';
import OperationalStudiesPage from './pages/operational-studies-page-model';
import RollingStockSelectorPage from './pages/rollingstock-selector-page-model';
import test from './test-logger';
import { readJsonFile, waitForInfraStateToBeCached } from './utils';
import { performOnLinux, readJsonFile, waitForInfraStateToBeCached } from './utils';
import { deleteApiRequest, getInfra, setElectricalProfile } from './utils/api-setup';
import { cleanWhitespace, type StationData } from './utils/dataNormalizer';
import createScenario from './utils/scenario';
Expand Down Expand Up @@ -174,7 +174,11 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('ElectricalProfile-SSC-ON.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot(
'ElectricalProfile-SSC-ON.png'
);
});
await scrollContainer(page, '.time-stop-outputs .time-stops-datasheet .dsg-container');
await opOutputTablePage.getOutputTableData(expectedCellDataElectricalProfileON, OSRDLanguage);
await opTimetablePage.clickOnTimetableCollapseButton();
Expand All @@ -188,7 +192,11 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('ElectricalProfile-SSC-OFF.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot(
'ElectricalProfile-SSC-OFF.png'
);
});
await opOutputTablePage.getOutputTableData(expectedCellDataElectricalProfileOFF, OSRDLanguage);
});
test('Activate composition code', async ({ page }) => {
Expand Down Expand Up @@ -234,7 +242,9 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('CodeCompo-SSC-ON.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('CodeCompo-SSC-ON.png');
});
await scrollContainer(page, '.time-stop-outputs .time-stops-datasheet .dsg-container');
await opOutputTablePage.getOutputTableData(expectedCellDataCodeCompoON, OSRDLanguage);
await opTimetablePage.clickOnTimetableCollapseButton();
Expand All @@ -248,7 +258,9 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('CodeCompo-SSC-OFF.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('CodeCompo-SSC-OFF.png');
});
await opOutputTablePage.getOutputTableData(expectedCellDataCodeCompoOFF, OSRDLanguage);
});
test('Activate linear and mareco margin', async ({ page }) => {
Expand Down Expand Up @@ -303,7 +315,9 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('LinearMargin-SSC.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('LinearMargin-SSC.png');
});
await scrollContainer(page, '.time-stop-outputs .time-stops-datasheet .dsg-container');
await opOutputTablePage.getOutputTableData(expectedCellDataLinearMargin, OSRDLanguage);
await opTimetablePage.clickOnTimetableCollapseButton();
Expand All @@ -317,7 +331,9 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('MarecoMargin-SSC.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('MarecoMargin-SSC.png');
});
await opOutputTablePage.getOutputTableData(expectedCellDataMarecoMargin, OSRDLanguage);
});
test('Add all the simulation settings', async ({ page }) => {
Expand Down Expand Up @@ -373,7 +389,9 @@ test.describe('Simulation Settings Tab Verification', () => {
await opTimetablePage.clickOnScenarioCollapseButton();
await opOutputTablePage.verifyTimesStopsDataSheetVisibility();
await simulationResultPage.checkAllSscCheckboxes();
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('AllSettings-SSC.png');
await performOnLinux(async () => {
await expect(opTimetablePage.speedSpaceChart).toHaveScreenshot('AllSettings-SSC.png');
});
await scrollContainer(page, '.time-stop-outputs .time-stops-datasheet .dsg-container');
await opOutputTablePage.getOutputTableData(expectedCellDataForAllSettings, OSRDLanguage);
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions front/tests/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,19 @@ export const waitForInfraStateToBeCached = async (infraId: number): Promise<void

throw new Error("Infrastructure state did not reach 'CACHED' within the allotted 3 minutes.");
};

/**
* Perform an action only on Linux platform.
* @param action - The action to perform on Linux.
* @param skipMessage - Optional message to log if the platform is not Linux.
*/
export async function performOnLinux(
action: () => Promise<void>,
skipMessage = 'Skipping action as the platform is not Linux.'
) {
if (process.platform === 'linux') {
await action();
} else {
console.info(skipMessage);
}
}

0 comments on commit 9695162

Please sign in to comment.