3 - Add existing user as a member.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Copyright (C) 2018 Cloudbase Solutions SRL
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. // @flow
  15. describe('Adds existing user as a member to the project', () => {
  16. before(() => {
  17. cy.login()
  18. })
  19. beforeEach(() => {
  20. Cypress.Cookies.preserveOnce('token', 'projectId')
  21. })
  22. it('Shows projects details page', () => {
  23. cy.getById('navigation-smallMenuItem-projects').click()
  24. cy.getById('plItem-content').contains('cypress-project').click()
  25. })
  26. it('Opens add member modal', () => {
  27. cy.get('button').contains('Add Member').click()
  28. cy.getById('modal-title').should('contain', 'Add Project Member')
  29. })
  30. it('Adds existing user', () => {
  31. cy.getById('acInput-text').last().type('cy')
  32. cy.getById('ad-listItem').contains('cypress-member-user').click()
  33. cy.getById('endpointField-multidropdown-role(s)').click()
  34. cy.getById('dropdownListItem').contains('_member_').click()
  35. cy.getById('dropdownListItem').contains('admin').click()
  36. cy.getById('modal-title').click()
  37. cy.server()
  38. cy.route({ url: '**/roles/**', method: 'PUT' }).as('addRoles')
  39. cy.route({ url: '**/role_assignments**', method: 'GET' }).as('getRoles')
  40. cy.getById('pmModal-addButton').click()
  41. cy.wait(['@addRoles', '@getRoles'])
  42. cy.getById('pdContent-roles-cypress-member-user').should('contain', '_member_, admin')
  43. })
  44. it('Deletes the user', () => {
  45. cy.server()
  46. cy.route({ url: '**/role_assignments**', method: 'GET' }).as('getRoles')
  47. cy.getById('pdContent-users-cypress-member-user').click()
  48. cy.wait('@getRoles')
  49. cy.get('button').contains('Delete user').click()
  50. cy.route({ url: '**/users/**', method: 'DELETE' }).as('deleteUser')
  51. cy.getById('aModal-yesButton').click()
  52. cy.wait('@deleteUser')
  53. })
  54. })