update test specs to handle the new multisite setup on CI

This commit is contained in:
Felipe Knorr Kuhn 2021-08-17 15:53:57 -07:00
parent 7e4c51f47f
commit de5518d262
5 changed files with 652 additions and 634 deletions

View File

@ -1,5 +1,8 @@
describe('Bisq', () => { describe('Bisq', () => {
let baseModule;
beforeEach(() => { beforeEach(() => {
baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'bisq') ? '' : '/bisq';
cy.intercept('/sockjs-node/info*').as('socket'); 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/hloc?market=btc_usd&interval=day').as('hloc');
cy.intercept('/bisq/api/markets/ticker').as('ticker'); cy.intercept('/bisq/api/markets/ticker').as('ticker');
@ -20,13 +23,15 @@ describe('Bisq', () => {
}); });
}); });
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'liquid') {
it('loads the dashboard', () => { it('loads the dashboard', () => {
cy.visit('/bisq'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
it('loads the transactions screen', () => { it('loads the transactions screen', () => {
cy.visit('/bisq'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(2) > a').click().then(() => { cy.get('li:nth-of-type(2) > a').click().then(() => {
cy.get('.table > tr').should('have.length', 50); cy.get('.table > tr').should('have.length', 50);
@ -34,7 +39,7 @@ describe('Bisq', () => {
}); });
it('loads the blocks screen', () => { it('loads the blocks screen', () => {
cy.visit('/bisq'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => { cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait('@blocks'); cy.wait('@blocks');
@ -43,7 +48,7 @@ describe('Bisq', () => {
}); });
it('loads the stats screen', () => { it('loads the stats screen', () => {
cy.visit('/bisq'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => { cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.wait('@stats'); cy.wait('@stats');
@ -51,7 +56,7 @@ describe('Bisq', () => {
}); });
it('loads the api screen', () => { it('loads the api screen', () => {
cy.visit('/bisq'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => { cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.get('.card').should('have.length.at.least', 1); cy.get('.card').should('have.length.at.least', 1);
@ -62,26 +67,22 @@ describe('Bisq', () => {
it('shows blocks pagination with 5 pages (desktop)', () => { it('shows blocks pagination with 5 pages (desktop)', () => {
cy.viewport(760, 800); cy.viewport(760, 800);
cy.visit('/bisq'); cy.visit(`${baseModule}/blocks`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('tbody tr').should('have.length', 10); cy.get('tbody tr').should('have.length', 10);
// 5 pages + 4 buttons = 9 buttons // 5 pages + 4 buttons = 9 buttons
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9); cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9);
}); });
});
it('shows blocks pagination with 3 pages (mobile)', () => { it('shows blocks pagination with 3 pages (mobile)', () => {
cy.viewport(669, 800); cy.viewport(669, 800);
cy.visit('/bisq'); cy.visit(`${baseModule}/blocks`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('tbody tr').should('have.length', 10); cy.get('tbody tr').should('have.length', 10);
// 3 pages + 4 buttons = 7 buttons // 3 pages + 4 buttons = 7 buttons
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7); cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7);
}); });
}); } else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
}); });

View File

@ -1,5 +1,8 @@
describe('Liquid', () => { describe('Liquid', () => {
let baseModule;
beforeEach(() => { beforeEach(() => {
baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'liquid') ? '' : '/liquid';
cy.intercept('/liquid/api/block/**').as('block'); cy.intercept('/liquid/api/block/**').as('block');
cy.intercept('/liquid/api/blocks/').as('blocks'); cy.intercept('/liquid/api/blocks/').as('blocks');
cy.intercept('/liquid/api/tx/**/outspends').as('outspends'); cy.intercept('/liquid/api/tx/**/outspends').as('outspends');
@ -13,28 +16,30 @@ describe('Liquid', () => {
}); });
}); });
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'bisq') {
it('loads the dashboard', () => { it('loads the dashboard', () => {
cy.visit('/liquid'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
it('loads the blocks page', () => { it('loads the blocks page', () => {
cy.visit('/liquid/blocks'); cy.visit(`${baseModule}/blocks`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
it('loads a specific block page', () => { it('loads a specific block page', () => {
cy.visit('/liquid/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54'); cy.visit(`${baseModule}/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
it('loads the graphs page', () => { it('loads the graphs page', () => {
cy.visit('/liquid/graphs'); cy.visit(`${baseModule}/graphs`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
it('loads the tv page - desktop', () => { it('loads the tv page - desktop', () => {
cy.visit('/liquid'); cy.visit(`${baseModule}`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => { cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait(1000); cy.wait(1000);
@ -42,7 +47,7 @@ describe('Liquid', () => {
}); });
it('loads the graphs page - mobile', () => { it('loads the graphs page - mobile', () => {
cy.visit('/liquid'); cy.visit(`${baseModule}`)
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => { cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.viewport('iphone-6'); cy.viewport('iphone-6');
@ -53,52 +58,46 @@ describe('Liquid', () => {
describe('assets', () => { describe('assets', () => {
it('shows the assets screen', () => { it('shows the assets screen', () => {
cy.visit('/liquid'); cy.visit(`${baseModule}/assets`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.get('table tr').should('have.length', 5); cy.get('table tr').should('have.length', 5);
}); });
});
it('allows searching assets', () => { it('allows searching assets', () => {
cy.visit('/liquid'); cy.visit(`${baseModule}/assets`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => { cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => {
cy.get('table tr').should('have.length', 1); cy.get('table tr').should('have.length', 1);
}); });
}); });
});
it('shows a specific asset ID', () => { it('shows a specific asset ID', () => {
cy.visit('/liquid'); cy.visit(`${baseModule}/assets`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.get('.container-xl input').click().type('Liquid CAD').then(() => { cy.get('.container-xl input').click().type('Liquid CAD').then(() => {
cy.get('table tr td:nth-of-type(1) a').click(); cy.get('table tr td:nth-of-type(1) a').click();
}); });
}); });
}); });
});
describe('unblinded TX', () => { describe('unblinded TX', () => {
it('show unblinded TX', () => { it('show unblinded TX', () => {
cy.visit('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a'); cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('#table-tx-vin tr').should('have.class', 'assetBox'); cy.get('#table-tx-vin tr').should('have.class', 'assetBox');
cy.get('#table-tx-vout tr').should('have.class', 'assetBox'); cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
}); });
it('show empty unblinded TX', () => { it('show empty unblinded TX', () => {
cy.visit('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded='); cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('#table-tx-vin tr').should('have.class', ''); cy.get('#table-tx-vin tr').should('have.class', '');
cy.get('#table-tx-vout tr').should('have.class', ''); cy.get('#table-tx-vout tr').should('have.class', '');
}); });
it('show invalid unblinded TX hex', () => { it('show invalid unblinded TX hex', () => {
cy.visit('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123'); cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('#table-tx-vin tr').should('have.class', ''); cy.get('#table-tx-vin tr').should('have.class', '');
cy.get('#table-tx-vout tr').should('have.class', ''); cy.get('#table-tx-vout tr').should('have.class', '');
@ -106,34 +105,36 @@ describe('Liquid', () => {
}); });
it('show first unblinded vout', () => { it('show first unblinded vout', () => {
cy.visit('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc'); cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('#table-tx-vout tr:first-child()').should('have.class', 'assetBox'); cy.get('#table-tx-vout tr:first-child()').should('have.class', 'assetBox');
}); });
it('show second unblinded vout', () => { it('show second unblinded vout', () => {
cy.visit('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a'); cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`);
cy.get('#table-tx-vout tr').should('have.class', 'assetBox'); cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
}); });
it('show invalid error unblinded TX', () => { it('show invalid error unblinded TX', () => {
cy.visit('/liquid/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3c'); cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3c`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('#table-tx-vout tr').should('have.class', 'assetBox'); cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
cy.get('.error-unblinded' ).contains('Error: Invalid blinding data.'); cy.get('.error-unblinded' ).contains('Error: Invalid blinding data.');
}); });
it('shows asset peg in/out and burn transactions', () => { it('shows asset peg in/out and burn transactions', () => {
cy.visit('/liquid/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d'); cy.visit(`${baseModule}/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
cy.get('#table-tx-vout tr').not('.assetBox'); cy.get('#table-tx-vout tr').not('.assetBox');
cy.get('#table-tx-vin tr').not('.assetBox'); cy.get('#table-tx-vin tr').not('.assetBox');
}); });
it('prevents regressing issue #644', () => { it('prevents regressing issue #644', () => {
cy.visit('/liquid/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82'); cy.visit(`${baseModule}/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82`);
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
}); });
}); });
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
}); });

View File

@ -15,6 +15,8 @@ describe('Mainnet', () => {
}); });
}); });
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
it('loads the status screen', () => { it('loads the status screen', () => {
cy.visit('/status'); cy.visit('/status');
cy.get('#mempool-block-0').should('be.visible'); cy.get('#mempool-block-0').should('be.visible');
@ -315,4 +317,7 @@ describe('Mainnet', () => {
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7); cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7);
}); });
}); });
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
}); });

View File

@ -8,6 +8,8 @@ describe('Signet', () => {
cy.intercept('/api/tx/*/outspends').as('tx-outspends'); cy.intercept('/api/tx/*/outspends').as('tx-outspends');
}); });
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
it('loads the dashboard', () => { it('loads the dashboard', () => {
cy.visit('/signet'); cy.visit('/signet');
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
@ -28,10 +30,11 @@ describe('Signet', () => {
"network": "signet" "network": "signet"
} }
}); });
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); 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(2) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
}); });
it('loads the blocks screen', () => { it('loads the blocks screen', () => {
cy.visit('/signet'); cy.visit('/signet');
@ -122,5 +125,7 @@ describe('Signet', () => {
}); });
}); });
}); });
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
}); });

