@@ -13,7 +13,7 @@ import { FeatureInfoPositions } from '@/store/modules/ui/types/featureInfoPositi
1313
1414registerProj4 ( proj4 )
1515type FeatureInfoPosition = ( typeof FeatureInfoPositions ) [ keyof typeof FeatureInfoPositions ]
16-
16+ const SELECTED_FEATURE_COUNT = 10
1717describe ( 'Testing the feature selection' , ( ) => {
1818 context ( 'Feature pre-selection in the URL' , ( ) => {
1919 const timeLayer = 'test.timeenabled.wmts.layer'
@@ -48,12 +48,12 @@ describe('Testing the feature selection', () => {
4848 }
4949
5050 function checkFeatures ( ) : void {
51- cy . log ( `Ensuring there are 10 selected features, and they're all different` )
51+ cy . log ( `Ensuring there are ${ SELECTED_FEATURE_COUNT } selected features, and they're all different` )
5252
5353 cy . getPinia ( ) . then ( ( pinia ) => {
5454 const featuresStore = useFeaturesStore ( pinia )
5555 const features = featuresStore . selectedFeatures
56- expect ( features . length ) . to . eq ( 10 )
56+ expect ( features . length ) . to . eq ( SELECTED_FEATURE_COUNT )
5757
5858 features . forEach ( ( feature ) => {
5959 expect ( [ '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '10' ] ) . to . include (
@@ -95,6 +95,10 @@ describe('Testing the feature selection', () => {
9595 it ( 'Adds pre-selected features and place the tooltip according to URL param on a narrow width screen' , ( ) => {
9696 cy . log ( 'When featureInfo is not specified, we should have no tooltip visible' )
9797 goToMapViewWithFeatureSelection ( )
98+ for ( let i = 0 ; i < SELECTED_FEATURE_COUNT ; i ++ ) {
99+ cy . wait ( '@featureDetail' )
100+ cy . wait ( '@htmlPopup' )
101+ }
98102 checkFeatures ( )
99103 checkFeatureInfoPosition ( FeatureInfoPositions . None )
100104 cy . log (
@@ -119,6 +123,10 @@ describe('Testing the feature selection', () => {
119123 'When featureInfo is specified, as the viewport is mobile-sized, we should see the infobox'
120124 )
121125 goToMapViewWithFeatureSelection ( FeatureInfoPositions . Default )
126+ for ( let i = 0 ; i < SELECTED_FEATURE_COUNT ; i ++ ) {
127+ cy . wait ( '@featureDetail' )
128+ cy . wait ( '@htmlPopup' )
129+ }
122130 checkFeatures ( )
123131 checkFeatureInfoPosition ( FeatureInfoPositions . Default )
124132 cy . log ( 'parameter is case insensitive, and we should see a popover here' )
@@ -269,11 +277,14 @@ describe('Testing the feature selection', () => {
269277 it ( 'Adds pre-selected features and verifys the translation of the feature text after changing the language' , ( ) => {
270278 cy . log ( 'Open the map with a feature preselected in english' )
271279 goToMapViewWithFeatureSelection ( FeatureInfoPositions . Default )
280+
281+ for ( let i = 0 ; i < SELECTED_FEATURE_COUNT ; i ++ ) {
282+ cy . wait ( '@featureDetail' )
283+ cy . wait ( '@htmlPopup' )
284+ }
272285 checkFeatures ( )
273286 checkFeatureInfoPosition ( FeatureInfoPositions . BottomPanel )
274287
275- cy . wait ( `@htmlPopup` )
276-
277288 cy . get ( '[data-cy="feature-list-category-title"]' ) . contains ( 'Kultur Gueter' )
278289 cy . get ( '[data-cy="feature-detail-htmlpopup-container"]' )
279290 . should ( 'have.length' , 1 )
@@ -583,13 +594,13 @@ describe('Testing the feature selection', () => {
583594 clickOnMap ( pixel3 , false )
584595 cy . wait ( '@routeChange' )
585596 cy . wait ( '@routeChange' )
597+ cy . wait ( '@routeChange' )
586598 cy . getPinia ( ) . then ( ( pinia ) => {
587599 const featuresStore3 = useFeaturesStore ( pinia )
588600 expect ( featuresStore3 . selectedFeatures . length ) . to . eq ( 1 )
589601 } )
590602 clickOnMap ( pixel1 , true )
591603 cy . wait ( '@routeChange' )
592- cy . wait ( '@routeChange' )
593604 cy . getPinia ( ) . then ( ( pinia ) => {
594605 const featuresStore4 = useFeaturesStore ( pinia )
595606 expect ( featuresStore4 . selectedFeatures . length ) . to . eq ( 2 )
0 commit comments