Skip to content

Commit f8dad09

Browse files
committed
PB-1895: bug corrections and test fixing
PB-1895: resolve issue with tests failing - Issue: The updateLayers mutation was not present in the watched mutations. for some reason, it worked fine outside of the test environments, but the test environment was not pleased at all - Fix : We added the mutation watcher where it belongs :)
1 parent d3517c8 commit f8dad09

File tree

10 files changed

+26
-27
lines changed

10 files changed

+26
-27
lines changed

packages/mapviewer/src/modules/infobox/components/styling/FeatureStyleEdit.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ function mediaTypes() {
258258
{{ t('modify_description') }}
259259
</label>
260260
<GeoadminTooltip
261-
:tooltip-content="t('display_on_map')"
262261
v-if="isFeatureMarker || isFeatureText"
262+
:tooltip-content="t('display_on_map')"
263263
>
264264
<button
265265
class="btn btn-sm btn-light d-flex align-items-center mb-2"

packages/mapviewer/src/router/storeSync/LayerParamConfig.class.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ export default class LayerParamConfig extends AbstractParamConfig {
320320
'setSelectedFeatures',
321321
'addSelectedFeatures',
322322
'updateLayer',
323+
'updateLayers',
323324
],
324325
setValuesInStore: dispatchLayersFromUrlIntoStore,
325326
extractValueFromStore: generateLayerUrlParamFromStoreValues,

packages/mapviewer/src/store/modules/ui.store.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,13 @@ export default {
322322
getFirstWarning(state) {
323323
return Array.from(state.warnings).find((warning) => !warning.isAcknowledged)
324324
},
325+
getNumberOfNonAcknowledgedErrors(state) {
326+
return Array.from(state.errors).filter((error) => !error.isAcknowledged).length
327+
},
328+
329+
getNumberOfNonAcknowledgedWarnings(state) {
330+
return Array.from(state.warnings).filter((warning) => !warning.isAcknowledged).length
331+
},
325332
},
326333
actions: {
327334
setSize({ commit, state }, { width, height, dispatcher }) {

packages/mapviewer/src/store/plugins/load-kml-kmz-data.plugin.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,7 @@ async function loadMetadata(store, kmlLayer) {
4040
...dispatcher,
4141
})
4242
}
43-
// if admin id dispatch open drawing
4443
} catch (error) {
45-
// ajouter error message here
46-
if (kmlLayer?.adminId) {
47-
//kmlLayer.adminId = null
48-
kmlLayer.addErrorMessage(
49-
new ErrorMessage({
50-
msg: 'BONJOUR EDITEUR',
51-
params: { layerName: kmlLayer.name ?? kmlLayer.id },
52-
sourceId: kmlLayer.id,
53-
})
54-
)
55-
}
56-
// TODO set admin Id to null
5744
log.error(`Error while fetching KML metadata for layer ${kmlLayer?.id}`, error)
5845
}
5946
}
@@ -174,7 +161,7 @@ async function loadData(store, kmlLayer) {
174161
error: errorMessage,
175162
...dispatcher,
176163
})
177-
store.dispatch('addErrors', [errorMessage], dispatcher)
164+
store.dispatch('addErrors', { errors: [errorMessage], dispatcher })
178165
}
179166
}
180167

packages/mapviewer/src/utils/components/ErrorWindow.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const store = useStore()
2323
const showBody = ref(true)
2424
const hasDevSiteWarning = computed(() => store.getters.hasDevSiteWarning)
2525
26-
const errorCount = computed(() => store.state.ui.errors.size)
26+
const errorCount = computed(() => store.getters.getNumberOfNonAcknowledgedErrors)
2727
2828
const { t } = useI18n()
2929
@@ -33,7 +33,7 @@ const emit = defineEmits(['close'])
3333
<template>
3434
<div
3535
v-show="!hide"
36-
class="simple-window card bg-danger text-white fw-bold"
36+
class="simple-window card bg-danger fw-bold text-white"
3737
:class="{ 'dev-disclaimer-present': hasDevSiteWarning }"
3838
data-cy="error-window"
3939
>
@@ -43,7 +43,7 @@ const emit = defineEmits(['close'])
4343
>
4444
<span
4545
v-if="title"
46-
class="me-auto text-truncate"
46+
class="text-truncate me-auto"
4747
>
4848
{{ t(title) }}
4949
<span v-if="errorCount > 1">({{ errorCount }})</span>

