https://cypress.io logo
Hey Community, I need some help. I am facing an is...
# e2e-testing
q
Hey Community, I need some help. I am facing an issue when I try to test the login feature of my app. The login process is done in a separate app. When clicking on login, I will be redirected to the auth app. There I can type the email and password. After successful login, I will be redirected back to my original app. In the auth app, after I enter the email, it will redirect to another page. And the URL has some parameters. I was trying to use the
origin
command to visit the auth app. But the entire spec will get restarted when I redirect to the next page after typing the email. When I checked the doc, I found that params are not supported in the URLs inside the
origin
callback function. Can anyone suggest me an alternate solution for this? Version: 9.6 App framework: React
Copy code
js
it("should login successfully", () => {
  cy.origin(
    "http:localhost:3000/", //auth app URL
    { args },
    ({ email, otp }) => {
      cy.visit("/");
      cy.get(".email-field").type("test@gmail.com");
      cy.get(".sbmit-btn").click();
      // Should redirect to otp page => http:localhost:3000/?email=test@gmail.com
      cy.get(".otp-field").type("123456");
    }
  );
  cy.visit("/"); // Should redirect to app url (http:localhost:3001)
});
This is the sample snippet.