diff --git a/apps/explorer-e2e/cypress.config.js b/apps/explorer-e2e/cypress.config.js new file mode 100644 index 000000000..bff3c5b62 --- /dev/null +++ b/apps/explorer-e2e/cypress.config.js @@ -0,0 +1,26 @@ +const { defineConfig } = require('cypress'); +const setupNodeEvents = require('./src/plugins/index.js'); + +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + setupNodeEvents, + baseUrl: 'http://localhost:3000', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: '**/*.feature', + excludeSpecPattern: '**/*.js', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, + env: { + environment: 'CUSTOM', + tsConfig: 'tsconfig.json', + TAGS: 'not @todo and not @ignore and not @manual', + }, +}); diff --git a/apps/explorer-e2e/cypress.json b/apps/explorer-e2e/cypress.json deleted file mode 100644 index 56edbee7e..000000000 --- a/apps/explorer-e2e/cypress.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "baseUrl": "http://localhost:3000", - "projectId": "et4snf", - "fileServerFolder": ".", - "fixturesFolder": false, - "pluginsFile": "./src/plugins/index.js", - "testFiles": "*.{ts,feature,features}", - "ignoreTestFiles": "**/*.js", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "video": true, - "videosFolder": "../../dist/cypress/apps/explorer-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/explorer-e2e/screenshots", - "chromeWebSecurity": false, - "env": { - "environment": "CUSTOM", - "tsConfig": "tsconfig.json", - "TAGS": "not @todo and not @ignore and not @manual" - } -} diff --git a/apps/explorer-e2e/project.json b/apps/explorer-e2e/project.json index 6edc32a5e..56548b049 100644 --- a/apps/explorer-e2e/project.json +++ b/apps/explorer-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/explorer-e2e/cypress.json", + "cypressConfig": "apps/explorer-e2e/cypress.config.js", "devServerTarget": "explorer:serve" }, "configurations": { diff --git a/apps/simple-trading-app-e2e/cypress.config.js b/apps/simple-trading-app-e2e/cypress.config.js new file mode 100644 index 000000000..4df3d82f1 --- /dev/null +++ b/apps/simple-trading-app-e2e/cypress.config.js @@ -0,0 +1,18 @@ +const { defineConfig } = require('cypress'); +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + baseUrl: 'http://localhost:4200', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: './src/integration/*.ts', + excludeSpecPattern: '**/*.js', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, +}); diff --git a/apps/simple-trading-app-e2e/cypress.json b/apps/simple-trading-app-e2e/cypress.json deleted file mode 100644 index a76041db9..000000000 --- a/apps/simple-trading-app-e2e/cypress.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "baseUrl": "http://localhost:4200", - "fileServerFolder": ".", - "testFiles": "*.{ts,feature,features}", - "ignoreTestFiles": "**/*.js", - "fixturesFolder": "./src/fixtures", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "pluginsFile": false, - "video": true, - "videosFolder": "../../dist/cypress/apps/simple-trading-app-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/simple-trading-app-e2e/screenshots", - "chromeWebSecurity": false, - "projectId": "et4snf" -} diff --git a/apps/simple-trading-app-e2e/project.json b/apps/simple-trading-app-e2e/project.json index 080a1350d..2603c0f51 100644 --- a/apps/simple-trading-app-e2e/project.json +++ b/apps/simple-trading-app-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/simple-trading-app-e2e/cypress.json", + "cypressConfig": "apps/simple-trading-app-e2e/cypress.config.js", "devServerTarget": "simple-trading-app:serve" }, "configurations": { diff --git a/apps/stats-e2e/cypress.config.js b/apps/stats-e2e/cypress.config.js new file mode 100644 index 000000000..d0f97a453 --- /dev/null +++ b/apps/stats-e2e/cypress.config.js @@ -0,0 +1,18 @@ +const { defineConfig } = require('cypress'); +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + baseUrl: 'http://localhost:3010', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: './src/integration/*.ts', + excludeSpecPattern: '**/*.js', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, +}); diff --git a/apps/stats-e2e/cypress.json b/apps/stats-e2e/cypress.json deleted file mode 100644 index 146fd9bd2..000000000 --- a/apps/stats-e2e/cypress.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "baseUrl": "http://localhost:3010", - "projectId": "et4snf", - "fileServerFolder": ".", - "fixturesFolder": "./src/fixtures", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "pluginsFile": false, - "video": true, - "videosFolder": "../../dist/cypress/apps/stats-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/stats-e2e/screenshots", - "chromeWebSecurity": false -} diff --git a/apps/stats-e2e/project.json b/apps/stats-e2e/project.json index fcaa00685..bafde918e 100644 --- a/apps/stats-e2e/project.json +++ b/apps/stats-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/stats-e2e/cypress.json", + "cypressConfig": "apps/stats-e2e/cypress.config.js", "devServerTarget": "stats:serve" }, "configurations": { diff --git a/apps/token-e2e/cypress.config.js b/apps/token-e2e/cypress.config.js new file mode 100644 index 000000000..8d67c0742 --- /dev/null +++ b/apps/token-e2e/cypress.config.js @@ -0,0 +1,17 @@ +const { defineConfig } = require('cypress'); +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + baseUrl: 'http://localhost:4210', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: '**/*.cy.{js,jsx,ts,tsx}', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, +}); diff --git a/apps/token-e2e/cypress.json b/apps/token-e2e/cypress.json deleted file mode 100644 index 3a1c8585c..000000000 --- a/apps/token-e2e/cypress.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "baseUrl": "http://localhost:4210", - "projectId": "et4snf", - "fileServerFolder": ".", - "fixturesFolder": "./src/fixtures", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "pluginsFile": false, - "video": true, - "videosFolder": "../../dist/cypress/apps/token-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/token-e2e/screenshots", - "chromeWebSecurity": false -} diff --git a/apps/token-e2e/project.json b/apps/token-e2e/project.json index 03fdfb16c..58e6a15e6 100644 --- a/apps/token-e2e/project.json +++ b/apps/token-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/token-e2e/cypress.json", + "cypressConfig": "apps/token-e2e/cypress.config.js", "devServerTarget": "token:serve" }, "configurations": { diff --git a/apps/token-e2e/src/integration/app.test.ts b/apps/token-e2e/src/integration/app.cy.ts similarity index 100% rename from apps/token-e2e/src/integration/app.test.ts rename to apps/token-e2e/src/integration/app.cy.ts diff --git a/apps/token-e2e/src/integration/view/home.test.js b/apps/token-e2e/src/integration/home.cy.js similarity index 96% rename from apps/token-e2e/src/integration/view/home.test.js rename to apps/token-e2e/src/integration/home.cy.js index 519fe9041..684354a89 100644 --- a/apps/token-e2e/src/integration/view/home.test.js +++ b/apps/token-e2e/src/integration/home.cy.js @@ -1,6 +1,6 @@ -import navigation from '../../locators/navigation.locators'; -import home from '../../locators/home.locators'; -import vegaToken from '../../data/vegaToken.json'; +import navigation from '../locators/navigation.locators'; +import home from '../locators/home.locators'; +import vegaToken from '../data/vegaToken.json'; context('Home Page - verify elements on page', function () { before('visit token home page', function () { diff --git a/apps/trading-e2e/cypress.config.js b/apps/trading-e2e/cypress.config.js new file mode 100644 index 000000000..f3ea716a0 --- /dev/null +++ b/apps/trading-e2e/cypress.config.js @@ -0,0 +1,48 @@ +const { defineConfig } = require('cypress'); + +module.exports = defineConfig({ + component: { + baseUrl: 'http://localhost:4200', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: '**/*.cy.{js,jsx,ts,tsx}', + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/trading-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/trading-e2e/screenshots', + chromeWebSecurity: false, + projectId: 'et4snf', + defaultCommandTimeout: 10000, + }, + e2e: { + baseUrl: 'http://localhost:4200', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: '**/*.cy.{js,jsx,ts,tsx}', + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/trading-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/trading-e2e/screenshots', + chromeWebSecurity: false, + projectId: 'et4snf', + defaultCommandTimeout: 10000, + }, + env: { + TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test', + ETHEREUM_PROVIDER_URL: + 'https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8', + VEGA_PUBLIC_KEY: + '47836c253520d2661bf5bed6339c0de08fd02cf5d4db0efee3b4373f20c7d278', + VEGA_PUBLIC_KEY2: + '1a18cdcaaa4f44a57b35a4e9b77e0701c17a476f2b407620f8c17371740cf2e4', + TRUNCATED_VEGA_PUBLIC_KEY: '47836c…c7d278', + TRUNCATED_VEGA_PUBLIC_KEY2: '1a18cd…0cf2e4', + ETHEREUM_WALLET_ADDRESS: '0x265Cc6d39a1B53d0d92068443009eE7410807158', + ETHERSCAN_URL: 'https://ropsten.etherscan.io', + tsConfig: 'tsconfig.json', + TAGS: 'not @todo and not @ignore and not @manual', + TRADING_TEST_VEGA_WALLET_PASSPHRASE: '123', + ETH_WALLET_MNEMONIC: + 'ugly gallery notice network true range brave clarify flat logic someone chunk', + }, +}); diff --git a/apps/trading-e2e/cypress.json b/apps/trading-e2e/cypress.json deleted file mode 100644 index fc00e9973..000000000 --- a/apps/trading-e2e/cypress.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "baseUrl": "http://localhost:4200", - "fileServerFolder": ".", - "fixturesFolder": false, - "pluginsFile": "./src/plugins/index.js", - "testFiles": "*.{ts,feature,features}", - "ignoreTestFiles": "**/*.js", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "video": true, - "videosFolder": "../../dist/cypress/apps/trading-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/trading-e2e/screenshots", - "chromeWebSecurity": false, - "projectId": "et4snf", - "defaultCommandTimeout": 10000, - "env": { - "TRADING_TEST_VEGA_WALLET_NAME": "UI_Trading_Test", - "ETHEREUM_PROVIDER_URL": "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8", - "VEGA_PUBLIC_KEY": "47836c253520d2661bf5bed6339c0de08fd02cf5d4db0efee3b4373f20c7d278", - "VEGA_PUBLIC_KEY2": "1a18cdcaaa4f44a57b35a4e9b77e0701c17a476f2b407620f8c17371740cf2e4", - "TRUNCATED_VEGA_PUBLIC_KEY": "47836c…c7d278", - "TRUNCATED_VEGA_PUBLIC_KEY2": "1a18cd…0cf2e4", - "ETHEREUM_WALLET_ADDRESS": "0x265Cc6d39a1B53d0d92068443009eE7410807158", - "ETHERSCAN_URL": "https://ropsten.etherscan.io", - "tsConfig": "tsconfig.json", - "TAGS": "not @todo and not @ignore and not @manual", - "TRADING_TEST_VEGA_WALLET_PASSPHRASE": "123", - "ETH_WALLET_MNEMONIC": "ugly gallery notice network true range brave clarify flat logic someone chunk" - } -} diff --git a/apps/trading-e2e/project.json b/apps/trading-e2e/project.json index da7658039..f2d777771 100644 --- a/apps/trading-e2e/project.json +++ b/apps/trading-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/trading-e2e/cypress.json", + "cypressConfig": "apps/trading-e2e/cypress.config.js", "devServerTarget": "trading:serve" }, "configurations": { diff --git a/apps/trading-e2e/src/integration/deposit.ts b/apps/trading-e2e/src/integration/deposit.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/deposit.ts rename to apps/trading-e2e/src/integration/deposit.cy.ts diff --git a/apps/trading-e2e/src/integration/global.ts b/apps/trading-e2e/src/integration/global.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/global.ts rename to apps/trading-e2e/src/integration/global.cy.ts diff --git a/apps/trading-e2e/src/integration/home.ts b/apps/trading-e2e/src/integration/home.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/home.ts rename to apps/trading-e2e/src/integration/home.cy.ts diff --git a/apps/trading-e2e/src/integration/markets.ts b/apps/trading-e2e/src/integration/markets.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/markets.ts rename to apps/trading-e2e/src/integration/markets.cy.ts diff --git a/apps/trading-e2e/src/integration/portfolio.ts b/apps/trading-e2e/src/integration/portfolio.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/portfolio.ts rename to apps/trading-e2e/src/integration/portfolio.cy.ts diff --git a/apps/trading-e2e/src/integration/trading-accounts.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/trading-accounts.ts rename to apps/trading-e2e/src/integration/trading-accounts.cy.ts diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket.ts b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/trading-deal-ticket.ts rename to apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts diff --git a/apps/trading-e2e/src/integration/trading-orders.ts b/apps/trading-e2e/src/integration/trading-orders.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/trading-orders.ts rename to apps/trading-e2e/src/integration/trading-orders.cy.ts diff --git a/apps/trading-e2e/src/integration/trading-positions.ts b/apps/trading-e2e/src/integration/trading-positions.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/trading-positions.ts rename to apps/trading-e2e/src/integration/trading-positions.cy.ts diff --git a/apps/trading-e2e/src/integration/trading-trades.ts b/apps/trading-e2e/src/integration/trading-trades.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/trading-trades.ts rename to apps/trading-e2e/src/integration/trading-trades.cy.ts diff --git a/apps/trading-e2e/src/integration/withdraw.ts b/apps/trading-e2e/src/integration/withdraw.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/withdraw.ts rename to apps/trading-e2e/src/integration/withdraw.cy.ts diff --git a/apps/trading-e2e/src/integration/withdrawals.ts b/apps/trading-e2e/src/integration/withdrawals.cy.ts similarity index 100% rename from apps/trading-e2e/src/integration/withdrawals.ts rename to apps/trading-e2e/src/integration/withdrawals.cy.ts diff --git a/apps/trading-e2e/src/plugins/index.js b/apps/trading-e2e/src/plugins/index.js deleted file mode 100644 index 97abe0be2..000000000 --- a/apps/trading-e2e/src/plugins/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/// - -const webpackPreprocessor = require('@cypress/webpack-preprocessor'); -const webpack = require('webpack'); -const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); -const nodeExternals = require('webpack-node-externals'); - -/** - * @type {Cypress.PluginConfig} - */ -module.exports = (on, config) => { - on( - 'file:preprocessor', - webpackPreprocessor({ - webpackOptions: { - resolve: { - extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'], - plugins: [ - new TsconfigPathsPlugin({ - configFile: config.env.tsConfig, - extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'], - }), - ], - fallback: { - path: require.resolve('path-browserify'), - }, - }, - module: { - rules: [ - { - test: /\.([jt])sx?$/, - loader: 'ts-loader', - exclude: [/node_modules/], - options: { - configFile: config.env.tsConfig, - // https://github.com/TypeStrong/ts-loader/pull/685 - experimentalWatchApi: true, - transpileOnly: true, - }, - }, - { - test: /\.feature$/, - use: [ - { - loader: 'cypress-cucumber-preprocessor/loader', - }, - ], - }, - { - test: /\.features$/, - use: [ - { - loader: 'cypress-cucumber-preprocessor/lib/featuresLoader', - }, - ], - }, - ], - }, - plugins: [ - new ForkTsCheckerWebpackPlugin({ - typescript: { - enabled: true, - configFile: config.env.tsConfig, - }, - }), - new webpack.ProvidePlugin({ - process: 'process/browser', - }), - ], - externals: [nodeExternals()], - }, - }) - ); -}; diff --git a/package.json b/package.json index efaa77903..398dc3a26 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "@sentry/nextjs": "^6.19.3", "@sentry/react": "^6.19.2", "@sentry/tracing": "^6.19.2", - "@vegaprotocol/vegawallet-service-api-client": "^0.4.13", "@testing-library/user-event": "^14.2.1", + "@vegaprotocol/vegawallet-service-api-client": "^0.4.13", "@walletconnect/ethereum-provider": "^1.7.5", "@web3-react/core": "8.0.20-beta.0", "@web3-react/metamask": "8.0.16-beta.0", @@ -127,7 +127,7 @@ "@typescript-eslint/parser": "5.18.0", "babel-jest": "27.2.3", "babel-loader": "8.1.0", - "cypress": "^9.5.4", + "cypress": "^10.2.0", "cypress-cucumber-preprocessor": "^4.3.1", "dotenv": "^16.0.1", "eslint": "8.12.0", diff --git a/yarn.lock b/yarn.lock index e71d7d286..c4f0f83df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10625,10 +10625,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.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"