Skip to content

Commit

Permalink
BGDIINF_SB-3060 : add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pakb committed Aug 21, 2023
1 parent def3df3 commit 5e0400f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
26 changes: 26 additions & 0 deletions tests/e2e-cypress/integration/infobox.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
})
})
6 changes: 3 additions & 3 deletions tests/e2e-cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = () => {
Expand Down

0 comments on commit 5e0400f

Please sign in to comment.