-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stakeholder, stakeholder-groups (#2)
* Add stakeholder groups * Add the title to modals * Add unit tests * delete unused code * rename files * Add business services test full form * Move e2e test to custom folders * Enhance filtering test * change controls default port to 8081 * Change controls db port to 5433 * Add readme docs * Add stakeholder groups * Restore proxy * add stakeholder groups * Change tabs order * add placeholders * Add select job * Move select-stakeholders to the shared folder to avoid conflicting order of css * Add test for stakeholders * Remove sort by members and groups * Reduce description width * Change widh * Changed 'name' field for to be 'role' (#1) * Fix test and remove creatable Co-authored-by: Marco Rizzi <mrizzi@users.noreply.github.com>
- Loading branch information
1 parent
d85fb56
commit 9b65a41
Showing
85 changed files
with
4,194 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
cypress/integration/controls/business-service/newBusinessService.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context("Test NewBusinessService", () => { | ||
beforeEach(() => { | ||
cy.kcLogout(); | ||
cy.kcLogin("alice").as("tokens"); | ||
|
||
cy.get("@tokens").then((tokens) => { | ||
const headers = { | ||
"Content-Type": "application/json", | ||
Accept: "application/hal+json", | ||
Authorization: "Bearer " + tokens.access_token, | ||
}; | ||
|
||
// Delete all business services | ||
cy.request({ | ||
method: "GET", | ||
headers: headers, | ||
url: `${Cypress.env("controls_base_url")}/business-service?size=1000`, | ||
}) | ||
.then((result) => { | ||
result.body._embedded["business-service"].forEach((e) => { | ||
cy.request({ | ||
method: "DELETE", | ||
headers: headers, | ||
url: `${Cypress.env("controls_base_url")}/business-service/${ | ||
e.id | ||
}`, | ||
}); | ||
}); | ||
}) | ||
|
||
// Delete all stakeholders | ||
.then(() => { | ||
cy.request({ | ||
method: "GET", | ||
headers: headers, | ||
url: `${Cypress.env("controls_base_url")}/stakeholder?size=1000`, | ||
}); | ||
}) | ||
.then((response) => { | ||
response.body._embedded["stakeholder"].forEach((elem) => { | ||
cy.request({ | ||
method: "DELETE", | ||
headers: headers, | ||
url: `${Cypress.env("controls_base_url")}/stakeholder/${elem.id}`, | ||
}); | ||
}); | ||
}) | ||
|
||
// Create stakeholders | ||
.then(() => { | ||
for (let i = 1; i <= 12; i++) { | ||
cy.request({ | ||
method: "POST", | ||
headers: headers, | ||
body: { | ||
email: `email${i}@domain.com`, | ||
displayName: `stakeholder${i}`, | ||
}, | ||
url: `${Cypress.env("controls_base_url")}/stakeholder`, | ||
}); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
it("Minimun data", () => { | ||
cy.intercept({ | ||
method: "GET", | ||
url: "/api/controls/business-service", | ||
}).as("apiCheck"); | ||
|
||
cy.visit("/controls/business-services"); | ||
|
||
// Open modal | ||
cy.get("button[aria-label='create-business-service']").click(); | ||
|
||
// Verify primary button is disabled | ||
cy.get("button[aria-label='submit']").should("be.disabled"); | ||
|
||
// Fill form | ||
cy.get("input[name='name']").type("my business service"); | ||
|
||
cy.get("button[aria-label='submit']").should("not.be.disabled"); | ||
cy.get("form").submit(); | ||
|
||
cy.wait("@apiCheck"); | ||
|
||
// Verify table | ||
cy.get("tbody > tr") | ||
.should("have.length", 1) | ||
.contains("my business service"); | ||
}); | ||
|
||
it("Fill all fields", () => { | ||
cy.intercept({ | ||
method: "GET", | ||
url: "/api/controls/business-service", | ||
}).as("apiCheckBusinessService"); | ||
|
||
cy.intercept({ | ||
method: "GET", | ||
url: "/api/controls/stakeholder", | ||
}).as("apiCheckStakeholder"); | ||
|
||
cy.visit("/controls/business-services"); | ||
|
||
// Open modal | ||
cy.get("button[aria-label='create-business-service']").click(); | ||
|
||
// Verify primary button is disabled | ||
cy.get("button[aria-label='submit']").should("be.disabled"); | ||
|
||
// Fill form | ||
cy.wait("@apiCheckStakeholder"); | ||
cy.get("input[name='name']").type("my name"); | ||
cy.get("textarea[name='description']").type("my description"); | ||
|
||
cy.get("button.pf-c-select__toggle-button").click(); | ||
cy.get("button.pf-c-select__menu-item") | ||
.eq(0) | ||
.click({ waitForAnimations: false }); | ||
|
||
cy.get("button[aria-label='submit']").should("not.be.disabled"); | ||
cy.get("form").submit(); | ||
|
||
cy.wait("@apiCheckBusinessService"); | ||
|
||
// Verify table | ||
cy.get("tbody > tr") | ||
.should("have.length", 1) | ||
.should("contain", "my name") | ||
.and("contain", "my description") | ||
.and("contain", "stakeholder1"); | ||
}); | ||
}); |
Oops, something went wrong.