Skip to content

Commit

Permalink
test: update map specs
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed Oct 31, 2024
1 parent 44e7db9 commit 92f3423
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/cypress/src/integration/map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const urlLondon =
'https://nominatim.openstreetmap.org/search?format=json&q=london&accept-language=en'

describe('[Map]', () => {
beforeEach(() => {
localStorage.setItem('VITE_THEME', 'fixing-fashion')
})

it('[Shows expected pins]', () => {
cy.viewport('macbook-16')

Expand Down Expand Up @@ -54,9 +58,8 @@ describe('[Map]', () => {
cy.get('[data-cy=MapFilterList-OpenButton]').first().click()
cy.get('[data-cy=MapFilterList]').should('be.visible')
cy.get('[data-cy=MapFilterList-CloseButton]').first().click()

cy.step('As the user moves in the list updates')
for (let i = 0; i < 9; i++) {
for (let i = 0; i < 6; i++) {
cy.get('.leaflet-control-zoom-in').click()
}
cy.get('[data-cy="list-results"]').contains('1 result')
Expand All @@ -83,23 +86,27 @@ describe('[Map]', () => {
cy.get('[data-cy=PinProfileCloseButton]').click()
cy.url().should('not.include', `#${userId}`)
cy.get('[data-cy=PinProfile]').should('not.exist')

cy.step('New map pins can be hidden by clicking the map')
cy.get(`[data-cy=pin-${userId}]`).click()
cy.url().should('include', `#${userId}`)

cy.step('New map pins can be hidden by clicking the map')
cy.get('[data-cy=PinProfile]').should('be.visible')
cy.get('.markercluster-map').click(10, 10)
cy.url().should('not.include', `#${userId}`)
cy.get('[data-cy=PinProfile]').should('not.exist')

cy.step('Mobile list view can be shown')
cy.viewport('samsung-note9')
cy.get('.leaflet-control-zoom-out').click()
cy.get('.leaflet-control-zoom-out').click()
cy.get('.leaflet-control-zoom-out').click()
cy.get('[data-cy="CardList-desktop"]').should('not.be.visible')
cy.get('[data-cy="CardList-mobile"]').should('not.be.visible')

cy.get('[data-cy="ShowMobileListButton"]').click()
cy.get('[data-cy="CardList-mobile"]').within(() => {
cy.get('[data-cy=CardListItem]')
.last()
.within(() => {
cy.contains(userId)
cy.get('[data-cy="MemberBadge-member"]')
Expand Down

0 comments on commit 92f3423

Please sign in to comment.