Openstack - OCI Migration.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 to OCI Migration', () => {
  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-Migration').click()
  26. cy.get('#app').should('contain', 'New Migration')
  27. })
  28. it('Chooses Openstack 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-openstack').first().click()
  33. cy.get('div').contains('e2e-openstack-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.openstackSearchText)
  41. // cy.wait('@search')
  42. cy.getById('wInstances-instanceItem').contains(config.wizard.instancesSearch.openstackSearchText)
  43. cy.getById('wInstances-instanceItem').its('length').should('be.gt', 0)
  44. cy.getById('wInstances-instanceItem').eq(config.wizard.instancesSearch.openstackItemIndex).click()
  45. })
  46. it('Chooses OCI as Target Cloud', () => {
  47. cy.server()
  48. cy.get('button').contains('Next').click()
  49. cy.getById('wEndpointList-dropdown-oci').first().click()
  50. cy.route({ url: '**/destination-options', method: 'GET' }).as('destOptions')
  51. cy.get('div').contains('e2e-oci-test').click()
  52. cy.wait('@destOptions')
  53. })
  54. it('Fills OCI migration info', () => {
  55. cy.get('button').contains('Next').click()
  56. cy.getById('wOptionsField-enumDropdown-compartment').click()
  57. cy.getById('dropdownListItem').contains(config.wizard.oci.compartment).click()
  58. cy.getById('wOptionsField-enumDropdown-availability_domain').click()
  59. cy.server()
  60. cy.route({ url: '**/destination-options**', method: 'GET' }).as('destOptions')
  61. cy.getById('dropdownListItem').contains(config.wizard.oci.availabilityDomain).click()
  62. cy.wait('@destOptions')
  63. cy.getById('wOptionsField-enumDropdown-migr_subnet_id').click()
  64. cy.getById('dropdownListItem').contains(config.wizard.oci.migrSubnetId).click()
  65. })
  66. it('Selects first available network mapping', () => {
  67. cy.server()
  68. cy.route({ url: '**/networks**', method: 'GET' }).as('networks')
  69. cy.route({ url: '**/instances/**', method: 'GET' }).as('instances')
  70. cy.get('button').contains('Next').click()
  71. cy.wait(['@networks', '@instances'])
  72. cy.get('button').contains('Next').should('be.disabled')
  73. cy.getById('networkItem').its('length').should('be.gt', 0)
  74. cy.get('div[value="Select ..."]').first().click()
  75. cy.getById('dropdownListItem').first().click()
  76. cy.get('button').contains('Next').should('not.be.disabled')
  77. })
  78. it('Shows summary page', () => {
  79. cy.get('button').contains('Next').click()
  80. cy.get('#app').should('contain', 'Summary')
  81. cy.get('#app').should('contain', 'e2e-openstack-test')
  82. cy.get('#app').should('contain', 'e2e-oci-test')
  83. cy.get('#app').should('contain', 'Coriolis Migration')
  84. cy.get('#app').should('contain', 'Migration Target Options')
  85. cy.getById('wSummary-optionValue-compartment').should('contain', 'ocid1.compartment')
  86. cy.getById('wSummary-optionValue-availability_domain').should('contain', config.wizard.oci.availabilityDomain)
  87. cy.getById('wSummary-optionValue-migr_subnet_id').should('contain', 'ocid1.subnet')
  88. })
  89. it('Executes migration', () => {
  90. cy.server()
  91. cy.route({ url: '**/migrations', method: 'POST' }).as('migration')
  92. cy.get('button').contains('Finish').click()
  93. cy.wait('@migration')
  94. })
  95. it('Shows running migration page', () => {
  96. cy.getById('statusPill-RUNNING').should('exist')
  97. })
  98. it('Cancels migration', () => {
  99. cy.getById('dcHeader-actionButton').click()
  100. cy.get('*[data-test-id="actionDropdown-listItem-Cancel"]', { timeout: 10000 }).click()
  101. cy.server()
  102. cy.route({ url: '**/actions', method: 'POST' }).as('cancel')
  103. cy.getById('aModal-yesButton').click()
  104. cy.wait('@cancel')
  105. cy.get('div[data-test-id="dcHeader-statusPill-ERROR"]', { timeout: 120000 })
  106. })
  107. it('Deletes migration', () => {
  108. cy.getById('dcHeader-actionButton').click()
  109. cy.getById('actionDropdown-listItem-Delete Migration').click()
  110. cy.server()
  111. cy.route({ url: '**/migrations/**', method: 'DELETE' }).as('delete')
  112. cy.getById('aModal-yesButton').click()
  113. cy.wait('@delete')
  114. })
  115. })