From de5518d26215f04d1d73584866114adbf174ea6c Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com> Date: Tue, 17 Aug 2021 15:53:57 -0700 Subject: [PATCH] update test specs to handle the new multisite setup on CI --- .../cypress/integration/bisq/bisq.spec.ts | 89 +-- .../cypress/integration/liquid/liquid.spec.ts | 209 +++---- .../integration/mainnet/mainnet.spec.ts | 541 +++++++++--------- .../cypress/integration/signet/signet.spec.ts | 229 ++++---- .../integration/testnet/testnet.spec.ts | 218 +++---- 5 files changed, 652 insertions(+), 634 deletions(-) diff --git a/frontend/cypress/integration/bisq/bisq.spec.ts b/frontend/cypress/integration/bisq/bisq.spec.ts index 2ba604153..761770ac8 100644 --- a/frontend/cypress/integration/bisq/bisq.spec.ts +++ b/frontend/cypress/integration/bisq/bisq.spec.ts @@ -1,5 +1,8 @@ describe('Bisq', () => { + let baseModule; 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'); @@ -20,68 +23,66 @@ describe('Bisq', () => { }); }); - it('loads the dashboard', () => { - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - }); + if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'liquid') { - it('loads the transactions screen', () => { - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(2) > a').click().then(() => { - cy.get('.table > tr').should('have.length', 50); + it('loads the dashboard', () => { + cy.visit(`${baseModule}`); + cy.waitForSkeletonGone(); }); - }); - it('loads the blocks screen', () => { - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { - cy.wait('@blocks'); - cy.get('tbody tr').should('have.length', 10); + it('loads the transactions screen', () => { + cy.visit(`${baseModule}`); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(2) > a').click().then(() => { + cy.get('.table > tr').should('have.length', 50); + }); }); - }); - it('loads the stats screen', () => { - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(4) > a').click().then(() => { - cy.wait('@stats'); + it('loads the blocks screen', () => { + cy.visit(`${baseModule}`); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(3) > a').click().then(() => { + cy.wait('@blocks'); + cy.get('tbody tr').should('have.length', 10); + }); }); - }); - it('loads the api screen', () => { - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { - cy.get('.card').should('have.length.at.least', 1); - cy.get('.card').first().click(); - cy.get('.card-body'); + it('loads the stats screen', () => { + cy.visit(`${baseModule}`); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(4) > a').click().then(() => { + cy.wait('@stats'); + }); }); - }); - it('shows blocks pagination with 5 pages (desktop)', () => { - cy.viewport(760, 800); - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { + it('loads the api screen', () => { + cy.visit(`${baseModule}`); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(5) > a').click().then(() => { + cy.get('.card').should('have.length.at.least', 1); + cy.get('.card').first().click(); + cy.get('.card-body'); + }); + }); + + it('shows blocks pagination with 5 pages (desktop)', () => { + cy.viewport(760, 800); + cy.visit(`${baseModule}/blocks`); cy.waitForSkeletonGone(); cy.get('tbody tr').should('have.length', 10); // 5 pages + 4 buttons = 9 buttons cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9); }); - }); - it('shows blocks pagination with 3 pages (mobile)', () => { - cy.viewport(669, 800); - cy.visit('/bisq'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { + it('shows blocks pagination with 3 pages (mobile)', () => { + cy.viewport(669, 800); + cy.visit(`${baseModule}/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"); + } }); diff --git a/frontend/cypress/integration/liquid/liquid.spec.ts b/frontend/cypress/integration/liquid/liquid.spec.ts index b5a736d02..57e96ee2d 100644 --- a/frontend/cypress/integration/liquid/liquid.spec.ts +++ b/frontend/cypress/integration/liquid/liquid.spec.ts @@ -1,5 +1,8 @@ describe('Liquid', () => { + let baseModule; beforeEach(() => { + baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'liquid') ? '' : '/liquid'; + cy.intercept('/liquid/api/block/**').as('block'); cy.intercept('/liquid/api/blocks/').as('blocks'); cy.intercept('/liquid/api/tx/**/outspends').as('outspends'); @@ -13,127 +16,125 @@ describe('Liquid', () => { }); }); - it('loads the dashboard', () => { - cy.visit('/liquid'); - cy.waitForSkeletonGone(); - }); + if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'bisq') { - it('loads the blocks page', () => { - cy.visit('/liquid/blocks'); - cy.waitForSkeletonGone(); - }); - - it('loads a specific block page', () => { - cy.visit('/liquid/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54'); - cy.waitForSkeletonGone(); - }); - - it('loads the graphs page', () => { - cy.visit('/liquid/graphs'); - cy.waitForSkeletonGone(); - }); - - it('loads the tv page - desktop', () => { - cy.visit('/liquid'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { - cy.wait(1000); - }); - }); - - it('loads the graphs page - mobile', () => { - cy.visit('/liquid'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { - cy.viewport('iphone-6'); - cy.wait(1000); - cy.get('.tv-only').should('not.exist'); - }); - }); - - describe('assets', () => { - it('shows the assets screen', () => { - cy.visit('/liquid'); + it('loads the dashboard', () => { + cy.visit(`${baseModule}`); cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { - cy.get('table tr').should('have.length', 5); + }); + + it('loads the blocks page', () => { + cy.visit(`${baseModule}/blocks`); + cy.waitForSkeletonGone(); + }); + + it('loads a specific block page', () => { + cy.visit(`${baseModule}/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54`); + cy.waitForSkeletonGone(); + }); + + it('loads the graphs page', () => { + cy.visit(`${baseModule}/graphs`); + cy.waitForSkeletonGone(); + }); + + it('loads the tv page - desktop', () => { + cy.visit(`${baseModule}`); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(3) > a').click().then(() => { + cy.wait(1000); }); }); - it('allows searching assets', () => { - cy.visit('/liquid'); + it('loads the graphs page - mobile', () => { + cy.visit(`${baseModule}`) cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { + cy.get('li:nth-of-type(3) > a').click().then(() => { + cy.viewport('iphone-6'); + cy.wait(1000); + cy.get('.tv-only').should('not.exist'); + }); + }); + + describe('assets', () => { + it('shows the assets screen', () => { + cy.visit(`${baseModule}/assets`); + cy.waitForSkeletonGone(); + cy.get('table tr').should('have.length', 5); + }); + + it('allows searching assets', () => { + cy.visit(`${baseModule}/assets`); + cy.waitForSkeletonGone(); cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => { cy.get('table tr').should('have.length', 1); }); }); - }); - it('shows a specific asset ID', () => { - cy.visit('/liquid'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { + it('shows a specific asset ID', () => { + cy.visit(`${baseModule}/assets`); + cy.waitForSkeletonGone(); cy.get('.container-xl input').click().type('Liquid CAD').then(() => { cy.get('table tr td:nth-of-type(1) a').click(); }); }); }); - }); - describe('unblinded TX', () => { - it('show unblinded TX', () => { - cy.visit('/liquid/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'); + describe('unblinded TX', () => { + it('show unblinded TX', () => { + cy.visit(`${baseModule}/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.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.waitForSkeletonGone(); + cy.get('#table-tx-vin tr').should('have.class', ''); + cy.get('#table-tx-vout tr').should('have.class', ''); + cy.get('.error-unblinded' ).contains('Error: Invalid blinding data (invalid hex)'); + }); + + it('show first unblinded vout', () => { + cy.visit(`${baseModule}/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.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.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.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.waitForSkeletonGone(); + }); }); - - it('show empty unblinded TX', () => { - cy.visit('/liquid/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('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123'); - cy.waitForSkeletonGone(); - cy.get('#table-tx-vin tr').should('have.class', ''); - cy.get('#table-tx-vout tr').should('have.class', ''); - cy.get('.error-unblinded' ).contains('Error: Invalid blinding data (invalid hex)'); - }); - - it('show first unblinded vout', () => { - cy.visit('/liquid/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('/liquid/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('/liquid/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('/liquid/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('/liquid/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82'); - cy.waitForSkeletonGone(); - }); - }); - + } else { + it.skip("Tests cannot be run on the selected BASE_MODULE"); + } }); diff --git a/frontend/cypress/integration/mainnet/mainnet.spec.ts b/frontend/cypress/integration/mainnet/mainnet.spec.ts index 3bd3b1369..2914be5f5 100644 --- a/frontend/cypress/integration/mainnet/mainnet.spec.ts +++ b/frontend/cypress/integration/mainnet/mainnet.spec.ts @@ -15,304 +15,309 @@ describe('Mainnet', () => { }); }); - it('loads the status screen', () => { - cy.visit('/status'); - cy.get('#mempool-block-0').should('be.visible'); - cy.get('[id^="bitcoin-block-"]').should('have.length', 8); - cy.get('.footer').should('be.visible'); - cy.get('.row > :nth-child(1)').invoke('text').then((text) => { - expect(text).to.match(/Tx vBytes per second:.* vB\/s/); - }); - cy.get('.row > :nth-child(2)').invoke('text').then((text) => { - expect(text).to.match(/Unconfirmed:(.*)/); - }); - cy.get('.row > :nth-child(3)').invoke('text').then((text) => { - expect(text).to.match(/Mempool size:(.*) (kB|MB) \((\d+) (block|blocks)\)/); - }); - }); + if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') { - it('loads dashboard, drop websocket and reconnect', () => { - cy.viewport('macbook-16'); - cy.mockMempoolSocket(); - cy.visit('/'); - cy.get('.badge').should('not.exist'); - dropWebSocket(); - cy.get('.badge').should('be.visible'); - cy.get('.badge', {timeout: 25000}).should('not.exist'); - emitMempoolInfo({ - 'params': { - loaded: true - } - }); - cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); - }); - - it('loads the dashboard', () => { - cy.visit('/'); - cy.waitForSkeletonGone(); - }); - - describe('blocks navigation', () => { - - describe('keyboard events', () => { - it('loads first blockchain blocks visible and keypress arrow right', () => { - cy.viewport('macbook-16'); - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('.blockchain-blocks-0 > a').click().then(() => { - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.waitForPageIdle(); - cy.document().right(); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - }); + it('loads the status screen', () => { + cy.visit('/status'); + cy.get('#mempool-block-0').should('be.visible'); + cy.get('[id^="bitcoin-block-"]').should('have.length', 8); + cy.get('.footer').should('be.visible'); + cy.get('.row > :nth-child(1)').invoke('text').then((text) => { + expect(text).to.match(/Tx vBytes per second:.* vB\/s/); }); + cy.get('.row > :nth-child(2)').invoke('text').then((text) => { + expect(text).to.match(/Unconfirmed:(.*)/); + }); + cy.get('.row > :nth-child(3)').invoke('text').then((text) => { + expect(text).to.match(/Mempool size:(.*) (kB|MB) \((\d+) (block|blocks)\)/); + }); + }); - it('loads first blockchain blocks visible and keypress arrow left', () => { - cy.viewport('macbook-16'); - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('.blockchain-blocks-0 > a').click().then(() => { + it('loads dashboard, drop websocket and reconnect', () => { + cy.viewport('macbook-16'); + cy.mockMempoolSocket(); + cy.visit('/'); + cy.get('.badge').should('not.exist'); + dropWebSocket(); + cy.get('.badge').should('be.visible'); + cy.get('.badge', {timeout: 25000}).should('not.exist'); + emitMempoolInfo({ + 'params': { + loaded: true + } + }); + cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); + }); + + it('loads the dashboard', () => { + cy.visit('/'); + cy.waitForSkeletonGone(); + }); + + describe('blocks navigation', () => { + + describe('keyboard events', () => { + it('loads first blockchain blocks visible and keypress arrow right', () => { + cy.viewport('macbook-16'); + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('.blockchain-blocks-0 > a').click().then(() => { + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.waitForPageIdle(); + cy.document().right(); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + }); + }); + + it('loads first blockchain blocks visible and keypress arrow left', () => { + cy.viewport('macbook-16'); + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('.blockchain-blocks-0 > a').click().then(() => { + cy.waitForPageIdle(); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.document().left(); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + }); + }); + + it('loads last blockchain blocks and keypress arrow right', () => { + cy.viewport('macbook-16'); + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('.blockchain-blocks-4 > a').click().then(() => { + cy.waitForPageIdle(); + + // block 6 + cy.document().right(); + cy.wait(5000); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + + // block 7 + cy.document().right(); + cy.wait(5000); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + + // block 8 - last visible block + cy.document().right(); + cy.wait(5000); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + + // block 9 - not visible at the blochchain blocks visible block + cy.document().right(); + cy.wait(5000); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + + }); + }); + + it('loads genesis block and keypress arrow right', () => { + cy.viewport('macbook-16'); + cy.visit('/block/0'); + cy.waitForSkeletonGone(); cy.waitForPageIdle(); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + + cy.document().right(); + cy.wait(5000); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); + }); + + it('loads genesis block and keypress arrow left', () => { + cy.viewport('macbook-16'); + cy.visit('/block/0'); + cy.waitForSkeletonGone(); + cy.waitForPageIdle(); + cy.document().left(); + cy.wait(5000); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); }); }); - - it('loads last blockchain blocks and keypress arrow right', () => { - cy.viewport('macbook-16'); - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('.blockchain-blocks-4 > a').click().then(() => { - cy.waitForPageIdle(); - - // block 6 - cy.document().right(); - cy.wait(5000); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - - // block 7 - cy.document().right(); - cy.wait(5000); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - - // block 8 - last visible block - cy.document().right(); - cy.wait(5000); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - - // block 9 - not visible at the blochchain blocks visible block - cy.document().right(); - cy.wait(5000); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - + describe('mouse events', () => { + it('loads first blockchain blocks visible and click on the arrow right', () => { + cy.viewport('macbook-16'); + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('.blockchain-blocks-0 > a').click().then(() => { + cy.waitForPageIdle(); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => { + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + }); + }); }); - }); - it('loads genesis block and keypress arrow right', () => { - cy.viewport('macbook-16'); - cy.visit('/block/0'); - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - - cy.document().right(); - cy.wait(5000); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); - }); - - it('loads genesis block and keypress arrow left', () => { - cy.viewport('macbook-16'); - cy.visit('/block/0'); - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - - cy.document().left(); - cy.wait(5000); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - }); - }); - describe('mouse events', () => { - it('loads first blockchain blocks visible and click on the arrow right', () => { - cy.viewport('macbook-16'); - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('.blockchain-blocks-0 > a').click().then(() => { + it('loads genesis block and click on the arrow left', () => { + cy.viewport('macbook-16'); + cy.visit('/block/0'); + cy.waitForSkeletonGone(); cy.waitForPageIdle(); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => { + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); + cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => { cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); }); }); }); + }); - it('loads genesis block and click on the arrow left', () => { + + it('loads skeleton when changes between networks', () => { + cy.visit('/'); + cy.waitForSkeletonGone(); + + cy.changeNetwork("testnet"); + cy.changeNetwork("signet"); + cy.changeNetwork("liquid"); + cy.changeNetwork("mainnet"); + cy.changeNetwork("bisq"); + }); + + it('loads the dashboard with the skeleton blocks', () => { + cy.mockMempoolSocket(); + 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'); + cy.get('#mempool-block-0').should('be.visible'); + cy.get('#mempool-block-1').should('be.visible'); + cy.get('#mempool-block-2').should('be.visible'); + + emitMempoolInfo({ + 'params': { + loaded: true + } + }); + + cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); + }); + + it('loads the blocks screen', () => { + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(2) > a').click().then(() => { + cy.waitForPageIdle(); + }); + }); + + it('loads the graphs screen', () => { + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(3) > a').click().then(() => { + cy.wait(1000); + }); + }); + + it('loads the tv screen - desktop', () => { + cy.viewport('macbook-16'); + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(4) > a').click().then(() => { cy.viewport('macbook-16'); + cy.get('.chart-holder'); + cy.get('.blockchain-wrapper').should('be.visible'); + cy.get('#mempool-block-0').should('be.visible'); + }); + }); + + it('loads the tv screen - mobile', () => { + cy.viewport('iphone-6'); + cy.visit('/tv'); + cy.waitForSkeletonGone(); + cy.get('.chart-holder'); + cy.get('.blockchain-wrapper').should('be.visible'); + }); + + it('loads the api screen', () => { + cy.visit('/'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(5) > a').click().then(() => { + cy.wait(1000); + }); + }); + + describe('blocks', () => { + it('shows empty blocks properly', () => { + cy.visit('/block/0000000000000000000bd14f744ef2e006e61c32214670de7eb891a5732ee775'); + cy.waitForSkeletonGone(); + cy.waitForPageIdle(); + cy.get('h2').invoke('text').should('equal', '1 transaction'); + }); + + it('expands and collapses the block details', () => { cy.visit('/block/0'); cy.waitForSkeletonGone(); cy.waitForPageIdle(); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist'); - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => { - cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); - cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible'); + cy.get('.btn.btn-outline-info').click().then(() => { + cy.get('#details').should('be.visible'); + }); + + cy.get('.btn.btn-outline-info').click().then(() => { + cy.get('#details').should('not.be.visible'); }); }); - }); - }); - - - it('loads skeleton when changes between networks', () => { - cy.visit('/'); - cy.waitForSkeletonGone(); - - cy.changeNetwork("testnet"); - cy.changeNetwork("signet"); - cy.changeNetwork("liquid"); - cy.changeNetwork("mainnet"); - cy.changeNetwork("bisq"); - }); - - it('loads the dashboard with the skeleton blocks', () => { - cy.mockMempoolSocket(); - 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'); - cy.get('#mempool-block-0').should('be.visible'); - cy.get('#mempool-block-1').should('be.visible'); - cy.get('#mempool-block-2').should('be.visible'); - - emitMempoolInfo({ - 'params': { - loaded: true - } - }); - - cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); - }); - - it('loads the blocks screen', () => { - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(2) > a').click().then(() => { - cy.waitForPageIdle(); - }); - }); - - it('loads the graphs screen', () => { - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { - cy.wait(1000); - }); - }); - - it('loads the tv screen - desktop', () => { - cy.viewport('macbook-16'); - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(4) > a').click().then(() => { - cy.viewport('macbook-16'); - cy.get('.chart-holder'); - cy.get('.blockchain-wrapper').should('be.visible'); - cy.get('#mempool-block-0').should('be.visible'); - }); - }); - - it('loads the tv screen - mobile', () => { - cy.viewport('iphone-6'); - cy.visit('/tv'); - cy.waitForSkeletonGone(); - cy.get('.chart-holder'); - cy.get('.blockchain-wrapper').should('be.visible'); - }); - - it('loads the api screen', () => { - cy.visit('/'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { - cy.wait(1000); - }); - }); - - describe('blocks', () => { - it('shows empty blocks properly', () => { - cy.visit('/block/0000000000000000000bd14f744ef2e006e61c32214670de7eb891a5732ee775'); - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - cy.get('h2').invoke('text').should('equal', '1 transaction'); - }); - - it('expands and collapses the block details', () => { - cy.visit('/block/0'); - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - cy.get('.btn.btn-outline-info').click().then(() => { - cy.get('#details').should('be.visible'); + it('shows blocks with no pagination', () => { + cy.visit('/block/00000000000000000001ba40caf1ad4cec0ceb77692662315c151953bfd7c4c4'); + cy.waitForSkeletonGone(); + cy.waitForPageIdle(); + cy.get('.block-tx-title h2').invoke('text').should('equal', '19 transactions'); + cy.get('.pagination-container ul.pagination').first().children().should('have.length', 5); }); - cy.get('.btn.btn-outline-info').click().then(() => { - cy.get('#details').should('not.be.visible'); - }); - }); - it('shows blocks with no pagination', () => { - cy.visit('/block/00000000000000000001ba40caf1ad4cec0ceb77692662315c151953bfd7c4c4'); - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - cy.get('.block-tx-title h2').invoke('text').should('equal', '19 transactions'); - cy.get('.pagination-container ul.pagination').first().children().should('have.length', 5); - }); - - it('supports pagination on the block screen', () => { - // 41 txs - cy.visit('/block/00000000000000000009f9b7b0f63ad50053ad12ec3b7f5ca951332f134f83d8'); - cy.waitForSkeletonGone(); - cy.get('.pagination-container a').invoke('text').then((text1) => { - cy.get('.active + li').first().click().then(() => { - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - cy.get('.header-bg.box > a').invoke('text').then((text2) => { - expect(text1).not.to.eq(text2); + it('supports pagination on the block screen', () => { + // 41 txs + cy.visit('/block/00000000000000000009f9b7b0f63ad50053ad12ec3b7f5ca951332f134f83d8'); + cy.waitForSkeletonGone(); + cy.get('.pagination-container a').invoke('text').then((text1) => { + cy.get('.active + li').first().click().then(() => { + cy.waitForSkeletonGone(); + cy.waitForPageIdle(); + cy.get('.header-bg.box > a').invoke('text').then((text2) => { + expect(text1).not.to.eq(text2); + }); }); }); }); - }); - it('shows blocks pagination with 5 pages (desktop)', () => { - cy.viewport(760, 800); - cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => { - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); - }); - - // 5 pages + 4 buttons = 9 buttons - cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9); - }); + it('shows blocks pagination with 5 pages (desktop)', () => { + cy.viewport(760, 800); + cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => { + cy.waitForSkeletonGone(); + cy.waitForPageIdle(); + }); - it('shows blocks pagination with 3 pages (mobile)', () => { - cy.viewport(669, 800); - cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => { - cy.waitForSkeletonGone(); - cy.waitForPageIdle(); + // 5 pages + 4 buttons = 9 buttons + cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9); + }); + + it('shows blocks pagination with 3 pages (mobile)', () => { + cy.viewport(669, 800); + cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => { + cy.waitForSkeletonGone(); + cy.waitForPageIdle(); + }); + + // 3 pages + 4 buttons = 7 buttons + cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7); }); - - // 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"); + } }); diff --git a/frontend/cypress/integration/signet/signet.spec.ts b/frontend/cypress/integration/signet/signet.spec.ts index 3ea2acc24..e10c5563d 100644 --- a/frontend/cypress/integration/signet/signet.spec.ts +++ b/frontend/cypress/integration/signet/signet.spec.ts @@ -8,119 +8,124 @@ describe('Signet', () => { cy.intercept('/api/tx/*/outspends').as('tx-outspends'); }); - it('loads the dashboard', () => { - cy.visit('/signet'); - cy.waitForSkeletonGone(); - }); - it('loads the dashboard with the skeleton blocks', () => { - cy.mockMempoolSocket(); - 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'); - cy.get('#mempool-block-0').should('be.visible'); - cy.get('#mempool-block-1').should('be.visible'); - cy.get('#mempool-block-2').should('be.visible'); - - emitMempoolInfo({ - 'params': { - "network": "signet" - } + if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') { + it('loads the dashboard', () => { + cy.visit('/signet'); + cy.waitForSkeletonGone(); }); - cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); -}); - - it('loads the blocks screen', () => { - cy.visit('/signet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(2) > a').click().then(() => { - cy.wait(1000); - }); - }); - - it('loads the graphs screen', () => { - cy.visit('/signet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { - cy.wait(1000); - }); - }); - - describe('tv mode', () => { - it('loads the tv screen - desktop', () => { - cy.viewport('macbook-16'); - cy.visit('/signet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(4) > a').click().then(() => { - cy.get('.chart-holder').should('be.visible'); - cy.get('#mempool-block-0').should('be.visible'); - cy.get('.tv-only').should('not.exist'); - }); - }); - - it('loads the tv screen - mobile', () => { - cy.visit('/signet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(4) > a').click().then(() => { - cy.viewport('iphone-8'); - cy.get('.chart-holder').should('be.visible'); - //TODO: Remove comment when the bug is fixed - //cy.get('#mempool-block-0').should('be.visible'); - cy.get('.tv-only').should('not.exist'); - }); - }); - }); - - - it('loads the api screen', () => { - cy.visit('/signet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { - cy.wait(1000); - }); - }); - - describe('blocks', () => { - it('shows empty blocks properly', () => { - cy.visit('/signet/block/00000133d54e4589f6436703b067ec23209e0a21b8a9b12f57d0592fd85f7a42'); - cy.waitForSkeletonGone(); - cy.get('h2').invoke('text').should('equal', '1 transaction'); - }); - - it('expands and collapses the block details', () => { - cy.visit('/signet/block/0'); - cy.waitForSkeletonGone(); - cy.get('.btn.btn-outline-info').click().then(() => { - cy.get('#details').should('be.visible'); - }); - - cy.get('.btn.btn-outline-info').click().then(() => { - cy.get('#details').should('not.be.visible'); - }); - }); - - it('shows blocks with no pagination', () => { - cy.visit('/signet/block/00000078f920a96a69089877b934ce7fd009ab55e3170920a021262cb258e7cc'); - cy.waitForSkeletonGone(); - cy.get('h2').invoke('text').should('equal', '13 transactions'); - cy.get('ul.pagination').first().children().should('have.length', 5); - }); - - it('supports pagination on the block screen', () => { - // 43 txs - cy.visit('/signet/block/00000094bd52f73bdbfc4bece3a94c21fec2dc968cd54210496e69e4059d66a6'); - cy.waitForSkeletonGone(); - cy.get('.header-bg.box > a').invoke('text').then((text1) => { - cy.get('.active + li').first().click().then(() => { - cy.get('.header-bg.box > a').invoke('text').then((text2) => { - expect(text1).not.to.eq(text2); - }); - }); - }); - }); - }); + it('loads the dashboard with the skeleton blocks', () => { + cy.mockMempoolSocket(); + 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'); + cy.get('#mempool-block-0').should('be.visible'); + cy.get('#mempool-block-1').should('be.visible'); + cy.get('#mempool-block-2').should('be.visible'); + + emitMempoolInfo({ + 'params': { + "network": "signet" + } + }); + + cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); + }); + + it('loads the blocks screen', () => { + cy.visit('/signet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(2) > a').click().then(() => { + cy.wait(1000); + }); + }); + + it('loads the graphs screen', () => { + cy.visit('/signet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(3) > a').click().then(() => { + cy.wait(1000); + }); + }); + + describe('tv mode', () => { + it('loads the tv screen - desktop', () => { + cy.viewport('macbook-16'); + cy.visit('/signet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(4) > a').click().then(() => { + cy.get('.chart-holder').should('be.visible'); + cy.get('#mempool-block-0').should('be.visible'); + cy.get('.tv-only').should('not.exist'); + }); + }); + + it('loads the tv screen - mobile', () => { + cy.visit('/signet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(4) > a').click().then(() => { + cy.viewport('iphone-8'); + cy.get('.chart-holder').should('be.visible'); + //TODO: Remove comment when the bug is fixed + //cy.get('#mempool-block-0').should('be.visible'); + cy.get('.tv-only').should('not.exist'); + }); + }); + }); + + + it('loads the api screen', () => { + cy.visit('/signet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(5) > a').click().then(() => { + cy.wait(1000); + }); + }); + + describe('blocks', () => { + it('shows empty blocks properly', () => { + cy.visit('/signet/block/00000133d54e4589f6436703b067ec23209e0a21b8a9b12f57d0592fd85f7a42'); + cy.waitForSkeletonGone(); + cy.get('h2').invoke('text').should('equal', '1 transaction'); + }); + + it('expands and collapses the block details', () => { + cy.visit('/signet/block/0'); + cy.waitForSkeletonGone(); + cy.get('.btn.btn-outline-info').click().then(() => { + cy.get('#details').should('be.visible'); + }); + + cy.get('.btn.btn-outline-info').click().then(() => { + cy.get('#details').should('not.be.visible'); + }); + }); + + it('shows blocks with no pagination', () => { + cy.visit('/signet/block/00000078f920a96a69089877b934ce7fd009ab55e3170920a021262cb258e7cc'); + cy.waitForSkeletonGone(); + cy.get('h2').invoke('text').should('equal', '13 transactions'); + cy.get('ul.pagination').first().children().should('have.length', 5); + }); + + it('supports pagination on the block screen', () => { + // 43 txs + cy.visit('/signet/block/00000094bd52f73bdbfc4bece3a94c21fec2dc968cd54210496e69e4059d66a6'); + cy.waitForSkeletonGone(); + cy.get('.header-bg.box > a').invoke('text').then((text1) => { + cy.get('.active + li').first().click().then(() => { + cy.get('.header-bg.box > a').invoke('text').then((text2) => { + expect(text1).not.to.eq(text2); + }); + }); + }); + }); + }); + } else { + it.skip("Tests cannot be run on the selected BASE_MODULE"); + } }); diff --git a/frontend/cypress/integration/testnet/testnet.spec.ts b/frontend/cypress/integration/testnet/testnet.spec.ts index eb75e72f6..d82a4d435 100644 --- a/frontend/cypress/integration/testnet/testnet.spec.ts +++ b/frontend/cypress/integration/testnet/testnet.spec.ts @@ -1,4 +1,4 @@ -import { emitMempoolInfo } from "../../support/websocket"; +import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket"; describe('Testnet', () => { beforeEach(() => { @@ -8,115 +8,121 @@ describe('Testnet', () => { cy.intercept('/api/tx/*/outspends').as('tx-outspends'); }); - it('loads the dashboard', () => { - cy.visit('/testnet'); - cy.waitForSkeletonGone(); - }); + if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') { - it('loads the dashboard with the skeleton blocks', () => { - cy.mockMempoolSocket(); - 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'); - cy.get('#mempool-block-0').should('be.visible'); - cy.get('#mempool-block-1').should('be.visible'); - cy.get('#mempool-block-2').should('be.visible'); - - emitMempoolInfo({ - 'params': { - loaded: true - } + it('loads the dashboard', () => { + cy.visit('/testnet'); + cy.waitForSkeletonGone(); }); - cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); - cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); -}); - it('loads the blocks screen', () => { - cy.visit('/testnet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(2) > a').click().then(() => { - cy.wait(1000); - }); - }); + it('loads the dashboard with the skeleton blocks', () => { + cy.mockMempoolSocket(); + 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'); + cy.get('#mempool-block-0').should('be.visible'); + cy.get('#mempool-block-1').should('be.visible'); + cy.get('#mempool-block-2').should('be.visible'); - it('loads the graphs screen', () => { - cy.visit('/testnet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(3) > a').click().then(() => { - cy.wait(1000); - }); - }); + emitMempoolInfo({ + 'params': { + loaded: true + } + }); - describe('tv mode', () => { - it('loads the tv screen - desktop', () => { - cy.viewport('macbook-16'); - cy.visit('/testnet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(4) > a').click().then(() => { - cy.wait(1000); - cy.get('.tv-only').should('not.exist'); - }); - }); - - it('loads the tv screen - mobile', () => { - cy.visit('/testnet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(4) > a').click().then(() => { - cy.viewport('iphone-6'); - cy.wait(1000); - cy.get('.tv-only').should('not.exist'); - }); - }); - }); - - - it('loads the api screen', () => { - cy.visit('/testnet'); - cy.waitForSkeletonGone(); - cy.get('li:nth-of-type(5) > a').click().then(() => { - cy.wait(1000); - }); - }); - - describe('blocks', () => { - it('shows empty blocks properly', () => { - cy.visit('/testnet/block/0'); - cy.waitForSkeletonGone(); - cy.get('h2').invoke('text').should('equal', '1 transaction'); - }); - - it('expands and collapses the block details', () => { - cy.visit('/testnet/block/0'); - cy.waitForSkeletonGone(); - cy.get('.btn.btn-outline-info').click().then(() => { - cy.get('#details').should('be.visible'); - }); - - cy.get('.btn.btn-outline-info').click().then(() => { - cy.get('#details').should('not.be.visible'); - }); - }); - - it('shows blocks with no pagination', () => { - cy.visit('/testnet/block/000000000000002f8ce27716e74ecc7ad9f7b5101fed12d09e28bb721b9460ea'); - cy.waitForSkeletonGone(); - cy.get('h2').invoke('text').should('equal', '11 transactions'); - cy.get('ul.pagination').first().children().should('have.length', 5); - }); - - it('supports pagination on the block screen', () => { - // 48 txs - cy.visit('/testnet/block/000000000000002ca3878ebd98b313a1c2d531f2e70a6575d232ca7564dea7a9'); - cy.waitForSkeletonGone(); - cy.get('.header-bg.box > a').invoke('text').then((text1) => { - cy.get('.active + li').first().click().then(() => { - cy.get('.header-bg.box > a').invoke('text').then((text2) => { - expect(text1).not.to.eq(text2); - }); - }); - }); - }); + cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist'); + cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); }); + + it('loads the blocks screen', () => { + cy.visit('/testnet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(2) > a').click().then(() => { + cy.wait(1000); + }); + }); + + it('loads the graphs screen', () => { + cy.visit('/testnet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(3) > a').click().then(() => { + cy.wait(1000); + }); + }); + + describe('tv mode', () => { + it('loads the tv screen - desktop', () => { + cy.viewport('macbook-16'); + cy.visit('/testnet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(4) > a').click().then(() => { + cy.wait(1000); + cy.get('.tv-only').should('not.exist'); + }); + }); + + it('loads the tv screen - mobile', () => { + cy.visit('/testnet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(4) > a').click().then(() => { + cy.viewport('iphone-6'); + cy.wait(1000); + cy.get('.tv-only').should('not.exist'); + }); + }); + }); + + + it('loads the api screen', () => { + cy.visit('/testnet'); + cy.waitForSkeletonGone(); + cy.get('li:nth-of-type(5) > a').click().then(() => { + cy.wait(1000); + }); + }); + + describe('blocks', () => { + it('shows empty blocks properly', () => { + cy.visit('/testnet/block/0'); + cy.waitForSkeletonGone(); + cy.get('h2').invoke('text').should('equal', '1 transaction'); + }); + + it('expands and collapses the block details', () => { + cy.visit('/testnet/block/0'); + cy.waitForSkeletonGone(); + cy.get('.btn.btn-outline-info').click().then(() => { + cy.get('#details').should('be.visible'); + }); + + cy.get('.btn.btn-outline-info').click().then(() => { + cy.get('#details').should('not.be.visible'); + }); + }); + + it('shows blocks with no pagination', () => { + cy.visit('/testnet/block/000000000000002f8ce27716e74ecc7ad9f7b5101fed12d09e28bb721b9460ea'); + cy.waitForSkeletonGone(); + cy.get('h2').invoke('text').should('equal', '11 transactions'); + cy.get('ul.pagination').first().children().should('have.length', 5); + }); + + it('supports pagination on the block screen', () => { + // 48 txs + cy.visit('/testnet/block/000000000000002ca3878ebd98b313a1c2d531f2e70a6575d232ca7564dea7a9'); + cy.waitForSkeletonGone(); + cy.get('.header-bg.box > a').invoke('text').then((text1) => { + cy.get('.active + li').first().click().then(() => { + cy.get('.header-bg.box > a').invoke('text').then((text2) => { + expect(text1).not.to.eq(text2); + }); + }); + }); + }); + }); + } else { + it.skip("Tests cannot be run on the selected BASE_MODULE"); + } });