chore(trading): delete duplicate cypress tests (#5287)
This commit is contained in:
parent
824bcf89bd
commit
b062339682
@ -1,87 +0,0 @@
|
|||||||
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
|
||||||
import {
|
|
||||||
accountsQuery,
|
|
||||||
amendGeneralAccountBalance,
|
|
||||||
amendMarginAccountBalance,
|
|
||||||
} from '@vegaprotocol/mock';
|
|
||||||
|
|
||||||
describe.skip(
|
|
||||||
'account validation',
|
|
||||||
{ tags: '@regression', testIsolation: true },
|
|
||||||
() => {
|
|
||||||
describe('zero balance error', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
cy.mockTradingPage();
|
|
||||||
let accounts = accountsQuery();
|
|
||||||
accounts = amendMarginAccountBalance(accounts, 'market-0', '1000');
|
|
||||||
accounts = amendGeneralAccountBalance(accounts, 'market-0', '0');
|
|
||||||
cy.mockGQL((req) => {
|
|
||||||
aliasGQLQuery(req, 'Accounts', accounts);
|
|
||||||
});
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.visit('/#/markets/market-0');
|
|
||||||
cy.wait('@Markets');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should show an error if your balance is zero', () => {
|
|
||||||
const accounts = accountsQuery();
|
|
||||||
amendMarginAccountBalance(accounts, 'market-0', '0');
|
|
||||||
cy.mockGQL((req) => {
|
|
||||||
aliasGQLQuery(req, 'Accounts', accounts);
|
|
||||||
});
|
|
||||||
// 7002-SORD-060
|
|
||||||
cy.getByTestId('place-order').should('be.enabled');
|
|
||||||
// 7002-SORD-003
|
|
||||||
cy.getByTestId('deal-ticket-error-message-zero-balance').should(
|
|
||||||
'have.text',
|
|
||||||
'You need ' +
|
|
||||||
'tDAI' +
|
|
||||||
' in your wallet to trade in this market. See all your collateral.Make a deposit'
|
|
||||||
);
|
|
||||||
cy.getByTestId('deal-ticket-deposit-dialog-button').should('exist');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('not enough balance warning', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
cy.mockTradingPage();
|
|
||||||
let accounts = accountsQuery();
|
|
||||||
accounts = amendMarginAccountBalance(accounts, 'market-0', '1000');
|
|
||||||
accounts = amendGeneralAccountBalance(accounts, 'market-0', '1');
|
|
||||||
cy.mockGQL((req) => {
|
|
||||||
aliasGQLQuery(req, 'Accounts', accounts);
|
|
||||||
});
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.visit('/#/markets/market-0');
|
|
||||||
cy.wait('@Markets');
|
|
||||||
|
|
||||||
cy.get('[data-testid="deal-ticket-form"]').then(($form) => {
|
|
||||||
if (!$form.length) {
|
|
||||||
cy.getByTestId('Order').click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display info and button for deposit', () => {
|
|
||||||
// 7002-SORD-003
|
|
||||||
|
|
||||||
// warning should show immediately
|
|
||||||
cy.getByTestId('deal-ticket-warning-margin').should(
|
|
||||||
'contain.text',
|
|
||||||
'You may not have enough margin available to open this position'
|
|
||||||
);
|
|
||||||
cy.getByTestId('deal-ticket-warning-margin').should(
|
|
||||||
'contain.text',
|
|
||||||
'You may not have enough margin available to open this position. 5.00 tDAI is currently required. You have only 0.01001 tDAI available.'
|
|
||||||
);
|
|
||||||
cy.getByTestId('deal-ticket-deposit-dialog-button').click();
|
|
||||||
cy.getByTestId('sidebar-content')
|
|
||||||
.find('h2')
|
|
||||||
.eq(0)
|
|
||||||
.should('have.text', 'Deposit');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,87 +0,0 @@
|
|||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
import { testOrderSubmission } from '../support/order-validation';
|
|
||||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
|
||||||
import { createOrder } from '../support/create-order';
|
|
||||||
|
|
||||||
const displayTomorrow = () => {
|
|
||||||
const tomorrow = new Date();
|
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
||||||
return tomorrow.toISOString().substring(0, 16);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe(
|
|
||||||
'must submit order for market in batch auction',
|
|
||||||
{ tags: '@regression' },
|
|
||||||
() => {
|
|
||||||
before(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
cy.mockTradingPage(
|
|
||||||
Schema.MarketState.STATE_SUSPENDED,
|
|
||||||
Schema.MarketTradingMode.TRADING_MODE_BATCH_AUCTION,
|
|
||||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
|
||||||
);
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.visit('/#/markets/market-0');
|
|
||||||
cy.wait('@Markets');
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places limit buy order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_BUY,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
|
||||||
size: '100',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
price: '200',
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, { price: '20000000' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places limit sell order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_SELL,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
|
||||||
size: '100',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
price: '50000',
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, { price: '5000000000' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places GTT limit buy order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_SELL,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
|
||||||
size: '100',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
price: '1.00',
|
|
||||||
expiresAt: displayTomorrow(),
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, {
|
|
||||||
price: '100000',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
expiresAt:
|
|
||||||
new Date(order.expiresAt as string).getTime().toString() + '000000',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,85 +0,0 @@
|
|||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
import { testOrderSubmission } from '../support/order-validation';
|
|
||||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
|
||||||
import { createOrder } from '../support/create-order';
|
|
||||||
|
|
||||||
const displayTomorrow = () => {
|
|
||||||
const tomorrow = new Date();
|
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
||||||
return tomorrow.toISOString().substring(0, 16);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe(
|
|
||||||
'must submit order for market in monitoring auction',
|
|
||||||
{ tags: '@regression' },
|
|
||||||
() => {
|
|
||||||
before(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
cy.mockTradingPage(
|
|
||||||
Schema.MarketState.STATE_SUSPENDED,
|
|
||||||
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
|
||||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
|
||||||
);
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.visit('/#/markets/market-0');
|
|
||||||
cy.wait('@Markets');
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places limit buy order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_BUY,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
|
||||||
size: '100',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
price: '200',
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, { price: '20000000' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places limit sell order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_SELL,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
|
||||||
size: '100',
|
|
||||||
price: '50000',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, { price: '5000000000' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places GTT limit buy order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_SELL,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
|
||||||
size: '100',
|
|
||||||
price: '1.00',
|
|
||||||
expiresAt: displayTomorrow(),
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, {
|
|
||||||
price: '100000',
|
|
||||||
expiresAt:
|
|
||||||
new Date(order.expiresAt as string).getTime().toString() + '000000',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,85 +0,0 @@
|
|||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
import { testOrderSubmission } from '../support/order-validation';
|
|
||||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
|
||||||
import { createOrder } from '../support/create-order';
|
|
||||||
|
|
||||||
const displayTomorrow = () => {
|
|
||||||
const tomorrow = new Date();
|
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
||||||
return tomorrow.toISOString().substring(0, 16);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe(
|
|
||||||
'must submit order for market in opening auction',
|
|
||||||
{ tags: '@regression' },
|
|
||||||
() => {
|
|
||||||
before(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
cy.mockTradingPage(
|
|
||||||
Schema.MarketState.STATE_SUSPENDED,
|
|
||||||
Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
|
|
||||||
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET
|
|
||||||
);
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.visit('/#/markets/market-0');
|
|
||||||
cy.wait('@Markets');
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.setVegaWallet();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places limit buy order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_BUY,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
|
||||||
size: '100',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
price: '200',
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, { price: '20000000' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places limit sell order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_SELL,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
|
||||||
size: '100',
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
price: '50000',
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, { price: '5000000000' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('successfully places GTT limit buy order', () => {
|
|
||||||
cy.mockVegaWalletTransaction();
|
|
||||||
const order: OrderSubmission = {
|
|
||||||
marketId: 'market-0',
|
|
||||||
type: Schema.OrderType.TYPE_LIMIT,
|
|
||||||
side: Schema.Side.SIDE_SELL,
|
|
||||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
|
||||||
size: '100',
|
|
||||||
price: '1.00',
|
|
||||||
expiresAt: displayTomorrow(),
|
|
||||||
postOnly: false,
|
|
||||||
reduceOnly: false,
|
|
||||||
};
|
|
||||||
createOrder(order);
|
|
||||||
testOrderSubmission(order, {
|
|
||||||
price: '100000',
|
|
||||||
expiresAt:
|
|
||||||
new Date(order.expiresAt as string).getTime().toString() + '000000',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
Loading…
Reference in New Issue
Block a user