-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin): added e2e tests for role RESOURCESELFSERVICE
* added e2e tests to test basic use cases for role RESOURCESELFSERVICE * fixed login credentials for e2e tests for role TOPGROUPCREATOR
- Loading branch information
1 parent
d6163ca
commit e384259
Showing
4 changed files
with
104 additions
and
4 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
97 changes: 97 additions & 0 deletions
97
apps/admin-gui-e2e/src/e2e/resource-self-service-perun_admin.cy.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,97 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('Actions', () => { | ||
const dbVoName = 'test-e2e-vo-from-db-6'; | ||
const dbResourceName = 'test-e2e-resource-from-db-4'; | ||
|
||
const dbGroupToAssign = 'test-e2e-group-from-db-9'; | ||
const dbGroupToRemove = 'test-e2e-group-from-db-8'; | ||
const dbGroupToActivate = 'test-e2e-group-from-db-7'; | ||
const dbGroupToDeactivate = 'test-e2e-group-from-db-6'; | ||
|
||
|
||
before(() => { | ||
if (Cypress.env('BA_USERNAME_RESOURCE_SELF_SERVICE')) { | ||
sessionStorage.setItem('baPrincipal', '{"name": "resourceSelfService"}'); | ||
sessionStorage.setItem('basicUsername', Cypress.env('BA_USERNAME_RESOURCE_SELF_SERVICE')); | ||
sessionStorage.setItem('basicPassword', Cypress.env('BA_PASSWORD_RESOURCE_SELF_SERVICE')); | ||
cy.visit('service-access'); | ||
} | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.visit('organizations') | ||
.get(`[data-cy=${dbVoName}]`) | ||
.click() | ||
.get('[data-cy=resources]') | ||
.click() | ||
.get('[data-cy=resource-list]') | ||
.click() | ||
.get(`[data-cy=${dbResourceName}]`) | ||
.click() | ||
.get('[data-cy=assigned-groups]') | ||
.click(); | ||
}); | ||
|
||
it('test assign group to resource', () => { | ||
cy.get('[data-cy=add-group-button]') | ||
.click() | ||
.get(`[data-cy=${dbGroupToAssign}-checkbox]`) | ||
.click() | ||
.get('[data-cy=next-button]') | ||
.click() | ||
.intercept('**/resourcesManager/getGroupAssignments**') | ||
.as('getGroupAssignments') | ||
.get('[data-cy=assign-button]') | ||
.click() | ||
.wait('@getGroupAssignments') | ||
|
||
// assert that group was added | ||
.get(`[data-cy=${dbGroupToAssign}-checkbox]`) | ||
.should('exist'); | ||
}); | ||
|
||
it('test remove group from resource', () => { | ||
cy.get(`[data-cy=${dbGroupToRemove}-checkbox]`) | ||
.click() | ||
.get('[data-cy=remove-group-button]') | ||
.click() | ||
.intercept('**/resourcesManager/getGroupAssignments**') | ||
.as('getGroupAssignments') | ||
.get('[data-cy=delete-button]') | ||
.click() | ||
.wait('@getGroupAssignments') | ||
|
||
// assert that group was removed | ||
.get(`[data-cy=${dbGroupToRemove}-checkbox]`) | ||
.should('not.exist'); | ||
}); | ||
|
||
it('test activate group resource assignment', () => { | ||
cy.get(`[data-cy=${dbGroupToActivate}-inactive]`) | ||
.click() | ||
.intercept('**/resourcesManager/activateGroupResourceAssignment**') | ||
.as('activateGroupResourceAssignment') | ||
.get('[data-cy=change-status-button]') | ||
.click() | ||
.wait('@activateGroupResourceAssignment') | ||
|
||
// assert that group is active | ||
.get(`[data-cy=${dbGroupToActivate}-active]`) | ||
.should('exist'); | ||
}); | ||
|
||
it('test deactivate group resource assignment', () => { | ||
cy.get(`[data-cy=${dbGroupToDeactivate}-active]`) | ||
.click() | ||
.intercept('**/resourcesManager/deactivateGroupResourceAssignment**') | ||
.as('deactivateGroupResourceAssignment') | ||
.get('[data-cy=change-status-button]') | ||
.click() | ||
.wait('@deactivateGroupResourceAssignment') | ||
|
||
// assert that group is inactive | ||
.get(`[data-cy=${dbGroupToDeactivate}-inactive]`) | ||
.should('exist'); | ||
}); | ||
}); |
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