Test/625 market info (#999)
* test: assert edit button * test: assert edit order btn * test: update market info mock * test: tests for market info
This commit is contained in:
parent
8f0898385f
commit
22fc0e7ac1
@ -129,12 +129,12 @@ jobs:
|
||||
run: yarn install
|
||||
|
||||
- name: Run Cypress tests
|
||||
run: yarn nx run ${{inputs.project}}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
|
||||
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
|
||||
env:
|
||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
|
||||
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
|
||||
CYPRESS_INCLUDE_FLOWS: ${{inputs.includeFlows}}
|
||||
CYPRESS_INCLUDE_FLOWS: ${{ github.event.inputs.includeFlows }}
|
||||
|
||||
######
|
||||
## Upload logs
|
||||
|
124
apps/trading-e2e/src/integration/market-info.cy.ts
Normal file
124
apps/trading-e2e/src/integration/market-info.cy.ts
Normal file
@ -0,0 +1,124 @@
|
||||
import { MarketState } from '@vegaprotocol/types';
|
||||
import { mockTradingPage } from '../support/trading';
|
||||
|
||||
const marketInfoBtn = 'Info';
|
||||
const row = 'key-value-table-row';
|
||||
const marketTitle = 'accordion-title';
|
||||
|
||||
describe('market info is displayed', () => {
|
||||
before(() => {
|
||||
cy.mockGQL((req) => {
|
||||
mockTradingPage(req, MarketState.Active);
|
||||
});
|
||||
cy.visit('/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
cy.getByTestId(marketInfoBtn).click();
|
||||
});
|
||||
|
||||
it('current fees displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Current fees').click();
|
||||
|
||||
validateMarketDataRow(0, 'Maker Fee', '0.02%');
|
||||
validateMarketDataRow(1, 'Infrastructure Fee', '0.05%');
|
||||
validateMarketDataRow(2, 'Liquidity Fee', '1.00%');
|
||||
});
|
||||
|
||||
it('market data displated', () => {
|
||||
cy.getByTestId(marketTitle).contains('Market data').click();
|
||||
|
||||
validateMarketDataRow(0, 'Mark Price', '57.49');
|
||||
validateMarketDataRow(1, 'Indicative Volume', '0');
|
||||
validateMarketDataRow(2, 'Best Bid Volume', '5');
|
||||
validateMarketDataRow(3, 'Best Offer Volume', '1');
|
||||
validateMarketDataRow(4, 'Best Static Bid Volume', '5');
|
||||
validateMarketDataRow(5, 'Best Static Offer Volume', '1');
|
||||
validateMarketDataRow(6, 'Open Interest', '0.00');
|
||||
});
|
||||
|
||||
it('key details displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Key details').click();
|
||||
|
||||
validateMarketDataRow(0, 'Name', 'ETHBTC Quarterly (30 Jun 2022)');
|
||||
validateMarketDataRow(1, 'Decimal Places', '2');
|
||||
validateMarketDataRow(2, 'Position Decimal Places', '0');
|
||||
validateMarketDataRow(3, 'Trading Mode', 'Continuous');
|
||||
validateMarketDataRow(4, 'State', 'Active');
|
||||
validateMarketDataRow(5, 'Market Id', 'market-0');
|
||||
});
|
||||
|
||||
it('instrument displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Instrument').click();
|
||||
|
||||
validateMarketDataRow(0, 'Market Name', 'BTCUSD Monthly (30 Jun 2022)');
|
||||
validateMarketDataRow(1, 'Code', 'BTCUSD.MF21');
|
||||
validateMarketDataRow(2, 'Product Type', 'Future');
|
||||
validateMarketDataRow(3, 'Quote Name', 'BTC');
|
||||
validateMarketDataRow(
|
||||
4,
|
||||
'Id',
|
||||
'5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c'
|
||||
);
|
||||
validateMarketDataRow(5, 'Symbol', 'tBTC');
|
||||
validateMarketDataRow(6, 'Name', 'tBTC TEST');
|
||||
});
|
||||
|
||||
it('metadata displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Metadata').click();
|
||||
|
||||
validateMarketDataRow(0, 'Formerly', '076BB86A5AA41E3E');
|
||||
validateMarketDataRow(1, 'Base', 'BTC');
|
||||
validateMarketDataRow(2, 'Quote', 'USD');
|
||||
validateMarketDataRow(3, 'Class', 'fx/crypto');
|
||||
validateMarketDataRow(4, 'Sector', 'crypto');
|
||||
});
|
||||
|
||||
it('risk factors displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Risk factors').click();
|
||||
|
||||
validateMarketDataRow(0, 'Short', '0.008571790367285281');
|
||||
validateMarketDataRow(1, 'Long', '0.008508132993273576');
|
||||
});
|
||||
|
||||
it('risk model displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Risk model').click();
|
||||
|
||||
validateMarketDataRow(0, 'Typename', 'LogNormalRiskModel');
|
||||
validateMarketDataRow(1, 'Tau', '0.0001140771161');
|
||||
validateMarketDataRow(2, 'Risk Aversion Parameter', '0.01');
|
||||
});
|
||||
|
||||
it('price monitoring trigger displayed', () => {
|
||||
cy.getByTestId(marketTitle).contains('Price monitoring trigger 1').click();
|
||||
|
||||
validateMarketDataRow(0, 'Horizon Secs', '43,200');
|
||||
validateMarketDataRow(1, 'Probability', '1');
|
||||
validateMarketDataRow(2, 'Auction Extension Secs', '600');
|
||||
});
|
||||
|
||||
it('liquidity monitoring parameters displayed', () => {
|
||||
cy.getByTestId(marketTitle)
|
||||
.contains('Liquidity monitoring parameters')
|
||||
.click();
|
||||
|
||||
validateMarketDataRow(0, 'Triggering Ratio', '0');
|
||||
validateMarketDataRow(1, 'Time Window', '3,600');
|
||||
validateMarketDataRow(2, 'Scaling Factor', '10');
|
||||
});
|
||||
|
||||
afterEach('close toggle', () => {
|
||||
cy.get('[data-state="open"]').find('button').click();
|
||||
});
|
||||
|
||||
function validateMarketDataRow(
|
||||
rowNumber: number,
|
||||
name: string,
|
||||
value: string
|
||||
) {
|
||||
cy.getByTestId(row)
|
||||
.eq(rowNumber)
|
||||
.within(() => {
|
||||
cy.get('dt').should('contain.text', name);
|
||||
cy.get('dd').should('contain.text', value);
|
||||
});
|
||||
}
|
||||
});
|
@ -65,6 +65,10 @@ describe('orders', () => {
|
||||
cy.getByTestId('cancel')
|
||||
.should('be.visible')
|
||||
.and('have.length.at.least', 1);
|
||||
|
||||
cy.getByTestId('edit')
|
||||
.should('be.visible')
|
||||
.and('have.length.at.least', 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
import type { MarketInfoQuery } from '@vegaprotocol/deal-ticket';
|
||||
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
|
||||
import {
|
||||
AccountType,
|
||||
MarketState,
|
||||
MarketTradingMode,
|
||||
} from '@vegaprotocol/types';
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
|
||||
@ -15,6 +19,26 @@ export const generateMarketInfoQuery = (
|
||||
positionDecimalPlaces: 0,
|
||||
state: MarketState.Active,
|
||||
tradingMode: MarketTradingMode.Continuous,
|
||||
accounts: [
|
||||
{
|
||||
type: AccountType.Insurance,
|
||||
asset: {
|
||||
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
|
||||
__typename: 'Asset',
|
||||
},
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
},
|
||||
{
|
||||
type: AccountType.FeeLiquidity,
|
||||
asset: {
|
||||
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
|
||||
__typename: 'Asset',
|
||||
},
|
||||
balance: '0',
|
||||
__typename: 'Account',
|
||||
},
|
||||
],
|
||||
fees: {
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
@ -58,11 +82,35 @@ export const generateMarketInfoQuery = (
|
||||
bestOfferVolume: '1',
|
||||
bestStaticBidVolume: '5',
|
||||
bestStaticOfferVolume: '1',
|
||||
openInterest: '0',
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: 0,
|
||||
targetStakeParameters: {
|
||||
timeWindow: 3600,
|
||||
scalingFactor: 10,
|
||||
__typename: 'TargetStakeParameters',
|
||||
},
|
||||
__typename: 'LiquidityMonitoringParameters',
|
||||
},
|
||||
tradableInstrument: {
|
||||
__typename: 'TradableInstrument',
|
||||
instrument: {
|
||||
__typename: 'Instrument',
|
||||
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
|
||||
name: 'BTCUSD Monthly (30 Jun 2022)',
|
||||
code: 'BTCUSD.MF21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly: 076BB86A5AA41E3E',
|
||||
'base: BTC',
|
||||
'quote: USD',
|
||||
'class: fx/crypto',
|
||||
'monthly',
|
||||
'sector :crypto',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
quoteName: 'BTC',
|
||||
@ -72,6 +120,19 @@ export const generateMarketInfoQuery = (
|
||||
symbol: 'tBTC',
|
||||
name: 'tBTC TEST',
|
||||
},
|
||||
oracleSpecForSettlementPrice: {
|
||||
__typename: 'OracleSpec',
|
||||
id: 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f',
|
||||
},
|
||||
oracleSpecForTradingTermination: {
|
||||
__typename: 'OracleSpec',
|
||||
id: 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f',
|
||||
},
|
||||
oracleSpecBinding: {
|
||||
__typename: 'OracleSpecToFutureBinding',
|
||||
settlementPriceProperty: 'prices.BTC.value',
|
||||
tradingTerminationProperty: 'termination.BTC.value',
|
||||
},
|
||||
},
|
||||
},
|
||||
riskModel: {
|
||||
|
Loading…
Reference in New Issue
Block a user