Skip to content

Commit

Permalink
refactor(cy-map.spec.ts): Add better approach to wait on map
Browse files Browse the repository at this point in the history
  • Loading branch information
tuliobluz authored and benfurber committed Oct 11, 2024
1 parent 3b9dd2b commit 1ccad37
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/cypress/src/integration/map.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const userId = 'davehakkens'
const profileTypesCount = 5
const urlLondon =
'https://nominatim.openstreetmap.org/search?format=json&q=london&accept-language=en'

describe('[Map]', () => {
it('[Shows expected pins]', () => {
Expand Down Expand Up @@ -102,11 +104,14 @@ describe('[Map]', () => {
cy.step('The whole map can be searched')
cy.get('[data-cy="ShowMobileListButton"]').click()
cy.get('[data-cy=osm-geocoding]').last().click().type('london')
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000) // Needed for location response
cy.intercept(urlLondon).as('londonSearch')
cy.wait('@londonSearch')
cy.contains('London, Greater London, England, United Kingdom').click()
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000) // Needed for animation
cy.get('.icon-cluster-text').contains('3')

cy.get('.icon-cluster-many')
.should('be.visible')
.within(() => {
cy.get('.icon-cluster-text').should('have.text', '3').and('be.visible')
})
})
})

0 comments on commit 1ccad37

Please sign in to comment.