test(trading): fixed capsule tests (#3031)

This commit is contained in:
daro-maj 2023-02-28 17:25:43 +01:00 committed by GitHub
parent 86739dfaad
commit 891b441427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,7 @@ const newPrice = '200';
const completeWithdrawalBtn = 'complete-withdrawal'; const completeWithdrawalBtn = 'complete-withdrawal';
const submitTransferBtn = '[type="submit"]'; const submitTransferBtn = '[type="submit"]';
const transferForm = 'transfer-form'; const transferForm = 'transfer-form';
const depositSubmit = 'deposit-submit';
// Because the tests are run on a live network to optimize time, the tests are interdependent and must be run in the given order. // Because the tests are run on a live network to optimize time, the tests are interdependent and must be run in the given order.
describe('capsule - without MultiSign', { tags: '@slow' }, () => { describe('capsule - without MultiSign', { tags: '@slow' }, () => {
@ -76,11 +77,11 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
'contain.text', 'contain.text',
`Deposits of ${btcSymbol} not approved` `Deposits of ${btcSymbol} not approved`
); );
cy.getByTestId('deposit-submit').click(); cy.getByTestId(depositSubmit).click();
cy.getByTestId('dialog-title').should('contain.text', 'Approve complete'); cy.getByTestId('dialog-title').should('contain.text', 'Approve complete');
cy.get('[data-testid="Return to deposit"]').click(); cy.get('[data-testid="Return to deposit"]').click();
cy.get(amountField).clear().type('10'); cy.get(amountField).clear().type('10');
cy.getByTestId('deposit-submit').click(); cy.getByTestId(depositSubmit).click();
cy.getByTestId(toastContent, txTimeout).should( cy.getByTestId(toastContent, txTimeout).should(
'contain.text', 'contain.text',
`Transaction confirmedYour transaction has been confirmed.View on EtherscanDeposit 10.00 ${btcSymbol}`, `Transaction confirmedYour transaction has been confirmed.View on EtherscanDeposit 10.00 ${btcSymbol}`,
@ -179,14 +180,14 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
describe('capsule', { tags: '@slow' }, () => { describe('capsule', { tags: '@slow' }, () => {
before(() => { before(() => {
cy.createMarket();
cy.get('@markets').then((markets) => {
cy.wrap(markets[0]).as('market');
});
cy.updateCapsuleMultiSig(); cy.updateCapsuleMultiSig();
}); });
beforeEach(() => { beforeEach(() => {
cy.createMarket();
cy.get('@markets').then((markets) => {
cy.wrap(markets[0]).as('market');
});
cy.setVegaWallet(); cy.setVegaWallet();
}); });
@ -220,7 +221,6 @@ describe('capsule', { tags: '@slow' }, () => {
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC, timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
}; };
const rawPrice = removeDecimal(order.price, market.decimalPlaces); const rawPrice = removeDecimal(order.price, market.decimalPlaces);
const rawSize = removeDecimal(order.size, market.positionDecimalPlaces);
cy.getByTestId('Collateral').click(); cy.getByTestId('Collateral').click();
cy.getByTestId('asset', txTimeout).should('contain.text', usdcSymbol); cy.getByTestId('asset', txTimeout).should('contain.text', usdcSymbol);
@ -238,7 +238,7 @@ describe('capsule', { tags: '@slow' }, () => {
.get(`[data-testid="price-${rawPrice}"]`) .get(`[data-testid="price-${rawPrice}"]`)
.should('contain.text', order.price) .should('contain.text', order.price)
.get(`[data-testid="bid-vol-${rawPrice}"]`) .get(`[data-testid="bid-vol-${rawPrice}"]`)
.should('contain.text', rawSize); .should('contain.text', order.size);
cy.getByTestId(ordersTab).click(); cy.getByTestId(ordersTab).click();
cy.getByTestId('edit', txTimeout).should('contain.text', 'Edit'); cy.getByTestId('edit', txTimeout).should('contain.text', 'Edit');
@ -410,12 +410,18 @@ describe('capsule', { tags: '@slow' }, () => {
it('approved amount is less than deposit', function () { it('approved amount is less than deposit', function () {
// 1001-DEPO-006 // 1001-DEPO-006
cy.getByTestId(depositsTab).click(); cy.getByTestId(depositsTab).click();
cy.getByTestId('deposit-button').click(); cy.getByTestId('deposit-button').click();
cy.get(assetSelectField, txTimeout).select(btcName, { force: true }); cy.get(assetSelectField, txTimeout).select(btcName, { force: true });
cy.contains('Deposits of tBTC not approved').should('not.exist');
cy.contains('Use maximum').should('be.visible');
cy.get(amountField).clear().type('20000000'); cy.get(amountField).clear().type('20000000');
cy.getByTestId('deposit-approve-submit').should('be.visible'); cy.getByTestId(depositSubmit).should('be.visible');
cy.getByTestId(depositSubmit).click();
cy.getByTestId('input-error-text').should(
'contain.text',
'Amount is above approved amount.Update approve amount'
);
}); });
it('withdraw - delay verification', function () { it('withdraw - delay verification', function () {