1 - Create replica.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 VmWare to Azure Replica', () => {
  17. before(() => {
  18. cy.login()
  19. })
  20. beforeEach(() => {
  21. Cypress.Cookies.preserveOnce('token', 'projectId')
  22. })
  23. it('Shows Wizard page', () => {
  24. cy.get('div').contains('New').click()
  25. cy.getById('newItemDropdown-listItem-Replica').click()
  26. cy.get('#app').should('contain', 'New Replica')
  27. })
  28. it('Chooses VmWare as Source Cloud', () => {
  29. cy.server()
  30. cy.route({ url: '**/instances**', method: 'GET' }).as('sourceInstances')
  31. cy.get('button').contains('Next').click()
  32. cy.getById('wEndpointList-dropdown-vmware_vsphere').first().click()
  33. cy.get('div').contains('e2e-vmware-test').click()
  34. cy.wait('@sourceInstances')
  35. })
  36. it('Searches and selects instances', () => {
  37. cy.get('button').contains('Next').click()
  38. cy.server()
  39. cy.route({ url: '**/instances**', method: 'GET' }).as('search')
  40. cy.get('input[placeholder="Search VMs"]').type(config.wizard.instancesSearch.vmwareSearchText)
  41. cy.wait('@search')
  42. cy.getById('wInstances-instanceItem').contains(config.wizard.instancesSearch.vmwareSearchText)
  43. cy.getById('wInstances-instanceItem').its('length').should('be.gt', 0)
  44. cy.getById('wInstances-instanceItem').eq(config.wizard.instancesSearch.vmwareItemIndex).click()
  45. })
  46. it('Chooses Azure as Target Cloud', () => {
  47. cy.get('button').contains('Next').click()
  48. cy.getById('wEndpointList-dropdown-azure').first().click()
  49. cy.server()
  50. cy.route({ url: '**/destination-options**', method: 'GET' }).as('dest-options')
  51. cy.get('div').contains('e2e-azure-test').click()
  52. cy.wait('@dest-options')
  53. })
  54. it('Fills Azure replica info', () => {
  55. cy.get('button').contains('Next').click()
  56. cy.getById('acDropdown-wrapper').first().click()
  57. cy.server()
  58. cy.route({ url: '**/destination-options**', method: 'GET' }).as('dest-options')
  59. cy.getById('ad-listItem').contains(config.wizard.azure.resourceGroup).click()
  60. cy.wait('@dest-options')
  61. })
  62. it('Selects first available network mapping', () => {
  63. cy.server()
  64. cy.route({ url: '**/networks**', method: 'GET' }).as('networks')
  65. cy.route({ url: '**/instances/**', method: 'GET' }).as('instances')
  66. cy.get('button').contains('Next').click()
  67. cy.wait(['@networks', '@instances'])
  68. cy.get('button').contains('Next').should('be.disabled')
  69. cy.getById('networkItem').its('length').should('be.gt', 0)
  70. cy.get('div[value="Select ..."]').first().click()
  71. cy.getById('dropdownListItem').first().click()
  72. cy.get('button').contains('Next').should('not.be.disabled')
  73. })
  74. it('Shows storage screen', () => {
  75. cy.get('button').contains('Next').click()
  76. cy.getById('wpContent-header').should('contain', 'Storage')
  77. })
  78. it('Shows schedule page', () => {
  79. cy.get('button').contains('Next').click()
  80. cy.getById('wpContent-header').should('contain', 'Schedule')
  81. })
  82. it('Shows summary page', () => {
  83. cy.get('button').contains('Next').click()
  84. cy.get('#app').should('contain', 'Summary')
  85. cy.get('#app').should('contain', 'e2e-vmware-test')
  86. cy.get('#app').should('contain', 'e2e-azure-test')
  87. cy.get('#app').should('contain', 'Coriolis Replica')
  88. cy.get('#app').should('contain', 'Replica Target Options')
  89. cy.getById('wSummary-optionValue-resource_group').should('contain', config.wizard.azure.resourceGroup)
  90. })
  91. it('Executes replica', () => {
  92. cy.server()
  93. cy.route({ url: '**/replicas', method: 'POST' }).as('replica')
  94. cy.get('button').contains('Finish').click()
  95. cy.wait('@replica')
  96. })
  97. it('Shows running replica page', () => {
  98. cy.getById('statusPill-RUNNING').should('exist')
  99. })
  100. it('Cancels replica execution', () => {
  101. cy.server()
  102. cy.getById('executions-cancelButton').click()
  103. cy.route({ url: '**/actions', method: 'POST' }).as('cancel')
  104. cy.getById('aModal-yesButton').click()
  105. cy.wait('@cancel')
  106. cy.get('div[data-test-id="dcHeader-statusPill-ERROR"]', { timeout: 120000 })
  107. })
  108. it('Should show in usage message when trying to delete', () => {
  109. cy.getById('dcHeader-backButton').click()
  110. cy.getById('navigation-smallMenuItem-endpoints').click()
  111. cy.getById('endpointListItem-content-e2e-azure-test').click()
  112. cy.getById('edContent-deleteButton').click()
  113. cy.getById('alertModal').should('contain', 'The endpoint can\'t be deleted because it is in use by replicas or migrations.')
  114. cy.getById('aModal-dismissButton').click()
  115. })
  116. })