From 545b5be7d4a4724f3b35d03fd5e83ede2bf2e81f Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:17:08 -0800 Subject: [PATCH 1/4] Remove the deprecated plugins file --- frontend/cypress.config.ts | 18 ++++++++++++------ frontend/cypress/plugins/index.js | 13 ------------- 2 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 frontend/cypress/plugins/index.js diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index 14d36fc74..4bdbd257d 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'cypress' +import { defineConfig } from 'cypress'; export default defineConfig({ projectId: 'ry4br7', @@ -12,12 +12,18 @@ export default defineConfig({ }, chromeWebSecurity: 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) + setupNodeEvents(on: any, config: any) { + const fs = require('fs'); + const CONFIG_FILE = 'mempool-frontend-config.json'; + if (fs.existsSync(CONFIG_FILE)) { + let contents = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8')); + config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool'; + } else { + config.env.BASE_MODULE = 'mempool'; + } + return config; }, baseUrl: 'http://localhost:4200', specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', }, -}) +}); diff --git a/frontend/cypress/plugins/index.js b/frontend/cypress/plugins/index.js deleted file mode 100644 index 11f43df95..000000000 --- a/frontend/cypress/plugins/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const fs = require('fs'); - -const CONFIG_FILE = 'mempool-frontend-config.json'; - -module.exports = (on, config) => { - if (fs.existsSync(CONFIG_FILE)) { - let contents = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8')); - config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool'; - } else { - config.env.BASE_MODULE = 'mempool'; - } - return config; -} From d87fd9552390c0d9f116c3dd10c8c1dc4619f71f Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:17:26 -0800 Subject: [PATCH 2/4] Bump Cypress to v12.7.0 --- frontend/package-lock.json | 44 ++++++++++++++++++++++++++++++-------- frontend/package.json | 4 ++-- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f4ae62701..6372f9af6 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -58,7 +58,7 @@ }, "optionalDependencies": { "@cypress/schematic": "^2.4.0", - "cypress": "^12.3.0", + "cypress": "^12.7.0", "cypress-fail-on-console-error": "~4.0.2", "cypress-wait-until": "^1.7.2", "mock-socket": "~9.1.5", @@ -7010,9 +7010,9 @@ "peer": true }, "node_modules/cypress": { - "version": "12.3.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.3.0.tgz", - "integrity": "sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw==", + "version": "12.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.7.0.tgz", + "integrity": "sha512-7rq+nmhzz0u6yabCFyPtADU2OOrYt6pvUau9qV7xyifJ/hnsaw/vkr0tnLlcuuQKUAOC1v1M1e4Z0zG7S0IAvA==", "hasInstallScript": true, "optional": true, "dependencies": { @@ -7033,7 +7033,7 @@ "commander": "^5.1.0", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", "eventemitter2": "6.4.7", "execa": "4.1.0", @@ -7159,6 +7159,23 @@ "node": ">= 6" } }, + "node_modules/cypress/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "optional": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/cypress/node_modules/execa": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", @@ -22276,9 +22293,9 @@ "peer": true }, "cypress": { - "version": "12.3.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.3.0.tgz", - "integrity": "sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw==", + "version": "12.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.7.0.tgz", + "integrity": "sha512-7rq+nmhzz0u6yabCFyPtADU2OOrYt6pvUau9qV7xyifJ/hnsaw/vkr0tnLlcuuQKUAOC1v1M1e4Z0zG7S0IAvA==", "optional": true, "requires": { "@cypress/request": "^2.88.10", @@ -22298,7 +22315,7 @@ "commander": "^5.1.0", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", "eventemitter2": "6.4.7", "execa": "4.1.0", @@ -22382,6 +22399,15 @@ "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "optional": true }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "optional": true, + "requires": { + "ms": "2.1.2" + } + }, "execa": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index e42c1bd8f..f23866d06 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -110,7 +110,7 @@ }, "optionalDependencies": { "@cypress/schematic": "^2.4.0", - "cypress": "^12.3.0", + "cypress": "^12.7.0", "cypress-fail-on-console-error": "~4.0.2", "cypress-wait-until": "^1.7.2", "mock-socket": "~9.1.5", @@ -119,4 +119,4 @@ "scarfSettings": { "enabled": false } -} +} \ No newline at end of file From 5d976eff7526dba585bbaf93270f5ceb8671acd3 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:17:48 -0800 Subject: [PATCH 3/4] Fix linting on bisq spec --- frontend/cypress/e2e/bisq/bisq.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/cypress/e2e/bisq/bisq.spec.ts b/frontend/cypress/e2e/bisq/bisq.spec.ts index e81b17185..ac3b747b2 100644 --- a/frontend/cypress/e2e/bisq/bisq.spec.ts +++ b/frontend/cypress/e2e/bisq/bisq.spec.ts @@ -1,5 +1,5 @@ describe('Bisq', () => { - const baseModule = Cypress.env("BASE_MODULE"); + const baseModule = Cypress.env('BASE_MODULE'); const basePath = ''; beforeEach(() => { @@ -20,7 +20,7 @@ describe('Bisq', () => { cy.waitForSkeletonGone(); }); - describe("transactions", () => { + describe('transactions', () => { it('loads the transactions screen', () => { cy.visit(`${basePath}`); cy.waitForSkeletonGone(); @@ -30,9 +30,9 @@ describe('Bisq', () => { }); const filters = [ - "Asset listing fee", "Blind vote", "Compensation request", - "Genesis", "Irregular", "Lockup", "Pay trade fee", "Proof of burn", - "Proposal", "Reimbursement request", "Transfer BSQ", "Unlock", "Vote reveal" + 'Asset listing fee', 'Blind vote', 'Compensation request', + 'Genesis', 'Irregular', 'Lockup', 'Pay trade fee', 'Proof of burn', + 'Proposal', 'Reimbursement request', 'Transfer BSQ', 'Unlock', 'Vote reveal' ]; filters.forEach((filter) => { it.only(`filters the transaction screen by ${filter}`, () => { @@ -49,7 +49,7 @@ describe('Bisq', () => { }); }); - it("filters using multiple criteria", () => { + it('filters using multiple criteria', () => { const filters = ['Proposal', 'Lockup', 'Unlock']; cy.visit(`${basePath}/transactions`); cy.waitForSkeletonGone(); From 0e338a2c6467ff6a7b8b61281b30b041f3497909 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:33:12 -0800 Subject: [PATCH 4/4] Fix linting on more specs --- frontend/cypress/e2e/liquid/liquid.spec.ts | 2 +- .../cypress/e2e/liquidtestnet/liquidtestnet.spec.ts | 2 +- frontend/cypress/e2e/mainnet/mainnet.spec.ts | 12 ++++++------ frontend/cypress/e2e/mainnet/mining.spec.ts | 2 +- frontend/cypress/e2e/signet/signet.spec.ts | 8 ++++---- frontend/cypress/e2e/testnet/testnet.spec.ts | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/cypress/e2e/liquid/liquid.spec.ts b/frontend/cypress/e2e/liquid/liquid.spec.ts index e24b19fad..e22a9b94e 100644 --- a/frontend/cypress/e2e/liquid/liquid.spec.ts +++ b/frontend/cypress/e2e/liquid/liquid.spec.ts @@ -1,5 +1,5 @@ describe('Liquid', () => { - const baseModule = Cypress.env("BASE_MODULE"); + const baseModule = Cypress.env('BASE_MODULE'); const basePath = ''; beforeEach(() => { diff --git a/frontend/cypress/e2e/liquidtestnet/liquidtestnet.spec.ts b/frontend/cypress/e2e/liquidtestnet/liquidtestnet.spec.ts index 5cf6cf331..e1172e51a 100644 --- a/frontend/cypress/e2e/liquidtestnet/liquidtestnet.spec.ts +++ b/frontend/cypress/e2e/liquidtestnet/liquidtestnet.spec.ts @@ -1,5 +1,5 @@ describe('Liquid Testnet', () => { - const baseModule = Cypress.env("BASE_MODULE"); + const baseModule = Cypress.env('BASE_MODULE'); const basePath = '/testnet'; beforeEach(() => { diff --git a/frontend/cypress/e2e/mainnet/mainnet.spec.ts b/frontend/cypress/e2e/mainnet/mainnet.spec.ts index 5ab3f9ce9..71a35ba86 100644 --- a/frontend/cypress/e2e/mainnet/mainnet.spec.ts +++ b/frontend/cypress/e2e/mainnet/mainnet.spec.ts @@ -1,6 +1,6 @@ -import { emitMempoolInfo, dropWebSocket } from "../../support/websocket"; +import { emitMempoolInfo, dropWebSocket } from '../../support/websocket'; -const baseModule = Cypress.env("BASE_MODULE"); +const baseModule = Cypress.env('BASE_MODULE'); //Credit: https://github.com/bahmutov/cypress-examples/blob/6cedb17f83a3bb03ded13cf1d6a3f0656ca2cdf5/docs/recipes/overlapping-elements.md @@ -339,14 +339,14 @@ describe('Mainnet', () => { cy.visit('/'); cy.waitForSkeletonGone(); - cy.changeNetwork("testnet"); - cy.changeNetwork("signet"); - cy.changeNetwork("mainnet"); + cy.changeNetwork('testnet'); + cy.changeNetwork('signet'); + cy.changeNetwork('mainnet'); }); it.skip('loads the dashboard with the skeleton blocks', () => { cy.mockMempoolSocket(); - cy.visit("/"); + cy.visit('/'); cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible'); diff --git a/frontend/cypress/e2e/mainnet/mining.spec.ts b/frontend/cypress/e2e/mainnet/mining.spec.ts index 5c60f3a8c..cfaa40015 100644 --- a/frontend/cypress/e2e/mainnet/mining.spec.ts +++ b/frontend/cypress/e2e/mainnet/mining.spec.ts @@ -1,4 +1,4 @@ -const baseModule = Cypress.env("BASE_MODULE"); +const baseModule = Cypress.env('BASE_MODULE'); describe('Mainnet - Mining Features', () => { beforeEach(() => { diff --git a/frontend/cypress/e2e/signet/signet.spec.ts b/frontend/cypress/e2e/signet/signet.spec.ts index 2f09bc4b8..03cfb3480 100644 --- a/frontend/cypress/e2e/signet/signet.spec.ts +++ b/frontend/cypress/e2e/signet/signet.spec.ts @@ -1,6 +1,6 @@ -import { emitMempoolInfo } from "../../support/websocket"; +import { emitMempoolInfo } from '../../support/websocket'; -const baseModule = Cypress.env("BASE_MODULE"); +const baseModule = Cypress.env('BASE_MODULE'); describe('Signet', () => { beforeEach(() => { @@ -25,7 +25,7 @@ describe('Signet', () => { it.skip('loads the dashboard with the skeleton blocks', () => { cy.mockMempoolSocket(); - cy.visit("/signet"); + cy.visit('/signet'); cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible'); @@ -35,7 +35,7 @@ describe('Signet', () => { emitMempoolInfo({ 'params': { - "network": "signet" + 'network': 'signet' } }); diff --git a/frontend/cypress/e2e/testnet/testnet.spec.ts b/frontend/cypress/e2e/testnet/testnet.spec.ts index b05229a28..4236ca207 100644 --- a/frontend/cypress/e2e/testnet/testnet.spec.ts +++ b/frontend/cypress/e2e/testnet/testnet.spec.ts @@ -1,6 +1,6 @@ -import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket"; +import { emitMempoolInfo } from '../../support/websocket'; -const baseModule = Cypress.env("BASE_MODULE"); +const baseModule = Cypress.env('BASE_MODULE'); describe('Testnet', () => { beforeEach(() => { @@ -25,7 +25,7 @@ describe('Testnet', () => { it.skip('loads the dashboard with the skeleton blocks', () => { cy.mockMempoolSocket(); - cy.visit("/testnet"); + cy.visit('/testnet'); cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');