hello! can anyone help me on the thing i wanted to...
# e2e-testing
a
hello! can anyone help me on the thing i wanted to achieve!!! i do have a menu list:
Copy code
export const Menu = [
    {
      id: 1,
      title: "Home",
      link: "/",
      children: [],
    },
    {
      id: 2,
      title: "Consultants",
      link: "#",
      children: [
        { childTitle: "Find a Doctor", childTo: "/consultant/doctors" },
      ],
    },
    {
      id: 3,
      title: "Services",
      link: "/services",
      children: [
        {
          childTitle: "Clinical Laboratory",
          childTo: "/services/laboratoryservices",
        },
      ],
    },
    {
      id: 4,
      title: "Packages",
      link: "/packages",
      children: [],
    },
  ];
and i want to check the links by going to the page and checking the url which matches with the list or not. the code i wrote is:
Copy code
const menus = Menu;

context("Nav items test", () => {
  beforeEach(() => {
    cy.visit("/");
  });

  it("should redirect to the expected pages", () => {
    cy.get(".navbar-nav>li>a[href!='/#']").each((links, index) => {
      cy.wrap(links).click();
      cy.url().should("contain", links[0].href);
    });
});
if i do it manually then it is working:
Copy code
cy.get('[data-cy=nav-item]').contains('About').click()
                    cy.url().should('include', '/about/')