Skip to content

Commit 2787bc3

Browse files
committed
PB-2064: fix featureSelection cypress test
1 parent df3a66e commit 2787bc3

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

packages/viewer/src/store/plugins/storeSync/params/featureInfo.param.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function parseFeatureInfoPosition(urlParamValue?: string): FeatureInfoPositions
2929

3030
const featureInfoParamConfig = new UrlParamConfig<string>({
3131
urlParamName: 'featureInfo',
32-
actionsToWatch: ['setFeatureInfoPosition'],
32+
actionsToWatch: ['setFeatureInfoPosition', 'clearAllSelectedFeatures'],
3333
extractValueFromStore: () => useUIStore().featureInfoPosition,
3434
setValuesInStore: (_: RouteLocationNormalizedGeneric, urlParamValue?: string) => {
3535
const position = parseFeatureInfoPosition(urlParamValue)

packages/viewer/src/store/plugins/storeSync/params/layers.param.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function createLayerObject(parsedLayer: Partial<Layer>, currentLayer?: La
125125
layer.opacity = parsedLayer.opacity ?? DEFAULT_OPACITY
126126

127127
if (adminId && layer.type === LayerType.KML) {
128-
;(layer as KMLLayer).adminId = adminId
128+
; (layer as KMLLayer).adminId = adminId
129129
}
130130
} else if (parsedLayer.type === LayerType.KML) {
131131
// format is KML|FILE_URL
@@ -184,7 +184,7 @@ export function createLayerObject(parsedLayer: Partial<Layer>, currentLayer?: La
184184
const internalLayer = layer as GeoAdminLayer
185185

186186
if (internalLayer.type === LayerType.GEOJSON && updateDelay !== undefined) {
187-
;(internalLayer as GeoAdminGeoJSONLayer).updateDelay = updateDelay
187+
; (internalLayer as GeoAdminGeoJSONLayer).updateDelay = updateDelay
188188
}
189189

190190
// only highlightable feature will output something, for the others a click coordinate is required
@@ -427,6 +427,7 @@ const layersParam = new UrlParamConfig<string>({
427427
'updateLayer',
428428
'updateLayers',
429429
'setSelectedFeatures',
430+
'clearAllSelectedFeatures'
430431
],
431432
setValuesInStore: dispatchLayersFromUrlIntoStore,
432433
extractValueFromStore: generateLayerUrlParamFromStoreValues,

packages/viewer/tests/cypress/tests-e2e/featureSelection.cy.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ describe('Testing the feature selection', () => {
127127
checkFeatures()
128128
checkFeatureInfoPosition(FeatureInfoPositions.ToolTip)
129129
})
130-
131130
it('Synchronise URL and feature selection', () => {
132131
const expectedFeatureIds = [1234, 5678]
133132
const mapSelector = '[data-cy="ol-map"]'
@@ -137,7 +136,7 @@ describe('Testing the feature selection', () => {
137136
},
138137
})
139138
cy.url().should((url) => {
140-
expect(new URLSearchParams(url.split('map')[1]).get('featureInfo')).to.eq(undefined)
139+
expect(new URLSearchParams(url.split('map')[1]).get('featureInfo')).to.eq(null)
141140
})
142141

143142
cy.log('Check that the features appear in the URL')
@@ -192,7 +191,8 @@ describe('Testing the feature selection', () => {
192191

193192
cy.log('Check that after a reload, features remain selected')
194193
cy.reload()
195-
cy.wait(`@featureDetail_${expectedFeatureIds[1]}`)
194+
cy.wait(['@layerConfig', '@topics'])
195+
cy.wait(`@featureDetail_${expectedFeatureIds[1]}`, { timeout: 10000 })
196196
cy.url().should((url) => {
197197
new URLSearchParams(url.split('map')[1])
198198
.get('layers')!
@@ -219,10 +219,12 @@ describe('Testing the feature selection', () => {
219219
.should('be.visible')
220220
.click()
221221
cy.closeMenuIfMobile()
222+
cy.wait(`@htmlPopup`)
222223

223224
cy.get(mapSelector).click()
224225
cy.wait(`@${timeLayer}_identify`)
225226
cy.wait(`@htmlPopup`)
227+
cy.wait('@htmlPopup')
226228

227229
cy.url().should((url) => {
228230
new URLSearchParams(url.split('map')[1])
@@ -241,7 +243,6 @@ describe('Testing the feature selection', () => {
241243
}
242244
})
243245
})
244-
245246
cy.log('Check that upon closing, the features are no longer in the URL')
246247
cy.get('[data-cy="infobox-close"]').click()
247248
cy.get('[data-cy="highlighted-features"]').should('not.exist')
@@ -369,7 +370,6 @@ describe('Testing the feature selection', () => {
369370
assertDefined(location[1])
370371
cy.get('@olMap').click(location[0], location[1], { ctrlKey })
371372
}
372-
373373
it('can select an area to identify features inside it', () => {
374374
const fileName = 'external-kml-file.kml'
375375
const localKmlFile = `import-tool/${fileName}`
@@ -526,7 +526,6 @@ describe('Testing the feature selection', () => {
526526
cy.get('@identifySingleFeature.all').should('have.length', 1)
527527
cy.get('@emptyIdentify.all').should('have.length', 1)
528528
})
529-
530529
it('can select feature by click, add more feature, and deselect feature', () => {
531530
const fileName = '4-points.kml'
532531
const localKmlFile = `import-tool/${fileName}`
@@ -598,7 +597,6 @@ describe('Testing the feature selection', () => {
598597
})
599598
})
600599
})
601-
602600
it('can print feature information', () => {
603601
const fileName = 'external-kml-file.kml'
604602
const localKmlFile = `import-tool/${fileName}`

0 commit comments

Comments
 (0)