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

Merge pull request #269 from smiclea/cypress

Cypress `wait` commands refactor, Electron support
Dorin Paslaru 7 лет назад
Родитель
Сommit
a47dc4fe64
18 измененных файлов с 37 добавлено и 53 удалено
  1. 1 1
      cypress.json
  2. 2 2
      package.json
  3. 1 2
      private/cypress/integration/3 - duplicate endpoints/Duplicate Azure Endpoint.js
  4. 1 2
      private/cypress/integration/3 - duplicate endpoints/Duplicate OCI Endpoint.js
  5. 1 2
      private/cypress/integration/4 - migrations and replicas/Openstack -> OCI Migration.js
  6. 1 2
      private/cypress/integration/4 - migrations and replicas/VmWare -> Azure Replica/1 - Create replica.js
  7. 1 2
      private/cypress/integration/4 - migrations and replicas/VmWare -> Openstack Migration.js
  8. 1 2
      private/cypress/integration/5 - delete endpoints/Delete Azure endpoint.js
  9. 1 2
      private/cypress/integration/5 - delete endpoints/Delete OCI endpoint.js
  10. 1 2
      private/cypress/integration/5 - delete endpoints/Delete Openstack and VmWare endpoints.js
  11. 1 2
      private/cypress/integration/6 - users and projects/1 - Create a project.js
  12. 1 3
      private/cypress/integration/6 - users and projects/2 - Add a new user as a member.js
  13. 1 2
      private/cypress/integration/6 - users and projects/3 - Add existing user as a member.js
  14. 1 2
      private/cypress/integration/6 - users and projects/4 - Create a user.js
  15. 2 4
      private/cypress/integration/6 - users and projects/5 - Edit and delete user.js
  16. 1 2
      private/cypress/integration/6 - users and projects/6 - Edit and delete project.js
  17. 2 2
      src/components/molecules/Modal/Modal.jsx
  18. 17 17
      yarn.lock

+ 1 - 1
cypress.json

@@ -10,5 +10,5 @@
   "viewportHeight": 900,
   "defaultCommandTimeout": 7000,
   "execTimeout": 5000,
-  "requestTimeout": 20000
+  "responseTimeout": 60000
 }

+ 2 - 2
package.json

@@ -37,7 +37,7 @@
     "@storybook/react": "^3.2.15",
     "babel-eslint": "^8.0.1",
     "babel-jest": "^21.2.0",
-    "cypress": "3.0.2",
+    "cypress": "3.0.3",
     "enzyme": "^3.1.0",
     "enzyme-adapter-react-16": "^1.0.4",
     "eslint": "^4.8.0",
@@ -104,4 +104,4 @@
     "webpack-blocks-happypack": "^0.1.3",
     "webpack-blocks-split-vendor": "^0.2.1"
   }
-}
+}

+ 1 - 2
private/cypress/integration/3 - duplicate endpoints/Duplicate Azure Endpoint.js

