@@ -662,7 +662,7 @@ describe('Stop search', () => {
662662
663663 beforeEach ( ( ) => setupTestsAndNavigateToPage ( { } ) ) ;
664664
665- it . only ( 'should have a working asterisk search and line selector' , ( ) => {
665+ it ( 'should have a working asterisk search and line selector' , ( ) => {
666666 injectKnownMonospaceFont ( ) ;
667667
668668 stopSearchBar . searchCriteriaRadioButtons . getLineRadioButton ( ) . click ( ) ;
@@ -802,7 +802,7 @@ describe('Stop search', () => {
802802 stopSearchBar . searchForDropdown . selectSearchFor ( 'Pysäkkialueet' ) ;
803803
804804 stopSearchBar . getSearchInput ( ) . clearAndType ( `*{enter}` ) ;
805- expectGraphQLCallToSucceed ( '@gqlfindStopAreas ' ) ;
805+ expectGraphQLCallToSucceed ( '@gqlFindStopPlaces ' ) ;
806806
807807 stopGroupSelector . shouldHaveGroups ( [
808808 'X0003' ,
@@ -823,7 +823,7 @@ describe('Stop search', () => {
823823 stopSearchBar . searchForDropdown . selectSearchFor ( 'Pysäkkialueet' ) ;
824824
825825 stopSearchBar . getSearchInput ( ) . clearAndType ( `X0004{enter}` ) ;
826- expectGraphQLCallToSucceed ( '@gqlfindStopAreas ' ) ;
826+ expectGraphQLCallToSucceed ( '@gqlFindStopPlaces ' ) ;
827827
828828 stopGroupSelector . shouldHaveGroups ( [ 'X0004' ] ) ;
829829
@@ -871,7 +871,7 @@ describe('Stop search', () => {
871871 stopSearchBar . searchForDropdown . selectSearchFor ( 'Pysäkkialueet' ) ;
872872
873873 stopSearchBar . getSearchInput ( ) . clearAndType ( `E2ENQ{enter}` ) ;
874- expectGraphQLCallToSucceed ( '@gqlfindStopAreas ' ) ;
874+ expectGraphQLCallToSucceed ( '@gqlFindStopPlaces ' ) ;
875875
876876 stopGroupSelector . shouldHaveGroups ( [ 'E2ENQ' ] ) ;
877877
@@ -1841,6 +1841,20 @@ describe('Stop search', () => {
18411841 ) ;
18421842 }
18431843
1844+ function unselectedSelectedRow ( label : string ) {
1845+ stopSearchResultsPage
1846+ . getRowByLabel ( label )
1847+ . shouldBeVisible ( )
1848+ . within ( ( ) =>
1849+ stopSearchResultsPage
1850+ . getSelectInput ( )
1851+ . shouldBeVisible ( )
1852+ . and ( 'be.checked' )
1853+ . click ( )
1854+ . and ( 'not.be.checked' ) ,
1855+ ) ;
1856+ }
1857+
18441858 function stopShouldBeOnMap ( label : string ) {
18451859 map
18461860 . getStopByStopLabelAndPriority ( label , Priority . Standard )
@@ -1929,6 +1943,66 @@ describe('Stop search', () => {
19291943 . map ( stopSearchResultsPage . getRowByLabel )
19301944 . forEach ( ( row ) => row . within ( stopShouldNotBeSelected ) ) ;
19311945 } ) ;
1946+
1947+ it ( 'Should handle partial selections of Stop Areas' , ( ) => {
1948+ setupTestsAndNavigateToPage ( { } ) ;
1949+
1950+ stopSearchBar . searchForDropdown . openSearchForDropdown ( ) ;
1951+ stopSearchBar . searchForDropdown . selectSearchFor ( 'Pysäkkialueet' ) ;
1952+ stopSearchBar . getSearchInput ( ) . clearAndType ( '*{enter}' ) ;
1953+
1954+ // Select both Stop Areas
1955+ stopGroupSelector . shouldHaveGroups ( [ 'PS002' , 'US001' ] ) ;
1956+ stopGroupSelector . getGroupSelectors ( ) . contains ( 'US001' ) . click ( ) ;
1957+
1958+ // By default, all should be selected
1959+ stopSearchResultsPage
1960+ . getSelectAllButton ( )
1961+ . shouldBeVisible ( )
1962+ . and ( 'be.checked' ) ;
1963+
1964+ // Unselect one
1965+ unselectedSelectedRow ( testStops . tagToPublicCode . urban1 ) ;
1966+
1967+ // And ALL should not be selected anymore
1968+ stopSearchResultsPage
1969+ . getSelectAllButton ( )
1970+ . shouldBeVisible ( )
1971+ . and ( 'not.be.checked' ) ;
1972+
1973+ // Unselect the group that contained the unselected stop
1974+ stopGroupSelector . getGroupSelectors ( ) . contains ( 'US001' ) . click ( ) ;
1975+ // And ALL should be selected again.
1976+ stopSearchResultsPage
1977+ . getSelectAllButton ( )
1978+ . shouldBeVisible ( )
1979+ . and ( 'be.checked' ) ;
1980+
1981+ // Unselect one from the list.
1982+ unselectedSelectedRow ( testStops . tagToPublicCode . postHelsinki ) ;
1983+ // Add in back the unselected Area
1984+ stopGroupSelector . getGroupSelectors ( ) . contains ( 'US001' ) . click ( ) ;
1985+ // And then they should not get auto selected as ALL has not been selected.
1986+ stopSearchResultsPage
1987+ . getRowByLabel ( testStops . tagToPublicCode . urban1 )
1988+ . within ( stopShouldNotBeSelected ) ;
1989+ stopSearchResultsPage
1990+ . getRowByLabel ( testStops . tagToPublicCode . urban2 )
1991+ . within ( stopShouldNotBeSelected ) ;
1992+
1993+ stopSearchResultsPage
1994+ . getShowOnMapButton ( )
1995+ . shouldBeVisible ( )
1996+ . and ( 'be.enabled' )
1997+ . click ( ) ;
1998+ stopSearchResultsPage . getShowOnMapButtonLoading ( ) . should ( 'not.exist' ) ;
1999+
2000+ map . getLoader ( ) . shouldBeVisible ( ) ;
2001+ map . waitForLoadToComplete ( ) ;
2002+
2003+ stopShouldBeOnMap ( testStops . tagToPublicCode . postEspoo ) ;
2004+ stopShouldNotBeOnMap ( testStops . tagToPublicCode . postHelsinki ) ;
2005+ } ) ;
19322006 } ) ;
19332007
19342008 describe ( 'CSV reports' , ( ) => {
0 commit comments