2022-06-20 15:16:47 +00:00
|
|
|
import { aliasQuery } from '@vegaprotocol/cypress';
|
2022-06-10 19:00:02 +00:00
|
|
|
import type { MarketState } from '@vegaprotocol/types';
|
2022-06-20 15:16:47 +00:00
|
|
|
import type { CyHttpMessages } from 'cypress/types/net-stubbing';
|
2022-06-10 19:00:02 +00:00
|
|
|
import { generateAccounts } from './mocks/generate-accounts';
|
|
|
|
import { generateCandles } from './mocks/generate-candles';
|
|
|
|
import { generateChart } from './mocks/generate-chart';
|
|
|
|
import { generateDealTicketQuery } from './mocks/generate-deal-ticket-query';
|
|
|
|
import { generateMarket } from './mocks/generate-market';
|
2022-08-26 15:39:40 +00:00
|
|
|
import { generateMarketDepth } from './mocks/generate-market-depth';
|
2022-06-22 19:08:12 +00:00
|
|
|
import { generateMarketInfoQuery } from './mocks/generate-market-info-query';
|
2022-09-02 14:31:30 +00:00
|
|
|
import { generateMarkets } from './mocks/generate-markets';
|
2022-06-10 19:00:02 +00:00
|
|
|
import { generateOrders } from './mocks/generate-orders';
|
|
|
|
import { generatePositions } from './mocks/generate-positions';
|
|
|
|
import { generateTrades } from './mocks/generate-trades';
|
|
|
|
|
2022-06-20 15:16:47 +00:00
|
|
|
export const mockTradingPage = (
|
|
|
|
req: CyHttpMessages.IncomingHttpRequest,
|
|
|
|
state: MarketState
|
|
|
|
) => {
|
|
|
|
aliasQuery(
|
|
|
|
req,
|
|
|
|
'Market',
|
|
|
|
generateMarket({
|
|
|
|
market: {
|
2022-09-07 18:37:39 +00:00
|
|
|
tradableInstrument: {
|
|
|
|
instrument: {
|
|
|
|
name: `${state.toUpperCase()} MARKET`,
|
|
|
|
},
|
|
|
|
},
|
2022-06-29 12:57:42 +00:00
|
|
|
state: state,
|
2022-06-20 15:16:47 +00:00
|
|
|
},
|
|
|
|
})
|
|
|
|
);
|
2022-09-02 14:31:30 +00:00
|
|
|
aliasQuery(req, 'MarketList', generateMarkets());
|
2022-08-26 15:39:40 +00:00
|
|
|
aliasQuery(req, 'MarketDepth', generateMarketDepth());
|
2022-06-20 15:16:47 +00:00
|
|
|
aliasQuery(req, 'Orders', generateOrders());
|
|
|
|
aliasQuery(req, 'Accounts', generateAccounts());
|
|
|
|
aliasQuery(req, 'Positions', generatePositions());
|
|
|
|
aliasQuery(
|
|
|
|
req,
|
|
|
|
'DealTicketQuery',
|
|
|
|
generateDealTicketQuery({ market: { state } })
|
|
|
|
);
|
2022-06-22 19:08:12 +00:00
|
|
|
aliasQuery(
|
|
|
|
req,
|
|
|
|
'MarketInfoQuery',
|
|
|
|
generateMarketInfoQuery({ market: { state } })
|
|
|
|
);
|
2022-06-20 15:16:47 +00:00
|
|
|
aliasQuery(req, 'Trades', generateTrades());
|
|
|
|
aliasQuery(req, 'Chart', generateChart());
|
|
|
|
aliasQuery(req, 'Candles', generateCandles());
|
2022-06-10 19:00:02 +00:00
|
|
|
};
|