@@ -50,8 +50,7 @@ describe('Duplicate Azure Endpoint', () => {
     cy.route({ url: '**/replicas/detail', method: 'GET' }).as('replicas')
     cy.route({ url: '**/migrations/detail', method: 'GET' }).as('migrations')
     cy.get('button[data-test-id="edContent-deleteButton"]').click()
-    cy.wait('@replicas')
-    cy.wait('@migrations')
+    cy.wait(['@replicas', '@migrations'])
     cy.route({ url: '**/secrets/**', method: 'DELETE' }).as('delete')
     cy.get('button[data-test-id="aModal-yesButton"]').click()
     cy.wait('@delete')

+ 1 - 2
private/cypress/integration/3 - duplicate endpoints/Duplicate OCI Endpoint.js

@@ -50,8 +50,7 @@ describe('Duplicate OCI Endpoint', () => {
     cy.route({ url: '**/replicas/detail', method: 'GET' }).as('replicas')
     cy.route({ url: '**/migrations/detail', method: 'GET' }).as('migrations')
     cy.get('button[data-test-id="edContent-deleteButton"]').click()
-    cy.wait('@replicas')
-    cy.wait('@migrations')
+    cy.wait(['@replicas', '@migrations'])
     cy.route({ url: '**/secrets/**', method: 'DELETE' }).as('delete')
     cy.get('button[data-test-id="aModal-yesButton"]').click()
     cy.wait('@delete')

+ 1 - 2
private/cypress/integration/4 - migrations and replicas/Openstack -> OCI Migration.js

@@ -78,8 +78,7 @@ describe('Create Openstack to OCI Migration', () => {
     cy.route({ url: '**/networks**', method: 'GET' }).as('networks')
     cy.route({ url: '**/instances/**', method: 'GET' }).as('instances')
     cy.get('button').contains('Next').click()
-    cy.wait('@networks')
-    cy.wait('@instances')
+    cy.wait(['@networks', '@instances'])
     cy.get('button').contains('Next').should('be.disabled')
     cy.get('div[data-test-id="networkItem"]').its('length').should('be.gt', 0)
     cy.get('div[value="Select ..."]').first().click()

+ 1 - 2
private/cypress/integration/4 - migrations and replicas/VmWare -> Azure Replica/1 - Create replica.js

@@ -71,8 +71,7 @@ describe('Create VmWare to Azure Replica', () => {
     cy.route({ url: '**/networks**', method: 'GET' }).as('networks')
     cy.route({ url: '**/instances/**', method: 'GET' }).as('instances')
     cy.get('button').contains('Next').click()
-    cy.wait('@networks')
-    cy.wait('@instances')
+    cy.wait(['@networks', '@instances'])
     cy.get('button').contains('Next').should('be.disabled')
     cy.get('div[data-test-id="networkItem"]').its('length').should('be.gt', 0)
     cy.get('div[value="Select ..."]').first().click()

+ 1 - 2
private/cypress/integration/4 - migrations and replicas/VmWare -> Openstack Migration.js

@@ -68,8 +68,7 @@ describe('Create VmWare to Openstack Migration', () => {
     cy.route({ url: '**/networks**', method: 'GET' }).as('networks')
     cy.route({ url: '**/instances/**', method: 'GET' }).as('instances')
     cy.get('button').contains('Next').click()
-    cy.wait('@networks')
-    cy.wait('@instances')
+    cy.wait(['@networks', '@instances'])
     cy.get('button').contains('Next').should('be.disabled')
     cy.get('div[data-test-id="networkItem"]').its('length').should('be.gt', 0)
     cy.get('div[value="Select ..."]').first().click()

+ 1 - 2
private/cypress/integration/5 - delete endpoints/Delete Azure endpoint.js

@@ -38,8 +38,7 @@ describe('Delete the Azure endpoint created for e2e testing', () => {
     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.wait(['@migrations', '@replicas'])
     cy.get('button').contains('Yes').click()
   })
 })

+ 1 - 2
private/cypress/integration/5 - delete endpoints/Delete OCI endpoint.js

@@ -38,8 +38,7 @@ describe('Delete the OCI endpoint created for e2e testing', () => {
     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.wait(['@migrations', '@replicas'])
     cy.get('button').contains('Yes').click()
   })
 })

+ 1 - 2
private/cypress/integration/5 - delete endpoints/Delete Openstack and VmWare endpoints.js

@@ -47,8 +47,7 @@ describe('Delete the Openstack and VmWare endpoints created for e2e testing', ()
     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.wait(['@delete', '@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)
   })

+ 1 - 2
private/cypress/integration/6 - users and projects/1 - Create a project.js

@@ -56,8 +56,7 @@ describe('Create a project', () => {
     cy.route({ url: '**/projects/', method: 'POST' }).as('addProject')
     cy.route({ url: '**/roles/**', method: 'PUT' }).as('addRole')
     cy.get('button').contains('New Project').click()
-    cy.wait('@addProject')
-    cy.wait('@addRole')
+    cy.wait(['@addProject', '@addRole'])
     cy.get('div[data-test-id="plItem-content"]').should('contain', 'cypress-project')
     cy.get('div[data-test-id="plItem-content"]').should('contain', 'Project created by Cypress')
   })

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

@@ -64,9 +64,7 @@ describe('Adds a new user as a member to the project', () => {
     cy.route({ url: '**/roles/**', method: 'PUT' }).as('addRole')
     cy.route({ url: '**/role_assignments**', method: 'GET' }).as('getRoles')
     cy.get('button[data-test-id="pmModal-addButton"]').contains('Add Member').click()
-    cy.wait('@addUser')
-    cy.wait('@addRole')
-    cy.wait('@getRoles')
+    cy.wait(['@addUser', '@addRole', '@getRoles'])
     cy.get('a[data-test-id="pdContent-users-cypress-member-user"]').its('length').should('eq', 1)
     cy.get('div[data-test-id="pdContent-roles-cypress-member-user"]').should('contain', '_member_')
   })

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

@@ -59,8 +59,7 @@ describe('Adds existing user as a member to the project', () => {
     cy.route({ url: '**/roles/**', method: 'PUT' }).as('addRoles')
     cy.route({ url: '**/role_assignments**', method: 'GET' }).as('getRoles')
     cy.get('button[data-test-id="pmModal-addButton"]').click()
-    cy.wait('@addRoles')
-    cy.wait('@getRoles')
+    cy.wait(['@addRoles', '@getRoles'])
     cy.get('div[data-test-id="pdContent-roles-cypress-member-user"]').should('contain', '_member_, admin')
   })
 

+ 1 - 2
private/cypress/integration/6 - users and projects/4 - Create a user.js

@@ -60,8 +60,7 @@ describe('Create a user', () => {
     cy.route({ url: '**/users', method: 'POST' }).as('addUser')
     cy.route({ url: '**/roles/**', method: 'PUT' }).as('addRole')
     cy.get('button').contains('New User').click()
-    cy.wait('@addUser')
-    cy.wait('@addRole')
+    cy.wait(['@addUser', '@addRole'])
     cy.get('div[data-test-id="ulItem-name"]').contains('cypress-user').should('exist')
   })
 })

+ 2 - 4
private/cypress/integration/6 - users and projects/5 - Edit and delete user.js

@@ -60,8 +60,7 @@ describe('Edit created user', () => {
     cy.route({ url: '**/users/**', method: 'PATCH' }).as('updateUser')
     cy.route({ url: '**/role_assignments**', method: 'GET' }).as('getRoles')
     cy.get('button').contains('Update User').click()
-    cy.wait('@updateUser')
-    cy.wait('@getRoles')
+    cy.wait(['@updateUser', '@getRoles'])
     cy.get('div[data-test-id="dcHeader-title"]').should('contain', 'user-cypress')
   })
 
@@ -71,8 +70,7 @@ describe('Edit created user', () => {
     cy.route({ url: '**/users/**', method: 'DELETE' }).as('deleteUser')
     cy.route({ url: '**/users', method: 'GET' }).as('getUsers')
     cy.get('button[data-test-id="aModal-yesButton"]').click()
-    cy.wait('@deleteUser')
-    cy.wait('@getUsers')
+    cy.wait(['@deleteUser', '@getUsers'])
     cy.get('div[data-test-id="ulItem-name"]').contains('user-cypress').should('not.exist')
   })
 })

+ 1 - 2
private/cypress/integration/6 - users and projects/6 - Edit and delete project.js

@@ -69,8 +69,7 @@ describe('Edit created project', () => {
     cy.route({ url: '**/projects/**', method: 'DELETE' }).as('deleteProject')
     cy.route({ url: '**/role_assignments**', method: 'GET' }).as('getRoles')
     cy.get('button[data-test-id="aModal-yesButton"]').click()
-    cy.wait('@deleteProject')
-    cy.wait('@getRoles')
+    cy.wait(['@deleteProject', '@getRoles'])
     cy.get('div[data-test-id="plItem-content"]').contains('project-cypress').should('not.exist')
   })
 })

+ 2 - 2
src/components/molecules/Modal/Modal.jsx

@@ -145,8 +145,8 @@ class NewModal extends React.Component<Props> {
     contentNode.style.top = `${top}px`
     contentNode.style.height = height
     contentNode.style.opacity = 1
-    // $FlowIssue
-    scrollableNode.scrollTo(0, scrollTop + scrollOffset)
+
+    scrollableNode.scrollTop = scrollTop + scrollOffset
   }
 
   renderTitle() {

+ 17 - 17
yarn.lock

@@ -576,9 +576,9 @@ async@1.5.0:
   version "1.5.0"
   resolved "https://registry.yarnpkg.com/async/-/async-1.5.0.tgz#2796642723573859565633fc6274444bee2f8ce3"
 
-async@2.1.4:
-  version "2.1.4"
-  resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4"
+async@2.4.0:
+  version "2.4.0"
+  resolved "https://registry.yarnpkg.com/async/-/async-2.4.0.tgz#4990200f18ea5b837c2cc4f8c031a6985c385611"
   dependencies:
     lodash "^4.14.0"
 
@@ -2657,9 +2657,9 @@ cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0":
   dependencies:
     cssom "0.3.x"
 
-cypress@3.0.2:
-  version "3.0.2"
-  resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.0.2.tgz#90caef84c91bd52b9cdf123aa76213249a289694"
+cypress@3.0.3:
+  version "3.0.3"
+  resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.0.3.tgz#b8d64d36a8c642f5343f826b6ebac312eed5a51d"
   dependencies:
     "@cypress/listr-verbose-renderer" "0.4.1"
     "@cypress/xvfb" "1.2.3"
@@ -2684,13 +2684,13 @@ cypress@3.0.2:
     executable "4.1.1"
     extract-zip "1.6.6"
     fs-extra "4.0.1"
-    getos "2.8.4"
+    getos "3.1.0"
     glob "7.1.2"
     is-ci "1.0.10"
     is-installed-globally "0.1.0"
     lazy-ass "1.6.0"
     listr "0.12.0"
-    lodash "4.17.4"
+    lodash "4.17.10"
     log-symbols "2.2.0"
     minimist "1.2.0"
     progress "1.1.8"
@@ -3850,11 +3850,11 @@ get-stream@^3.0.0:
   version "3.0.0"
   resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
 
-getos@2.8.4:
-  version "2.8.4"
-  resolved "https://registry.yarnpkg.com/getos/-/getos-2.8.4.tgz#7b8603d3619c28e38cb0fe7a4f63c3acb80d5163"
+getos@3.1.0:
+  version "3.1.0"
+  resolved "https://registry.yarnpkg.com/getos/-/getos-3.1.0.tgz#db3aa4df15a3295557ce5e81aa9e3e5cdfaa6567"
   dependencies:
-    async "2.1.4"
+    async "2.4.0"
 
 getpass@^0.1.1:
   version "0.1.7"
@@ -5315,7 +5315,11 @@ lodash.words@^3.0.0:
   dependencies:
     lodash._root "^3.0.0"
 
-lodash@4.17.4, lodash@4.x.x, lodash@^4.15.0, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1:
+lodash@4.17.10, lodash@^4.14.0:
+  version "4.17.10"
+  resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
+
+lodash@4.x.x, lodash@^4.15.0, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1:
   version "4.17.4"
   resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
 
@@ -5323,10 +5327,6 @@ lodash@^3.10.1:
   version "3.10.1"
   resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
 
-lodash@^4.14.0:
-  version "4.17.10"
-  resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
-
 log-symbols@2.2.0:
   version "2.2.0"
   resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"