https://cypress.io logo
Hi. I'm experiencing some weird randomness in resu...
# e2e-testing
b
Hi. I'm experiencing some weird randomness in results of e2e tests. It sometimes passes but most of the time fails. Maybe doing something incorrectly but looks like my
cy.wait('...')
is blocking pretty much every call that is happening and in consequence times out 😮 I think it only passes if MP3 stream is fast enough to fulfill before waiting begins. Otherwise, it always fails. See screenshots. Could this be related to problems Cypress has with intercepting binary/stream data (https://github.com/cypress-io/cypress/issues/24278 )? Does anyone have any idea what I'm doing incorrectly? Using: * Cypress 11.0.1 * NodeJS: 16 * Chrome E2E Code for reproduction:
Copy code
describe('E2E: Intercept', () => {
  it('Can intercept player related requests without getting blocked', () => {
    cy.intercept({
      url: 'https://api.energy.ch/sts/energych-player',
    }).as('audioStreamRelatedRequest');

    cy.visit('https://energy.ch/on-air');
    cy.wait(5000);
    cy.visit('https://energy.ch/on-air');
    cy.wait(5000);

    cy.get('button.flex-shrink-0.w-12.h-12.p-2.cursor-pointer')
      .filter(':visible')
      .click();

    // This randomly causes https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop
    //  request to hang and consecutive awaited @audioStreamRelatedRequest request never fires, then timeout happens
    cy.wait('@audioStreamRelatedRequest')
      .its('response.statusCode')
      .should('eq', 200);

    cy.wait(3000);
  });
});