1 - Create a project.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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('Create a project', () => {
  16. before(() => {
  17. cy.login()
  18. })
  19. beforeEach(() => {
  20. Cypress.Cookies.preserveOnce('token', 'projectId')
  21. })
  22. it('Shows projects page', () => {
  23. cy.getById('navigation-smallMenuItem-projects').click()
  24. cy.title().should('eq', 'Projects')
  25. })
  26. it('Shows new project modal', () => {
  27. cy.getById('newItemDropdown-button').click()
  28. cy.getById('newItemDropdown-listItem-Project').click()
  29. cy.getById('modal-title').should('contain', 'New Project')
  30. })
  31. it('Creates project', () => {
  32. cy.getById('endpointField-textInput-project_name').last().type('cypress-project')
  33. cy.getById('endpointField-textInput-description').last().type('Project created by Cypress')
  34. cy.server()
  35. cy.route({ url: '**/projects/', method: 'POST' }).as('addProject')
  36. cy.route({ url: '**/roles/**', method: 'PUT' }).as('addRole')
  37. cy.get('button').contains('New Project').click()
  38. cy.wait(['@addProject', '@addRole'])
  39. cy.getById('plItem-content').should('contain', 'cypress-project')
  40. cy.getById('plItem-content').should('contain', 'Project created by Cypress')
  41. })
  42. })