Skip to content

Commit 7d1f32f

Browse files
committed
BGDIINF_SB-3170: Added E2E tests for external layers attributions
1 parent 0d742a7 commit 7d1f32f

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

src/utils/ModalWithBackdrop.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
<FontAwesomeIcon icon="times" />
4242
</button>
4343
</div>
44-
<div ref="modalContent" class="card-body pt-3 ps-4 pe-4">
44+
<div
45+
ref="modalContent"
46+
class="card-body pt-3 ps-4 pe-4"
47+
data-cy="modal-content"
48+
>
4549
<slot />
4650
<div v-if="showConfirmationButtons" class="mt-1 d-flex justify-content-end">
4751
<button

tests/e2e-cypress/integration/importTool.cy.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/// <reference types="cypress" />
22

3+
import { isMobile } from '../support/utils'
4+
35
describe('The Import Tool', () => {
46
beforeEach(() => {
57
cy.goToMapView({}, true)
6-
cy.get('[data-cy="menu-button"]').click()
8+
cy.clickOnMenuButtonIfMobile()
79
})
810
it('Open and close the infobox import tool', () => {
911
cy.get('[data-cy="menu-tray-tool-section"]').click()
@@ -54,5 +56,19 @@ describe('The Import Tool', () => {
5456
expect(externalLayer.externalLayerId).to.eq('ch.vbs.armeelogistikcenter')
5557
expect(externalLayer.name).to.eq('Centres logistiques de l`armée CLA')
5658
})
59+
60+
// Check the map attribution
61+
cy.get('[data-cy="layer-copyright-Das Geoportal des Bundes"]')
62+
.should('be.visible')
63+
.contains('Da s Geoportal des Bundes')
64+
// Check the layer attribution
65+
if (isMobile()) {
66+
cy.get('[data-cy="menu-button"]').click()
67+
cy.get('[data-cy="menu-active-layers"]').should('be.visible').click()
68+
}
69+
cy.get('[data-cy="menu-external-disclaimer-icon"]').should('be.visible').click()
70+
cy.get('[data-cy="modal-content"]').contains(
71+
'Warning: Third party data and/or style shown (Das Geoportal des Bundes)'
72+
)
5773
})
5874
})

tests/e2e-cypress/support/commands.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { BREAKPOINT_TABLET } from '@/config'
21
import { FAKE_URL_CALLED_AFTER_ROUTE_CHANGE } from '@/router/storeSync/storeSync.routerPlugin'
32
import { randomIntBetween } from '@/utils/numberUtils'
43
import 'cypress-real-events'
54
import 'cypress-wait-until'
65
import { MapBrowserEvent } from 'ol'
6+
import { isMobile } from './utils'
77

88
// ***********************************************
99
// For more comprehensive examples of custom
@@ -267,8 +267,7 @@ Cypress.Commands.add(
267267
*/
268268
Cypress.Commands.add('clickOnLanguage', (lang) => {
269269
let menuSection = null
270-
const width = Cypress.config('viewportWidth')
271-
if (width < BREAKPOINT_TABLET) {
270+
if (isMobile()) {
272271
// mobile/tablet : clicking on the menu button first
273272
menuSection = cy.get('[data-cy="menu-settings-section"]')
274273
menuSection.click()
@@ -450,12 +449,13 @@ Cypress.Commands.add('waitUntilCesiumTilesLoaded', () => {
450449
})
451450

452451
Cypress.Commands.add('clickOnMenuButtonIfMobile', () => {
453-
if (Cypress.config('viewportWidth') < BREAKPOINT_TABLET) {
452+
if (isMobile()) {
454453
// mobile/tablet : clicking on the menu button
455454
cy.get('[data-cy="menu-button"]').click()
456455
}
457456
})
458457

458+
459459
/**
460460
* Returns a timestamp from the layer's config that is different from the default behaviour
461461
*

tests/e2e-cypress/support/utils.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { BREAKPOINT_TABLET } from '@/config'
2+
3+
export function isMobile() {
4+
if (Cypress.config('viewportWidth') < BREAKPOINT_TABLET) {
5+
return true
6+
}
7+
return false
8+
}

0 commit comments

Comments
 (0)