Просмотр исходного кода

Add multiple deletion test to Cypress

Group VmWare and Openstack endpoints deletion into one single step using
multiple endpoints selection and deletion feature.
Sergiu Miclea 8 лет назад
Родитель
Сommit
b4ee802c96

+ 55 - 0
private/cypress/integration/5 - delete endpoints/Delete Openstack and VmWare endpoints.js

@@ -0,0 +1,55 @@
+/*
+Copyright (C) 2018  Cloudbase Solutions SRL
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Affero General Public License for more details.
+You should have received a copy of the GNU Affero General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+// @flow
+
+import config from '../../config'
+
+declare var expect: any
+
+describe('Delete the Openstack and VmWare endpoints created for e2e testing', () => {
+  before(() => {
+    cy.login()
+  })
+
+  beforeEach(() => {
+    Cypress.Cookies.preserveOnce('token', 'projectId')
+  })
+
+  it('Goes to endpoints page', () => {
+    cy.get('#app').should('contain', 'Coriolis Replicas')
+    cy.visit(`${config.nodeServer}#/endpoints`)
+    cy.get('#app').should('contain', 'Coriolis Endpoints')
+  })
+
+  it('Selects both endpoints', () => {
+    cy.get('[data-test-id="endpointListItem-checkbox-e2e-openstack-test"]').should('have.length', 1)
+    cy.get('[data-test-id="endpointListItem-checkbox-e2e-vmware-test"]').should('have.length', 1)
+    cy.get('[data-test-id="endpointListItem-checkbox-e2e-openstack-test"]').click()
+    cy.get('[data-test-id="endpointListItem-checkbox-e2e-vmware-test"]').click()
+    cy.get('[data-test-id="mainListFilter-selectionText"]').should('contain', '2 of 2')
+  })
+
+  it('Deletes selected endpoints', () => {
+    cy.get('div[data-test-id="dropdown-dropdownButton"]').contains('Select an action').click()
+    cy.get('div[data-test-id="dropdownListItem"]').contains('Delete').click()
+    cy.server()
+    cy.route({ url: '**/secrets/**', method: 'DELETE' }).as('delete')
+    cy.get('[data-test-id="aModal-yesButton"]').click()
+    cy.wait('@delete')
+    cy.wait('@delete')
+    cy.get('[data-test-id="endpointListItem-checkbox-e2e-openstack-test"]').should('have.length', 0)
+    cy.get('[data-test-id="endpointListItem-checkbox-e2e-vmware-test"]').should('have.length', 0)
+  })
+})

+ 0 - 46
private/cypress/integration/5 - delete endpoints/Delete Openstack endpoint.js

@@ -1,46 +0,0 @@
-/*
-Copyright (C) 2018  Cloudbase Solutions SRL
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of the
-License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Affero General Public License for more details.
-You should have received a copy of the GNU Affero General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-// @flow
-
-import config from '../../config'
-
-describe('Delete the Openstack endpoint created for e2e testing', () => {
-  before(() => {
-    cy.login()
-  })
-
-  beforeEach(() => {
-    Cypress.Cookies.preserveOnce('token', 'projectId')
-  })
-
-  it('Goes to endpoints page', () => {
-    cy.get('#app').should('contain', 'Coriolis Replicas')
-    cy.visit(`${config.nodeServer}#/endpoints`)
-    cy.get('#app').should('contain', 'Coriolis Endpoints')
-  })
-
-  it('Delete e2e Openstack endpoint', () => {
-    cy.get('div[data-test-id="endpointListItem-content-e2e-openstack-test"]').should('contain', 'e2e-openstack-test')
-    cy.get('div[data-test-id="endpointListItem-content-e2e-openstack-test"]').first().click()
-    cy.server()
-    cy.route({ url: '**/migrations/**', method: 'GET' }).as('migrations')
-    cy.route({ url: '**/replicas/**', method: 'GET' }).as('replicas')
-    cy.get('button').contains('Delete Endpoint').click()
-    cy.wait('@migrations')
-    cy.wait('@replicas')
-    cy.get('button').contains('Yes').click()
-  })
-})
-

+ 0 - 46
private/cypress/integration/5 - delete endpoints/Delete VmWare endpoint.js

@@ -1,46 +0,0 @@
-/*
-Copyright (C) 2018  Cloudbase Solutions SRL
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of the
-License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Affero General Public License for more details.
-You should have received a copy of the GNU Affero General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-// @flow
-
-import config from '../../config'
-
-describe('Delete the VmWare endpoint created for e2e testing', () => {
-  before(() => {
-    cy.login()
-  })
-
-  beforeEach(() => {
-    Cypress.Cookies.preserveOnce('token', 'projectId')
-  })
-
-  it('Goes to endpoints page', () => {
-    cy.get('#app').should('contain', 'Coriolis Replicas')
-    cy.visit(`${config.nodeServer}#/endpoints`)
-    cy.get('#app').should('contain', 'Coriolis Endpoints')
-  })
-
-  it('Delete e2e VmWare endpoint', () => {
-    cy.get('div[data-test-id="endpointListItem-content-e2e-vmware-test"]').should('contain', 'e2e-vmware-test')
-    cy.get('div[data-test-id="endpointListItem-content-e2e-vmware-test"]').first().click()
-    cy.server()
-    cy.route({ url: '**/migrations/**', method: 'GET' }).as('migrations')
-    cy.route({ url: '**/replicas/**', method: 'GET' }).as('replicas')
-    cy.get('button').contains('Delete Endpoint').click()
-    cy.wait('@migrations')
-    cy.wait('@replicas')
-    cy.get('button').contains('Yes').click()
-  })
-})
-

+ 1 - 1
private/cypress/integration/6 - users and projects/3 - Add existing user as a member.js

@@ -49,7 +49,7 @@ describe('Adds existing user as a member to the project', () => {
   })
 
   it('Adds existing user', () => {
-    cy.get('input[data-test-id="textInput-input"]').type('cy')
+    cy.get('input[data-test-id="acInput-text"]').type('cy')
     cy.get('div[data-test-id="ad-listItem"]').contains('cypress-member-user').click()
     cy.get('div[data-test-id="endpointField-multidropdown-role(s)"]').click()
     cy.get('div[data-test-id="dropdownListItem"]').contains('_member_').click()