Skip to content

Commit 0c07e61

Browse files
committed
Remove duplicate names from stop
1 parent 48135a9 commit 0c07e61

File tree

3 files changed

+14
-122
lines changed

3 files changed

+14
-122
lines changed

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

+6-24
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
getClonedBaseStopRegistryData,
1515
} from '../../datasets/stopRegistry';
1616
import {
17-
BasicDetailsForm,
1817
BasicDetailsViewCard,
1918
SelectMemberStopsDropdown,
2019
StopAreaDetailsPage,
@@ -492,40 +491,23 @@ describe('Stop area details', () => {
492491
expectGraphQLCallToReturnError('@gqlUpsertStopArea');
493492
});
494493

495-
it('should change all stop names when editing one stop name', () => {
494+
it('should change name in all stop pages when editing stop area name', () => {
496495
stopAreaDetailsPage.visit(dbIds.stopPlaceIdsByName.X0003);
497496

498-
// When editing Basic details
499497
stopAreaDetailsPage.details.getEditButton().click();
500-
// Can't test properly as we are missing most of the name fields.
501-
/*
502-
stopAreaDetailsPage.nameConsistencyChecker.assertIsConsistent();
503-
stopAreaDetailsPage.details.edit.getName().clearAndType('New name');
504-
*/
505-
stopAreaDetailsPage.nameConsistencyChecker.assertIsInconsistent();
506-
stopAreaDetailsPage.details.edit.getCancelButton().click();
498+
stopAreaDetailsPage.details.edit.getName().clearAndType('uusinimi');
499+
stopAreaDetailsPage.details.edit.getSaveButton().click();
507500

508-
// When editing member stop's names
509501
const stopDetailsPage = new StopDetailsPage();
510502
const bdViewCard = new BasicDetailsViewCard();
511-
const bdForm = new BasicDetailsForm();
503+
512504
stopDetailsPage.visit('E2E001');
513505
stopDetailsPage.page().shouldBeVisible();
514-
stopDetailsPage.basicDetails.getEditButton().click();
515-
516-
bdForm.getNameFinInput().clearAndType('uusinimi');
517-
bdForm.getPrivateCodeInput().clearAndType('label');
518-
bdForm.getStopPlaceStateDropdownButton().click();
519-
bdForm.getStopPlaceStateDropdownOptions().contains('Käytössä').click();
520-
stopDetailsPage.basicDetails.getSaveButton().click();
521-
bdViewCard.getNameFin().shouldBeVisible();
522-
523-
stopAreaDetailsPage.visit(dbIds.stopPlaceIdsByName.X0003);
524-
stopAreaDetailsPage.details.getName().should('contain.text', 'uusinimi');
506+
bdViewCard.getAreaName().shouldHaveText('uusinimi');
525507

526508
stopDetailsPage.visit('E2E009');
527509
stopDetailsPage.page().shouldBeVisible();
528-
bdViewCard.getNameFin().should('contain.text', 'uusinimi');
510+
bdViewCard.getAreaName().should('contain.text', 'uusinimi');
529511
});
530512
});
531513
});

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

