Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cypress Tests #533

Merged
merged 7 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions cypress/integration/owm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ describe('OpenWeatherMap layer', function() {
cy.wait(300)
cy.window().then((win) => {
cy.get('.leaflet-tile-pane').children().should('have.length', 1)
cy.get('#map-city label').click({ force: true })
cy.get('#map-Clouds label').click({ force: true })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - will this be more stable? Like, there are clouds everywhere even though there aren't cities everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah clouds,temp and pressure seemed to be more general to me among other maps. I just went with clouds.

cy.get('.leaflet-tile-pane').children().should('have.length', 2)
cy.get('.img')
cy.get('div.leaflet-layer:nth-child(2) > div > img').should('have.attr', 'src').and('contains', 'openweathermap.org/map/clouds')
})
})

it('loads correct owmloading.gif with config option set', function() {
cy.openWindow('/example/oneLinerCodeExample.html')
cy.wait(300)
cy.window().then((win) => {
expect(LEL.overlayMaps.current.options.imageLoadingUrl).to.equal('https://raw.githubusercontent.com/buche/leaflet-openweathermap/master/owmloading.gif')
})
let LEL;
cy.window()
.then((win) => {
LEL = win.LEL
})
.then(() => {
expect(LEL.overlayMaps.current.options.imageLoadingUrl).to.equal('https://raw.githubusercontent.com/buche/leaflet-openweathermap/master/owmloading.gif')
})
})
});
4 changes: 2 additions & 2 deletions cypress/integration/purpleAirMarker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Purple layer - markers', function() {
const spy = cy.spy(window.top.aut.PurpleAirMarkerLayer, 'requestData')
cy.get('[title="Show minimal markers"]').click().then(() => {
expect(spy).to.be.called
cy.get('.leaflet-overlay-pane svg g').children().should('have.length', 2)
cy.get('.leaflet-overlay-pane svg g').children().should('have.length.gt', 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'stroke').should('eq', '#7c7c7c')
cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'fill').should('eq', '#7c22b5')
cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'stroke-linecap').should('eq', 'round')
Expand All @@ -43,7 +43,7 @@ describe('Purple layer - markers', function() {
it('shows popup', function() {
cy.get('.leaflet-overlay-pane svg g').children().last().click({ force: true })
cy.get('.leaflet-popup-pane').children().should('have.length', 1)
cy.get('.leaflet-popup-content').should('contain', 'MandMnorth40')
cy.get('.leaflet-popup-content').should('contain', 'www.purpleair.com')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent.

})

it('removes markers from the map and the layer name from the hash when clicked again', function() {
Expand Down