diff --git a/tests/e2e-cypress/integration/3d/layers.cy.js b/tests/e2e-cypress/integration/3d/layers.cy.js index 50c09904af..394583c2a7 100644 --- a/tests/e2e-cypress/integration/3d/layers.cy.js +++ b/tests/e2e-cypress/integration/3d/layers.cy.js @@ -61,7 +61,8 @@ describe('Test of layer handling in 3D', () => { '3d': true, layers: `${visibleLayerIds[0]},,0.5`, }) - cy.waitUntilCesiumTilesLoaded().then((viewer) => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then((viewer) => { const layers = viewer.scene.imageryLayers expect(layers.get(1).alpha).to.eq(0.5) }) @@ -78,7 +79,8 @@ describe('Test of layer handling in 3D', () => { 4 )}`, }) - cy.waitUntilCesiumTilesLoaded().then((viewer) => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then((viewer) => { expect(viewer.scene.imageryLayers.get(1).imageryProvider.url).to.have.string( `1.0.0/${timeEnabledLayerId}/default/${randomTimestampFromLayer}/3857/{z}/{x}/{y}.png` ) @@ -123,7 +125,8 @@ describe('Test of layer handling in 3D', () => { '3d': true, layers: `${visibleLayerIds[3]},,0.5`, }) - cy.waitUntilCesiumTilesLoaded().then((viewer) => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then((viewer) => { expect(viewer.scene.primitives.length).to.eq( 3, 'should have 1 primitive (GeoJSON) on top of labels and buildings primitives' diff --git a/tests/e2e-cypress/integration/3d/navigation.cy.js b/tests/e2e-cypress/integration/3d/navigation.cy.js index 0a526f2a63..5a43fd717c 100644 --- a/tests/e2e-cypress/integration/3d/navigation.cy.js +++ b/tests/e2e-cypress/integration/3d/navigation.cy.js @@ -16,7 +16,8 @@ describe('Testing 3D navigation', () => { }) }) it('minimum distance from the terrain', () => { - cy.waitUntilCesiumTilesLoaded().then((viewer) => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then((viewer) => { // Move close to the ground and try to zoom closer with the mouse wheel viewer.camera.flyTo({ destination: Cartesian3.fromDegrees( @@ -27,7 +28,8 @@ describe('Testing 3D navigation', () => { duration: 0.0, }) cy.get('[data-cy="cesium-map"] .cesium-viewer').trigger('wheel', { deltaY: -5000 }) - cy.waitUntilCesiumTilesLoaded().then(() => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then(() => { expect(viewer.scene.camera.positionCartographic.height).gt( CAMERA_MIN_ZOOM_DISTANCE ) @@ -35,7 +37,8 @@ describe('Testing 3D navigation', () => { }) }) it('maximum distance from the terrain', () => { - cy.waitUntilCesiumTilesLoaded().then((viewer) => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then((viewer) => { // Move far from the ground and try to zoom higher with the mouse wheel viewer.camera.flyTo({ destination: Cartesian3.fromDegrees( @@ -46,7 +49,8 @@ describe('Testing 3D navigation', () => { duration: 0.0, }) cy.get('[data-cy="cesium-map"] .cesium-viewer').trigger('wheel', { deltaY: 5000 }) - cy.waitUntilCesiumTilesLoaded().then(() => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then(() => { expect(viewer.scene.camera.positionCartographic.height).lt( CAMERA_MAX_ZOOM_DISTANCE ) @@ -54,7 +58,8 @@ describe('Testing 3D navigation', () => { }) }) it('updates the position in store', () => { - cy.waitUntilCesiumTilesLoaded().then((viewer) => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then((viewer) => { const lon = 7.451498 const lat = 46.92805 viewer.camera.flyTo({ @@ -64,7 +69,8 @@ describe('Testing 3D navigation', () => { }, duration: 0.0, }) - cy.waitUntilCesiumTilesLoaded().then(() => { + cy.waitUntilCesiumTilesLoaded() + cy.readWindowValue('cesiumViewer').then(() => { cy.readStoreValue('getters.centerEpsg4326').should((center) => { expect(center[0]).to.eq(lon) expect(center[1]).to.eq(lat) diff --git a/tests/e2e-cypress/support/commands.js b/tests/e2e-cypress/support/commands.js index 0870436c4b..60d5ad637e 100644 --- a/tests/e2e-cypress/support/commands.js +++ b/tests/e2e-cypress/support/commands.js @@ -445,10 +445,6 @@ function cesiumTilesLoaded(viewer) { Cypress.Commands.add('waitUntilCesiumTilesLoaded', () => { cy.wait(['@cesiumTileset', '@cesiumTile']) - cy.readWindowValue('cesiumViewer').then(async (viewer) => { - await cesiumTilesLoaded(viewer) - return viewer - }) }) Cypress.Commands.add('clickOnMenuButtonIfMobile', () => {