From 735dd13f9279daf77ca05b2921348b2095407307 Mon Sep 17 00:00:00 2001 From: Reza Rahemtola Date: Sun, 26 Jun 2022 12:49:01 +0200 Subject: [PATCH] feat: Cypress updated to latest version and with `.ts` files (#27) --- cypress.config.ts | 13 +++++ cypress.json | 4 -- .../dashboard.spec.js => e2e/dashboard.cy.ts} | 2 +- .../dashboardFront.cy.ts} | 4 +- .../home.spec.js => e2e/home.cy.ts} | 0 .../login.spec.js => e2e/login.cy.ts} | 0 .../signup.spec.js => e2e/signup.cy.ts} | 2 +- .../uploadProgram.cy.ts} | 6 +-- cypress/support/{index.js => e2e.js} | 2 +- cypress/tsconfig.json | 11 ++++ package.json | 2 +- yarn.lock | 50 ++++++++++++++++++- 12 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 cypress.config.ts delete mode 100644 cypress.json rename cypress/{integration/dashboard.spec.js => e2e/dashboard.cy.ts} (97%) rename cypress/{integration/dashboardFront.spec.js => e2e/dashboardFront.cy.ts} (96%) rename cypress/{integration/home.spec.js => e2e/home.cy.ts} (100%) rename cypress/{integration/login.spec.js => e2e/login.cy.ts} (100%) rename cypress/{integration/signup.spec.js => e2e/signup.cy.ts} (99%) rename cypress/{integration/uploadProgram.js => e2e/uploadProgram.cy.ts} (94%) rename cypress/support/{index.js => e2e.js} (96%) create mode 100644 cypress/tsconfig.json diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 00000000..91f04b76 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + watchForFileChanges: false, + e2e: { + // We've imported your old cypress plugins here. + // You may want to clean this up later by importing these. + setupNodeEvents(on, config) { + return require('./cypress/plugins/index.js')(on, config) + }, + baseUrl: 'http://localhost:8080', + }, +}) diff --git a/cypress.json b/cypress.json deleted file mode 100644 index ed666c88..00000000 --- a/cypress.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "watchForFileChanges": false, - "baseUrl": "http://localhost:8080" -} \ No newline at end of file diff --git a/cypress/integration/dashboard.spec.js b/cypress/e2e/dashboard.cy.ts similarity index 97% rename from cypress/integration/dashboard.spec.js rename to cypress/e2e/dashboard.cy.ts index 89a5b28e..97ee3c7b 100644 --- a/cypress/integration/dashboard.spec.js +++ b/cypress/e2e/dashboard.cy.ts @@ -8,7 +8,7 @@ describe('Create account for DashboardView tests', () => { cy.get('#ipc-signupView-text-area') .invoke('val') .then((input) => { - dashboardSpecMnemonic = input; + dashboardSpecMnemonic = input as string; }); cy.get('#ipc-modal-close-button').click(); }); diff --git a/cypress/integration/dashboardFront.spec.js b/cypress/e2e/dashboardFront.cy.ts similarity index 96% rename from cypress/integration/dashboardFront.spec.js rename to cypress/e2e/dashboardFront.cy.ts index 110914a5..9e8ff1ac 100644 --- a/cypress/integration/dashboardFront.spec.js +++ b/cypress/e2e/dashboardFront.cy.ts @@ -1,5 +1,3 @@ -let dashboardSpecMnemonic = ''; - describe('Create account for DashboardView tests', () => { it('Connect', () => { cy.visit('/signup'); @@ -8,7 +6,7 @@ describe('Create account for DashboardView tests', () => { cy.get('#ipc-signupView-text-area') .invoke('val') .then((input) => { - dashboardSpecMnemonic = input; + dashboardSpecMnemonic = input as string; }); cy.get('#ipc-modal-close-button').click(); }); diff --git a/cypress/integration/home.spec.js b/cypress/e2e/home.cy.ts similarity index 100% rename from cypress/integration/home.spec.js rename to cypress/e2e/home.cy.ts diff --git a/cypress/integration/login.spec.js b/cypress/e2e/login.cy.ts similarity index 100% rename from cypress/integration/login.spec.js rename to cypress/e2e/login.cy.ts diff --git a/cypress/integration/signup.spec.js b/cypress/e2e/signup.cy.ts similarity index 99% rename from cypress/integration/signup.spec.js rename to cypress/e2e/signup.cy.ts index bdea7439..3735e211 100644 --- a/cypress/integration/signup.spec.js +++ b/cypress/e2e/signup.cy.ts @@ -58,7 +58,7 @@ describe('Signup with credentials Button for SignupView', () => { cy.visit('/signup'); cy.wait(1000); cy.get('#ipc-signupView-credentials-signup-button').click(); - cy.get(1000); + cy.wait(1000); cy.get('#ipc-signupView-copy-mnemonics-button').click(); }); diff --git a/cypress/integration/uploadProgram.js b/cypress/e2e/uploadProgram.cy.ts similarity index 94% rename from cypress/integration/uploadProgram.js rename to cypress/e2e/uploadProgram.cy.ts index f32da487..c32e91c6 100644 --- a/cypress/integration/uploadProgram.js +++ b/cypress/e2e/uploadProgram.cy.ts @@ -1,5 +1,3 @@ -let dashboardSpecMnemonic = ''; - describe('Create account for DashboardView tests', () => { it('Connect', () => { cy.visit('/signup'); @@ -8,7 +6,7 @@ describe('Create account for DashboardView tests', () => { cy.get('#ipc-signupView-text-area') .invoke('val') .then((input) => { - dashboardSpecMnemonic = input; + dashboardSpecMnemonic = input as string; }); cy.get('#ipc-modal-close-button').click(); }); @@ -37,4 +35,4 @@ describe('Upload a program modal for DashboardView', () => { cy.get('#ipc-modal-close-button').click(); cy.get('button').should('have.length', 10); }); -}); \ No newline at end of file +}); diff --git a/cypress/support/index.js b/cypress/support/e2e.js similarity index 96% rename from cypress/support/index.js rename to cypress/support/e2e.js index d68db96d..37a498fb 100644 --- a/cypress/support/index.js +++ b/cypress/support/e2e.js @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import './commands'; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json new file mode 100644 index 00000000..3a440bcf --- /dev/null +++ b/cypress/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["es5", "dom"], + "types": ["cypress", "node"] + }, + "include": [ + "**/*.ts", + "../node_modules/cypress-file-upload", + ] +} diff --git a/package.json b/package.json index 3fe3f56c..a2d2df1f 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "@types/react-dom": "^17.0.8", "@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/parser": "^5.29.0", - "cypress": "^9.1.1", + "cypress": "^10.2.0", "cypress-file-upload": "^5.0.8", "eslint": "^8.18.0", "eslint-config-airbnb": "^19.0.4", diff --git a/yarn.lock b/yarn.lock index c6296150..0d76a573 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3205,7 +3205,55 @@ cypress-file-upload@^5.0.8: resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz#d8824cbeaab798e44be8009769f9a6c9daa1b4a1" integrity sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g== -cypress@^9.1.1, cypress@^9.3.1: +cypress@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.2.0.tgz#ca078abfceb13be2a33cbba6e0e80ded770f542a" + integrity sha512-+i9lY5ENlfi2mJwsggzR+XASOIgMd7S/Gd3/13NCpv596n3YSplMAueBTIxNLcxDpTcIksp+9pM3UaDrJDpFqA== + dependencies: + "@cypress/request" "^2.88.10" + "@cypress/xvfb" "^1.2.4" + "@types/node" "^14.14.31" + "@types/sinonjs__fake-timers" "8.1.1" + "@types/sizzle" "^2.3.2" + arch "^2.2.0" + blob-util "^2.0.2" + bluebird "^3.7.2" + buffer "^5.6.0" + cachedir "^2.3.0" + chalk "^4.1.0" + check-more-types "^2.24.0" + cli-cursor "^3.1.0" + cli-table3 "~0.6.1" + commander "^5.1.0" + common-tags "^1.8.0" + dayjs "^1.10.4" + debug "^4.3.2" + enquirer "^2.3.6" + eventemitter2 "^6.4.3" + execa "4.1.0" + executable "^4.1.1" + extract-zip "2.0.1" + figures "^3.2.0" + fs-extra "^9.1.0" + getos "^3.2.1" + is-ci "^3.0.0" + is-installed-globally "~0.4.0" + lazy-ass "^1.6.0" + listr2 "^3.8.3" + lodash "^4.17.21" + log-symbols "^4.0.0" + minimist "^1.2.6" + ospath "^1.2.2" + pretty-bytes "^5.6.0" + proxy-from-env "1.0.0" + request-progress "^3.0.0" + semver "^7.3.2" + supports-color "^8.1.1" + tmp "~0.2.1" + untildify "^4.0.0" + yauzl "^2.10.0" + +cypress@^9.3.1: version "9.7.0" resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.7.0.tgz#bf55b2afd481f7a113ef5604aa8b693564b5e744" integrity sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==