0

I have cypress smoke test which is working fine with cypress version 8.7.0 but failing with version 10.

Sample test looks like

{

describe("Smoke - test login flow", () => {
  const userId = Cypress.env("test_user");
  const customPassword = Cypress.env("test_password");

  before(() => {
    cy.clearCookies();
    cy.clearLocalStorage();
  });

it("Verify header elements", () => {
    cy.visit("/");
    cy.login(userId, customPassword); // https://www.dev.com/login
    cy.get("#header-logo").should("be.visible");
    cy.visit("step/test/#/overview");//localhost:8080/step/test/#/overview
    cy.url().should("contain", "overview");
    cy.findByTestId("logo-light").should("be.visible");
    cy.findByText("Overview").should("be.visible");
  });
});


cy.login is a custom command which does login to dev environment 


Cypress.Commands.add("login", (userName: string, password: string) => {
    cy.findByTestId("user_input").as("userNameInput");
    cy.findByTestId("user_pass").as("passwordInput");
    cy.findByText("Log In").as("submit");
    cy.get("@userNameInput").type(userName);
    cy.get("@passwordInput").type(password);
    cy.get("@submit").click();
});

base url defined in config.ts file to localhost:8080 and does the login but when, cy.visit("step/test/#/overview"); gets called it agin redirects to dev login and does not come back to local host.

What is wrong here?

pravin
  • 51
  • 2
  • 4

0 Answers0