'Cypress cy.origin is doesn't work when it link to LinkedIn

I was developing a feature that redirects users to profiles on various platforms. And to test this, I wrote the following code using the newly released cy.origin yesterday.

cy.origin('www.example.com', () => {
    cy.visit('/username')
})

However, github and twitter were successfully redirected, but linkedin was not the only one.

error image

I think the problem is caused by the user agent. Is there any way to solve this problem?



Solution 1:[1]

For the record,

cy.origin('https://www.linkedin.com', () => {
  cy.visit('/in/sunwoo0706', {failOnStatusCode: false})  // redirects to login page
})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fody