2022-06-10 19:00:02 +00:00
|
|
|
import { MarketState } from '@vegaprotocol/types';
|
|
|
|
import { mockTradingPage } from '../support/trading';
|
|
|
|
import { connectVegaWallet } from '../support/vega-wallet';
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-06-20 15:16:47 +00:00
|
|
|
cy.mockGQL((req) => {
|
|
|
|
mockTradingPage(req, MarketState.Active);
|
|
|
|
});
|
2022-06-10 19:00:02 +00:00
|
|
|
cy.visit('/markets/market-0');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('positions', () => {
|
|
|
|
it('renders positions', () => {
|
|
|
|
cy.getByTestId('Positions').click();
|
|
|
|
cy.getByTestId('tab-positions').contains('Please connect Vega wallet');
|
|
|
|
|
|
|
|
connectVegaWallet();
|
|
|
|
|
|
|
|
cy.getByTestId('tab-positions').should('be.visible');
|
|
|
|
cy.getByTestId('tab-positions')
|
|
|
|
.get('[col-id="market.tradableInstrument.instrument.code"]')
|
2022-07-13 14:23:46 +00:00
|
|
|
.should('be.visible')
|
2022-06-10 19:00:02 +00:00
|
|
|
.each(($marketSymbol) => {
|
|
|
|
cy.wrap($marketSymbol).invoke('text').should('not.be.empty');
|
|
|
|
});
|
|
|
|
cy.getByTestId('tab-positions')
|
|
|
|
.get('[col-id="openVolume"]')
|
|
|
|
.each(($openVolume) => {
|
|
|
|
cy.wrap($openVolume).invoke('text').should('not.be.empty');
|
|
|
|
});
|
|
|
|
// includes average entry price, mark price & realised PNL
|
|
|
|
cy.getByTestId('tab-positions')
|
|
|
|
.getByTestId('flash-cell')
|
|
|
|
.each(($prices) => {
|
|
|
|
cy.wrap($prices).invoke('text').should('not.be.empty');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|