View File

@ -1,4 +1,4 @@
import { emitMempoolInfo } from "../../support/websocket"; import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket";
describe('Testnet', () => { describe('Testnet', () => {
beforeEach(() => { beforeEach(() => {
@ -8,6 +8,8 @@ describe('Testnet', () => {
cy.intercept('/api/tx/*/outspends').as('tx-outspends'); cy.intercept('/api/tx/*/outspends').as('tx-outspends');
}); });
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
it('loads the dashboard', () => { it('loads the dashboard', () => {
cy.visit('/testnet'); cy.visit('/testnet');
cy.waitForSkeletonGone(); cy.waitForSkeletonGone();
@ -15,7 +17,7 @@ describe('Testnet', () => {
it('loads the dashboard with the skeleton blocks', () => { it('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket(); cy.mockMempoolSocket();
cy.visit("/signet"); cy.visit("/testnet");
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible'); 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(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible'); cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
@ -28,10 +30,11 @@ describe('Testnet', () => {
loaded: true loaded: true
} }
}); });
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist'); 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(2) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist'); cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
}); });
it('loads the blocks screen', () => { it('loads the blocks screen', () => {
cy.visit('/testnet'); cy.visit('/testnet');
@ -119,4 +122,7 @@ describe('Testnet', () => {
}); });
}); });
}); });
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
}); });