mempool/frontend/cypress/integration/mainnet/mainnet.spec.ts

99 lines
3.3 KiB
TypeScript
Raw Normal View History

describe('Mainnet', () => {
beforeEach(() => {
2021-06-07 21:48:27 +02:00
cy.intercept('/api/block-height/*').as('block-height');
cy.intercept('/api/block/*').as('block');
cy.intercept('/api/block/*/txs/0').as('block-txs');
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
2021-06-07 21:48:27 +02:00
// TODO: Fix ng serve to deliver this file
cy.fixture('pools').then((json) => {
2021-06-07 21:48:27 +02:00
cy.intercept('/resources/pools.json', json);
});
});
it('loads the dashboard', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/');
cy.wait(1000);
});
it('loads the blocks screen', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/');
cy.get('li:nth-of-type(2) > a').click().then(() => {
2021-06-07 21:48:27 +02:00
cy.wait(1000);
});
});
it('loads the graphs screen', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/');
cy.get('li:nth-of-type(3) > a').click().then(() => {
2021-06-07 21:48:27 +02:00
cy.wait(1000);
});
});
describe('tv mode', () => {
it('loads the tv screen - desktop', () => {
2021-06-07 21:48:27 +02:00
cy.viewport('macbook-16');
cy.visit('/');
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.viewport('macbook-16');
2021-06-07 21:48:27 +02:00
cy.wait(1000);
cy.get('.blockchain-wrapper').should('be.visible');
2021-06-07 21:48:27 +02:00
});
});
it('loads the tv screen - mobile', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/');
cy.get('li:nth-of-type(4) > a').click().then(() => {
2021-06-07 21:48:27 +02:00
cy.viewport('iphone-6');
cy.wait(1000);
cy.get('.blockchain-wrapper').should('not.be.visible');
2021-06-07 21:48:27 +02:00
});
});
});
it('loads the api screen', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/');
cy.get('li:nth-of-type(5) > a').click().then(() => {
2021-06-07 21:48:27 +02:00
cy.wait(1000);
});
});
describe('blocks', () => {
it('shows empty blocks properly', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/block/0000000000000000000bd14f744ef2e006e61c32214670de7eb891a5732ee775');
cy.get('h2').invoke('text').should('equal', '1 transaction');
});
it('expands and collapses the block details', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/block/0');
cy.wait('@tx-outspends');
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('be.visible');
2021-06-07 21:48:27 +02:00
});
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('not.be.visible');
2021-06-07 21:48:27 +02:00
});
});
it('shows blocks with no pagination', () => {
2021-06-07 21:48:27 +02:00
cy.visit('/block/00000000000000000001ba40caf1ad4cec0ceb77692662315c151953bfd7c4c4');
cy.get('h2').invoke('text').should('equal', '19 transactions');
cy.get('ul.pagination').first().children().should('have.length', 5);
});
it('supports pagination on the block screen', () => {
2021-06-07 21:48:27 +02:00
// 41 txs
cy.visit('/block/00000000000000000009f9b7b0f63ad50053ad12ec3b7f5ca951332f134f83d8');
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) => {
2021-06-07 21:48:27 +02:00
expect(text1).not.to.eq(text2);
});
});
});
});
});
});