Cypress XHR requests get aborted when running headless, in cypress based image container

1.7k Views Asked by At

Cypress XHR requests get aborted when running headless, in a cypress-based image container. Browser: Electron

describe('Test Sign-In and search', () => {
  before(() => {
    cy.clearLocalStorageSnapshot();
  });
  beforeEach(() => {
    cy.restoreLocalStorage();
  });
  afterEach(() => {
    cy.saveLocalStorage();
  });
  it('Test Sign In Process', () => {
    cy.visit(Cypress.config().baseUrl);
    cy.get('[data-test="signInHeader"]', { timeout: 10000 }).should(
      'be.visible'
    );
    cy.get('[data-test="emailInput"]').type(Cypress.env('USER_EMAIL'));
    cy.get('[data-test="passwordInput"]').type(Cypress.env('USER_PASSWORD'));
    cy.get('[data-test="signInBtn"]').click(); // Preform Sign-in
    cy.get('[data-test="newAnalysisHeader"]', { timeout: 25000 }).should(
      'be.visible'
    );
  });

Attaching Picture:

enter image description here

Thanks for helping!

1

There are 1 best solutions below

1
Ido Bleicher On

I had an issue with WAF (AWS Cloud). in my cloud front, there was a rule to block XHR requests to the backend. which causes this issue. after whitelisting my IP it worked.