Skip to content

Commit

Permalink
Merge pull request #1192 from geoadmin/bug-PB-995-add-kml-test-for-3d
Browse files Browse the repository at this point in the history
PB-995 : add KML test in 3D
  • Loading branch information
pakb authored Jan 10, 2025
2 parents 074f592 + 60b239c commit 74f0174
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions tests/cypress/tests-e2e/3d/layers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,39 +241,24 @@ describe('Test of layer handling in 3D', () => {
expect(provider?.url).to.contain('test.background.layer_3d')
})
})

// TODO: PB-284 This test is flaky and not always pass on the CI (but is working locally).
// re-enable the test and modify it to test the feature selection instead of cesium internal
it.skip('add KML layer from drawing', () => {
it('add KML layer from drawing', () => {
cy.goToDrawing()
cy.clickDrawingTool(EditableFeatureTypes.LINEPOLYGON)
const olSelector = '.ol-viewport'
// Create a line
cy.get(olSelector).click(100, 200)
cy.get(olSelector).click(150, 200)
cy.get(olSelector).should('be.visible').dblclick(120, 240, { force: true })
cy.get('[data-cy="ol-map"]').click(100, 250)
cy.get('[data-cy="ol-map"]').click(150, 250)
cy.get('[data-cy="ol-map"]').dblclick(150, 280)

cy.clickDrawingTool(EditableFeatureTypes.MARKER)
cy.readWindowValue('map').then((map) => {
// Create a point
cy.simulateEvent(map, 'pointermove', 0, 0)
cy.simulateEvent(map, 'pointerdown', 0, 0)
cy.simulateEvent(map, 'pointerup', 0, 0)
})
cy.get('[data-cy="ol-map"]').click()

cy.get('[data-cy="drawing-style-feature-title"]').type('This is a title')
cy.wait('@post-kml')
cy.closeDrawingMode()
cy.closeMenuIfMobile()
cy.get('[data-cy="3d-button"]').click()
cy.waitUntilCesiumTilesLoaded()
cy.readWindowValue('cesiumViewer').then((viewer) => {
// main collection
cy.wrap(viewer.scene.primitives.get(0)).should('have.length', 1)
// layer collection
// should be 3 (line, icon, text) but ol-cesium creates additional empty collection
cy.wrap(viewer.scene.primitives.get(0).get(0), { timeout: 10000 }).should(
'have.length',
4
)
cy.readWindowValue('cesiumViewer').should((viewer) => {
expect(viewer.dataSources.length).to.eq(1)
})
})
})

0 comments on commit 74f0174

Please # to comment.