Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
});
});
})