I want to handle some requests for some files when I open the page. On the screenshot, you can see the log from the cypress panel:
To handle these requests I added code like this:
it('Check intercept', () => {
cy.intercept('/settings.json').as('settings');
cy.intercept('/static/model/*').as('plates');
cy.visit('/editor/ckpdx02f7098c08632il2aetr');
cy.wait('@settings')
cy.wait('@plates')
});
It works well with settings.json
, but with .stl
files doesn't
It also doesn't work if I will write it like this:
it('Check intercept', () => {
cy.intercept('/settings.json').as('settings');
cy.intercept('/static/model/ckpdwtgpg096g08636kd57n39/plate_4.stl').as('plate4');
cy.intercept('/static/model/ckpdwtgpg096g08636kd57n39/plate_3.stl').as('plate3');
cy.intercept('/static/model/ckpdwtgpg096g08636kd57n39/plate_2.stl').as('plate2');
cy.intercept('/static/model/ckpdwtgpg096g08636kd57n39/plate_1.stl').as('plate1');
cy.intercept('/static/model/ckpdwtgpg096g08636kd57n39/plate_0.stl').as('plate0');
cy.visit('/editor/ckpdx02f7098c08632il2aetr');
cy.wait('@settings')
cy.wait('@plate4')
cy.wait('@plate3')
cy.wait('@plate2')
cy.wait('@plate1')
});
I didn't find any restrictions about it in docs, welcome to your ideas :)
Cypress: v7.4.0
UPDATE 1:
I found one more detail: if open the chrome developer tools and disable cache in the "Network" tab - it works correctly always
UPDATE 2:
I created an issue with the demo repo: https://github.com/cypress-io/cypress/issues/16766