Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Johaney-s committed Sep 12, 2022
2 parents 6b66608 + e384259 commit 9ae6cd3
Show file tree
Hide file tree
Showing 94 changed files with 1,329 additions and 103 deletions.
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -1593,5 +1593,8 @@
},
"tags": []
}
},
"cli": {
"analytics": false
}
}
7 changes: 6 additions & 1 deletion apps/admin-gui-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export default defineConfig({
BA_PASSWORD_FACILITY_MANAGER: 'test',
BA_USERNAME_RESOURCE_MANAGER: 'resourceManager',
BA_PASSWORD_RESOURCE_MANAGER: 'test',
BA_PASSWORD_TOP_GROUP_CREATOR: 'topGroupCreator',
BA_USERNAME_TOP_GROUP_CREATOR: 'topGroupCreator',
BA_PASSWORD_TOP_GROUP_CREATOR: 'test',
BA_USERNAME_RESOURCE_SELF_SERVICE: 'resourceSelfService',
BA_PASSWORD_RESOURCE_SELF_SERVICE: 'test',
BA_USERNAME_TRUSTED_FACILITY_ADMIN: 'trustedFacilityAdmin',
BA_PASSWORD_TRUSTED_FACILITY_ADMIN: 'test',
},
specPattern: 'src/e2e/**/*.cy.{js,jsx,ts,tsx}',
supportFile: false,
Expand Down
97 changes: 97 additions & 0 deletions apps/admin-gui-e2e/src/e2e/resource-self-service-perun_admin.cy.js
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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ context('Actions', () => {
const groupName = 'test';

before(() => {
if (Cypress.env('BA_PASSWORD_TOP_GROUP_CREATOR')) {
if (Cypress.env('BA_USERNAME_TOP_GROUP_CREATOR')) {
sessionStorage.setItem('baPrincipal', '{"name": "topGroupCreator"}');
sessionStorage.setItem('basicUsername', Cypress.env('BA_PASSWORD_TOP_GROUP_CREATOR'));
sessionStorage.setItem('basicUsername', Cypress.env('BA_USERNAME_TOP_GROUP_CREATOR'));
sessionStorage.setItem('basicPassword', Cypress.env('BA_PASSWORD_TOP_GROUP_CREATOR'));
cy.visit('service-access');
}
Expand Down
Loading

0 comments on commit 9ae6cd3

Please sign in to comment.