From f9ee30cd5786f9f01730f01b2131d0a6dd88c332 Mon Sep 17 00:00:00 2001 From: Zhenja Date: Fri, 3 Jun 2022 08:16:36 +0200 Subject: [PATCH 1/6] upd cypress version --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 901f7714..d3d0e5fa 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@cypress/browserify-preprocessor": "^3.0.2", "@testing-library/cypress": "^8.0.2", "axios": "^0.26.1", - "cypress": "^9.5.4", + "cypress": "^10.0.2", "cypress-cucumber-preprocessor": "^4.3.1", "firebase-tools": "^10.7.0", "ts-proto": "^1.110.4", diff --git a/yarn.lock b/yarn.lock index d732dc05..48f3549e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7233,10 +7233,10 @@ cypress-cucumber-preprocessor@^4.3.1: minimist "^1.2.5" through "^2.3.8" -cypress@^9.5.4: - version "9.5.4" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.5.4.tgz#49d9272f62eba12f2314faf29c2a865610e87550" - integrity sha512-6AyJAD8phe7IMvOL4oBsI9puRNOWxZjl8z1lgixJMcgJ85JJmyKeP6uqNA0dI1z14lmJ7Qklf2MOgP/xdAqJ/Q== +cypress@^10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.0.2.tgz#6aeac1923d534f9850d57dad9496f9ea74034a23" + integrity sha512-7+C4KHYBcfZrawss+Gt5PlS35rfc6ySc59JcHDVsIMm1E/J35dqE41UEXpdtwIq3549umCerNWnFADzqib4kcA== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" From b3b2532a6394b8827d53c1449e6adedc0dcc6743 Mon Sep 17 00:00:00 2001 From: Zhenja Date: Mon, 6 Jun 2022 22:28:55 +0200 Subject: [PATCH 2/6] small progress --- cypress.config.ts | 8 ++++++++ cypress/{dev-config.json => config/dev.json} | 0 .../{localhost-config.json => config/local.json} | 0 cypress/{stage-config.json => config/stage.json} | 0 .../createTrustedCircle.spec.cy.ts} | 0 cypress/{integration => e2e}/exchangeTokens.feature | 0 .../volumeTests/addNonVotingMemeber.spec.cy.ts} | 0 .../volumeTests/createAsset.spec.cy.ts} | 0 .../volumeTests/createTC.spec.cy.ts} | 0 .../{ => integration}/page-object/TMarketPage.ts | 0 .../page-object/TrustedCirclesPage.ts | 0 .../{ => integration}/steps-definition/T-Market.ts | 0 .../steps-definition/TrustedCircles.ts | 2 +- cypress/plugins/index.ts | 13 +++++++++++-- cypress/support/{index.ts => e2e.ts} | 0 package.json | 12 ++++++------ yarn.lock | 8 ++++---- 17 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 cypress.config.ts rename cypress/{dev-config.json => config/dev.json} (100%) rename cypress/{localhost-config.json => config/local.json} (100%) rename cypress/{stage-config.json => config/stage.json} (100%) rename cypress/{integration/createTrustedCircle.ts => e2e/createTrustedCircle.spec.cy.ts} (100%) rename cypress/{integration => e2e}/exchangeTokens.feature (100%) rename cypress/{integration/volumeTests/addNonVotingMemeber.ts => e2e/volumeTests/addNonVotingMemeber.spec.cy.ts} (100%) rename cypress/{integration/volumeTests/createAsset.ts => e2e/volumeTests/createAsset.spec.cy.ts} (100%) rename cypress/{integration/volumeTests/createTC.ts => e2e/volumeTests/createTC.spec.cy.ts} (100%) rename cypress/{ => integration}/page-object/TMarketPage.ts (100%) rename cypress/{ => integration}/page-object/TrustedCirclesPage.ts (100%) rename cypress/{ => integration}/steps-definition/T-Market.ts (100%) rename cypress/{ => integration}/steps-definition/TrustedCircles.ts (98%) rename cypress/support/{index.ts => e2e.ts} (100%) diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 00000000..8e990c22 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "cypress"; + +export default defineConfig({ + e2e: { + specPattern: "cypress/e2e/**/*.*", + excludeSpecPattern: "**/page-object/*,**/steps-definition/*", + }, +}); diff --git a/cypress/dev-config.json b/cypress/config/dev.json similarity index 100% rename from cypress/dev-config.json rename to cypress/config/dev.json diff --git a/cypress/localhost-config.json b/cypress/config/local.json similarity index 100% rename from cypress/localhost-config.json rename to cypress/config/local.json diff --git a/cypress/stage-config.json b/cypress/config/stage.json similarity index 100% rename from cypress/stage-config.json rename to cypress/config/stage.json diff --git a/cypress/integration/createTrustedCircle.ts b/cypress/e2e/createTrustedCircle.spec.cy.ts similarity index 100% rename from cypress/integration/createTrustedCircle.ts rename to cypress/e2e/createTrustedCircle.spec.cy.ts diff --git a/cypress/integration/exchangeTokens.feature b/cypress/e2e/exchangeTokens.feature similarity index 100% rename from cypress/integration/exchangeTokens.feature rename to cypress/e2e/exchangeTokens.feature diff --git a/cypress/integration/volumeTests/addNonVotingMemeber.ts b/cypress/e2e/volumeTests/addNonVotingMemeber.spec.cy.ts similarity index 100% rename from cypress/integration/volumeTests/addNonVotingMemeber.ts rename to cypress/e2e/volumeTests/addNonVotingMemeber.spec.cy.ts diff --git a/cypress/integration/volumeTests/createAsset.ts b/cypress/e2e/volumeTests/createAsset.spec.cy.ts similarity index 100% rename from cypress/integration/volumeTests/createAsset.ts rename to cypress/e2e/volumeTests/createAsset.spec.cy.ts diff --git a/cypress/integration/volumeTests/createTC.ts b/cypress/e2e/volumeTests/createTC.spec.cy.ts similarity index 100% rename from cypress/integration/volumeTests/createTC.ts rename to cypress/e2e/volumeTests/createTC.spec.cy.ts diff --git a/cypress/page-object/TMarketPage.ts b/cypress/integration/page-object/TMarketPage.ts similarity index 100% rename from cypress/page-object/TMarketPage.ts rename to cypress/integration/page-object/TMarketPage.ts diff --git a/cypress/page-object/TrustedCirclesPage.ts b/cypress/integration/page-object/TrustedCirclesPage.ts similarity index 100% rename from cypress/page-object/TrustedCirclesPage.ts rename to cypress/integration/page-object/TrustedCirclesPage.ts diff --git a/cypress/steps-definition/T-Market.ts b/cypress/integration/steps-definition/T-Market.ts similarity index 100% rename from cypress/steps-definition/T-Market.ts rename to cypress/integration/steps-definition/T-Market.ts diff --git a/cypress/steps-definition/TrustedCircles.ts b/cypress/integration/steps-definition/TrustedCircles.ts similarity index 98% rename from cypress/steps-definition/TrustedCircles.ts rename to cypress/integration/steps-definition/TrustedCircles.ts index f7fe7587..88d57e90 100644 --- a/cypress/steps-definition/TrustedCircles.ts +++ b/cypress/integration/steps-definition/TrustedCircles.ts @@ -91,7 +91,7 @@ And("I select Whitelist Pair option", () => { And("I select Trading Pair from drop down", () => { cy.get(trustedCirclesPage.getDialogHeaderName()).should("contain.text", "Whitelist Pair"); cy.get(trustedCirclesPage.getDialogStepActiveNumber()).should("have.text", "2"); - cy.wait(4000) //Wait to finishing fetch (probably bug) + cy.wait(4000); //Wait to finishing fetch (probably bug) cy.get(trustedCirclesPage.getProposalOptionDropDown()).click(); cy.get(trustedCirclesPage.getFirstItemFromDropDown()).click(); }); diff --git a/cypress/plugins/index.ts b/cypress/plugins/index.ts index 396c3867..fbce1ec6 100644 --- a/cypress/plugins/index.ts +++ b/cypress/plugins/index.ts @@ -19,6 +19,13 @@ const browserify = require("@cypress/browserify-preprocessor"); const cucumber = require("cypress-cucumber-preprocessor").default; const resolve = require("resolve"); +const fs = require("fs-extra"); +const path = require("path"); + +function getConfigurationByFile(file) { + const pathToConfigFile = path.resolve("..", "config", `${file}.json`); + return fs.readJson(pathToConfigFile); +} module.exports = (on, config) => { const options = { @@ -34,6 +41,8 @@ module.exports = (on, config) => { return null; }, }); -}; + // accept a configFile value or use development by default + const file = config.env.configFile || "stage"; -export {}; + return getConfigurationByFile(file); +}; diff --git a/cypress/support/index.ts b/cypress/support/e2e.ts similarity index 100% rename from cypress/support/index.ts rename to cypress/support/e2e.ts diff --git a/package.json b/package.json index d3d0e5fa..79d00954 100644 --- a/package.json +++ b/package.json @@ -91,12 +91,12 @@ "compile": "tsc", "format": "prettier --write --loglevel warn \"./src/**/*.ts{,x}\" --ignore-path \"./.custom-prettierignore\"", "proto": "./scripts/proto/get-proto.sh && ./scripts/proto/codegen.sh && prettier --write --loglevel warn \"./src/codec/**/*.ts\"", - "cy:open:local": "cypress open --config-file cypress/localhost-config.json", - "cy:open:dev": "cypress open --config-file cypress/dev-config.json", - "cy:open:stage": "cypress open --config-file cypress/stage-config.json", - "cy:dev": "npx cypress run --browser chrome --config-file cypress/dev-config.json --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'", - "cy:stage": "npx cypress run --browser chrome --config-file cypress/stage-config.json --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'", - "cy:local": "yarn start:local & wait-on http://localhost:3000 && cypress run --browser chrome --config-file cypress/localhost-config.json --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'" + "cy:open:local": "cypress open --env configFile=local", + "cy:open:dev": "cypress open --env configFile=dev", + "cy:open:stage": "cypress open --env configFile=stage", + "cy:dev": "npx cypress run --browser chrome --env configFile=dev --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'", + "cy:stage": "npx cypress run --browser chrome --env configFile=stage --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'", + "cy:local": "yarn start:local & wait-on http://localhost:3000 && cypress run --browser chrome --env configFile=local --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'" }, "browserslist": [ "last 2 chrome versions", diff --git a/yarn.lock b/yarn.lock index 48f3549e..bc1bac49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7233,10 +7233,10 @@ cypress-cucumber-preprocessor@^4.3.1: minimist "^1.2.5" through "^2.3.8" -cypress@^10.0.2: - version "10.0.2" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.0.2.tgz#6aeac1923d534f9850d57dad9496f9ea74034a23" - integrity sha512-7+C4KHYBcfZrawss+Gt5PlS35rfc6ySc59JcHDVsIMm1E/J35dqE41UEXpdtwIq3549umCerNWnFADzqib4kcA== +cypress@^10.0.3: + version "10.0.3" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.0.3.tgz#889b4bef863b7d1ef1b608b85b964394ad350c5f" + integrity sha512-8C82XTybsEmJC9POYSNITGUhMLCRwB9LadP0x33H+52QVoBjhsWvIzrI+ybCe0+TyxaF0D5/9IL2kSTgjqCB9A== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" From df0ee7fd8271451f19d0337c32e4732502358a6c Mon Sep 17 00:00:00 2001 From: ebazhanov Date: Sun, 12 Jun 2022 22:29:41 +0200 Subject: [PATCH 3/6] next attempt#2 --- .circleci/config.yml | 22 ++++----- .gitignore | 4 +- cypress.config.ts | 11 ++++- cypress/config/dev.json | 13 ----- cypress/config/local.json | 12 ----- cypress/config/stage.json | 13 ----- cypress/fixtures/example.json | 5 -- cypress/plugins/index.ts | 48 ------------------- .../features}/exchangeTokens.feature | 0 .../page-object/TMarketPage.ts | 0 .../page-object/TrustedCirclesPage.ts | 0 e2e/plugins/index.js | 12 +++++ .../steps-definition/T-Market.ts | 0 .../steps-definition/TrustedCircles.ts | 0 {cypress => e2e}/support/commands.ts | 0 {cypress => e2e}/support/e2e.ts | 0 .../tests}/createTrustedCircle.spec.cy.ts | 0 .../addNonVotingMemeber.spec.cy.ts | 0 .../tests}/volumeTests/createAsset.spec.cy.ts | 0 .../tests}/volumeTests/createTC.spec.cy.ts | 0 package.json | 16 +++---- yarn.lock | 31 +++++++++--- 22 files changed, 66 insertions(+), 121 deletions(-) delete mode 100644 cypress/config/dev.json delete mode 100644 cypress/config/local.json delete mode 100644 cypress/config/stage.json delete mode 100644 cypress/fixtures/example.json delete mode 100644 cypress/plugins/index.ts rename {cypress/e2e => e2e/features}/exchangeTokens.feature (100%) rename {cypress/integration => e2e}/page-object/TMarketPage.ts (100%) rename {cypress/integration => e2e}/page-object/TrustedCirclesPage.ts (100%) create mode 100644 e2e/plugins/index.js rename {cypress/integration => e2e}/steps-definition/T-Market.ts (100%) rename {cypress/integration => e2e}/steps-definition/TrustedCircles.ts (100%) rename {cypress => e2e}/support/commands.ts (100%) rename {cypress => e2e}/support/e2e.ts (100%) rename {cypress/e2e => e2e/tests}/createTrustedCircle.spec.cy.ts (100%) rename {cypress/e2e => e2e/tests}/volumeTests/addNonVotingMemeber.spec.cy.ts (100%) rename {cypress/e2e => e2e/tests}/volumeTests/createAsset.spec.cy.ts (100%) rename {cypress/e2e => e2e/tests}/volumeTests/createTC.spec.cy.ts (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index b04cbbd0..f3f7d9a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,11 +128,11 @@ jobs: - ~/.cache - run: yarn cy:dev - store_artifacts: - name: Uploading cypress/videos artifacts - path: cypress/videos + name: Uploading e2e/videos artifacts + path: e2e/videos - store_artifacts: - name: Uploading cypress/screenshots artifacts - path: cypress/screenshots + name: Uploading e2e/screenshots artifacts + path: e2e/screenshots cy-stage: docker: @@ -156,11 +156,11 @@ jobs: - ~/.cache - run: yarn cy:stage - store_artifacts: - name: Uploading cypress/videos artifacts - path: cypress/videos + name: Uploading e2e/videos artifacts + path: e2e/videos - store_artifacts: - name: Uploading cypress/screenshots artifacts - path: cypress/screenshots + name: Uploading e2e/screenshots artifacts + path: e2e/screenshots cy-local: machine: @@ -210,7 +210,7 @@ jobs: keys: - v1-dependencies-{{ checksum "yarn.lock" }} - run: yarn install --frozen-lockfile - - run: yarn cypress install + - run: yarn e2e install - save_cache: name: Save Yarn Package Cache key: v1-dependencies-{{ checksum "yarn.lock" }} @@ -229,9 +229,9 @@ jobs: - run: command: yarn cy:local - store_artifacts: - path: cypress/videos + path: e2e/videos - store_artifacts: - path: cypress/screenshots + path: e2e/screenshots - run: name: Stop chains command: | diff --git a/.gitignore b/.gitignore index 33aeb57e..1f66a435 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,8 @@ .env.production.local .eslintcache .idea -cypress/videos -cypress/screenshots +e2e/videos +e2e/screenshots npm-debug.log* yarn-debug.log* diff --git a/cypress.config.ts b/cypress.config.ts index 8e990c22..288ba134 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -2,7 +2,14 @@ import { defineConfig } from "cypress"; export default defineConfig({ e2e: { - specPattern: "cypress/e2e/**/*.*", - excludeSpecPattern: "**/page-object/*,**/steps-definition/*", + // We've imported your old e2e plugins here. + // You may want to clean this up later by importing these. + setupNodeEvents(on, config) { + return require("./e2e/plugins/index.js")(on, config); + }, + specPattern: "./e2e/features/*.feature", + excludeSpecPattern: "**/*.{js,ts}", + supportFile: false, + video: false, }, }); diff --git a/cypress/config/dev.json b/cypress/config/dev.json deleted file mode 100644 index 1612af8d..00000000 --- a/cypress/config/dev.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "baseUrl": "https://dev.tgrade.finance/", - "defaultCommandTimeout": 25000, - "viewportWidth": 1920, - "viewportHeight": 1080, - "watchForFileChanges": false, - "video": true, - "videoCompression": false, - "screenshotOnRunFailure": true, - "retries": { - "runMode": 0 - } -} diff --git a/cypress/config/local.json b/cypress/config/local.json deleted file mode 100644 index 0ade2cb5..00000000 --- a/cypress/config/local.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "baseUrl": "http://localhost:3000/", - "defaultCommandTimeout": 80000, - "viewportWidth": 1920, - "viewportHeight": 1080, - "watchForFileChanges": false, - "video": true, - "screenshotOnRunFailure": true, - "retries": { - "runMode": 0 - } -} diff --git a/cypress/config/stage.json b/cypress/config/stage.json deleted file mode 100644 index d948ec25..00000000 --- a/cypress/config/stage.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "baseUrl": "https://staging.tgrade.finance/", - "defaultCommandTimeout": 25000, - "viewportWidth": 1920, - "viewportHeight": 1080, - "watchForFileChanges": false, - "video": true, - "videoCompression": false, - "screenshotOnRunFailure": true, - "retries": { - "runMode": 0 - } -} diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index 02e42543..00000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/cypress/plugins/index.ts b/cypress/plugins/index.ts deleted file mode 100644 index fbce1ec6..00000000 --- a/cypress/plugins/index.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// -// *********************************************************** -// This example plugins/index.ts can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -/** - * @type {Cypress.PluginConfig} - */ -// eslint-disable-next-line no-unused-vars -const browserify = require("@cypress/browserify-preprocessor"); -const cucumber = require("cypress-cucumber-preprocessor").default; -const resolve = require("resolve"); -const fs = require("fs-extra"); -const path = require("path"); - -function getConfigurationByFile(file) { - const pathToConfigFile = path.resolve("..", "config", `${file}.json`); - return fs.readJson(pathToConfigFile); -} - -module.exports = (on, config) => { - const options = { - ...browserify.defaultOptions, - typescript: resolve.sync("typescript", { baseDir: config.projectRoot }), - }; - on("file:preprocessor", cucumber(options)); - - on("task", { - log(message) { - console.log(message); - - return null; - }, - }); - // accept a configFile value or use development by default - const file = config.env.configFile || "stage"; - - return getConfigurationByFile(file); -}; diff --git a/cypress/e2e/exchangeTokens.feature b/e2e/features/exchangeTokens.feature similarity index 100% rename from cypress/e2e/exchangeTokens.feature rename to e2e/features/exchangeTokens.feature diff --git a/cypress/integration/page-object/TMarketPage.ts b/e2e/page-object/TMarketPage.ts similarity index 100% rename from cypress/integration/page-object/TMarketPage.ts rename to e2e/page-object/TMarketPage.ts diff --git a/cypress/integration/page-object/TrustedCirclesPage.ts b/e2e/page-object/TrustedCirclesPage.ts similarity index 100% rename from cypress/integration/page-object/TrustedCirclesPage.ts rename to e2e/page-object/TrustedCirclesPage.ts diff --git a/e2e/plugins/index.js b/e2e/plugins/index.js new file mode 100644 index 00000000..8bacc262 --- /dev/null +++ b/e2e/plugins/index.js @@ -0,0 +1,12 @@ +const browserify = require("@cypress/browserify-preprocessor"); +const cucumber = require("cypress-cucumber-preprocessor").default; +const resolve = require("resolve"); + +module.exports = (on, config) => { + const options = { + ...browserify.defaultOptions, + typescript: resolve.sync("typescript", { baseDir: config.projectRoot }), + }; + + on("file:preprocessor", cucumber(options)); +}; diff --git a/cypress/integration/steps-definition/T-Market.ts b/e2e/steps-definition/T-Market.ts similarity index 100% rename from cypress/integration/steps-definition/T-Market.ts rename to e2e/steps-definition/T-Market.ts diff --git a/cypress/integration/steps-definition/TrustedCircles.ts b/e2e/steps-definition/TrustedCircles.ts similarity index 100% rename from cypress/integration/steps-definition/TrustedCircles.ts rename to e2e/steps-definition/TrustedCircles.ts diff --git a/cypress/support/commands.ts b/e2e/support/commands.ts similarity index 100% rename from cypress/support/commands.ts rename to e2e/support/commands.ts diff --git a/cypress/support/e2e.ts b/e2e/support/e2e.ts similarity index 100% rename from cypress/support/e2e.ts rename to e2e/support/e2e.ts diff --git a/cypress/e2e/createTrustedCircle.spec.cy.ts b/e2e/tests/createTrustedCircle.spec.cy.ts similarity index 100% rename from cypress/e2e/createTrustedCircle.spec.cy.ts rename to e2e/tests/createTrustedCircle.spec.cy.ts diff --git a/cypress/e2e/volumeTests/addNonVotingMemeber.spec.cy.ts b/e2e/tests/volumeTests/addNonVotingMemeber.spec.cy.ts similarity index 100% rename from cypress/e2e/volumeTests/addNonVotingMemeber.spec.cy.ts rename to e2e/tests/volumeTests/addNonVotingMemeber.spec.cy.ts diff --git a/cypress/e2e/volumeTests/createAsset.spec.cy.ts b/e2e/tests/volumeTests/createAsset.spec.cy.ts similarity index 100% rename from cypress/e2e/volumeTests/createAsset.spec.cy.ts rename to e2e/tests/volumeTests/createAsset.spec.cy.ts diff --git a/cypress/e2e/volumeTests/createTC.spec.cy.ts b/e2e/tests/volumeTests/createTC.spec.cy.ts similarity index 100% rename from cypress/e2e/volumeTests/createTC.spec.cy.ts rename to e2e/tests/volumeTests/createTC.spec.cy.ts diff --git a/package.json b/package.json index 79d00954..51c5e415 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@testing-library/user-event": "^13.5.0", "@types/jest": "^27.0.2", "@types/ledgerhq__hw-transport-webusb": "^4.70.1", - "@types/node": "^16.11.6", + "@types/node": "^17.0.42", "@types/react": "^17.0.33", "@types/react-burger-menu": "^2.8.2", "@types/react-dom": "^17.0.10", @@ -62,11 +62,13 @@ }, "devDependencies": { "@cypress/browserify-preprocessor": "^3.0.2", + "@cypress/webpack-preprocessor": "^5.12.0", "@testing-library/cypress": "^8.0.2", "axios": "^0.26.1", - "cypress": "^10.0.2", + "cypress": "^10.1.0", "cypress-cucumber-preprocessor": "^4.3.1", "firebase-tools": "^10.7.0", + "resolve": "^1.22.0", "ts-proto": "^1.110.4", "wait-on": "^6.0.1" }, @@ -91,12 +93,8 @@ "compile": "tsc", "format": "prettier --write --loglevel warn \"./src/**/*.ts{,x}\" --ignore-path \"./.custom-prettierignore\"", "proto": "./scripts/proto/get-proto.sh && ./scripts/proto/codegen.sh && prettier --write --loglevel warn \"./src/codec/**/*.ts\"", - "cy:open:local": "cypress open --env configFile=local", - "cy:open:dev": "cypress open --env configFile=dev", - "cy:open:stage": "cypress open --env configFile=stage", - "cy:dev": "npx cypress run --browser chrome --env configFile=dev --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'", - "cy:stage": "npx cypress run --browser chrome --env configFile=stage --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'", - "cy:local": "yarn start:local & wait-on http://localhost:3000 && cypress run --browser chrome --env configFile=local --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'" + "cy:open:local": "e2e open", + "cy:local": "yarn start:local & wait-on http://localhost:3000 && e2e run --browser chrome --spec 'e2e/integration/volumeTests/**.ts', 'e2e/integration/exchangeTokens.feature'" }, "browserslist": [ "last 2 chrome versions", @@ -104,6 +102,6 @@ "last 2 safari versions" ], "cypress-cucumber-preprocessor": { - "step_definitions": "cypress/steps-definition/" + "step_definitions": "e2e/steps-definition/" } } diff --git a/yarn.lock b/yarn.lock index bc1bac49..b995df92 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2707,6 +2707,15 @@ tunnel-agent "^0.6.0" uuid "^8.3.2" +"@cypress/webpack-preprocessor@^5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.12.0.tgz#231f6c86423237e17eaf12ce6193d4b67290b852" + integrity sha512-D/eLKKlgx6c/307FaCmjZGjFA64G29aA8KcCy6WqpNK/bSnRdPquMW2plemIsT/B80TK2DDKzZX/H3FcS41ZDA== + dependencies: + bluebird "3.7.1" + debug "^4.3.2" + lodash "^4.17.20" + "@cypress/xvfb@^1.2.4": version "1.2.4" resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.4.tgz#2daf42e8275b39f4aa53c14214e557bd14e7748a" @@ -3748,7 +3757,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== -"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@^16.11.6": +"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0": version "16.11.6" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae" integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w== @@ -3763,6 +3772,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.10.tgz#774f43868964f3cfe4ced1f5417fe15818a4eaea" integrity sha512-6iihJ/Pp5fsFJ/aEDGyvT4pHGmCpq7ToQ/yf4bl5SbVAvwpspYJ+v3jO7n8UyjhQVHTy+KNszOozDdv+O6sovQ== +"@types/node@^17.0.42": + version "17.0.42" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.42.tgz#d7e8f22700efc94d125103075c074396b5f41f9b" + integrity sha512-Q5BPGyGKcvQgAMbsr7qEGN/kIPN6zZecYYABeTDBizOsau+2NMdSVTar9UQw21A2+JyA2KRNDYaYrPB0Rpk2oQ== + "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" @@ -5311,6 +5325,11 @@ blob-util@^2.0.2: resolved "https://registry.yarnpkg.com/blob-util/-/blob-util-2.0.2.tgz#3b4e3c281111bb7f11128518006cdc60b403a1eb" integrity sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ== +bluebird@3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de" + integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg== + bluebird@^3.4.1, bluebird@^3.5.5, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" @@ -7233,10 +7252,10 @@ cypress-cucumber-preprocessor@^4.3.1: minimist "^1.2.5" through "^2.3.8" -cypress@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.0.3.tgz#889b4bef863b7d1ef1b608b85b964394ad350c5f" - integrity sha512-8C82XTybsEmJC9POYSNITGUhMLCRwB9LadP0x33H+52QVoBjhsWvIzrI+ybCe0+TyxaF0D5/9IL2kSTgjqCB9A== +cypress@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.1.0.tgz#6514a26c721822a02bc194e9a7f72c3142aea174" + integrity sha512-aQ4JVZVib4Xd9FZW8IRZfKelUvqF4y5A+oUbNvn8TlsBmEfIg3m5Xd6Mt6PVU/jHiVJ9Psl905B3ZPnrDcmyuQ== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -16111,7 +16130,7 @@ resolve@1.18.1: is-core-module "^2.0.0" path-parse "^1.0.6" -resolve@^1.1.4, resolve@^1.3.3, resolve@^1.4.0: +resolve@^1.1.4, resolve@^1.22.0, resolve@^1.3.3, resolve@^1.4.0: version "1.22.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== From 9194e73641e8a3c182f8cda226e8facd501da2d6 Mon Sep 17 00:00:00 2001 From: ebazhanov Date: Sun, 12 Jun 2022 22:32:32 +0200 Subject: [PATCH 4/6] improve config --- cypress.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cypress.config.ts b/cypress.config.ts index 288ba134..b4e57c06 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -7,9 +7,12 @@ export default defineConfig({ setupNodeEvents(on, config) { return require("./e2e/plugins/index.js")(on, config); }, + baseUrl: "http://localhost:3000", specPattern: "./e2e/features/*.feature", excludeSpecPattern: "**/*.{js,ts}", supportFile: false, - video: false, + video: true, + screenshotOnRunFailure: true, + watchForFileChanges: false, }, }); From 42111e91e0b5258d209bf7be01d306b77afce1d5 Mon Sep 17 00:00:00 2001 From: Zhenja Date: Sun, 12 Jun 2022 23:48:14 +0200 Subject: [PATCH 5/6] next part of improvements --- .gitignore | 4 ++-- cypress.config.ts | 7 +++---- .../integration}/features/exchangeTokens.feature | 0 .../integration}/tests/createTrustedCircle.spec.cy.ts | 2 +- .../tests/volumeTests/addNonVotingMemeber.spec.cy.ts | 2 +- .../tests/volumeTests/createAsset.spec.cy.ts | 4 ++-- .../integration}/tests/volumeTests/createTC.spec.cy.ts | 2 +- {e2e => cypress}/page-object/TMarketPage.ts | 0 {e2e => cypress}/page-object/TrustedCirclesPage.ts | 0 e2e/plugins/index.js => cypress/plugins/index.ts | 0 {e2e => cypress}/steps-definition/T-Market.ts | 0 {e2e => cypress}/steps-definition/TrustedCircles.ts | 0 {e2e => cypress}/support/commands.ts | 0 {e2e => cypress}/support/e2e.ts | 1 + package.json | 9 +++++---- yarn.lock | 8 ++++---- 16 files changed, 20 insertions(+), 19 deletions(-) rename {e2e => cypress/integration}/features/exchangeTokens.feature (100%) rename {e2e => cypress/integration}/tests/createTrustedCircle.spec.cy.ts (97%) rename {e2e => cypress/integration}/tests/volumeTests/addNonVotingMemeber.spec.cy.ts (98%) rename {e2e => cypress/integration}/tests/volumeTests/createAsset.spec.cy.ts (94%) rename {e2e => cypress/integration}/tests/volumeTests/createTC.spec.cy.ts (97%) rename {e2e => cypress}/page-object/TMarketPage.ts (100%) rename {e2e => cypress}/page-object/TrustedCirclesPage.ts (100%) rename e2e/plugins/index.js => cypress/plugins/index.ts (100%) rename {e2e => cypress}/steps-definition/T-Market.ts (100%) rename {e2e => cypress}/steps-definition/TrustedCircles.ts (100%) rename {e2e => cypress}/support/commands.ts (100%) rename {e2e => cypress}/support/e2e.ts (93%) diff --git a/.gitignore b/.gitignore index 1f66a435..33aeb57e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,8 @@ .env.production.local .eslintcache .idea -e2e/videos -e2e/screenshots +cypress/videos +cypress/screenshots npm-debug.log* yarn-debug.log* diff --git a/cypress.config.ts b/cypress.config.ts index b4e57c06..e1cc91c3 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -2,14 +2,13 @@ import { defineConfig } from "cypress"; export default defineConfig({ e2e: { - // We've imported your old e2e plugins here. + // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. setupNodeEvents(on, config) { - return require("./e2e/plugins/index.js")(on, config); + return require("./cypress/plugins")(on, config); }, baseUrl: "http://localhost:3000", - specPattern: "./e2e/features/*.feature", - excludeSpecPattern: "**/*.{js,ts}", + specPattern: "./cypress/integration/**/**/", supportFile: false, video: true, screenshotOnRunFailure: true, diff --git a/e2e/features/exchangeTokens.feature b/cypress/integration/features/exchangeTokens.feature similarity index 100% rename from e2e/features/exchangeTokens.feature rename to cypress/integration/features/exchangeTokens.feature diff --git a/e2e/tests/createTrustedCircle.spec.cy.ts b/cypress/integration/tests/createTrustedCircle.spec.cy.ts similarity index 97% rename from e2e/tests/createTrustedCircle.spec.cy.ts rename to cypress/integration/tests/createTrustedCircle.spec.cy.ts index 3ff229e7..3034d165 100644 --- a/e2e/tests/createTrustedCircle.spec.cy.ts +++ b/cypress/integration/tests/createTrustedCircle.spec.cy.ts @@ -1,6 +1,6 @@ import moment from "moment"; -import { TrustedCirclesPage } from "../page-object/TrustedCirclesPage"; +import { TrustedCirclesPage } from "../../page-object/TrustedCirclesPage"; const trustedCirclesPage = new TrustedCirclesPage(); const currentTime = moment().unix(); diff --git a/e2e/tests/volumeTests/addNonVotingMemeber.spec.cy.ts b/cypress/integration/tests/volumeTests/addNonVotingMemeber.spec.cy.ts similarity index 98% rename from e2e/tests/volumeTests/addNonVotingMemeber.spec.cy.ts rename to cypress/integration/tests/volumeTests/addNonVotingMemeber.spec.cy.ts index feb78e17..2628da49 100644 --- a/e2e/tests/volumeTests/addNonVotingMemeber.spec.cy.ts +++ b/cypress/integration/tests/volumeTests/addNonVotingMemeber.spec.cy.ts @@ -2,7 +2,7 @@ import { Random } from "@cosmjs/crypto"; import { Bech32 } from "@cosmjs/encoding"; import moment from "moment"; -import { TrustedCirclesPage } from "../../page-object/TrustedCirclesPage"; +import { TrustedCirclesPage } from "../../../page-object/TrustedCirclesPage"; const trustedCirclesPage = new TrustedCirclesPage(); const currentTime = moment().unix(); diff --git a/e2e/tests/volumeTests/createAsset.spec.cy.ts b/cypress/integration/tests/volumeTests/createAsset.spec.cy.ts similarity index 94% rename from e2e/tests/volumeTests/createAsset.spec.cy.ts rename to cypress/integration/tests/volumeTests/createAsset.spec.cy.ts index d317b536..90c6513b 100644 --- a/e2e/tests/volumeTests/createAsset.spec.cy.ts +++ b/cypress/integration/tests/volumeTests/createAsset.spec.cy.ts @@ -1,5 +1,5 @@ -import { TMarketPage } from "../../page-object/TMarketPage"; -import { TrustedCirclesPage } from "../../page-object/TrustedCirclesPage"; +import { TMarketPage } from "../../../page-object/TMarketPage"; +import { TrustedCirclesPage } from "../../../page-object/TrustedCirclesPage"; const trustedCirclesPage = new TrustedCirclesPage(); const tMarketPage = new TMarketPage(); diff --git a/e2e/tests/volumeTests/createTC.spec.cy.ts b/cypress/integration/tests/volumeTests/createTC.spec.cy.ts similarity index 97% rename from e2e/tests/volumeTests/createTC.spec.cy.ts rename to cypress/integration/tests/volumeTests/createTC.spec.cy.ts index 13a88c7f..bf9b20ef 100644 --- a/e2e/tests/volumeTests/createTC.spec.cy.ts +++ b/cypress/integration/tests/volumeTests/createTC.spec.cy.ts @@ -1,6 +1,6 @@ import moment from "moment"; -import { TrustedCirclesPage } from "../../page-object/TrustedCirclesPage"; +import { TrustedCirclesPage } from "../../../page-object/TrustedCirclesPage"; const trustedCirclesPage = new TrustedCirclesPage(); const currentTime = moment().unix(); diff --git a/e2e/page-object/TMarketPage.ts b/cypress/page-object/TMarketPage.ts similarity index 100% rename from e2e/page-object/TMarketPage.ts rename to cypress/page-object/TMarketPage.ts diff --git a/e2e/page-object/TrustedCirclesPage.ts b/cypress/page-object/TrustedCirclesPage.ts similarity index 100% rename from e2e/page-object/TrustedCirclesPage.ts rename to cypress/page-object/TrustedCirclesPage.ts diff --git a/e2e/plugins/index.js b/cypress/plugins/index.ts similarity index 100% rename from e2e/plugins/index.js rename to cypress/plugins/index.ts diff --git a/e2e/steps-definition/T-Market.ts b/cypress/steps-definition/T-Market.ts similarity index 100% rename from e2e/steps-definition/T-Market.ts rename to cypress/steps-definition/T-Market.ts diff --git a/e2e/steps-definition/TrustedCircles.ts b/cypress/steps-definition/TrustedCircles.ts similarity index 100% rename from e2e/steps-definition/TrustedCircles.ts rename to cypress/steps-definition/TrustedCircles.ts diff --git a/e2e/support/commands.ts b/cypress/support/commands.ts similarity index 100% rename from e2e/support/commands.ts rename to cypress/support/commands.ts diff --git a/e2e/support/e2e.ts b/cypress/support/e2e.ts similarity index 93% rename from e2e/support/e2e.ts rename to cypress/support/e2e.ts index d8f88f1d..25ab0551 100644 --- a/e2e/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -15,6 +15,7 @@ // Import commands.ts using ES2015 syntax: import "./commands"; +import "@testing-library/cypress/add-commands"; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/package.json b/package.json index 51c5e415..b7dc72c7 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "devDependencies": { "@cypress/browserify-preprocessor": "^3.0.2", "@cypress/webpack-preprocessor": "^5.12.0", - "@testing-library/cypress": "^8.0.2", + "@testing-library/cypress": "^8.0.3", "axios": "^0.26.1", "cypress": "^10.1.0", "cypress-cucumber-preprocessor": "^4.3.1", @@ -93,8 +93,8 @@ "compile": "tsc", "format": "prettier --write --loglevel warn \"./src/**/*.ts{,x}\" --ignore-path \"./.custom-prettierignore\"", "proto": "./scripts/proto/get-proto.sh && ./scripts/proto/codegen.sh && prettier --write --loglevel warn \"./src/codec/**/*.ts\"", - "cy:open:local": "e2e open", - "cy:local": "yarn start:local & wait-on http://localhost:3000 && e2e run --browser chrome --spec 'e2e/integration/volumeTests/**.ts', 'e2e/integration/exchangeTokens.feature'" + "cy:open:local": "cypress open", + "cy:local": "yarn start:local & wait-on http://localhost:3000 && e2e run --browser chrome --spec 'cypress/integration/volumeTests/**.ts', 'cypress/integration/exchangeTokens.feature'" }, "browserslist": [ "last 2 chrome versions", @@ -102,6 +102,7 @@ "last 2 safari versions" ], "cypress-cucumber-preprocessor": { - "step_definitions": "e2e/steps-definition/" + "nonGlobalStepDefinitions": false, + "step_definitions": "./cypress/steps-definition/" } } diff --git a/yarn.lock b/yarn.lock index b995df92..7e266e24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3518,10 +3518,10 @@ dependencies: defer-to-connect "^1.0.1" -"@testing-library/cypress@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@testing-library/cypress/-/cypress-8.0.2.tgz#b13f0ff2424dec4368b6670dfbfb7e43af8eefc9" - integrity sha512-KVdm7n37sg/A4e3wKMD4zUl0NpzzVhx06V9Tf0hZHZ7nrZ4yFva6Zwg2EFF1VzHkEfN/ahUzRtT1qiW+vuWnJw== +"@testing-library/cypress@^8.0.3": + version "8.0.3" + resolved "https://registry.yarnpkg.com/@testing-library/cypress/-/cypress-8.0.3.tgz#24ab34df34d7896866603ade705afbdd186e273c" + integrity sha512-nY2YaSbmuPo5k6kL0iLj/pGPPfka3iwb3kpTx8QN/vOCns92Saz9wfACqB8FJzcR7+lfA4d5HUOWqmTddBzczg== dependencies: "@babel/runtime" "^7.14.6" "@testing-library/dom" "^8.1.0" From ab016c8c9852e4fc7a262037e876a932c96311b8 Mon Sep 17 00:00:00 2001 From: Zhenja Date: Wed, 15 Jun 2022 10:14:27 +0200 Subject: [PATCH 6/6] remove `spec` from file names --- .../{createTrustedCircle.spec.cy.ts => createTrustedCircle.cy.ts} | 0 .../{addNonVotingMemeber.spec.cy.ts => addNonVotingMemeber.cy.ts} | 0 .../volumeTests/{createAsset.spec.cy.ts => createAsset.cy.ts} | 0 .../tests/volumeTests/{createTC.spec.cy.ts => createTC.cy.ts} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename cypress/integration/tests/{createTrustedCircle.spec.cy.ts => createTrustedCircle.cy.ts} (100%) rename cypress/integration/tests/volumeTests/{addNonVotingMemeber.spec.cy.ts => addNonVotingMemeber.cy.ts} (100%) rename cypress/integration/tests/volumeTests/{createAsset.spec.cy.ts => createAsset.cy.ts} (100%) rename cypress/integration/tests/volumeTests/{createTC.spec.cy.ts => createTC.cy.ts} (100%) diff --git a/cypress/integration/tests/createTrustedCircle.spec.cy.ts b/cypress/integration/tests/createTrustedCircle.cy.ts similarity index 100% rename from cypress/integration/tests/createTrustedCircle.spec.cy.ts rename to cypress/integration/tests/createTrustedCircle.cy.ts diff --git a/cypress/integration/tests/volumeTests/addNonVotingMemeber.spec.cy.ts b/cypress/integration/tests/volumeTests/addNonVotingMemeber.cy.ts similarity index 100% rename from cypress/integration/tests/volumeTests/addNonVotingMemeber.spec.cy.ts rename to cypress/integration/tests/volumeTests/addNonVotingMemeber.cy.ts diff --git a/cypress/integration/tests/volumeTests/createAsset.spec.cy.ts b/cypress/integration/tests/volumeTests/createAsset.cy.ts similarity index 100% rename from cypress/integration/tests/volumeTests/createAsset.spec.cy.ts rename to cypress/integration/tests/volumeTests/createAsset.cy.ts diff --git a/cypress/integration/tests/volumeTests/createTC.spec.cy.ts b/cypress/integration/tests/volumeTests/createTC.cy.ts similarity index 100% rename from cypress/integration/tests/volumeTests/createTC.spec.cy.ts rename to cypress/integration/tests/volumeTests/createTC.cy.ts