Skip to content

Commit a26b7d6

Browse files
committed
front: removed rocket component and ensured searchByTrigramContainer is not visible in tests
1 parent 2e42e63 commit a26b7d6

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

front/src/modules/pathfinding/components/Itinerary/ItineraryV2.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const ItineraryV2 = ({
113113
</div>
114114
{displayTypeAndPath && (
115115
<div className="mb-2">
116-
<TypeAndPathV2 />
116+
<TypeAndPathV2 setDisplayTypeAndPath={setDisplayTypeAndPath} />
117117
</div>
118118
)}
119119
{origin && destination && (

front/src/modules/pathfinding/components/Pathfinding/TypeAndPathV2.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ function OpTooltips({ opList }: { opList: SearchResultItemOperationalPoint[] })
5454
</div>
5555
);
5656
}
57+
type typeAndPathV2Props = {
58+
setDisplayTypeAndPath: React.Dispatch<React.SetStateAction<boolean>>;
59+
};
5760

58-
const TypeAndPathV2 = () => {
61+
const TypeAndPathV2 = ({ setDisplayTypeAndPath }: typeAndPathV2Props) => {
5962
const dispatch = useAppDispatch();
6063
const [inputText, setInputText] = useState('');
6164
const [opList, setOpList] = useState<SearchResultItemOperationalPoint[]>([]);
@@ -168,6 +171,7 @@ const TypeAndPathV2 = () => {
168171
}));
169172

170173
dispatch(updatePathSteps({ pathSteps }));
174+
setDisplayTypeAndPath(false);
171175
}
172176
};
173177

@@ -233,7 +237,7 @@ const TypeAndPathV2 = () => {
233237
<>
234238
<div
235239
className="type-and-path mb-2"
236-
style={{ minWidth: `${monospaceOneCharREMWidth * inputText.length + 5.5}rem` }} // To grow input field & whole div along text size
240+
style={{ minWidth: `${monospaceOneCharREMWidth * inputText.length + 5.5}rem` }}
237241
data-testid="type-and-path-container"
238242
>
239243
<div className="help">{opList.length === 0 && tManageTrainSchedule('inputOPTrigrams')}</div>
@@ -273,7 +277,7 @@ const TypeAndPathV2 = () => {
273277
<>
274278
<span className="arrow-img"> </span>
275279
<div className="results-container">
276-
<div className="station-results p-2 ">
280+
<div className="station-results p-2">
277281
{sortedSearchResults.map((result) => (
278282
<button
279283
id={`trigram-button-${result.name}`}
@@ -283,7 +287,7 @@ const TypeAndPathV2 = () => {
283287
className="station"
284288
title={`${result.name} ${result.ch}`}
285289
>
286-
<span className="station-text text-secondary ">{result.name}</span>
290+
<span className="station-text text-secondary">{result.name}</span>
287291
</button>
288292
))}
289293
{sortedSearchResults.length > 8 && (

front/tests/010-op-route-tab.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ test.describe('Verifying that all elements in the route tab are loaded correctly
161161
await operationalStudiesPage.verifyNoSelectedRoute(selectedLanguage);
162162

163163
// Search by trigram and verify map markers
164-
await operationalStudiesPage.clickSearchByTrigramSubmitButton();
164+
await operationalStudiesPage.performPathfindingByTrigram('WS', 'SES', 'MWS');
165165
if (browserName === 'chromium') {
166166
await operationalStudiesPage.verifyMapMarkers(...expectedMapMarkersValues);
167167
}

front/tests/pages/operational-studies-page-model.ts

+6-12
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,6 @@ class OperationalStudiesPage {
203203
const noDestinationChosenText = await this.noDestinationChosen.innerText();
204204
expect(noDestinationChosenText).toEqual(translations.noDestinationChosen);
205205
}
206-
const isSearchByTrigramInputVisible = await this.searchByTrigramInput.isVisible();
207-
208-
if (!isSearchByTrigramInputVisible) {
209-
const pathfindingNoStateText = await this.pathfindingNoState.innerText();
210-
expect(pathfindingNoStateText).toEqual(translations.pathfindingNoState);
211-
}
212206
}
213207

214208
// Performs pathfinding by entering origin, destination, and optionally via trigrams.
@@ -230,16 +224,16 @@ class OperationalStudiesPage {
230224
if (viaTrigram) {
231225
await expect(this.getViaLocatorByTrigram(viaTrigram)).toBeVisible();
232226
}
227+
const expectedOriginTrigram = await this.getOriginLocatorByTrigram(originTrigram).innerText();
228+
const expectedDestinationTrigram =
229+
await this.getDestinationLocatorByTrigram(destinationTrigram).innerText();
233230
await this.clickSearchByTrigramSubmitButton();
231+
await expect(this.searchByTrigramContainer).not.toBeVisible();
234232
await this.page.waitForLoadState('load');
235233
await expect(this.resultPathfindingDone).toBeVisible();
236234

237-
expect(await this.originInfo.innerText()).toEqual(
238-
await this.getOriginLocatorByTrigram(originTrigram).innerText()
239-
);
240-
expect(await this.destinationInfo.innerText()).toEqual(
241-
await this.getDestinationLocatorByTrigram(destinationTrigram).innerText()
242-
);
235+
expect(await this.originInfo.innerText()).toEqual(expectedOriginTrigram);
236+
expect(await this.destinationInfo.innerText()).toEqual(expectedDestinationTrigram);
243237
}
244238

245239
// Clicks the button to reverse the itinerary.

0 commit comments

Comments
 (0)