Newer
Older
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.loginPath(':nth-child(2) > .container > .row > :nth-child(2) > a > .btn', '/services');
//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
});
});
it('logs in through resources', () => {
cy.loginPath(':nth-child(3) > .container > .row > .order-md-1 > a > .btn', '/resources');
});
it('logs in through testing', () => {
cy.loginPath(':nth-child(5) > .container > .row > .order-md-1 > a > .btn', '/testing');
});
it('logs in through products', () => {
cy.loginPath(':nth-child(6) > .container > .row > :nth-child(2) > a > .btn', '/products');
});