-52
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ const stopAreaInput: Array<StopAreaInput> = [
8787
name: { lang: 'swe', value: 'Norraesplanaden' },
8888
nameType: StopRegistryNameType.Translation,
8989
},
90-
{
91-
name: { lang: 'fin', value: 'P.Esp' },
92-
nameType: StopRegistryNameType.Label,
93-
},
94-
{
95-
name: { lang: 'swe', value: 'N.Esp' },
96-
nameType: StopRegistryNameType.Label,
97-
},
9890
{
9991
name: { lang: 'fin', value: 'Pohjoisesplanadi (pitkä)' },
10092
nameType: StopRegistryNameType.Alias,
@@ -232,14 +224,8 @@ describe('Stop details', () => {
232224
bdView.getContent().shouldBeVisible();
233225
bdView.getLabel().shouldHaveText('H2003');
234226
bdView.getPrivateCode().shouldHaveText('10003');
235-
bdView.getNameFin().shouldHaveText('Pohjoisesplanadi');
236-
bdView.getNameSwe().shouldHaveText('Norraesplanaden');
237-
bdView.getNameLongFin().shouldHaveText('Pohjoisesplanadi (pitkä)');
238-
bdView.getNameLongSwe().shouldHaveText('Norraesplanaden (lång)');
239227
bdView.getLocationFin().shouldHaveText('Pohjoisesplanadi (sij.)');
240228
bdView.getLocationSwe().shouldHaveText('Norraesplanaden (plats)');
241-
bdView.getAbbreviationFin().shouldHaveText('Pohj.esplanadi');
242-
bdView.getAbbreviationSwe().shouldHaveText('N.esplanaden');
243229
bdView.getElyNumber().shouldHaveText('1234567');
244230

245231
bdView.getTimingPlaceId().shouldHaveText('1AURLA');
@@ -556,15 +542,8 @@ describe('Stop details', () => {
556542
bdView.getContent().shouldBeVisible();
557543
bdView.getLabel().shouldHaveText('H2003');
558544
bdView.getPrivateCode().shouldHaveText('10003');
559-
bdView.getNameFin().shouldHaveText('Pohjoisesplanadi');
560-
bdView.getNameSwe().shouldHaveText('Norraesplanaden');
561-
562-
bdView.getNameLongFin().shouldHaveText('Pohjoisesplanadi (pitkä)');
563-
bdView.getNameLongSwe().shouldHaveText('Norraesplanaden (lång)');
564545
bdView.getLocationFin().shouldHaveText('Pohjoisesplanadi (sij.)');
565546
bdView.getLocationSwe().shouldHaveText('Norraesplanaden (plats)');
566-
bdView.getAbbreviationFin().shouldHaveText('Pohj.esplanadi');
567-
bdView.getAbbreviationSwe().shouldHaveText('N.esplanaden');
568547
bdView.getElyNumber().shouldHaveText('1234567');
569548

570549
stopDetailsPage.basicDetails.getEditButton().click();
@@ -575,36 +554,17 @@ describe('Stop details', () => {
575554
// Verify correct initial values.
576555
bdForm.getLabelInput().should('have.value', 'H2003');
577556
bdForm.getPrivateCodeInput().should('have.value', '10003');
578-
bdForm.getNameFinInput().should('have.value', 'Pohjoisesplanadi');
579-
bdForm.getNameSweInput().should('have.value', 'Norraesplanaden');
580-
bdForm
581-
.getNameLongFinInput()
582-
.should('have.value', 'Pohjoisesplanadi (pitkä)');
583-
bdForm
584-
.getNameLongSweInput()
585-
.should('have.value', 'Norraesplanaden (lång)');
586557
bdForm
587558
.getLocationFinInput()
588559
.should('have.value', 'Pohjoisesplanadi (sij.)');
589560
bdForm
590561
.getLocationSweInput()
591562
.should('have.value', 'Norraesplanaden (plats)');
592-
bdForm.getAbbreviationFinInput().should('have.value', 'Pohj.esplanadi');
593-
bdForm.getAbbreviationSweInput().should('have.value', 'N.esplanaden');
594563
bdForm.getElyNumberInput().should('have.value', '1234567');
595564

596565
bdForm.getPrivateCodeInput().clearAndType('10004');
597-
bdForm.getNameFinInput().clearAndType('NewPohjoisesplanadi');
598-
bdForm.getNameSweInput().clearAndType('NewNorraesplanaden');
599-
600-
bdForm
601-
.getNameLongFinInput()
602-
.clearAndType('NewPohjoisesplanadi (pitkä)');
603-
bdForm.getNameLongSweInput().clearAndType('NewNorraesplanaden (lång)');
604566
bdForm.getLocationFinInput().clearAndType('NewPohjoisesplanadi (sij.)');
605567
bdForm.getLocationSweInput().clearAndType('NewNorraesplanaden (plats)');
606-
bdForm.getAbbreviationFinInput().clearAndType('NewPohj.esplanadi');
607-
bdForm.getAbbreviationSweInput().clearAndType('NewN.esplanaden');
608568

609569
bdForm.getElyNumberInput().clearAndType('1234568');
610570

@@ -614,14 +574,8 @@ describe('Stop details', () => {
614574

615575
bdView.getLabel().shouldHaveText('H2003');
616576
bdView.getPrivateCode().shouldHaveText('10004');
617-
bdView.getNameFin().shouldHaveText('NewPohjoisesplanadi');
618-
bdView.getNameSwe().shouldHaveText('NewNorraesplanaden');
619-
bdView.getNameLongFin().shouldHaveText('NewPohjoisesplanadi (pitkä)');
620-
bdView.getNameLongSwe().shouldHaveText('NewNorraesplanaden (lång)');
621577
bdView.getLocationFin().shouldHaveText('NewPohjoisesplanadi (sij.)');
622578
bdView.getLocationSwe().shouldHaveText('NewNorraesplanaden (plats)');
623-
bdView.getAbbreviationFin().shouldHaveText('NewPohj.esplanadi');
624-
bdView.getAbbreviationSwe().shouldHaveText('NewN.esplanaden');
625579
bdView.getElyNumber().shouldHaveText('1234568');
626580
},
627581
);
@@ -668,14 +622,8 @@ describe('Stop details', () => {
668622
// the saves do not change other fields.
669623
bdView.getLabel().shouldHaveText('H2003');
670624
bdView.getPrivateCode().shouldHaveText('10003');
671-
bdView.getNameFin().shouldHaveText('Pohjoisesplanadi');
672-
bdView.getNameSwe().shouldHaveText('Norraesplanaden');
673-
bdView.getNameLongFin().shouldHaveText('Pohjoisesplanadi (pitkä)');
674-
bdView.getNameLongSwe().shouldHaveText('Norraesplanaden (lång)');
675625
bdView.getLocationFin().shouldHaveText('Pohjoisesplanadi (sij.)');
676626
bdView.getLocationSwe().shouldHaveText('Norraesplanaden (plats)');
677-
bdView.getAbbreviationFin().shouldHaveText('Pohj.esplanadi');
678-
bdView.getAbbreviationSwe().shouldHaveText('N.esplanaden');
679627
bdView.getTransportMode().shouldHaveText('Bussi');
680628
bdView.getTimingPlaceId().shouldHaveText('1AURLA');
681629
bdView

ui/src/components/stop-registry/stops/stop-details/basic-details/BasicDetailsStopFields.tsx

+8-46
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
mapStopPlaceStateToUiName,
44
mapStopRegistryTransportModeTypeToUiName,
55
} from '../../../../../i18n/uiNameMappings';
6-
import { HorizontalSeparator } from '../../../../../layoutComponents';
76
import { StopWithDetails } from '../../../../../types';
87
import { DetailRow, LabeledDetail } from '../layout';
98
import { MainLineWarning } from '../MainLineWarning';
@@ -54,30 +53,6 @@ export const StopDetailsSection = ({ stop }: Props) => {
5453
detail={stop.quay?.privateCode}
5554
testId={testIds.privateCode}
5655
/>
57-
<LabeledDetail
58-
title={t('stopDetails.basicDetails.nameFin')}
59-
detail={stop.stop_place?.name}
60-
testId={testIds.nameFin}
61-
/>
62-
<LabeledDetail
63-
title={t('stopDetails.basicDetails.nameSwe')}
64-
detail={stop.stop_place?.nameSwe}
65-
testId={testIds.nameSwe}
66-
/>
67-
</DetailRow>
68-
<HorizontalSeparator />
69-
<DetailRow>
70-
<LabeledDetail
71-
title={t('stopDetails.basicDetails.nameLongFin')}
72-
detail={stop.stop_place?.nameLongFin}
73-
testId={testIds.nameLongFin}
74-
/>
75-
<LabeledDetail
76-
title={t('stopDetails.basicDetails.nameLongSwe')}
77-
detail={stop.stop_place?.nameLongSwe}
78-
testId={testIds.nameLongSwe}
79-
/>
80-
<div className="h-9 w-[0px] border-r border-black" />
8156
<LabeledDetail
8257
title={t('stopDetails.basicDetails.locationFin')}
8358
detail={stop.quay?.locationFin}
@@ -88,26 +63,23 @@ export const StopDetailsSection = ({ stop }: Props) => {
8863
detail={stop.quay?.locationSwe}
8964
testId={testIds.locationSwe}
9065
/>
91-
</DetailRow>
92-
<DetailRow>
93-
<LabeledDetail
94-
title={t('stopDetails.basicDetails.abbreviationFin')}
95-
detail={stop.stop_place?.abbreviationFin}
96-
testId={testIds.abbreviationFin}
97-
/>
9866
<LabeledDetail
99-
title={t('stopDetails.basicDetails.abbreviationSwe')}
100-
detail={stop.stop_place?.abbreviationSwe}
101-
testId={testIds.abbreviationSwe}
67+
title={t('stopDetails.basicDetails.stopState')}
68+
detail={stopState}
69+
testId={testIds.stopState}
10270
/>
10371
</DetailRow>
104-
<HorizontalSeparator />
10572
<DetailRow>
10673
<LabeledDetail
10774
title={t('stopDetails.basicDetails.transportMode')}
10875
detail={transportMode}
10976
testId={testIds.transportMode}
11077
/>
78+
<LabeledDetail
79+
title={t('stopDetails.basicDetails.elyNumber')}
80+
detail={stop.quay?.elyNumber}
81+
testId={testIds.elyNumber}
82+
/>
11183
<LabeledDetail
11284
title={t('stops.timingPlaceId')}
11385
detail={stop.timing_place?.label}
@@ -126,16 +98,6 @@ export const StopDetailsSection = ({ stop }: Props) => {
12698
}
12799
/>
128100
</div>
129-
<LabeledDetail
130-
title={t('stopDetails.basicDetails.stopState')}
131-
detail={stopState}
132-
testId={testIds.stopState}
133-
/>
134-
<LabeledDetail
135-
title={t('stopDetails.basicDetails.elyNumber')}
136-
detail={stop.quay?.elyNumber}
137-
testId={testIds.elyNumber}
138-
/>
139101
</DetailRow>
140102
</>
141103
);

0 commit comments

Comments
 (0)