fix: remove market state check from markets.cy.ts

This commit is contained in:
madalinaraicu 2022-07-16 13:35:54 +02:00
parent 1ba3db02f2
commit be60e56d8a
2 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,5 @@
import { aliasQuery } from '@vegaprotocol/cypress';
import { MarketState } from '@vegaprotocol/types';
import { MarketTradingMode } from '@vegaprotocol/types';
import { generateMarkets } from '../support/mocks/generate-markets';
import { mockTradingPage } from '../support/trading';
@ -56,37 +56,37 @@ describe('markets table', () => {
});
});
it('can select an active market', () => {
it('can select an continuously trading market', () => {
cy.wait('@Markets');
cy.get('.ag-root-wrapper').should('be.visible');
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.Active);
mockTradingPage(req, MarketTradingMode.Continuous);
});
// click on active market
// click on market
cy.get('[role="gridcell"][col-id=data]').should('be.visible');
cy.wait('@Market');
cy.contains('ACTIVE MARKET');
cy.contains(MarketTradingMode.Continuous);
cy.url().should('include', '/markets/market-0');
verifyMarketSummaryDisplayed();
});
it('can select a suspended market', () => {
it('can select a monitoring auction trading market', () => {
cy.wait('@Markets');
cy.get('.ag-root-wrapper').should('be.visible');
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.Suspended);
mockTradingPage(req, MarketTradingMode.MonitoringAuction);
});
// click on active market
// click on market
cy.get('[role="gridcell"][col-id=data]').should('be.visible');
cy.wait('@Market');
cy.contains('SUSPENDED MARKET');
cy.contains(MarketTradingMode.MonitoringAuction);
cy.url().should('include', '/markets/market-1');
verifyMarketSummaryDisplayed();

View File

@ -1,5 +1,5 @@
import { aliasQuery } from '@vegaprotocol/cypress';
import type { MarketState } from '@vegaprotocol/types';
import type { MarketTradingMode } from '@vegaprotocol/types';
import type { CyHttpMessages } from 'cypress/types/net-stubbing';
import { generateAccounts } from './mocks/generate-accounts';
import { generateCandles } from './mocks/generate-candles';
@ -13,15 +13,15 @@ import { generateTrades } from './mocks/generate-trades';
export const mockTradingPage = (
req: CyHttpMessages.IncomingHttpRequest,
state: MarketState
tradingMode: MarketTradingMode
) => {
aliasQuery(
req,
'Market',
generateMarket({
market: {
name: `${state.toUpperCase()} MARKET`,
state: state,
name: tradingMode,
tradingMode: tradingMode,
},
})
);
@ -31,12 +31,12 @@ export const mockTradingPage = (
aliasQuery(
req,
'DealTicketQuery',
generateDealTicketQuery({ market: { state } })
generateDealTicketQuery({ market: { tradingMode } })
);
aliasQuery(
req,
'MarketInfoQuery',
generateMarketInfoQuery({ market: { state } })
generateMarketInfoQuery({ market: { tradingMode } })
);
aliasQuery(req, 'Trades', generateTrades());
aliasQuery(req, 'Chart', generateChart());