packages/mapviewer/src/utils/components/FeedbackPopup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const warning = computed(() => store.getters.getFirstWarning)
2525
<WarningWindow
2626
v-if="warning"
2727
title="warning"
28-
@close="store.dispatch('acknowledgedWarning', { warning, ...dispatcher })"
28+
@close="store.dispatch('acknowledgeWarning', { warning, ...dispatcher })"
2929
>
3030
<div>{{ t(warning.msg, warning.params) }}</div>
3131
</WarningWindow>

packages/mapviewer/src/utils/components/WarningWindow.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const store = useStore()
2323
const showBody = ref(true)
2424
const hasDevSiteWarning = computed(() => store.getters.hasDevSiteWarning)
2525
26-
const warningCount = computed(() => store.state.ui.warnings.size)
26+
const warningCount = computed(() => store.getters.getNumberOfNonAcknowledgedWarnings)
2727
2828
const { t } = useI18n()
2929
@@ -43,7 +43,7 @@ const emit = defineEmits(['close'])
4343
>
4444
<span
4545
v-if="title"
46-
class="me-auto text-truncate"
46+
class="text-truncate me-auto"
4747
>
4848
{{ t(title) }}
4949
<span v-if="warningCount > 1">({{ warningCount }})</span>

packages/mapviewer/tests/cypress/tests-e2e/geolocation.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ describe('Geolocation cypress', () => {
140140
// null island
141141
cy.goToMapView({}, true, { latitude: 0, longitude: 0 })
142142
getGeolocationButtonAndClickIt()
143-
testErrorMessage('geoloc_out_of_bounds')
143+
testErrorMessage('geoloc_out_of_bounds', true)
144144

145145
// Java island
146146
cy.goToMapView({}, true, { latitude: -7.71, longitude: 110.37 })
147147
getGeolocationButtonAndClickIt()
148-
testErrorMessage('geoloc_out_of_bounds')
148+
testErrorMessage('geoloc_out_of_bounds', false)
149149
})
150150
}
151151
)

packages/mapviewer/tests/cypress/tests-e2e/legacyParamImport.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('Test on legacy param import', () => {
122122
const kmlServiceFilePath = `${kmlServiceBasePath}/files/${kmlId}`
123123
beforeEach(() => {
124124
// serving a dummy KML so that we don't get a 404
125-
cy.intercept(`**${kmlServiceFilePath}`, '<kml />').as('get-kml')
125+
cy.intercept(`**${kmlServiceFilePath}`, '<kml></kml>').as('get-kml')
126126
cy.intercept(`**${kmlServiceAdminPath}?admin_id=${adminId}`, (request) => {
127127
request.reply({
128128
id: kmlId,

packages/mapviewer/tests/cypress/tests-e2e/utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function getGeolocationButtonAndClickIt() {
1414
cy.get(geolocationButtonSelector).should('be.visible').click()
1515
}
1616

17-
export function testErrorMessage(message) {
17+
export function testErrorMessage(message, shouldErrorMessageBeShown = true) {
1818
const geolocationButtonSelector = '[data-cy="geolocation-button"]'
1919
// move the mouse away from the button because the tooltip covers the
2020
// error message
@@ -28,10 +28,14 @@ export function testErrorMessage(message) {
2828

2929
const error = errors.values().next().value
3030
expect(error.msg).to.eq(message)
31+
// When we are checking an acknowledged error, it should not appear in the UI (and won't be added to the set)
32+
expect(error.isAcknowledged).to.eq(!shouldErrorMessageBeShown)
3133
})
3234
// Check error in UI
33-
cy.get('[data-cy="error-window"]').should('be.visible')
34-
cy.get('[data-cy="error-window-close"]').should('be.visible').click() // close the error window
35+
if (shouldErrorMessageBeShown) {
36+
cy.get('[data-cy="error-window"]').should('be.visible')
37+
cy.get('[data-cy="error-window-close"]').should('be.visible').click() // close the error window
38+
}
3539
}
3640

3741
export function checkStorePosition(storeString, x, y) {

0 commit comments

Comments
 (0)