describe('logged user journeys', () => { //sign user in before each test beforeEach(() => { cy.visit("http://localhost:4200/"); //sign in journey through services portal }); it('logs in through services', () => { cy.get(':nth-child(2) > .container > .row > :nth-child(2) > a > .btn').click(); //cy.get(':nth-child(1) > .nav-link').click() cy.location("pathname").should("equal", "/services"); // cy.get('.btn').should("contain", "Sign In").click(); cy.origin('http://portal.openslice.eu', () => { cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth"); cy.get('#username').type('admin'); cy.get('#password').type('openslice'); cy.get('#kc-login').click(); }); //redirect page cy.location("pathname").should("equal", "/redirect"); //back on services marketplace after login cy.location("pathname").should("equal", "/services/services_marketplace"); cy.get(':nth-child(2) > #navbarDropdown').each(($link) => { const url = $link.prop('href'); console.log(url); if (url) { cy.request(url).then((response) => { expect(response.status).to.eq(200); // Ensure link is not broken }); } cy.wrap($link).click(); // Click the link cy.url().should('eq', url); // Ensure navigation happened correctly cy.go('back'); // Navigate back to check the next link }); }); })