Skip to content

Commit

Permalink
front: try fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Berezovskiy <[email protected]>
  • Loading branch information
Wadjetz committed Jan 23, 2025
1 parent 54b4abd commit b78ddb6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const StdcmOperationalPoint = ({ location, pathStepId, disabled }: StdcmOperatio
<div className="col-9 ci-input">
<ComboBox
id={`${pathStepId}-ci`}
data-testid="operational-point-ci"
label={t('trainPath.ci')}
value={selectedCi}
suggestions={ciSuggestions}
Expand All @@ -180,6 +181,7 @@ const StdcmOperationalPoint = ({ location, pathStepId, disabled }: StdcmOperatio
<Select
label={t('trainPath.ch')}
id={`${pathStepId}-ch`}
data-testid="operational-point-ch"
value={selectedCh}
onChange={handleChSelect}
options={chSuggestions}
Expand Down
3 changes: 2 additions & 1 deletion front/src/utils/react-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import { v4 as uuidV4 } from 'uuid';
* @returns a unique id
*/
export default function nextId() {
return `id-${uuidV4()}`;
// return `id-${uuidV4()}`;
return uuidV4();
}
22 changes: 13 additions & 9 deletions front/tests/pages/stdcm-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ class STDCMPage {
this.maxSpeedField = page.locator('#maxSpeed');
this.addViaButton = page.locator('.stdcm-vias-list button .stdcm-card__body.add-via');
this.launchSimulationButton = page.getByTestId('launch-simulation-button');
this.originChField = this.originCard.locator('[id^="id"][id$="-ch"]');
this.destinationChField = this.destinationCard.locator('[id^="id"][id$="-ch"]');
this.originCiField = this.originCard.locator('[id^="id"][id$="-ci"]');
this.destinationCiField = this.destinationCard.locator('[id^="id"][id$="-ci"]');
this.originChField = this.originCard.locator('[data-testid="operational-point-ch"]');
this.destinationChField = this.destinationCard.locator('[data-testid="operational-point-ch"]');
this.originCiField = this.originCard.locator('[data-testid="operational-point-ci"]');
this.destinationCiField = this.destinationCard.locator('[data-testid="operational-point-ci"]');
this.viaIcon = page.locator('.stdcm-via-icons');
this.viaDeleteButton = page.getByTestId('delete-via-button');
this.originArrival = page.locator('#select-origin-arrival');
Expand Down Expand Up @@ -213,10 +213,14 @@ class STDCMPage {
hasText: 'MWS Mid_West_station',
});

this.dynamicOriginCh = this.originCard.locator('[id^="id"][id$="-ch"]');
this.dynamicDestinationCh = this.destinationCard.locator('[id^="id"][id$="-ch"]');
this.dynamicOriginCi = this.originCard.locator('[id^="id"][id$="-ci"]');
this.dynamicDestinationCi = this.destinationCard.locator('[id^="id"][id$="-ci"]');
this.dynamicOriginCh = this.originCard.locator('[data-testid="operational-point-ch"]');
this.dynamicDestinationCh = this.destinationCard.locator(
'[data-testid="operational-point-ch"]'
);
this.dynamicOriginCi = this.originCard.locator('[data-testid="operational-point-ci"]');
this.dynamicDestinationCi = this.destinationCard.locator(
'[data-testid="operational-point-ci"]'
);
this.simulationStatus = page.getByTestId('simulation-status');
this.simulationList = page.locator('.stdcm-results .simulation-list');
this.incrementButton = page.locator('.minute-button', { hasText: '+1mn' });
Expand Down Expand Up @@ -248,7 +252,7 @@ class STDCMPage {
}

private getViaCI(viaNumber: number): Locator {
return this.getViaCard(viaNumber).locator('[id^="id"][id$="-ci"]');
return this.getViaCard(viaNumber).locator('[data-testid="operational-point-ci"]');
}

private getViaType(viaNumber: number): Locator {
Expand Down

0 comments on commit b78ddb6

Please sign in to comment.