test(trading): update of capsule and live tests (#3635)

This commit is contained in:
daro-maj 2023-05-08 16:52:33 +02:00 committed by GitHub
parent 313eff1c95
commit d1265a6af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 245 additions and 230 deletions

View File

@ -138,7 +138,7 @@ context('Network parameters page', { tags: '@smoke' }, function () {
}); });
}); });
it('should list each network parameter displayed as a currency value with four decimals - in the correct format', function () { it.skip('should list each network parameter displayed as a currency value with four decimals - in the correct format', function () {
cy.get_network_parameters().then((network_parameters) => { cy.get_network_parameters().then((network_parameters) => {
network_parameters = Object.entries(network_parameters); network_parameters = Object.entries(network_parameters);
network_parameters.forEach((network_parameter) => { network_parameters.forEach((network_parameter) => {

View File

@ -109,7 +109,7 @@ context(
); );
cy.getByTestId('protocol-upgrade-proposal-status').should( cy.getByTestId('protocol-upgrade-proposal-status').should(
'have.text', 'have.text',
'Approved' 'Approved '
); );
}); });
}); });

View File

@ -9,6 +9,7 @@ import {
import { isBefore, isAfter, addSeconds, subSeconds } from 'date-fns'; import { isBefore, isAfter, addSeconds, subSeconds } from 'date-fns';
import { createOrder } from '../support/create-order'; import { createOrder } from '../support/create-order';
import { connectEthereumWallet } from '../support/ethereum-wallet'; import { connectEthereumWallet } from '../support/ethereum-wallet';
import { selectAsset } from '../support/helpers';
const orderSize = 'size'; const orderSize = 'size';
const orderType = 'type'; const orderType = 'type';
@ -22,15 +23,13 @@ const assetSelectField = 'select[name="asset"]';
const amountField = 'input[name="amount"]'; const amountField = 'input[name="amount"]';
const txTimeout = Cypress.env('txTimeout'); const txTimeout = Cypress.env('txTimeout');
const sepoliaUrl = Cypress.env('ETHERSCAN_URL'); const sepoliaUrl = Cypress.env('ETHERSCAN_URL');
const btcName = const btcName = 0;
'BTC (local)5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c - tBTC'; const vegaName = 4;
const vegaName =
'Vegab4f2726571fbe8e33b442dc92ed2d7f0d810e21835b7371a7915a365f07ccd9b - VEGA';
const btcSymbol = 'tBTC'; const btcSymbol = 'tBTC';
const vegaSymbol = 'VEGA'; const vegaSymbol = 'VEGA';
const usdcSymbol = 'fUSDC'; const usdcSymbol = 'fUSDC';
const toastContent = 'toast-content'; const toastContent = 'toast-content';
const ordersTab = 'Orders'; const openOrdersTab = 'Open';
const depositsTab = 'Deposits'; const depositsTab = 'Deposits';
const collateralTab = 'Collateral'; const collateralTab = 'Collateral';
const toastCloseBtn = 'toast-close'; const toastCloseBtn = 'toast-close';
@ -50,6 +49,7 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.get('@markets').then((markets) => { cy.get('@markets').then((markets) => {
cy.wrap(markets[0]).as('market'); cy.wrap(markets[0]).as('market');
}); });
cy.visit('/#/portfolio');
}); });
beforeEach(() => { beforeEach(() => {
@ -73,7 +73,7 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.getByTestId(depositsTab).click(); cy.getByTestId(depositsTab).click();
cy.getByTestId('deposit-button').click(); cy.getByTestId('deposit-button').click();
connectEthereumWallet('Unknown'); connectEthereumWallet('Unknown');
cy.get(assetSelectField, txTimeout).select(btcName, { force: true }); selectAsset(btcName);
cy.getByTestId('approve-default').should( cy.getByTestId('approve-default').should(
'contain.text', 'contain.text',
`Before you can make a deposit of your chosen asset, ${btcSymbol}, you need to approve its use in your Ethereum wallet` `Before you can make a deposit of your chosen asset, ${btcSymbol}, you need to approve its use in your Ethereum wallet`
@ -81,6 +81,7 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.getByTestId(approveSubmit).click(); cy.getByTestId(approveSubmit).click();
cy.getByTestId('approve-pending').should('exist'); cy.getByTestId('approve-pending').should('exist');
cy.getByTestId('approve-confirmed').should('exist'); cy.getByTestId('approve-confirmed').should('exist');
cy.get(amountField).focus();
cy.get(amountField).clear().type('10'); cy.get(amountField).clear().type('10');
cy.getByTestId(depositSubmit).click(); cy.getByTestId(depositSubmit).click();
cy.getByTestId(toastContent, txTimeout).should( cy.getByTestId(toastContent, txTimeout).should(
@ -115,7 +116,6 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
}); });
it('can key to key transfers', function () { it('can key to key transfers', function () {
cy.visit('/#/portfolio');
cy.get('main[data-testid="/portfolio"]').should('exist'); cy.get('main[data-testid="/portfolio"]').should('exist');
cy.getByTestId(collateralTab).click(); cy.getByTestId(collateralTab).click();
@ -147,8 +147,8 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.getByTestId('Withdrawals').click(); cy.getByTestId('Withdrawals').click();
cy.getByTestId('withdraw-dialog-button').click(); cy.getByTestId('withdraw-dialog-button').click();
connectEthereumWallet('Unknown'); selectAsset(0);
cy.get(assetSelectField, txTimeout).select(btcName, { force: true }); cy.get(amountField).focus();
cy.get(amountField).clear().type('1'); cy.get(amountField).clear().type('1');
cy.getByTestId('submit-withdrawal').click(); cy.getByTestId('submit-withdrawal').click();
cy.getByTestId(toastContent, txTimeout).should( cy.getByTestId(toastContent, txTimeout).should(
@ -170,7 +170,7 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.getByTestId(toastContent, txTimeout).should( cy.getByTestId(toastContent, txTimeout).should(
'contain.text', 'contain.text',
'Error occurredprocessing response error' 'Error occurredcannot estimate gas'
); );
cy.getByTestId(toastCloseBtn).click({ multiple: true }); cy.getByTestId(toastCloseBtn).click({ multiple: true });
cy.getByTestId(completeWithdrawalBtn).should( cy.getByTestId(completeWithdrawalBtn).should(
@ -180,7 +180,7 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
}); });
}); });
describe('capsule', { tags: '@slow' }, () => { describe('capsule', { tags: '@slow', testIsolation: true }, () => {
before(() => { before(() => {
cy.updateCapsuleMultiSig(); cy.updateCapsuleMultiSig();
}); });
@ -231,7 +231,7 @@ describe('capsule', { tags: '@slow' }, () => {
cy.getByTestId(toastContent).should( cy.getByTestId(toastContent).should(
'contain.text', 'contain.text',
`ConfirmedYour transaction has been confirmed View in block explorerSubmit order - activeTEST.24h+${order.size} @ ${order.price}.00 ${usdcSymbol}`, `Order submittedYour transaction has been confirmed View in block explorerSubmit order - activeTEST.24h+${order.size} @ ${order.price}.00 ${usdcSymbol}`,
{ matchCase: false } { matchCase: false }
); );
cy.getByTestId(toastCloseBtn).click(); cy.getByTestId(toastCloseBtn).click();
@ -242,9 +242,9 @@ describe('capsule', { tags: '@slow' }, () => {
.get(`[data-testid="bid-vol-${rawPrice}"]`) .get(`[data-testid="bid-vol-${rawPrice}"]`)
.should('contain.text', order.size); .should('contain.text', order.size);
cy.getByTestId(ordersTab).click(); cy.getByTestId(openOrdersTab).click();
cy.getByTestId('edit', txTimeout).should('contain.text', 'Edit'); cy.getByTestId('edit', txTimeout).should('contain.text', 'Edit');
cy.getByTestId('tab-orders').within(() => { cy.getByTestId('tab-open-orders').within(() => {
cy.get('.ag-center-cols-container') cy.get('.ag-center-cols-container')
.children() .children()
.first() .first()
@ -283,7 +283,9 @@ describe('capsule', { tags: '@slow' }, () => {
}); });
}); });
it('can edit order', function () { it('can edit order', function () {
cy.getByTestId(ordersTab).click(); const market = this.market;
cy.visit(`/#/markets/${market.id}`);
cy.getByTestId(openOrdersTab).click();
cy.getByTestId('edit').first().should('be.visible').click(); cy.getByTestId('edit').first().should('be.visible').click();
cy.getByTestId('dialog-title').should('contain.text', 'Edit order'); cy.getByTestId('dialog-title').should('contain.text', 'Edit order');
cy.get('#limitPrice').focus().clear().type(newPrice); cy.get('#limitPrice').focus().clear().type(newPrice);
@ -291,12 +293,12 @@ describe('capsule', { tags: '@slow' }, () => {
cy.getByTestId(toastContent).should( cy.getByTestId(toastContent).should(
'contain.text', 'contain.text',
`ConfirmedYour transaction has been confirmed View in block explorerEdit order - activeTEST.24h+${size} @ ${price}.00 ${usdcSymbol}+${size} @ ${newPrice}.00 ${usdcSymbol}`, `Order submittedYour transaction has been confirmed View in block explorerEdit order - activeTEST.24h+${size} @ ${price}.00 ${usdcSymbol}+${size} @ ${newPrice}.00 ${usdcSymbol}`,
{ matchCase: false } { matchCase: false }
); );
cy.getByTestId(toastCloseBtn).click({ multiple: true }); cy.getByTestId(toastCloseBtn).click({ multiple: true });
cy.getByTestId(ordersTab).click(); cy.getByTestId(openOrdersTab).click();
cy.get('.ag-center-cols-container') cy.get('.ag-center-cols-container')
.children() .children()
.first() .first()
@ -307,18 +309,20 @@ describe('capsule', { tags: '@slow' }, () => {
checkIfDataAndTimeOfCreationAndUpdateIsEqual(orderUpdatedAt); checkIfDataAndTimeOfCreationAndUpdateIsEqual(orderUpdatedAt);
}); });
}); });
// comment because of bug #2695
it.skip('can cancel order', function () { it('can cancel order', function () {
cy.getByTestId(ordersTab).click(); const market = this.market;
cy.visit(`/#/markets/${market.id}`);
cy.getByTestId(openOrdersTab).click();
cy.getByTestId('cancel').first().click(); cy.getByTestId('cancel').first().click();
cy.getByTestId(toastContent).should( cy.getByTestId(toastContent).should(
'contain.text', 'contain.text',
`ConfirmedYour transaction has been confirmed View in block explorerCancel order - cancelledTEST.24h+${size} @ ${newPrice}.00 ${usdcSymbol}`, `Order cancelledYour transaction has been confirmed View in block explorerCancel order - cancelledTEST.24h+${size} @ ${newPrice}.00 ${usdcSymbol}`,
{ matchCase: false } { matchCase: false }
); );
cy.getByTestId(toastCloseBtn).click({ multiple: true }); cy.getByTestId(toastCloseBtn).click({ multiple: true });
cy.getByTestId('Closed').click();
cy.getByTestId('tab-orders') cy.getByTestId('tab-closed-orders')
.get('.ag-center-cols-container') .get('.ag-center-cols-container')
.children() .children()
.first() .first()
@ -348,7 +352,7 @@ describe('capsule', { tags: '@slow' }, () => {
cy.getByTestId('Withdrawals').click(); cy.getByTestId('Withdrawals').click();
cy.getByTestId('withdraw-dialog-button').click(); cy.getByTestId('withdraw-dialog-button').click();
connectEthereumWallet('Unknown'); connectEthereumWallet('Unknown');
cy.get(assetSelectField, txTimeout).select(btcName, { force: true }); selectAsset(btcName);
cy.get(amountField).clear().type('1'); cy.get(amountField).clear().type('1');
cy.getByTestId('submit-withdrawal').click(); cy.getByTestId('submit-withdrawal').click();
cy.getByTestId(toastContent, txTimeout).should( cy.getByTestId(toastContent, txTimeout).should(
@ -371,19 +375,15 @@ describe('capsule', { tags: '@slow' }, () => {
'contain.text', 'contain.text',
'Transaction confirmed' 'Transaction confirmed'
); );
cy.getByTestId(toastCloseBtn).click({ multiple: true }); cy.getByTestId(toastContent, txTimeout).should(
'contain.text',
'Funds unlockedYour funds have been unlocked for withdrawalView in block explorerWithdraw 1.00 tBTCComplete withdrawal'
);
cy.wrap(null).then(() => { cy.get('.ag-center-cols-container')
try { .find('[col-id="status"]')
cy.getByTestId(completeWithdrawalBtn) .eq(0, txTimeout)
.eq(0, txTimeout) .should('contain.text', 'Completed');
.should('not.exist');
} catch (error) {
console.log(
'Assertion failed, but we are continuing because this is our wait to complete transaction'
);
}
});
cy.get('[col-id="txHash"]', txTimeout) cy.get('[col-id="txHash"]', txTimeout)
.should('have.length.above', 1) .should('have.length.above', 1)
@ -404,17 +404,20 @@ describe('capsule', { tags: '@slow' }, () => {
.should('have.attr', 'href') .should('have.attr', 'href')
.and('contain', `${sepoliaUrl}/tx/0x`); .and('contain', `${sepoliaUrl}/tx/0x`);
}); });
// comment because of bug #2819
// cy.getByTestId('withdraw-dialog-button').click(); cy.getByTestId('withdraw-dialog-button').click({ force: true });
// cy.getByTestId('BALANCE_AVAILABLE_value').should('have.text', '0') cy.getByTestId('BALANCE_AVAILABLE_value').should('have.text', '7.999');
}); });
it('approved amount is less than deposit', function () { it('approved amount is less than deposit', function () {
// 1001-DEPO-006 // 1001-DEPO-006
// 1001-DEPO-007 // 1001-DEPO-007
cy.visit('/#/portfolio');
cy.get('main[data-testid="/portfolio"]').should('exist');
cy.getByTestId(depositsTab).click(); cy.getByTestId(depositsTab).click();
cy.getByTestId('deposit-button').click(); cy.getByTestId('deposit-button').click();
cy.get(assetSelectField, txTimeout).select(btcName, { force: true }); connectEthereumWallet('Unknown');
selectAsset(btcName);
cy.contains('Deposits of tBTC not approved').should('not.exist'); cy.contains('Deposits of tBTC not approved').should('not.exist');
cy.contains('Use maximum').should('be.visible'); cy.contains('Use maximum').should('be.visible');
cy.get(amountField).clear().type('20000000'); cy.get(amountField).clear().type('20000000');
@ -422,11 +425,7 @@ describe('capsule', { tags: '@slow' }, () => {
cy.getByTestId(depositSubmit).click(); cy.getByTestId(depositSubmit).click();
cy.getByTestId('input-error-text').should( cy.getByTestId('input-error-text').should(
'contain.text', 'contain.text',
'Amount is above approved amount' `You can't deposit more than you have in your Ethereum wallet`
);
cy.getByTestId('reapprove-default').should(
'contain.text',
'Approve again to deposit more than'
); );
}); });
@ -440,11 +439,11 @@ describe('capsule', { tags: '@slow' }, () => {
cy.getByTestId(depositsTab).click(); cy.getByTestId(depositsTab).click();
cy.getByTestId('deposit-button').click(); cy.getByTestId('deposit-button').click();
connectEthereumWallet('Unknown'); connectEthereumWallet('Unknown');
cy.get(assetSelectField, txTimeout).select(vegaName, { force: true }); selectAsset(vegaName);
cy.getByTestId('approve-submit').click(); cy.getByTestId('approve-submit').click();
cy.getByTestId('approve-confirmed').should( cy.getByTestId('approve-confirmed').should(
'contain.text', 'contain.text',
'You can now make deposits in VEGA, up to a maximum of' 'You approved deposits of up to VEGA'
); );
cy.get(amountField).clear().type('10000'); cy.get(amountField).clear().type('10000');
cy.getByTestId('deposit-submit').click(); cy.getByTestId('deposit-submit').click();
@ -478,9 +477,9 @@ describe('capsule', { tags: '@slow' }, () => {
.and('contain', `${sepoliaUrl}/tx/0x`); .and('contain', `${sepoliaUrl}/tx/0x`);
}); });
cy.getByTestId('Withdrawals').click(); cy.getByTestId('Withdrawals').click(txTimeout);
cy.getByTestId('withdraw-dialog-button').click(); cy.getByTestId('withdraw-dialog-button').click();
cy.get(assetSelectField, txTimeout).select(vegaName, { force: true }); selectAsset(1);
cy.get(amountField).clear().type('10000'); cy.get(amountField).clear().type('10000');
cy.getByTestId('DELAY_TIME_value').should('have.text', '5 days'); cy.getByTestId('DELAY_TIME_value').should('have.text', '5 days');
cy.getByTestId('submit-withdrawal').click(); cy.getByTestId('submit-withdrawal').click();

View File

@ -14,210 +14,226 @@ const itemHeader = 'item-header';
const itemValue = 'item-value'; const itemValue = 'item-value';
const marketListContent = 'popover-content'; const marketListContent = 'popover-content';
describe('Console - market list - live env', { tags: '@live' }, () => { describe(
beforeEach(() => { 'Console - market list - live env',
cy.visit('/'); { tags: '@live', testIsolation: true },
}); () => {
beforeEach(() => {
it('shows the market list page', () => { cy.visit('/');
cy.get('main', { timeout: 20000 });
// Overlay should be shown
cy.getByTestId(selectMarketOverlay).should('exist');
cy.contains('Select a market to get started').should('be.visible');
// I expect the market overlay table to contain at least one row
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.should('have.length.greaterThan', 1);
// each market shown in overlay table contains content under the last price and change fields
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.getByTestId('price')
.should('not.be.empty');
});
it('redirects to a default market', () => {
cy.getByTestId('dialog-close').click();
cy.getByTestId(selectMarketOverlay).should('not.exist');
// the choose market overlay is no longer showing
cy.contains('Select a market to get started').should('not.exist');
cy.contains('Loading...').should('not.exist');
cy.getByTestId('popover-trigger').should('not.be.empty');
});
});
describe('Console - market info - live env', { tags: '@live' }, () => {
before(() => {
cy.visit('/');
cy.contains('Loading market data...').should('not.exist');
cy.getByTestId('link').should('be.visible');
cy.getByTestId('dialog-close').click();
cy.getByTestId(marketInfoBtn).click();
});
const titles = ['Market data', 'Market specification', 'Market governance'];
const subtitles = [
'Current fees',
'Market price',
'Market volume',
'Insurance pool',
'Key details',
'Instrument',
'Settlement asset',
'Metadata',
'Risk model',
'Risk parameters',
'Risk factors',
'Price monitoring bounds 1',
'Liquidity monitoring parameters',
'Liquidity',
'Liquidity price range',
'Oracle',
'Proposal',
];
it('market info titles are displayed', () => {
cy.getByTestId('split-view-view')
.find('.text-lg')
.each((element, index) => {
cy.wrap(element).should('have.text', titles[index]);
});
});
it('market info subtitles are displayed', () => {
cy.getByTestId('popover-trigger').click();
cy.contains('Loading market data...').should('not.exist');
cy.contains('[data-testid="link"]', 'AAVEDAI.MF21').click();
cy.getByTestId(marketInfoBtn).click();
cy.getByTestId(marketInfoSubtitle).each((element, index) => {
cy.wrap(element).should('have.text', subtitles[index]);
}); });
});
it('renders correctly liquidity in trading tab', () => { it('shows the market list page', () => {
cy.getByTestId('Liquidity').click(); cy.get('main', { timeout: 20000 });
cy.contains('Loading').should('not.exist');
cy.contains('Something went wrong').should('not.exist'); // Overlay should be shown
cy.contains('Application error').should('not.exist'); cy.getByTestId(selectMarketOverlay).should('exist');
cy.getByTestId('tab-liquidity').within(() => { cy.contains('Select a market to get started').should('be.visible');
cy.get('[col-id="party.id"]').eq(1).should('not.be.empty');
// I expect the market overlay table to contain at least one row
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.should('have.length.greaterThan', 1);
// each market shown in overlay table contains content under the last price and change fields
cy.getByTestId(selectMarketOverlay)
.get('table tr')
.getByTestId('price')
.should('not.be.empty');
}); });
});
});
describe('Console - market summary - live env', { tags: '@live' }, () => { it('redirects to a default market', () => {
before(() => { cy.getByTestId('dialog-close').click();
cy.visit('/'); cy.getByTestId(selectMarketOverlay).should('not.exist');
cy.getByTestId('dialog-close').click();
cy.getByTestId(marketSummaryBlock).should('be.visible');
});
it('must display market name', () => { // the choose market overlay is no longer showing
cy.getByTestId('popover-trigger').should('not.be.empty'); cy.contains('Select a market to get started').should('not.exist');
}); cy.contains('Loading...').should('not.exist');
cy.getByTestId('popover-trigger').should('not.be.empty');
});
}
);
it('must see market expiry', () => { describe(
cy.getByTestId(marketSummaryBlock).within(() => { 'Console - market info - live env',
cy.getByTestId(marketExpiry).within(() => { { tags: '@live', testIsolation: true },
cy.getByTestId(itemHeader).should('have.text', 'Expiry'); () => {
cy.getByTestId(itemValue).should('not.be.empty'); before(() => {
cy.visit('/');
cy.contains('Loading market data...').should('not.exist');
cy.getByTestId('link').should('be.visible');
cy.getByTestId('dialog-close').click();
cy.getByTestId(marketInfoBtn).click();
});
const titles = ['Market data', 'Market specification', 'Market governance'];
const subtitles = [
'Current fees',
'Market price',
'Market volume',
'Insurance pool',
'Key details',
'Instrument',
'Settlement asset',
'Metadata',
'Risk model',
'Risk parameters',
'Risk factors',
'Price monitoring bounds 1',
'Liquidity monitoring parameters',
'Liquidity',
'Liquidity price range',
'Oracle',
'Proposal',
];
it('market info titles are displayed', () => {
cy.getByTestId('split-view-view')
.find('.text-lg')
.each((element, index) => {
cy.wrap(element).should('have.text', titles[index]);
});
});
it('market info subtitles are displayed', () => {
cy.getByTestId('popover-trigger').click();
cy.contains('Loading market data...').should('not.exist');
cy.contains('[data-testid="link"]', 'AAVEDAI.MF21').click();
cy.getByTestId(marketInfoBtn).click();
cy.getByTestId(marketInfoSubtitle).each((element, index) => {
cy.wrap(element).should('have.text', subtitles[index]);
}); });
}); });
});
it('must see market price', () => { it('renders correctly liquidity in trading tab', () => {
cy.getByTestId(marketSummaryBlock).within(() => { cy.getByTestId('Liquidity').click();
cy.getByTestId(marketPrice).within(() => { cy.contains('Loading').should('not.exist');
cy.getByTestId(itemHeader).should('have.text', 'Price'); cy.contains('Something went wrong').should('not.exist');
cy.getByTestId(itemValue).should('not.be.empty'); cy.contains('Application error').should('not.exist');
cy.getByTestId('tab-liquidity').within(() => {
cy.get('[col-id="party.id"]').eq(1).should('not.be.empty');
}); });
}); });
}); }
);
it('must see market change', () => { describe(
cy.getByTestId(marketSummaryBlock).within(() => { 'Console - market summary - live env',
cy.getByTestId(marketChange).within(() => { { tags: '@live', testIsolation: true },
cy.getByTestId(itemHeader).should('have.text', 'Change (24h)'); () => {
cy.getByTestId(percentageValue).should('not.be.empty'); before(() => {
cy.getByTestId(priceChangeValue).should('not.be.empty'); cy.visit('/');
cy.getByTestId('dialog-close').click();
cy.getByTestId(marketSummaryBlock).should('be.visible');
});
it('must display market name', () => {
cy.getByTestId('popover-trigger').should('not.be.empty');
});
it('must see market expiry', () => {
cy.getByTestId(marketSummaryBlock).within(() => {
cy.getByTestId(marketExpiry).within(() => {
cy.getByTestId(itemHeader).should('have.text', 'Expiry');
cy.getByTestId(itemValue).should('not.be.empty');
});
}); });
}); });
});
it('must see market volume', () => { it('must see market price', () => {
cy.getByTestId(marketSummaryBlock).within(() => { cy.getByTestId(marketSummaryBlock).within(() => {
cy.getByTestId(marketVolume).within(() => { cy.getByTestId(marketPrice).within(() => {
cy.getByTestId(itemHeader).should('have.text', 'Volume (24h)'); cy.getByTestId(itemHeader).should('have.text', 'Price');
cy.getByTestId(itemValue).should('not.be.empty'); cy.getByTestId(itemValue).should('not.be.empty');
});
}); });
}); });
});
it('must see market mode', () => { it('must see market change', () => {
cy.getByTestId(marketSummaryBlock).within(() => { cy.getByTestId(marketSummaryBlock).within(() => {
cy.getByTestId(marketMode).within(() => { cy.getByTestId(marketChange).within(() => {
cy.getByTestId(itemHeader).should('have.text', 'Trading mode'); cy.getByTestId(itemHeader).should('have.text', 'Change (24h)');
cy.getByTestId(itemValue).should('not.be.empty'); cy.getByTestId(percentageValue).should('not.be.empty');
cy.getByTestId(priceChangeValue).should('not.be.empty');
});
}); });
}); });
});
it('must see market settlement', () => { it('must see market volume', () => {
cy.getByTestId(marketSummaryBlock).within(() => { cy.getByTestId(marketSummaryBlock).within(() => {
cy.getByTestId(marketSettlement).within(() => { cy.getByTestId(marketVolume).within(() => {
cy.getByTestId(itemHeader).should('have.text', 'Settlement asset'); cy.getByTestId(itemHeader).should('have.text', 'Volume (24h)');
cy.getByTestId(itemValue).should('not.be.empty'); cy.getByTestId(itemValue).should('not.be.empty');
});
}); });
}); });
});
});
describe('Console - markets table - live env', { tags: '@live' }, () => { it('must see market mode', () => {
beforeEach(() => { cy.getByTestId(marketSummaryBlock).within(() => {
cy.visit('/'); cy.getByTestId(marketMode).within(() => {
}); cy.getByTestId(itemHeader).should('have.text', 'Trading mode');
cy.getByTestId(itemValue).should('not.be.empty');
it('renders markets correctly', () => { });
cy.get('[data-testid^="market-link-"]').should('not.be.empty');
cy.getByTestId('price').invoke('text').should('not.be.empty');
cy.getByTestId('settlement-asset').should('not.be.empty');
cy.getByTestId('price-change-percentage').should('not.be.empty');
cy.getByTestId('price-change').should('not.be.empty');
cy.getByTestId('sparkline-svg').should('be.visible');
});
it('renders market list drop down', () => {
openMarketDropDown();
cy.getByTestId(marketListContent)
.find('[data-testid="price"]')
.invoke('text')
.should('not.be.empty');
cy.getByTestId(marketListContent)
.find('[data-testid="trading-mode-col"]')
.should('not.be.empty');
cy.getByTestId(marketListContent)
.find('[data-testid="taker-fee"]')
.should('contain.text', '%');
cy.getByTestId(marketListContent)
.find('[data-testid="market-volume"]')
.should('not.be.empty');
cy.getByTestId(marketListContent)
.find('[data-testid="market-name"]')
.should('not.be.empty');
});
it('Able to select market from dropdown', () => {
cy.getByTestId('popover-trigger')
.invoke('text')
.then((marketName) => {
openMarketDropDown();
cy.get('[data-testid^=market-link]').eq(1).click();
cy.getByTestId('popover-trigger').should('not.be.equal', marketName);
}); });
}); });
});
it('must see market settlement', () => {
cy.getByTestId(marketSummaryBlock).within(() => {
cy.getByTestId(marketSettlement).within(() => {
cy.getByTestId(itemHeader).should('have.text', 'Settlement asset');
cy.getByTestId(itemValue).should('not.be.empty');
});
});
});
}
);
describe(
'Console - markets table - live env',
{ tags: '@live', testIsolation: true },
() => {
beforeEach(() => {
cy.visit('/');
});
it('renders markets correctly', () => {
cy.get('[data-testid^="market-link-"]').should('not.be.empty');
cy.getByTestId('price').invoke('text').should('not.be.empty');
cy.getByTestId('settlement-asset').should('not.be.empty');
cy.getByTestId('price-change-percentage').should('not.be.empty');
cy.getByTestId('price-change').should('not.be.empty');
cy.getByTestId('sparkline-svg').should('be.visible');
});
it('renders market list drop down', () => {
openMarketDropDown();
cy.getByTestId(marketListContent)
.find('[data-testid="price"]')
.invoke('text')
.should('not.be.empty');
cy.getByTestId(marketListContent)
.find('[data-testid="trading-mode-col"]')
.should('not.be.empty');
cy.getByTestId(marketListContent)
.find('[data-testid="taker-fee"]')
.should('contain.text', '%');
cy.getByTestId(marketListContent)
.find('[data-testid="market-volume"]')
.should('not.be.empty');
cy.getByTestId(marketListContent)
.find('[data-testid="market-name"]')
.should('not.be.empty');
});
it('Able to select market from dropdown', () => {
cy.getByTestId('popover-trigger')
.invoke('text')
.then((marketName) => {
openMarketDropDown();
cy.get('[data-testid^=market-link]').eq(1).click();
cy.getByTestId('popover-trigger').should('not.be.equal', marketName);
});
});
}
);
function openMarketDropDown() { function openMarketDropDown() {
cy.contains('Loading...').should('not.exist'); cy.contains('Loading...').should('not.exist');