question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:28 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mjhenkescommented, Nov 23, 2022

@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.

0reactions
mjhenkescommented, Dec 6, 2022

Right now there doesn’t seem to be enough information to reproduce the problem on our end. Unless we receive a reliable reproduction, we’ll eventually have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Please provide a reproducible example of the issue you’re encountering. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Web Security - Cypress Documentation
Display insecure content; Navigate to any superdomain without cross-origin errors with or without cy.origin; Access cross-origin iframes that are embedded in ...
Read more >
Cypress throws "cross origin error happened on page load ...
This error means that your application navigated to a superdomain that Cypress was not bound to. Initially when you cy.visit() , Cypress changes ......
Read more >
Cypress cy.intercept Problems - Gleb Bahmutov
Let's imagine the most common scenario - every test starts with zero items. We stab the GET /todos request and visit the site...
Read more >
Web Security - Cypress - w3resource
To solve this problem, you will need to update your HTML and JavaScript code not to navigate to an insecure HTTP page, instead...
Read more >
Fixing Cypress cross-origin errors - Reflect.run
Although older versions of Cypress did not support testing across domains, with the addition of cy.origin() in version 9.6, tests can now be ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found