Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cy.origin() navigations to nordstromrack fail #24756

Open
AtofStryker opened this issue Nov 21, 2022 · 4 comments
Open

Cy.origin() navigations to nordstromrack fail #24756

AtofStryker opened this issue Nov 21, 2022 · 4 comments
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.

Comments

@AtofStryker
Copy link
Contributor

AtofStryker commented Nov 21, 2022

Current behavior

cy.origin navigations to nordstromrack seem to be running into possible request/cookie issues with the shopping cart.This doesn't seem to happen with a first cy.visit to nordstromrack. This is likely a cookie issue.

Screen Shot 2022-11-21 at 12 33 23 PM

Screen Shot 2022-11-21 at 12 33 34 PM

Desired behavior

I would expect the shopping cart request to not 401 and contain the appropriate cookies in the initial request

Test code to reproduce

describe("nordstrom", () => {
  it("goes to nordstrom rack", () => {
    cy.visit("https://www.nordstrom.com/");
    cy.visit("https://www.nordstromrack.com/");
    cy.origin("https://www.nordstromrack.com", () => {
      // Seem to be running into cookie issues where page reloads? shopping cart is returning a 401 and reloading the page
      // which blows away state. Requires further investigation
      // automation tests repeated eventually get flagged for bot behavior.
      // Eventually the page does become stable
      cy.get("#keyword-search-input").clear().type("nordstrom rack shoes");
    });
  });
}); 

Cypress Version

11.1.0

Node version

v16

Operating System

macOS 12.6

Debug Logs

No response

Other

No response

@AtofStryker
Copy link
Contributor Author

@bahmutov reposting your thread here:

@AtofStryker in your comment to #944 (comment) you are using cy.origin incorrectly, but I cannot even post that the site is refusing to load since that issue has been closed
Screen Shot 2022-11-21 at 12 08 17

@AtofStryker
Copy link
Contributor Author

I created #24756 to track that issue, which is open and you should be able to comment. On the issue, could you elaborate what is wrong with the usage of cy.origin? It's a very contrived example but should work the same. Going to move over to that thread.

@shishir-dwivedi-ethos
Copy link

shishir-dwivedi-ethos commented Nov 24, 2022

I am facing the same issue. I have a use case where I need to perform some action on one host and then open a different host to verify. For opening a different host I am using cy.origin() but the problem is in the header of the API call CSRF token is going as undefined which breaks the flow and the page doesn't load. Whereas when I open the first Host with cy.visit() CSRF token goes in the header for underlying API calls

`
cy.get(txtClientURL).invoke('attr', 'value').then(url => {
PORTAL_URL = url
cy.origin("https://abc.somehost.com/", { args: PORTAL_URL }, (PORTAL_URL) => {

            cy.visit(PORTAL_URL.split("/")[3], { timeout: 240000 })
            cy.get("button[data-tid='show-payment-button']").click()
          
        })

    })

`
image

Cypress Verison: 11.1.0
OS: mac
Browser : Chrome 107
Node Version: 16.11.1

@AtofStryker
Copy link
Contributor Author

@shishir-dwivedi-ethos could be related. Would you be able to provide a small reproduction that I can run on my end to reproduce?

@nagash77 nagash77 added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.
Projects
None yet
Development

No branches or pull requests

3 participants