Newer
Older
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
declare namespace Cypress {
interface Chainable {
navigateToServices(selector): Chainable<any>,
navigateToResources(selector): Chainable<any>,
navigateToTesting(selector): Chainable<any>,
navigateToProducts(selector): Chainable<any>
}
}
Cypress.Commands.add('navigateToServices', (selector) => {
cy.get(selector).click();
cy.location("pathname").should("equal", "/services");
cy.get('.btn').should("contain", "Sign In");
cy.get(':nth-child(2) > .nav-item > .nav-link').should("exist");
//service marketplace button should exist and should redirect to /services_marketplace
cy.get('.mr-auto > .nav-item > .nav-link').click();
cy.get('.jumbotron > h5.ng-tns-c147-1').should("contain", "Browse available services and sign in to order");
cy.get('.catalog-tree-header').should("exist");
//sign in button should exist
cy.get(':nth-child(2) > .nav-item > .nav-link').click();
//sign in button should redirect to auth form
cy.origin('http://portal.openslice.eu', () => {
cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");
});
});
Cypress.Commands.add('navigateToResources', (selector) => {
cy.get(selector).click();
cy.location("pathname").should("equal", "/resources");
//sign in button should exist
cy.get('.btn').should('exist').click();
//cy.get('nav-link').should('exist').click();
//sign in button should redirect to auth form
cy.origin('http://portal.openslice.eu', () => {
cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");
});
})
Cypress.Commands.add('navigateToTesting', (selector) => {
cy.get(selector).click();
cy.location("pathname").should("equal", "/testing");
//sign in button should exist
cy.get('.btn').should('exist').click();
//cy.get('nav-link').should('exist').click();
//sign in button should redirect to auth form
cy.origin('http://portal.openslice.eu', () => {
cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");
});
});
Cypress.Commands.add('navigateToProducts', (selector) => {
cy.get(selector).click();
cy.location("pathname").should("equal", "/products");
cy.get('.btn').should("contain", "Sign In");
cy.get(':nth-child(2) > .nav-item > .nav-link').should("exist");
//marketplace button should exist and should redirect to products/marketplace
cy.get('.mr-auto > .nav-item > .nav-link').click();
cy.get('.catalog-tree-header').should("exist");
cy.get('.mb-0').should("contain", "Product Catalog Explorer");
//sign in button should exist
cy.get(':nth-child(2) > .nav-item > .nav-link').click();
//sign in button should redirect to auth form
cy.origin('http://portal.openslice.eu', () => {
cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");
});
})