Skip to content
Snippets Groups Projects

Draft: Resolve "Implement user journey tests"

Open trantzas requested to merge 26-implement-user-journey-tests into develop
3 files
+ 118
75
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 102
0
describe('logged user journeys', () => {
beforeEach(() => {
//cy.visit("http://localhost:4200/");
cy.visit(window.location.origin);
});
afterEach(() => {
//log user out after each test
cy.get('#navbarDropdown2').click();
cy.get(':nth-child(2) > .dropdown > .dropdown-menu > :nth-child(8)').click();
cy.location("pathname").should("equal", "/");
});
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");
//check every 'Manage Services' dropdown item
cy.get(':nth-child(2) > #navbarDropdown').click();
let i=0;
cy.get('.show .dropdown-item').each(($el) => {
i++;
cy.wrap($el).click(); // Click the link
cy.get(':nth-child(1) > .cdk-column-actions > .btn').first().click();
//does the dialog open?
cy.get('mat-dialog-container').should('exist');
cy.go('back');
cy.get(':nth-child(2) > #navbarDropdown').click();
if(i>1) {
return false;
}
});
//access the service specs dropdown
cy.get('#navbarDropdown1').click();
let j=0;
for(let i=1; i<=2; i++) {
cy.get(`.dropdown-submenu > .dropdown-menu > :nth-child(${i}) `).click();
cy.location("pathname").should("not.equal", "/services/services_marketplace");
cy.go('back');
cy.get(':nth-child(2) > #navbarDropdown').click();
cy.get('#navbarDropdown1').click();
}
//check the rest dropdown items
cy.get(':nth-child(4) > .dropdown-item').click();
cy.get('mat-dialog-container').should('exist');
cy.go('back');
cy.get(':nth-child(2) > #navbarDropdown').click();
//'Manage Entities' dropdown
cy.manageEntities(':nth-child(3) > #navbarDropdown', '.jumbotron-heading > .btn', 2, 2);
});
it('logs in through resources', () => {
cy.loginPath(':nth-child(3) > .container > .row > .order-md-1 > a > .btn', '/resources');
cy.location("pathname").should("equal", "/resources/resource_catalogs");
cy.get('.text-md-right > .btn').click();
cy.get('mat-dialog-container').should('exist');
cy.go('back');
cy.get('#navbarDropdown').click();
cy.get('.show > :nth-child(2) > .dropdown-item').click();
cy.location("pathname").should("equal", "/resources/resource_categories");
cy.get('.text-md-right > .btn').click();
cy.location("pathname").should("equal", "/resources/resource_categories_update");
cy.go('back');
cy.get('#navbarDropdown').click();
cy.get('#navbarDropdown1').click();
for(let i=1; i<=2; i++) {
cy.get(`.dropdown-submenu > .dropdown-menu > :nth-child(${i}) `).click();
cy.location("pathname").should("not.equal", "/resources/resource_categories");
cy.go('back');
cy.get('#navbarDropdown').click();
cy.get('#navbarDropdown1').click();
}
//resource inventory
cy.get(':nth-child(5) > .dropdown-item').click();
cy.location("pathname").should("equal", "/resources/resource_inventory");
cy.get('#navbarDropdown').click();
//resource pools
cy.get(':nth-child(7) > .dropdown-item').click();
cy.location("pathname").should("equal", "/resources/resource_pools");
cy.get('#navbarDropdown').click();
//resource reservations
cy.get(':nth-child(8) > .dropdown-item').click();
cy.location("pathname").should("equal", "/resources/resource_reservations");
});
it('logs in through testing', () => {
cy.loginPath(':nth-child(5) > .container > .row > .order-md-1 > a > .btn', '/testing');
cy.manageEntities(':nth-child(1) > #navbarDropdown', '.text-md-right > .btn', 3, 2);
cy.manageEntities(':nth-child(2) > #navbarDropdown', '.jumbotron-heading > .btn', 2, 2);
});
it('logs in through products', () => {
cy.loginPath(':nth-child(6) > .container > .row > :nth-child(2) > a > .btn', '/products');
cy.manageEntities(':nth-child(2) > #navbarDropdown', '.text-md-right > .btn', 2, 4);
cy.manageEntities(':nth-child(3) > #navbarDropdown', '.jumbotron-heading > .btn', 2, 2);
});
})
\ No newline at end of file
Loading