Skip to content

Commit

Permalink
PB-1204: fix unrelated test failure on import KML
Browse files Browse the repository at this point in the history
don't know why this pops up on this PR which doesn't change anything in the import KML, but I've added the necessary intercepts on the search made while importing a KML to fix the flakyness of this test.
Was certainly due to some race condition on the real search service responding faster than expected, we should not use the real service for such tests anyway...
  • Loading branch information
pakb committed Dec 13, 2024
1 parent 23e2e5a commit bb109a7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/cypress/tests-e2e/importToolFile.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,24 @@ describe('The Import File Tool', () => {
expect(result[0]).to.approximately(expected[0], acceptedDelta)
expect(result[1]).to.approximately(expected[1], acceptedDelta)
}
const emptySearchResponse = {
results: [],
}
cy.mockupBackendResponse(
'rest/services/ech/SearchServer*?type=layers*',
emptySearchResponse,
'search-layers'
)
cy.mockupBackendResponse(
'rest/services/ech/SearchServer*?type=locations*',
emptySearchResponse,
'search-locations'
)

cy.log('Test search for a feature in the local KML file')
cy.closeMenuIfMobile()
cy.get('[data-cy="searchbar"]').paste('placemark')
cy.wait(['@search-layers', '@search-locations'])
cy.get('[data-cy="search-results"]').should('be.visible')
cy.get('[data-cy="search-result-entry"]').as('layerSearchResults').should('have.length', 3)
cy.get('@layerSearchResults').invoke('text').should('contain', 'Sample Placemark')
Expand All @@ -252,6 +266,7 @@ describe('The Import File Tool', () => {
cy.log('Test search for a feature in the online KML file')
cy.get('[data-cy="searchbar-clear"]').click()
cy.get('[data-cy="searchbar"]').paste('another sample')
cy.wait(['@search-layers', '@search-locations'])
cy.get('[data-cy="search-results"]').should('be.visible')
cy.get('[data-cy="search-result-entry"]').as('layerSearchResults').should('have.length', 1)
cy.get('@layerSearchResults').invoke('text').should('contain', 'Another Sample Placemark')
Expand Down

0 comments on commit bb109a7

Please sign in to comment.