vega-frontend-monorepo/apps/trading-e2e/src/support/trading.ts
Art c83b5bf93c
chore(#1259): replaced market name with tradable instrument name (#1269)
* chore: replaced market name with tradable instrument name (1259)

* removed lodash import that must have added itself magically

* =aligned cypress tests with code changed

* =aligned console lite cypress mocks to the code changes

* changed cypress market info key details test

* changed cypress market info key details test

* generate markets for console lite
2022-09-07 11:37:39 -07:00

53 lines
1.8 KiB
TypeScript

import { aliasQuery } from '@vegaprotocol/cypress';
import type { MarketState } from '@vegaprotocol/types';
import type { CyHttpMessages } from 'cypress/types/net-stubbing';
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';
import { generateMarketDepth } from './mocks/generate-market-depth';
import { generateMarketInfoQuery } from './mocks/generate-market-info-query';
import { generateMarkets } from './mocks/generate-markets';
import { generateOrders } from './mocks/generate-orders';
import { generatePositions } from './mocks/generate-positions';
import { generateTrades } from './mocks/generate-trades';
export const mockTradingPage = (
req: CyHttpMessages.IncomingHttpRequest,
state: MarketState
) => {
aliasQuery(
req,
'Market',
generateMarket({
market: {
tradableInstrument: {
instrument: {
name: `${state.toUpperCase()} MARKET`,
},
},
state: state,
},
})
);
aliasQuery(req, 'MarketList', generateMarkets());
aliasQuery(req, 'MarketDepth', generateMarketDepth());
aliasQuery(req, 'Orders', generateOrders());
aliasQuery(req, 'Accounts', generateAccounts());
aliasQuery(req, 'Positions', generatePositions());
aliasQuery(
req,
'DealTicketQuery',
generateDealTicketQuery({ market: { state } })
);
aliasQuery(
req,
'MarketInfoQuery',
generateMarketInfoQuery({ market: { state } })
);
aliasQuery(req, 'Trades', generateTrades());
aliasQuery(req, 'Chart', generateChart());
aliasQuery(req, 'Candles', generateCandles());
};