From f52c36093e69996335ba5b0add92981012701eaf Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Fri, 22 Oct 2021 11:51:52 -0700 Subject: [PATCH 1/6] Remove old json based proxy config --- frontend/proxy.conf.json | 114 ---------------------------------- frontend/proxy.prod.conf.json | 99 ----------------------------- frontend/proxy.stg.conf.json | 100 ----------------------------- 3 files changed, 313 deletions(-) delete mode 100644 frontend/proxy.conf.json delete mode 100644 frontend/proxy.prod.conf.json delete mode 100644 frontend/proxy.stg.conf.json diff --git a/frontend/proxy.conf.json b/frontend/proxy.conf.json deleted file mode 100644 index e694f0990..000000000 --- a/frontend/proxy.conf.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "/api/v1": { - "target": "http://localhost:8999/", - "secure": false - }, - "/api/v1/ws": { - "target": "http://localhost:8999/", - "secure": false, - "ws": true - }, - "/api/": { - "target": "http://localhost:8999/", - "secure": false, - "pathRewrite": { - "^/api/": "/api/v1/" - } - }, - "/testnet/api/v1": { - "target": "http://localhost:8999/", - "secure": false, - "pathRewrite": { - "^/testnet/api/v1": "/api/v1" - } - }, - "/testnet/api/v1/ws": { - "target": "http://localhost:8999/", - "secure": false, - "ws": true, - "pathRewrite": { - "^/testnet/api": "/api/v1/ws" - } - }, - "/testnet/api/": { - "target": "http://localhost:50001/", - "secure": false, - "pathRewrite": { - "^/testnet/api": "" - } - }, - "/signet/api/v1": { - "target": "http://localhost:8999/", - "secure": false, - "pathRewrite": { - "^/signet/api/v1": "/api/v1" - } - }, - "/signet/api/v1/ws": { - "target": "http://localhost:8999/", - "secure": false, - "ws": true, - "pathRewrite": { - "^/signet/api": "/api/v1/ws" - } - }, - "/signet/api/": { - "target": "http://localhost:50001/", - "secure": false, - "pathRewrite": { - "^/signet/api": "" - } - }, - "/liquid/api/v1/ws": { - "target": "http://localhost:8999/", - "secure": false, - "ws": true, - "pathRewrite": { - "^/liquid/api": "/api/v1/ws" - } - }, - "/liquid/api/v1/": { - "target": "http://localhost:8999/", - "secure": false, - "pathRewrite": { - "^/liquid/api/": "/api/" - } - }, - "/liquid/api/": { - "target": "http://localhost:8999/", - "secure": false, - "pathRewrite": { - "^/liquid/api/": "/api/v1/" - } - }, - "/bisq/api/": { - "target": "http://localhost:8999/", - "secure": false, - "pathRewrite": { - "^/bisq/api/": "/api/v1/bisq/" - } - }, - "/bisq/api/v1/ws": { - "target": "http://localhost:8999/", - "secure": false, - "ws": true, - "pathRewrite": { - "^/bisq/api": "/api/v1/ws" - } - }, - "/resources/assets.minimal.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - }, - "/resources/assets.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - }, - "/resources/pools.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - } -} diff --git a/frontend/proxy.prod.conf.json b/frontend/proxy.prod.conf.json deleted file mode 100644 index a101ce9d5..000000000 --- a/frontend/proxy.prod.conf.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "/api/v1/ws": { - "target": "https://mempool.space", - "secure": false, - "ws": true - }, - "/api": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true, - "logLevel": "debug", - "timeout": 3600000 - }, - "/testnet/api/v1/ws": { - "target": "https://mempool.space/testnet", - "secure": false, - "ws": true, - "loglevel": "debug", - "pathRewrite": { - "^/testnet/api": "/api/v1/ws" - } - }, - "/testnet/api": { - "target": "https://mempool.space", - "secure": true, - "changeOrigin": true, - "loglevel": "debug", - "pathRewrite": { - "/testnet/api": "/testnet/api" - }, - "timeout": 3600000 - }, - "/signet/api/v1/ws": { - "target": "https://mempool.space/signet", - "secure": false, - "ws": true, - "loglevel": "debug", - "pathRewrite": { - "^/signet/api": "/api/v1/ws" - } - }, - "/signet/api": { - "target": "https://mempool.space", - "secure": true, - "changeOrigin": true, - "loglevel": "debug", - "pathRewrite": { - "/signet/api": "/signet/api" - }, - "timeout": 3600000 - }, - - "/bisq/api/v1/ws": { - "target": "https://mempool.space/bisq", - "secure": false, - "ws": true, - "pathRewrite": { - "^/bisq/api": "/api/v1/ws" - } - }, - "/bisq/api": { - "target": "https://mempool.space/bisq", - "secure": false, - "changeOrigin": true, - "pathRewrite": { - "^/bisq/api/": "/api/v1/bisq/" - }, - "timeout": 3600000 - }, - "/liquid/api/v1/ws": { - "target": "https://mempool.space", - "secure": false, - "ws": true - }, - "/liquid/api": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true, - "pathRewrite": { - "^/liquid/api/": "/liquid/api/" - }, - "timeout": 3600000 - }, - "/resources/assets.minimal.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - }, - "/resources/assets.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - }, - "/resources/pools.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - } -} \ No newline at end of file diff --git a/frontend/proxy.stg.conf.json b/frontend/proxy.stg.conf.json deleted file mode 100644 index c07122510..000000000 --- a/frontend/proxy.stg.conf.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "/api/v1/ws": { - "target": "https://mempool.ninja", - "secure": false, - "ws": true - }, - "/api/*": { - "target": "https://mempool.ninja", - "secure": false, - "changeOrigin": true, - "logLevel": "debug", - "pathRewrite": { - "^/api": "https://mempool.ninja/api" - }, - "timeout": 3600000 - }, - "/testnet/api/v1/ws": { - "target": "https://mempool.ninja/testnet", - "secure": false, - "ws": true, - "pathRewrite": { - "^/testnet/api": "/api/v1/ws" - } - }, - "/testnet/api/v1/*": { - "target": "https://mempool.ninja/testnet", - "secure": false, - "changeOrigin": true, - "pathRewrite": { - "^/testnet/api/v1": "/api/v1" - }, - "timeout": 3600000 - }, - "/signet/api/v1/ws": { - "target": "https://mempool.ninja/signet", - "secure": false, - "ws": true, - "pathRewrite": { - "^/signet/api": "/api/v1/ws" - } - }, - "/signet/api/v1/*": { - "target": "https://mempool.ninja/signet", - "secure": false, - "changeOrigin": true, - "pathRewrite": { - "^/signet/api/v1": "/api/v1" - }, - "timeout": 3600000 - }, - "/bisq/api/v1/ws": { - "target": "https://mempool.ninja/bisq", - "secure": false, - "ws": true, - "pathRewrite": { - "^/bisq/api": "/api/v1/ws" - } - }, - "/bisq/api/*": { - "target": "https://mempool.ninja/bisq", - "secure": false, - "changeOrigin": true, - "pathRewrite": { - "^/bisq/api/": "/api/v1/bisq/" - }, - "timeout": 3600000 - }, - "/liquid/api/v1/ws": { - "target": "https://mempool.ninja/liquid", - "secure": false, - "ws": true, - "pathRewrite": { - "^/liquid/api": "/api/v1/ws" - } - }, - "/liquid/api/*": { - "target": "https://mempool.ninja/liquid", - "secure": false, - "changeOrigin": true, - "pathRewrite": { - "^/liquid/api/": "/api/liquid/" - }, - "timeout": 3600000 - }, - "/resources/assets.minimal.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - }, - "/resources/assets.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - }, - "/resources/pools.json": { - "target": "https://mempool.space", - "secure": false, - "changeOrigin": true - } -} From 40914236d4d13785f729600e946cb9d07aaf85e9 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Fri, 22 Oct 2021 11:52:23 -0700 Subject: [PATCH 2/6] Update references to the JS proxy config --- frontend/angular.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/angular.json b/frontend/angular.json index e3ebc7bd2..471cd029c 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -211,11 +211,11 @@ "browserTarget": "mempool:build:production" }, "local": { - "proxyConfig": "proxy.conf.json", + "proxyConfig": "proxy.conf.js", "verbose": true }, "staging": { - "proxyConfig": "proxy.stg.conf.json", + "proxyConfig": "proxy.conf.js", "disableHostCheck": true, "host": "0.0.0.0", "verbose": true From 837992f7ea847944a27904bb1e5c800bbdf172f2 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Fri, 22 Oct 2021 11:54:28 -0700 Subject: [PATCH 3/6] Route json assets based on the BASE_MODULE --- frontend/proxy.conf.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/proxy.conf.js b/frontend/proxy.conf.js index 4869935ff..65aa0df65 100644 --- a/frontend/proxy.conf.js +++ b/frontend/proxy.conf.js @@ -15,7 +15,6 @@ try { throw new Error(e); } else { console.log(`${CONFIG_FILE_NAME} file not found, using default config`); - } } @@ -61,4 +60,20 @@ PROXY_CONFIG = [ } ]; +if (configContent && configContent.BASE_MODULE == "liquid") { + PROXY_CONFIG.push({ + context: ['/resources/pools.json', '/resources/assets.json', '/resources/assets.minimal.json'], + target: "https://liquid.network", + secure: false, + changeOrigin: true, + }); +} else { + PROXY_CONFIG.push( { + context: ['/resources/pools.json', '/resources/assets.json', '/resources/assets.minimal.json'], + target: "https://mempool.space", + secure: false, + changeOrigin: true, + }); +} + module.exports = PROXY_CONFIG; From 5139ffb4df4a5c087e694b777e23749cd19bbd5a Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 27 Oct 2021 20:32:42 -0700 Subject: [PATCH 4/6] Update e2e tests BASE_MODULE resolution --- .../cypress/integration/bisq/bisq.spec.ts | 24 +++++----- .../cypress/integration/liquid/liquid.spec.ts | 46 +++++++++---------- .../integration/mainnet/mainnet.spec.ts | 8 ++-- .../cypress/integration/signet/signet.spec.ts | 6 ++- .../integration/testnet/testnet.spec.ts | 6 ++- frontend/cypress/plugins/index.js | 15 +++++- frontend/cypress/support/commands.ts | 7 +++ frontend/proxy.conf.js | 2 +- 8 files changed, 70 insertions(+), 44 deletions(-) diff --git a/frontend/cypress/integration/bisq/bisq.spec.ts b/frontend/cypress/integration/bisq/bisq.spec.ts index 761770ac8..0271ca775 100644 --- a/frontend/cypress/integration/bisq/bisq.spec.ts +++ b/frontend/cypress/integration/bisq/bisq.spec.ts @@ -1,8 +1,8 @@ describe('Bisq', () => { - let baseModule; + const baseModule = Cypress.env("BASE_MODULE"); + const basePath = (baseModule === 'bisq') ? '' : '/bisq'; + beforeEach(() => { - baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'bisq') ? '' : '/bisq'; - cy.intercept('/sockjs-node/info*').as('socket'); cy.intercept('/bisq/api/markets/hloc?market=btc_usd&interval=day').as('hloc'); cy.intercept('/bisq/api/markets/ticker').as('ticker'); @@ -23,15 +23,15 @@ describe('Bisq', () => { }); }); - if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'liquid') { + if (baseModule === 'mempool' || baseModule === 'bisq') { it('loads the dashboard', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); }); it('loads the transactions screen', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); cy.get('li:nth-of-type(2) > a').click().then(() => { cy.get('.table > tr').should('have.length', 50); @@ -39,7 +39,7 @@ describe('Bisq', () => { }); it('loads the blocks screen', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); cy.get('li:nth-of-type(3) > a').click().then(() => { cy.wait('@blocks'); @@ -48,7 +48,7 @@ describe('Bisq', () => { }); it('loads the stats screen', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); cy.get('li:nth-of-type(4) > a').click().then(() => { cy.wait('@stats'); @@ -56,7 +56,7 @@ describe('Bisq', () => { }); it('loads the api screen', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); cy.get('li:nth-of-type(5) > a').click().then(() => { cy.get('.card').should('have.length.at.least', 1); @@ -67,7 +67,7 @@ describe('Bisq', () => { it('shows blocks pagination with 5 pages (desktop)', () => { cy.viewport(760, 800); - cy.visit(`${baseModule}/blocks`); + cy.visit(`${basePath}/blocks`); cy.waitForSkeletonGone(); cy.get('tbody tr').should('have.length', 10); // 5 pages + 4 buttons = 9 buttons @@ -76,13 +76,13 @@ describe('Bisq', () => { it('shows blocks pagination with 3 pages (mobile)', () => { cy.viewport(669, 800); - cy.visit(`${baseModule}/blocks`); + cy.visit(`${basePath}/blocks`); cy.waitForSkeletonGone(); cy.get('tbody tr').should('have.length', 10); // 3 pages + 4 buttons = 7 buttons cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7); }); } else { - it.skip("Tests cannot be run on the selected BASE_MODULE"); + it.skip(`Tests cannot be run on the selected BASE_MODULE ${baseModule}`); } }); diff --git a/frontend/cypress/integration/liquid/liquid.spec.ts b/frontend/cypress/integration/liquid/liquid.spec.ts index 26c032860..44aca078e 100644 --- a/frontend/cypress/integration/liquid/liquid.spec.ts +++ b/frontend/cypress/integration/liquid/liquid.spec.ts @@ -1,8 +1,8 @@ describe('Liquid', () => { - let baseModule; - beforeEach(() => { - baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'liquid') ? '' : '/liquid'; + const baseModule = Cypress.env("BASE_MODULE"); + const basePath = (baseModule === 'liquid') ? '' : '/liquid'; + beforeEach(() => { cy.intercept('/liquid/api/block/**').as('block'); cy.intercept('/liquid/api/blocks/').as('blocks'); cy.intercept('/liquid/api/tx/**/outspends').as('outspends'); @@ -16,30 +16,30 @@ describe('Liquid', () => { }); }); - if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'bisq') { + if (baseModule === 'mempool' || baseModule === 'liquid') { it('loads the dashboard', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); }); it('loads the blocks page', () => { - cy.visit(`${baseModule}/blocks`); + cy.visit(`${basePath}/blocks`); cy.waitForSkeletonGone(); }); it('loads a specific block page', () => { - cy.visit(`${baseModule}/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54`); + cy.visit(`${basePath}/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54`); cy.waitForSkeletonGone(); }); it('loads the graphs page', () => { - cy.visit(`${baseModule}/graphs`); + cy.visit(`${basePath}/graphs`); cy.waitForSkeletonGone(); }); it('loads the tv page - desktop', () => { - cy.visit(`${baseModule}`); + cy.visit(`${basePath}`); cy.waitForSkeletonGone(); cy.get('li:nth-of-type(3) > a').click().then(() => { cy.wait(1000); @@ -47,7 +47,7 @@ describe('Liquid', () => { }); it('loads the graphs page - mobile', () => { - cy.visit(`${baseModule}`) + cy.visit(`${basePath}`) cy.waitForSkeletonGone(); cy.get('li:nth-of-type(3) > a').click().then(() => { cy.viewport('iphone-6'); @@ -58,13 +58,13 @@ describe('Liquid', () => { describe('assets', () => { it('shows the assets screen', () => { - cy.visit(`${baseModule}/assets`); + cy.visit(`${basePath}/assets`); cy.waitForSkeletonGone(); cy.get('table tr').should('have.length.at.least', 5); }); it('allows searching assets', () => { - cy.visit(`${baseModule}/assets`); + cy.visit(`${basePath}/assets`); cy.waitForSkeletonGone(); cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => { cy.get('table tr').should('have.length', 1); @@ -72,7 +72,7 @@ describe('Liquid', () => { }); it('shows a specific asset ID', () => { - cy.visit(`${baseModule}/assets`); + cy.visit(`${basePath}/assets`); cy.waitForSkeletonGone(); cy.get('.container-xl input').click().type('Liquid AUD').then(() => { cy.get('table tr td:nth-of-type(1) a').click(); @@ -84,27 +84,27 @@ describe('Liquid', () => { describe('unblinded TX', () => { it('should not show an unblinding error message for regular txs', () => { - cy.visit(`${baseModule}/tx/82a479043ec3841e0d3f829afc8df4f0e2bbd675a13f013ea611b2fde0027d45`); + cy.visit(`${basePath}/tx/82a479043ec3841e0d3f829afc8df4f0e2bbd675a13f013ea611b2fde0027d45`); cy.waitForSkeletonGone(); cy.get('.error-unblinded' ).should('not.exist'); }); it('show unblinded TX', () => { - cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`); + cy.visit(`${basePath}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`); cy.waitForSkeletonGone(); cy.get('#table-tx-vin tr').should('have.class', 'assetBox'); cy.get('#table-tx-vout tr').should('have.class', 'assetBox'); }); it('show empty unblinded TX', () => { - cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=`); + cy.visit(`${basePath}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=`); cy.waitForSkeletonGone(); cy.get('#table-tx-vin tr').should('have.class', ''); cy.get('#table-tx-vout tr').should('have.class', ''); }); it('show invalid unblinded TX hex', () => { - cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123`); + cy.visit(`${basePath}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123`); cy.waitForSkeletonGone(); cy.get('#table-tx-vin tr').should('have.class', ''); cy.get('#table-tx-vout tr').should('have.class', ''); @@ -112,36 +112,36 @@ describe('Liquid', () => { }); it('show first unblinded vout', () => { - cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc`); + cy.visit(`${basePath}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc`); cy.waitForSkeletonGone(); cy.get('#table-tx-vout tr:first-child()').should('have.class', 'assetBox'); }); it('show second unblinded vout', () => { - cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`); + cy.visit(`${basePath}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`); cy.get('#table-tx-vout tr').should('have.class', 'assetBox'); }); it('show invalid error unblinded TX', () => { - cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3c`); + cy.visit(`${basePath}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3c`); cy.waitForSkeletonGone(); cy.get('#table-tx-vout tr').should('have.class', 'assetBox'); cy.get('.error-unblinded' ).contains('Error: Invalid blinding data.'); }); it('shows asset peg in/out and burn transactions', () => { - cy.visit(`${baseModule}/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`); + cy.visit(`${basePath}/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`); cy.waitForSkeletonGone(); cy.get('#table-tx-vout tr').not('.assetBox'); cy.get('#table-tx-vin tr').not('.assetBox'); }); it('prevents regressing issue #644', () => { - cy.visit(`${baseModule}/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82`); + cy.visit(`${basePath}/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82`); cy.waitForSkeletonGone(); }); }); } else { - it.skip("Tests cannot be run on the selected BASE_MODULE"); + it.skip(`Tests cannot be run on the selected BASE_MODULE ${baseModule}`); } }); diff --git a/frontend/cypress/integration/mainnet/mainnet.spec.ts b/frontend/cypress/integration/mainnet/mainnet.spec.ts index 5839f4f51..f700c00d9 100644 --- a/frontend/cypress/integration/mainnet/mainnet.spec.ts +++ b/frontend/cypress/integration/mainnet/mainnet.spec.ts @@ -1,5 +1,7 @@ import { emitMempoolInfo, dropWebSocket } from "../../support/websocket"; +const baseModule = Cypress.env("BASE_MODULE"); + describe('Mainnet', () => { beforeEach(() => { //cy.intercept('/sockjs-node/info*').as('socket'); @@ -20,7 +22,7 @@ describe('Mainnet', () => { }); }); - if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') { + if (baseModule === 'mempool') { it('loads the status screen', () => { cy.visit('/status'); @@ -281,7 +283,7 @@ describe('Mainnet', () => { }); }); - it.only('loads the tv screen - mobile', () => { + it('loads the tv screen - mobile', () => { cy.viewport('iphone-6'); cy.visit('/tv'); cy.waitForSkeletonGone(); @@ -363,6 +365,6 @@ describe('Mainnet', () => { }); }); } else { - it.skip("Tests cannot be run on the selected BASE_MODULE"); + it.skip(`Tests cannot be run on the selected BASE_MODULE ${baseModule}`); } }); diff --git a/frontend/cypress/integration/signet/signet.spec.ts b/frontend/cypress/integration/signet/signet.spec.ts index e10c5563d..ec2a0a852 100644 --- a/frontend/cypress/integration/signet/signet.spec.ts +++ b/frontend/cypress/integration/signet/signet.spec.ts @@ -1,5 +1,7 @@ import { emitMempoolInfo } from "../../support/websocket"; +const baseModule = Cypress.env("BASE_MODULE"); + describe('Signet', () => { beforeEach(() => { cy.intercept('/api/block-height/*').as('block-height'); @@ -9,7 +11,7 @@ describe('Signet', () => { }); - if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') { + if (baseModule === 'mempool') { it('loads the dashboard', () => { cy.visit('/signet'); cy.waitForSkeletonGone(); @@ -126,6 +128,6 @@ describe('Signet', () => { }); }); } else { - it.skip("Tests cannot be run on the selected BASE_MODULE"); + it.skip(`Tests cannot be run on the selected BASE_MODULE ${baseModule}`); } }); diff --git a/frontend/cypress/integration/testnet/testnet.spec.ts b/frontend/cypress/integration/testnet/testnet.spec.ts index d82a4d435..6e406c087 100644 --- a/frontend/cypress/integration/testnet/testnet.spec.ts +++ b/frontend/cypress/integration/testnet/testnet.spec.ts @@ -1,5 +1,7 @@ import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket"; +const baseModule = Cypress.env("BASE_MODULE"); + describe('Testnet', () => { beforeEach(() => { cy.intercept('/api/block-height/*').as('block-height'); @@ -8,7 +10,7 @@ describe('Testnet', () => { cy.intercept('/api/tx/*/outspends').as('tx-outspends'); }); - if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') { + if (baseModule === 'mempool') { it('loads the dashboard', () => { cy.visit('/testnet'); @@ -123,6 +125,6 @@ describe('Testnet', () => { }); }); } else { - it.skip("Tests cannot be run on the selected BASE_MODULE"); + it.skip(`Tests cannot be run on the selected BASE_MODULE ${baseModule}`); } }); diff --git a/frontend/cypress/plugins/index.js b/frontend/cypress/plugins/index.js index 1ee7c778d..1ae86fa18 100644 --- a/frontend/cypress/plugins/index.js +++ b/frontend/cypress/plugins/index.js @@ -1 +1,14 @@ -module.exports = (on, config) => {} +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')); + console.log(contents); + config.env.BASE_MODULE = contents.BASE_MODULE; + } else { + config.env.BASE_MODULE = 'mempool'; + } + return config; +} diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index ea5e88996..4d165e409 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -56,6 +56,13 @@ const codes = { ArrowDown: 40 } +Cypress.Commands.add("getBaseModule", () => { + return cy.task("getBaseModule").then((baseModule) => { + console.log(baseModule); + return baseModule; + }); +}); + Cypress.Commands.add('waitForSkeletonGone', () => { cy.waitUntil(() => { return Cypress.$('.skeleton-loader').length === 0; diff --git a/frontend/proxy.conf.js b/frontend/proxy.conf.js index 65aa0df65..88ad4040b 100644 --- a/frontend/proxy.conf.js +++ b/frontend/proxy.conf.js @@ -68,7 +68,7 @@ if (configContent && configContent.BASE_MODULE == "liquid") { changeOrigin: true, }); } else { - PROXY_CONFIG.push( { + PROXY_CONFIG.push({ context: ['/resources/pools.json', '/resources/assets.json', '/resources/assets.minimal.json'], target: "https://mempool.space", secure: false, From 5dab44e6c40368e46449fdcc68aeef8fea528104 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 27 Oct 2021 20:49:49 -0700 Subject: [PATCH 5/6] Cleanup Cypress config and commands --- frontend/cypress/plugins/index.js | 3 +-- frontend/cypress/support/commands.ts | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/frontend/cypress/plugins/index.js b/frontend/cypress/plugins/index.js index 1ae86fa18..11f43df95 100644 --- a/frontend/cypress/plugins/index.js +++ b/frontend/cypress/plugins/index.js @@ -5,8 +5,7 @@ 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')); - console.log(contents); - config.env.BASE_MODULE = contents.BASE_MODULE; + config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool'; } else { config.env.BASE_MODULE = 'mempool'; } diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 4d165e409..ea5e88996 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -56,13 +56,6 @@ const codes = { ArrowDown: 40 } -Cypress.Commands.add("getBaseModule", () => { - return cy.task("getBaseModule").then((baseModule) => { - console.log(baseModule); - return baseModule; - }); -}); - Cypress.Commands.add('waitForSkeletonGone', () => { cy.waitUntil(() => { return Cypress.$('.skeleton-loader').length === 0; From cbeeef3b2c1a085ba859e7d8e61c280dbf9d8f1a Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 27 Oct 2021 20:52:50 -0700 Subject: [PATCH 6/6] Remove BASE_MODULE from the GHA env vars as we read from the config now --- .github/workflows/cypress.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 42af9a166..1f1fdda94 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -25,7 +25,6 @@ jobs: wait-on-timeout: 120 record: true parallel: true - env: BASE_MODULE=mempool group: Tests on ${{ matrix.browser }} (Mempool) browser: ${{ matrix.browser }} ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}' @@ -46,7 +45,6 @@ jobs: record: true parallel: true spec: cypress/integration/liquid/liquid.spec.ts - env: BASE_MODULE=liquid group: Tests on ${{ matrix.browser }} (Liquid) browser: ${{ matrix.browser }} ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}' @@ -67,7 +65,6 @@ jobs: record: true parallel: true spec: cypress/integration/bisq/bisq.spec.ts - env: BASE_MODULE=bisq group: Tests on ${{ matrix.browser }} (Bisq) browser: ${{ matrix.browser }} ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'