cypress: Origin header is not getting passed while visiting the website using cypress

Current behavior

My Widgets in the website are not loading while trying to visit the site using cypress automation and it’s showing 500 error response code. But I can see my website is loading successfully with all the widgets when I visit manually. I observed that origin header is missing while visiting the site using cypress.

I tried changing the websecurity in the cypress.config file to ‘true’. But it didn’t resolved my issue. Missing header:: Origin: https://esolution-citizenportal2.dev.esolg.ca code for visiting the page:

describe('Adding a single property', () => {

  it('T02 - check login credentials', () => {
    
    const sentArgs = { username: 'VijayKumar.Chinthalapudi@ghd.com', password: 'Amstrong@66' }
    cy.origin('https://esolution-citizenportal2.dev.esolg.ca',
      

      { args: sentArgs },

      ({ username, password }) => {
        console.log('test2');
        cy.visit('/');
        console.log('test3');
        cy.get('#email').clear().type('VijayKumar.Chinthalapudi@ghd.com');
        cy.get('#password').clear().type('Amstrong@66');
        cy.get('#next').click();
       
      })

  })

})

Receiving the below error while using the above code:

Timed out retrying after 4000ms: The command was expected to run against origin https://esolution-citizenportal2.dev.esolg.ca but the application is at origin https://esolution-citizenportal2.dev.esolg.ca.

This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.

Desired behavior

Timed out retrying after 4000ms: The command was expected to run against origin https://esolution-citizenportal2.dev.esolg.ca but the application is at origin https://esolution-citizenportal2.dev.esolg.ca.

This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.

Test code to reproduce

describe('Adding a single property', () => {

  it('T02 - check login credentials', () => {
    
    const sentArgs = { username: 'VijayKumar.Chinthalapudi@ghd.com', password: 'Amstrong@66' }
    cy.origin('https://esolution-citizenportal2.dev.esolg.ca',
      

      { args: sentArgs },

      ({ username, password }) => {
        console.log('test2');
        cy.visit('/');
        console.log('test3');
        cy.get('#email').clear().type('VijayKumar.Chinthalapudi@ghd.com');
        cy.get('#password').clear().type('Amstrong@66');
        cy.get('#next').click();
       
      })

  })

})

Cypress Version

v.10.11.0

Node version

v14.17.6

Operating System

Windows 10 Enterprise

Debug Logs

No response

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (3 by maintainers)

Most upvoted comments

@StephaneColson, could you log a separate issue for this? I’d be interested if you could give us a reproducible example, Cookie handling is tricky.

@vijaykumar59694 do you happen to have chromeWebSecurity: false set in your cypress config?