Skip to content

Commit fc99927

Browse files
committed
Add tests to terminal details in stop
1 parent 8d82dab commit fc99927

File tree

2 files changed

+44
-18
lines changed

2 files changed

+44
-18
lines changed

cypress/e2e/stop-registry/stopDetails.cy.ts

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import {
33
Priority,
44
StopAreaInput,
55
StopInsertInput,
6+
StopRegistryGeoJsonType,
67
StopRegistryNameType,
78
StopRegistryTransportModeType,
9+
TerminalInput,
810
buildStop,
911
buildTimingPlace,
1012
extractInfrastructureLinkIdsFromResponse,
@@ -141,6 +143,35 @@ const stopAreaInput: Array<StopAreaInput> = [
141143
},
142144
];
143145

146+
const terminalH2003: TerminalInput = {
147+
terminal: {
148+
privateCode: { type: 'HSL/TEST', value: 'TH2003' },
149+
name: { lang: 'fin', value: 'E2ETH2003' },
150+
description: { lang: 'fin', value: 'E2E testiterminaali H2003' },
151+
geometry: {
152+
coordinates: [24.92596546020357, 60.16993494912799],
153+
type: StopRegistryGeoJsonType.Point,
154+
},
155+
keyValues: [
156+
{ key: 'validityStart', values: ['2020-01-01'] },
157+
{ key: 'validityEnd', values: ['2050-01-01'] },
158+
{ key: 'streetAddress', values: ['Mannerheimintie 22-24'] },
159+
{ key: 'postalCode', values: ['00100'] },
160+
{ key: 'municipality', values: ['Helsinki'] },
161+
{ key: 'fareZone', values: ['A'] },
162+
{ key: 'terminalType', values: ['BusTerminal'] },
163+
{ key: 'departurePlatforms', values: ['7'] },
164+
{ key: 'arrivalPlatforms', values: ['6'] },
165+
{ key: 'loadingPlatforms', values: ['3'] },
166+
{ key: 'electricCharging', values: ['2'] },
167+
],
168+
externalLinks: [
169+
{ name: 'Terminaalin Testilinkki', location: 'https://terminaltest.fi' },
170+
],
171+
},
172+
memberLabels: ['H2003'],
173+
};
174+
144175
const buildScheduledStopPoints = (
145176
infrastructureLinkIds: UUID[],
146177
): StopInsertInput[] => [
@@ -223,9 +254,7 @@ describe('Stop details', () => {
223254
insertToDbHelper(dbResources);
224255
toast = new Toast();
225256
cy.task<InsertedStopRegistryIds>('insertStopRegistryData', {
226-
// Inserting the terminals here causes it's child stop H0003,
227-
// to generate extra versions of it's quay, which breaks info spots.
228-
// terminals: seedTerminals,
257+
terminals: [terminalH2003],
229258
stopPlaces: stopAreaInput,
230259
organisations: seedOrganisations,
231260
infoSpots: seedInfoSpots,
@@ -264,14 +293,15 @@ describe('Stop details', () => {
264293
locationView.getLongitude().shouldHaveText('24.932072417514647');
265294
locationView.getAltitude().shouldHaveText('0');
266295
locationView.getFunctionalArea().shouldHaveText('20 m');
267-
locationView.getStopArea().shouldHaveText('-');
268-
locationView.getStopAreaName().shouldHaveText('-');
269-
locationView.getStopAreaStops().shouldHaveText('-');
270296
locationView.getQuay().shouldHaveText('-');
271297
locationView.getStopAreaQuays().shouldHaveText('-');
272-
locationView.getTerminal().shouldHaveText('-');
273-
locationView.getTerminalName().shouldHaveText('-');
274-
locationView.getTerminalStops().shouldHaveText('-');
298+
locationView.getTerminalPrivateCode().shouldHaveText('TH2003');
299+
locationView
300+
.getTerminalLink()
301+
.shouldBeVisible()
302+
.should('have.attr', 'href', `/stop-registry/terminals/TH2003`);
303+
locationView.getTerminalName().shouldHaveText('E2ETH2003');
304+
locationView.getTerminalStops().shouldHaveText('H2003');
275305
};
276306

277307
const verifyInitialSignageDetails = () => {

cypress/pageObjects/stop-registry/stop-details/LocationDetailsViewCard.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,16 @@ export class LocationDetailsViewCard {
2020
getFunctionalArea = () =>
2121
cy.getByTestId('LocationDetailsViewCard::functionalArea');
2222

23-
getStopArea = () => cy.getByTestId('LocationDetailsViewCard::stopArea');
24-
25-
getStopAreaName = () =>
26-
cy.getByTestId('LocationDetailsViewCard::stopAreaName');
27-
28-
getStopAreaStops = () =>
29-
cy.getByTestId('LocationDetailsViewCard::stopAreaStops');
30-
3123
getQuay = () => cy.getByTestId('LocationDetailsViewCard::quay');
3224

3325
getStopAreaQuays = () =>
3426
cy.getByTestId('LocationDetailsViewCard::stopAreaQuays');
3527

36-
getTerminal = () => cy.getByTestId('LocationDetailsViewCard::terminal');
28+
getTerminalPrivateCode = () =>
29+
cy.getByTestId('LocationDetailsViewCard::terminalPrivateCode');
30+
31+
getTerminalLink = () =>
32+
cy.getByTestId('LocationDetailsViewCard::terminalLink');
3733

3834
getTerminalName = () =>
3935
cy.getByTestId('LocationDetailsViewCard::terminalName');

0 commit comments

Comments
 (0)