diff --git a/tests/e2e-cypress/integration/infobox.cy.js b/tests/e2e-cypress/integration/infobox.cy.js index 09a764fbe8..83f6b74aab 100644 --- a/tests/e2e-cypress/integration/infobox.cy.js +++ b/tests/e2e-cypress/integration/infobox.cy.js @@ -112,4 +112,30 @@ describe('The infobox', () => { }) generateInfoboxTestsForMapSelector('[data-cy="cesium-map"]', true) }) + context('transition from 2D to 3D (and back to 2D)', () => { + beforeEach(() => { + cy.goToMapView({ layers: layer }) + + cy.get('[data-cy="ol-map"]').click() + cy.waitUntilState((state) => { + return state.features.selectedFeatures.length > 0 + }) + cy.get('[data-cy="highlighted-features"]').should('be.visible') + }) + it('keeps the selected features when going 3D', () => { + cy.get('[data-cy="3d-button"]').click() + // waiting for 3D to be loaded + cy.readWindowValue('cesiumViewer').then(() => { + cy.get('[data-cy="highlighted-features"]').should('be.visible') + }) + }) + it('keeps the selected features when going back to 2D', () => { + cy.get('[data-cy="3d-button"]').click() + cy.readWindowValue('cesiumViewer').then(() => { + cy.get('[data-cy="3d-button"]').click() + cy.wait('@jpeg-tiles') + cy.get('[data-cy="highlighted-features"]').should('be.visible') + }) + }) + }) }) diff --git a/tests/e2e-cypress/support/commands.js b/tests/e2e-cypress/support/commands.js index 079ef7d22b..39d9f55969 100644 --- a/tests/e2e-cypress/support/commands.js +++ b/tests/e2e-cypress/support/commands.js @@ -1,8 +1,8 @@ import { BREAKPOINT_TABLET } from '@/config' +import { randomIntBetween } from '@/utils/numberUtils' import 'cypress-real-events' import 'cypress-wait-until' import { MapBrowserEvent } from 'ol' -import { randomIntBetween } from '@/utils/numberUtils' // *********************************************** // For more comprehensive examples of custom @@ -14,10 +14,10 @@ const addLayerTileFixture = () => { // catching WMTS type URLs cy.intercept(`**/3857/**/**/**/**.jpeg`, { fixture: '256.jpeg', - }) + }).as('jpeg-tiles') cy.intercept(`**/3857/**/**/**/**.png`, { fixture: '256.png', - }) + }).as('png-tiles') } const addLayerFixtureAndIntercept = () => {