2022-06-20 15:16:47 +00:00
|
|
|
import { aliasQuery } from '@vegaprotocol/cypress';
|
2022-10-12 07:55:23 +00:00
|
|
|
import type {
|
|
|
|
MarketState,
|
|
|
|
MarketTradingMode,
|
|
|
|
AuctionTrigger,
|
|
|
|
} from '@vegaprotocol/types';
|
2022-06-20 15:16:47 +00:00
|
|
|
import type { CyHttpMessages } from 'cypress/types/net-stubbing';
|
2022-10-05 19:57:55 +00:00
|
|
|
import { generateAccounts } from './mocks/generate-accounts';
|
2022-10-11 12:22:55 +00:00
|
|
|
import { generateAsset, generateAssets } from './mocks/generate-assets';
|
2022-06-10 19:00:02 +00:00
|
|
|
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-13 10:14:06 +00:00
|
|
|
import {
|
|
|
|
generateMarkets,
|
|
|
|
generateMarketsData,
|
|
|
|
generateMarketsCandles,
|
|
|
|
} from './mocks/generate-markets';
|
2022-06-10 19:00:02 +00:00
|
|
|
import { generateOrders } from './mocks/generate-orders';
|
2022-10-04 08:37:31 +00:00
|
|
|
import { generateMargins, generatePositions } from './mocks/generate-positions';
|
2022-06-10 19:00:02 +00:00
|
|
|
import { generateTrades } from './mocks/generate-trades';
|
|
|
|
|
2022-06-20 15:16:47 +00:00
|
|
|
export const mockTradingPage = (
|
|
|
|
req: CyHttpMessages.IncomingHttpRequest,
|
2022-10-12 07:55:23 +00:00
|
|
|
state: MarketState,
|
|
|
|
tradingMode?: MarketTradingMode,
|
|
|
|
trigger?: AuctionTrigger
|
2022-06-20 15:16:47 +00:00
|
|
|
) => {
|
|
|
|
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-10-12 07:55:23 +00:00
|
|
|
tradingMode: tradingMode,
|
2022-06-20 15:16:47 +00:00
|
|
|
},
|
|
|
|
})
|
|
|
|
);
|
2022-09-13 10:14:06 +00:00
|
|
|
aliasQuery(req, 'Markets', generateMarkets());
|
2022-10-03 17:28:32 +00:00
|
|
|
aliasQuery(req, 'MarketsData', generateMarketsData());
|
|
|
|
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
|
2022-09-13 10:14:06 +00:00
|
|
|
|
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());
|
2022-10-04 08:37:31 +00:00
|
|
|
aliasQuery(req, 'Margins', generateMargins());
|
2022-10-12 07:55:23 +00:00
|
|
|
aliasQuery(
|
|
|
|
req,
|
|
|
|
'DealTicket',
|
|
|
|
generateDealTicketQuery({
|
|
|
|
market: {
|
|
|
|
state,
|
|
|
|
tradingMode: tradingMode,
|
|
|
|
data: {
|
|
|
|
trigger: trigger,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
);
|
2022-10-04 08:37:31 +00:00
|
|
|
aliasQuery(req, 'Assets', generateAssets());
|
2022-10-11 12:22:55 +00:00
|
|
|
aliasQuery(req, 'Asset', generateAsset());
|
2022-10-04 08:37:31 +00:00
|
|
|
|
2022-06-22 19:08:12 +00:00
|
|
|
aliasQuery(
|
|
|
|
req,
|
|
|
|
'MarketInfoQuery',
|
2022-10-12 07:55:23 +00:00
|
|
|
generateMarketInfoQuery({
|
|
|
|
market: {
|
|
|
|
state,
|
|
|
|
tradingMode: tradingMode,
|
|
|
|
data: {
|
|
|
|
trigger: trigger,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2022-06-22 19:08:12 +00:00
|
|
|
);
|
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
|
|
|
};
|