I'm writing a cypress test that tests a map application. When I click on a specific button, I want to wait for all resources to load on the map.
Currently, the button is making a request to a url: someurl.com/myData/** Where the ** represents dynamic data.
This is what I currently have:
describe('Map Data', () => {
beforeEach(()=> {
cy.intercept('GET', 'http://someurl.com/myData/**').as('loadData')
cy.visit('/')
})
it('checks for all resources to be loaded', () => {
cy.get('#loadButton').click()
cy.wait('@loadData')
})
})
This waits until the first resource was loaded. However, there are many resources from the url and I was wondering if it's possible to wait for at least a certain number of them to load?
Intercepts are valid for any number of requests. They are listeners that keep listening, except when the test changes - then they are removed (but are re-setup when you have a
beforeEach())You can just wait for "a certain number"
Of course, you have to be certain about the number.