test: margin positions and collateral tests added (#1204)
This commit is contained in:
parent
036f67a68e
commit
7edf4fc64c
32
apps/trading-e2e/src/integration/trading-collateral.cy.ts
Normal file
32
apps/trading-e2e/src/integration/trading-collateral.cy.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { MarketState } from '@vegaprotocol/types';
|
||||
import { mockTradingPage } from '../support/trading';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.mockGQL((req) => {
|
||||
mockTradingPage(req, MarketState.STATE_ACTIVE);
|
||||
});
|
||||
cy.visit('/markets/market-0');
|
||||
});
|
||||
|
||||
describe('collateral', () => {
|
||||
const collateralTab = 'Collateral';
|
||||
const assetSymbolColumn = "[col-id='asset.symbol']";
|
||||
const assetTypeColumn = "[col-id='type']";
|
||||
const assetMarketName = "[col-id='market.name']";
|
||||
it('renders collateral', () => {
|
||||
connectVegaWallet();
|
||||
cy.getByTestId(collateralTab).click();
|
||||
cy.get(assetSymbolColumn).each(($symbol) => {
|
||||
cy.wrap($symbol).invoke('text').should('not.be.empty');
|
||||
});
|
||||
cy.get(assetTypeColumn).should('contain.text', 'General');
|
||||
cy.get(assetMarketName).should(
|
||||
'contain.text',
|
||||
'AAVEDAI Monthly (30 Jun 2022)'
|
||||
);
|
||||
cy.getByTestId('price').each(($price) => {
|
||||
cy.wrap($price).invoke('text').should('not.be.empty');
|
||||
});
|
||||
});
|
||||
});
|
@ -28,11 +28,19 @@ describe('positions', () => {
|
||||
.each(($openVolume) => {
|
||||
cy.wrap($openVolume).invoke('text').should('not.be.empty');
|
||||
});
|
||||
// includes average entry price, mark price & realised PNL
|
||||
// includes average entry price, mark price, realised PNL & leverage
|
||||
cy.getByTestId('tab-positions')
|
||||
.getByTestId('flash-cell')
|
||||
.each(($prices) => {
|
||||
cy.wrap($prices).invoke('text').should('not.be.empty');
|
||||
});
|
||||
|
||||
cy.get('[col-id="averageEntryPrice"]')
|
||||
.should('contain.text', '11.29935') // entry price
|
||||
.should('contain.text', '9.21954'); // liquidation price
|
||||
|
||||
cy.get('[col-id="capitalUtilisation"]') // margin allocated
|
||||
.should('contain.text', '0.00%')
|
||||
.should('contain.text', '1,000.01000');
|
||||
});
|
||||
});
|
||||
|
@ -27,7 +27,11 @@ export const generateAccounts = (
|
||||
__typename: 'Account',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
balance: '100000000',
|
||||
market: null,
|
||||
market: {
|
||||
id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13',
|
||||
name: 'AAVEDAI Monthly (30 Jun 2022)',
|
||||
__typename: 'Market',
|
||||
},
|
||||
asset: {
|
||||
__typename: 'Asset',
|
||||
id: 'asset-id-2',
|
||||
|
@ -49,7 +49,7 @@ export const VegaWalletConnectButton = ({
|
||||
<KeypairItem key={kp.pub} kp={kp} />
|
||||
))}
|
||||
</DropdownMenuRadioGroup>
|
||||
<DropdownMenuItem onClick={disconnect}>
|
||||
<DropdownMenuItem data-testid="disconnect" onClick={disconnect}>
|
||||
{t('Disconnect')}
|
||||
</DropdownMenuItem>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user