test(trading): key to key transfer tests (#4014)
This commit is contained in:
parent
22af89e78c
commit
0465fb8ca9
@ -114,6 +114,8 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can key to key transfers', function () {
|
it('can key to key transfers', function () {
|
||||||
|
// 1003-TRAN-023
|
||||||
|
// 1003-TRAN-006
|
||||||
cy.get('main[data-testid="/portfolio"]').should('exist');
|
cy.get('main[data-testid="/portfolio"]').should('exist');
|
||||||
|
|
||||||
cy.getByTestId(collateralTab).click();
|
cy.getByTestId(collateralTab).click();
|
||||||
|
@ -19,6 +19,7 @@ describe('accounts', { tags: '@smoke' }, () => {
|
|||||||
// 7001-COLL-005
|
// 7001-COLL-005
|
||||||
// 7001-COLL-006
|
// 7001-COLL-006
|
||||||
// 7001-COLL-007
|
// 7001-COLL-007
|
||||||
|
// 1003-TRAN-001
|
||||||
|
|
||||||
const tradingAccountRowId = '[row-id="t-0"]';
|
const tradingAccountRowId = '[row-id="t-0"]';
|
||||||
cy.getByTestId('Collateral').click();
|
cy.getByTestId('Collateral').click();
|
||||||
@ -62,6 +63,7 @@ describe('accounts', { tags: '@smoke' }, () => {
|
|||||||
.click();
|
.click();
|
||||||
cy.getByTestId('deposit').should('be.visible');
|
cy.getByTestId('deposit').should('be.visible');
|
||||||
cy.getByTestId('withdraw').should('be.visible');
|
cy.getByTestId('withdraw').should('be.visible');
|
||||||
|
cy.getByTestId('transfer').should('be.visible');
|
||||||
cy.getByTestId('breakdown').should('be.visible');
|
cy.getByTestId('breakdown').should('be.visible');
|
||||||
cy.getByTestId('Collateral').click({ force: true });
|
cy.getByTestId('Collateral').click({ force: true });
|
||||||
});
|
});
|
||||||
|
@ -1,49 +1,189 @@
|
|||||||
import { selectAsset } from '../support/helpers';
|
import { selectAsset } from '../support/helpers';
|
||||||
|
// #region consts
|
||||||
const formFieldError = 'input-error-text';
|
|
||||||
const toAddressField = '[name="toAddress"]';
|
|
||||||
const amountField = 'input[name="amount"]';
|
const amountField = 'input[name="amount"]';
|
||||||
const submitTransferBtn = '[type="submit"]';
|
const amountShortName = 'input[name="amount"] + div + span.text-xs';
|
||||||
const transferForm = 'transfer-form';
|
const assetSelection = 'select-asset';
|
||||||
const errorText = 'input-error-text';
|
const assetBalance = 'asset-balance';
|
||||||
const openTransferDialog = 'open-transfer-dialog';
|
const assetOption = 'rich-select-option';
|
||||||
const closeDialog = 'dialog-close';
|
const closeDialog = 'dialog-close';
|
||||||
|
const dialogTitle = 'dialog-title';
|
||||||
const dialogTransferText = 'dialog-transfer-text';
|
const dialogTransferText = 'dialog-transfer-text';
|
||||||
|
const dropdownMenu = 'dropdown-menu';
|
||||||
|
const errorText = 'input-error-text';
|
||||||
|
const formFieldError = 'input-error-text';
|
||||||
|
const includeTransferFeeRadioBtn = 'include-transfer-fee';
|
||||||
|
const keyID = '[data-testid="dialog-transfer-text"] > .rounded-md';
|
||||||
|
const manageVegaWallet = 'manage-vega-wallet';
|
||||||
|
const openTransferDialog = 'open-transfer-dialog';
|
||||||
|
const submitTransferBtn = '[type="submit"]';
|
||||||
|
const toAddressField = '[name="toAddress"]';
|
||||||
|
const totalTransferfee = 'total-transfer-fee';
|
||||||
|
const transfer = 'transfer';
|
||||||
|
const transferAmount = 'transfer-amount';
|
||||||
|
const transferForm = 'transfer-form';
|
||||||
|
const transferFee = 'transfer-fee';
|
||||||
|
const walletTransfer = 'wallet-transfer';
|
||||||
|
|
||||||
const ASSET_SEPOLIA_TBTC = 2;
|
|
||||||
const ASSET_EURO = 1;
|
const ASSET_EURO = 1;
|
||||||
|
const ASSET_SEPOLIA_TBTC = 2;
|
||||||
|
|
||||||
const toastContent = 'toast-content';
|
|
||||||
const collateralTab = 'Collateral';
|
const collateralTab = 'Collateral';
|
||||||
const toastCloseBtn = 'toast-close';
|
const toastCloseBtn = 'toast-close';
|
||||||
|
const toastContent = 'toast-content';
|
||||||
|
// #endregion
|
||||||
|
|
||||||
describe(
|
describe('transfer fees', { tags: '@regression', testIsolation: true }, () => {
|
||||||
'transfer form validation and transfer from options',
|
beforeEach(() => {
|
||||||
{ tags: '@smoke' },
|
|
||||||
() => {
|
|
||||||
before(() => {
|
|
||||||
cy.mockWeb3Provider();
|
cy.mockWeb3Provider();
|
||||||
cy.mockTradingPage();
|
cy.mockTradingPage();
|
||||||
cy.mockSubscription();
|
cy.mockSubscription();
|
||||||
cy.setVegaWallet();
|
cy.setVegaWallet();
|
||||||
|
|
||||||
cy.visit('/#/portfolio');
|
cy.visit('/#/portfolio');
|
||||||
|
cy.getByTestId('Trading').first().click();
|
||||||
cy.getByTestId(collateralTab).click();
|
cy.getByTestId(collateralTab).click();
|
||||||
cy.getByTestId(openTransferDialog).click();
|
cy.getByTestId(dropdownMenu).first().click();
|
||||||
|
cy.getByTestId(transfer).click();
|
||||||
|
|
||||||
|
cy.wait('@Accounts');
|
||||||
|
cy.wait('@Assets');
|
||||||
|
cy.mockVegaWalletTransaction();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transfer fees tooltips', () => {
|
||||||
|
// 1003-TRAN-015
|
||||||
|
// 1003-TRAN-016
|
||||||
|
// 1003-TRAN-017
|
||||||
|
// 1003-TRAN-018
|
||||||
|
// 1003-TRAN-019
|
||||||
|
cy.getByTestId(transferForm);
|
||||||
|
cy.contains('Enter manually').click();
|
||||||
|
|
||||||
|
cy.getByTestId(transferForm)
|
||||||
|
.find(toAddressField)
|
||||||
|
.type('7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535');
|
||||||
|
selectAsset(ASSET_SEPOLIA_TBTC);
|
||||||
|
cy.getByTestId(transferForm)
|
||||||
|
.find(amountField)
|
||||||
|
.type('1', { delay: 100, force: true });
|
||||||
|
|
||||||
|
/// Check Include Transfer Fee tooltip
|
||||||
|
cy.get('label[for="include-transfer-fee"] div').realHover();
|
||||||
|
cy.get('[data-side="bottom"] div')
|
||||||
|
.should('be.visible')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId(dialogTitle).click();
|
||||||
|
|
||||||
|
//Check Transfer Fee tooltip
|
||||||
|
cy.contains('div', 'Transfer fee').realHover();
|
||||||
|
cy.get('[data-side="bottom"] div')
|
||||||
|
.should('be.visible')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId(dialogTitle).click();
|
||||||
|
|
||||||
|
//Check Amount to be transferred tooltip
|
||||||
|
cy.contains('div', 'Amount to be transferred').realHover();
|
||||||
|
cy.get('[data-side="bottom"] div')
|
||||||
|
.should('be.visible')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId(dialogTitle).click();
|
||||||
|
|
||||||
|
//Check Total amount (with fee) tooltip
|
||||||
|
cy.contains('div', 'Total amount (with fee)').realHover();
|
||||||
|
cy.get('[data-side="bottom"] div')
|
||||||
|
.should('be.visible')
|
||||||
|
.should('not.be.empty');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transfer fees', () => {
|
||||||
|
// 1003-TRAN-020
|
||||||
|
// 1003-TRAN-021
|
||||||
|
// 1003-TRAN-022
|
||||||
|
// 1003-TRAN-023
|
||||||
|
cy.getByTestId(transferForm);
|
||||||
|
cy.contains('Enter manually').click();
|
||||||
|
|
||||||
|
cy.getByTestId(transferForm)
|
||||||
|
.find(toAddressField)
|
||||||
|
.type('7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535');
|
||||||
|
selectAsset(ASSET_SEPOLIA_TBTC);
|
||||||
|
cy.getByTestId(includeTransferFeeRadioBtn).should('be.disabled');
|
||||||
|
|
||||||
|
cy.getByTestId(transferForm)
|
||||||
|
.find(amountField)
|
||||||
|
.type('1', { delay: 100, force: true });
|
||||||
|
|
||||||
|
cy.getByTestId(transferFee)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('contain.text', '0.01');
|
||||||
|
cy.getByTestId(transferAmount)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('contain.text', '1.00');
|
||||||
|
cy.getByTestId(totalTransferfee)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('contain.text', '1.01');
|
||||||
|
cy.getByTestId(includeTransferFeeRadioBtn).click();
|
||||||
|
cy.getByTestId(transferFee)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('contain.text', '0.01');
|
||||||
|
cy.getByTestId(transferAmount)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('contain.text', '0.99');
|
||||||
|
cy.getByTestId(totalTransferfee)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('contain.text', '1.00');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe(
|
||||||
|
'transfer form validation',
|
||||||
|
{ tags: '@regression', testIsolation: true },
|
||||||
|
() => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.mockWeb3Provider();
|
||||||
|
cy.mockTradingPage();
|
||||||
|
cy.mockSubscription();
|
||||||
|
cy.setVegaWallet();
|
||||||
|
|
||||||
|
cy.visit('/#/portfolio');
|
||||||
|
cy.getByTestId(manageVegaWallet).click();
|
||||||
|
cy.getByTestId(walletTransfer).click();
|
||||||
|
|
||||||
cy.wait('@Accounts');
|
cy.wait('@Accounts');
|
||||||
cy.wait('@Assets');
|
cy.wait('@Assets');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('empty fields', () => {
|
it('transfer Text', () => {
|
||||||
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
// 1003-TRAN-003
|
||||||
|
cy.getByTestId(dialogTransferText)
|
||||||
|
.should('exist')
|
||||||
|
.get(keyID)
|
||||||
|
.invoke('text')
|
||||||
|
.should('match', /[\w.]{6}…[\w.]{6}/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('invalid vega key validation', () => {
|
||||||
|
//1003-TRAN-013
|
||||||
|
//1003-TRAN-004
|
||||||
|
cy.getByTestId(transferForm).should('be.visible');
|
||||||
|
cy.contains('Enter manually').click();
|
||||||
|
cy.getByTestId(transferForm).find(toAddressField).type('asd');
|
||||||
|
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
||||||
|
cy.getByTestId(formFieldError).should('contain.text', 'Invalid Vega key');
|
||||||
|
cy.contains('label', 'Vega key').should('be.visible');
|
||||||
|
cy.contains('label', 'Asset').should('be.visible');
|
||||||
|
cy.contains('label', 'Amount').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty fields', () => {
|
||||||
|
// 1003-TRAN-012
|
||||||
|
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
||||||
cy.getByTestId(formFieldError).should('contain.text', 'Required');
|
cy.getByTestId(formFieldError).should('contain.text', 'Required');
|
||||||
// only 2 despite 3 fields because the ethereum address will be auto populated
|
|
||||||
cy.getByTestId(formFieldError).should('have.length', 3);
|
cy.getByTestId(formFieldError).should('have.length', 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('min amount', () => {
|
it('min amount', () => {
|
||||||
// 1002-WITH-010
|
// 1002-WITH-010
|
||||||
|
// 1003-TRAN-014
|
||||||
selectAsset(ASSET_SEPOLIA_TBTC);
|
selectAsset(ASSET_SEPOLIA_TBTC);
|
||||||
cy.get(amountField).clear().type('0');
|
cy.get(amountField).clear().type('0');
|
||||||
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
||||||
@ -52,7 +192,11 @@ describe(
|
|||||||
'Value is below minimum'
|
'Value is below minimum'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('max amount', () => {
|
it('max amount', () => {
|
||||||
|
// 1003-TRAN-002
|
||||||
|
// 1003-TRAN-011
|
||||||
|
// 1003-TRAN-002
|
||||||
selectAsset(ASSET_EURO); // Will be above maximum because the vega wallet doesn't have any collateral
|
selectAsset(ASSET_EURO); // Will be above maximum because the vega wallet doesn't have any collateral
|
||||||
cy.get(amountField).clear().type('1001', { delay: 100 });
|
cy.get(amountField).clear().type('1001', { delay: 100 });
|
||||||
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
||||||
@ -60,38 +204,11 @@ describe(
|
|||||||
'contain.text',
|
'contain.text',
|
||||||
'You cannot transfer more than your available collateral'
|
'You cannot transfer more than your available collateral'
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
it('can start transfer from vega wallet', () => {
|
|
||||||
cy.getByTestId(closeDialog).click();
|
cy.getByTestId(closeDialog).click();
|
||||||
cy.getByTestId('manage-vega-wallet').click();
|
|
||||||
cy.getByTestId('wallet-transfer').should('have.text', 'Transfer').click();
|
|
||||||
cy.getByTestId(dialogTransferText).should(
|
|
||||||
'contain.text',
|
|
||||||
'Transfer funds to another Vega key from 02ecea…342f65 If you are at all unsure, stop and seek advice.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can start transfer from trading collateral table', () => {
|
|
||||||
cy.getByTestId(closeDialog).click();
|
|
||||||
cy.getByTestId('Trading').first().click();
|
|
||||||
cy.getByTestId(collateralTab).click();
|
|
||||||
cy.getByTestId(openTransferDialog).should('not.exist');
|
|
||||||
cy.getByTestId('Portfolio').eq(0).click();
|
|
||||||
cy.getByTestId(collateralTab).click();
|
|
||||||
cy.getByTestId(openTransferDialog).click();
|
|
||||||
cy.getByTestId(dialogTransferText).should(
|
|
||||||
'contain.text',
|
|
||||||
'Transfer funds to another Vega key from 02ecea…342f65 If you are at all unsure, stop and seek advice.'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
describe('withdraw actions', { tags: '@smoke', testIsolation: true }, () => {
|
||||||
describe(
|
|
||||||
'withdraw actions',
|
|
||||||
{ tags: '@regression', testIsolation: true },
|
|
||||||
() => {
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.mockWeb3Provider();
|
cy.mockWeb3Provider();
|
||||||
cy.mockTradingPage();
|
cy.mockTradingPage();
|
||||||
@ -107,11 +224,38 @@ describe(
|
|||||||
cy.mockVegaWalletTransaction();
|
cy.mockVegaWalletTransaction();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('key to key transfers by select key', function () {
|
it('key to key transfers by select key', () => {
|
||||||
|
// 1003-TRAN-001
|
||||||
|
// 1003-TRAN-006
|
||||||
|
// 1003-TRAN-007
|
||||||
|
// 1003-TRAN-008
|
||||||
|
// 1003-TRAN-009
|
||||||
|
// 1003-TRAN-010
|
||||||
|
// 1003-TRAN-023
|
||||||
cy.getByTestId(transferForm).should('be.visible');
|
cy.getByTestId(transferForm).should('be.visible');
|
||||||
cy.getByTestId(transferForm).find(toAddressField).select(1);
|
cy.getByTestId(transferForm).find(toAddressField).select(1);
|
||||||
selectAsset(ASSET_SEPOLIA_TBTC);
|
|
||||||
cy.getByTestId(transferForm).find(amountField).type('1', { delay: 100 });
|
cy.getByTestId(assetSelection).click();
|
||||||
|
cy.getByTestId(assetOption);
|
||||||
|
cy.getByTestId(assetBalance).should('not.be.empty');
|
||||||
|
cy.getByTestId(assetOption).should('have.length.gt', 4);
|
||||||
|
|
||||||
|
let optionText: string;
|
||||||
|
cy.getByTestId(assetOption)
|
||||||
|
.eq(2)
|
||||||
|
.invoke('text')
|
||||||
|
.then((text: string) => {
|
||||||
|
optionText = text;
|
||||||
|
cy.getByTestId(assetOption).eq(2).click();
|
||||||
|
cy.getByTestId(assetSelection).should('have.text', optionText);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.getByTestId(transferForm)
|
||||||
|
.find(amountField)
|
||||||
|
.type('1', { delay: 100, force: true });
|
||||||
|
|
||||||
|
cy.getByTestId(transferForm).find(amountShortName).should('not.be.empty');
|
||||||
|
|
||||||
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
||||||
cy.getByTestId(toastContent).should(
|
cy.getByTestId(toastContent).should(
|
||||||
'contain.text',
|
'contain.text',
|
||||||
@ -120,16 +264,17 @@ describe(
|
|||||||
cy.getByTestId(toastCloseBtn).click();
|
cy.getByTestId(toastCloseBtn).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('key to key transfers by enter manual key', function () {
|
it('key to key transfers by enter manual key', () => {
|
||||||
|
//1003-TRAN-005
|
||||||
cy.getByTestId(transferForm).should('be.visible');
|
cy.getByTestId(transferForm).should('be.visible');
|
||||||
cy.contains('Enter manually').click();
|
cy.contains('Enter manually').click();
|
||||||
cy.getByTestId(transferForm)
|
cy.getByTestId(transferForm)
|
||||||
.find(toAddressField)
|
.find(toAddressField)
|
||||||
.type(
|
.type('7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535');
|
||||||
'7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535'
|
|
||||||
);
|
|
||||||
selectAsset(ASSET_SEPOLIA_TBTC);
|
selectAsset(ASSET_SEPOLIA_TBTC);
|
||||||
cy.getByTestId(transferForm).find(amountField).type('1', { delay: 100 });
|
cy.getByTestId(transferForm)
|
||||||
|
.find(amountField)
|
||||||
|
.type('1', { delay: 100, force: true });
|
||||||
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
cy.getByTestId(transferForm).find(submitTransferBtn).click();
|
||||||
cy.getByTestId(toastContent).should(
|
cy.getByTestId(toastContent).should(
|
||||||
'contain.text',
|
'contain.text',
|
||||||
@ -137,5 +282,4 @@ describe(
|
|||||||
);
|
);
|
||||||
cy.getByTestId(toastCloseBtn).click();
|
cy.getByTestId(toastCloseBtn).click();
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user