Duplicate Azure Endpoint.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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('Duplicate Azure Endpoint', () => {
  16. before(() => {
  17. cy.login()
  18. })
  19. beforeEach(() => {
  20. Cypress.Cookies.preserveOnce('token', 'projectId')
  21. })
  22. it('Creates duplicate', () => {
  23. cy.getById('navigation-smallMenuItem-endpoints').click()
  24. cy.getById('endpointListItem-content-e2e-azure-test').should('contain', 'e2e-azure-test')
  25. cy.getById('endpointListItem-checkbox-e2e-azure-test').click()
  26. cy.getById('dropdown-dropdownButton').contains('Select an action').click()
  27. cy.getById('dropdownListItem').contains('Duplicate').click()
  28. cy.server()
  29. cy.route({ url: '**/endpoints', method: 'POST' }).as('duplicate')
  30. cy.get('button').contains('Duplicate').click()
  31. cy.wait('@duplicate')
  32. })
  33. it('Validates duplicated endpoint', () => {
  34. cy.get('div[data-test-id="endpointListItem-content-e2e-azure-test (copy)"').click()
  35. cy.server()
  36. cy.route({ url: '**/actions', method: 'POST' }).as('validate')
  37. cy.getById('edContent-validateButton').click()
  38. cy.wait('@validate')
  39. cy.getById('eValidation-title').should('contain', 'Endpoint is Valid')
  40. cy.get('button').contains('Dismiss').click()
  41. })
  42. it('Deletes duplicated endpoint', () => {
  43. cy.server()
  44. cy.route({ url: '**/replicas/detail', method: 'GET' }).as('replicas')
  45. cy.route({ url: '**/migrations/detail', method: 'GET' }).as('migrations')
  46. cy.getById('edContent-deleteButton').click()
  47. cy.wait(['@replicas', '@migrations'])
  48. cy.route({ url: '**/secrets/**', method: 'DELETE' }).as('delete')
  49. cy.getById('aModal-yesButton').click()
  50. cy.wait('@delete')
  51. })
  52. })