Create Openstack Endpoint.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. import config from '../../config'
  16. describe('Create Openstack Endpoint', () => {
  17. before(() => {
  18. cy.login()
  19. })
  20. beforeEach(() => {
  21. Cypress.Cookies.preserveOnce('token', 'projectId')
  22. })
  23. it('Shows new Openstack endpoint dialog', () => {
  24. cy.get('div').contains('New').click()
  25. cy.getById('newItemDropdown-listItem-Endpoint').click()
  26. cy.getById('cProvider-endpointLogo-openstack').click()
  27. })
  28. it('Fills Openstack connection info', () => {
  29. cy.get('div').contains('Advanced').click()
  30. cy.get('input[placeholder="Name"]').type('e2e-openstack-test')
  31. cy.get('input[placeholder="Username"]').type(config.endpoints.openstack.username)
  32. cy.get('input[placeholder="Password"]').type(config.endpoints.openstack.password)
  33. cy.get('input[placeholder="Authentication URL"]').type(config.endpoints.openstack.authUrl)
  34. cy.get('input[placeholder="Project Name"]').type(config.endpoints.openstack.projectName)
  35. cy.getById('endpointField-dropdown-glance_api_version').first().click()
  36. cy.getById('dropdownListItem').contains('2').click()
  37. cy.getById('endpointField-dropdown-identity_api_version').first().click()
  38. cy.getById('dropdownListItem').contains('3').click()
  39. cy.get('input[placeholder="Project Domain Name"]').type(config.endpoints.openstack.projectDomainName)
  40. cy.get('input[placeholder="User Domain Name"]').type(config.endpoints.openstack.userDomainName)
  41. if (config.endpoints.openstack.allowUntrusted) {
  42. cy.getById('endpointField-switch-allow_untrusted').click()
  43. }
  44. if (config.endpoints.openstack.allowUntrustedSwift) {
  45. cy.getById('endpointField-switch-allow_untrusted_swift').click()
  46. }
  47. cy.server()
  48. cy.route({ url: '**/actions', method: 'POST' }).as('validate')
  49. cy.get('button').contains('Validate and save').click()
  50. cy.wait('@validate')
  51. cy.getById('endpointStatus').should('contain', 'Endpoint is Valid')
  52. })
  53. it('Added Openstack to endpoint list', () => {
  54. cy.getById('navigation-smallMenuItem-endpoints').click()
  55. cy.getById('endpointListItem-content-e2e-openstack-test').should('contain', 'e2e-openstack-test')
  56. })
  57. })