test: dissassociation tests reworked to current implementation (#1182)
This commit is contained in:
parent
ea7e175fde
commit
fcd9a0321b
@ -17,6 +17,7 @@ const vestingContractSection = '[data-testid="vega-in-vesting-contract"]';
|
||||
const vegaInWalletSection = '[data-testid="vega-in-wallet"]';
|
||||
const associatedKey = '[data-test-id="associated-key"]';
|
||||
const associatedAmount = '[data-test-id="associated-amount"]';
|
||||
const disassocitiationWarning = '[data-testid="disassociation-warning"]';
|
||||
|
||||
context(
|
||||
'Token association flow - with eth and vega wallets connected',
|
||||
@ -144,6 +145,9 @@ context(
|
||||
|
||||
it('Able to disassociate all tokens', function () {
|
||||
// 1000-ASSO-0026
|
||||
const warningText =
|
||||
'Warning: Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.';
|
||||
|
||||
cy.staking_page_associate_tokens('2');
|
||||
|
||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||
@ -151,9 +155,7 @@ context(
|
||||
cy.get('button').contains('Select a validator to nominate').click();
|
||||
|
||||
cy.get(ethWalletDissociateButton).click();
|
||||
cy.contains(
|
||||
'If you disassociate tokens that have been nominated to a node, you will sacrifice any rewards they are due for the current epoch. If you do not wish to sacrifice rewards, remove your stake from a node at the end of an epoch before disassociating.'
|
||||
).should('be.visible');
|
||||
cy.get(disassocitiationWarning).should('contain', warningText);
|
||||
|
||||
cy.staking_page_disassociate_all_tokens();
|
||||
|
||||
@ -203,7 +205,7 @@ context(
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it('Associate both wallet and vesting contract tokens', function () {
|
||||
it('Able to associate & disassociate both wallet and vesting contract tokens', function () {
|
||||
// 1000-ASSO-0019
|
||||
// 1000-ASSO-0020
|
||||
// 1000-ASSO-0021
|
||||
@ -218,7 +220,7 @@ context(
|
||||
'contain',
|
||||
Cypress.env('vegaWalletPublicKeyShort')
|
||||
);
|
||||
cy.get(associatedAmount).should('contain', '37');
|
||||
cy.get(associatedAmount, txTimeout).should('contain', 37);
|
||||
});
|
||||
|
||||
cy.get(vegaInWalletSection).within(() => {
|
||||
@ -226,8 +228,24 @@ context(
|
||||
'contain',
|
||||
Cypress.env('vegaWalletPublicKeyShort')
|
||||
);
|
||||
cy.get(associatedAmount).should('contain', '21');
|
||||
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
||||
});
|
||||
|
||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 58);
|
||||
|
||||
cy.staking_page_disassociate_tokens('6', { type: 'contract' });
|
||||
cy.get(vestingContractSection).within(() => {
|
||||
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
||||
});
|
||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 52);
|
||||
|
||||
cy.get('[href="/staking"]').first().click();
|
||||
|
||||
cy.staking_page_disassociate_tokens('9', { type: 'wallet' });
|
||||
cy.get(vegaInWalletSection).within(() => {
|
||||
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
||||
});
|
||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 43);
|
||||
});
|
||||
|
||||
it('Not able to associate more tokens than owned', function () {
|
||||
|
@ -15,6 +15,8 @@ const stakeValidatorListPendingStake = '[col-id="pendingStake"]';
|
||||
const stakeValidatorListTotalStake = '[col-id="totalStakeThisEpoch"]';
|
||||
const stakeValidatorListTotalShare = '[col-id="share"]';
|
||||
const stakeValidatorListName = '[col-id="validator"]';
|
||||
const vegaKeySelector = '#vega-key-selector';
|
||||
|
||||
const txTimeout = Cypress.env('txTimeout');
|
||||
const epochTimeout = Cypress.env('epochTimeout');
|
||||
|
||||
@ -91,24 +93,19 @@ Cypress.Commands.add('staking_page_disassociate_tokens', (amount, options) => {
|
||||
|
||||
cy.highlight(`Disassociating ${amount} tokens via Staking Page`);
|
||||
cy.get(ethWalletDissociateButton).first().click();
|
||||
cy.get(associateWalletRadioButton, epochTimeout).click();
|
||||
|
||||
cy.get(vegaKeySelector)
|
||||
.invoke('attr', 'disabled')
|
||||
.then((disabled) => {
|
||||
if (!disabled) {
|
||||
cy.get(vegaKeySelector).select(
|
||||
`${type}-${Cypress.env('vegaWalletPublicKey')}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
cy.get(tokenAmountInputBox, epochTimeout).type(amount);
|
||||
|
||||
cy.get(tokenSubmitButton, epochTimeout).should('be.enabled').click();
|
||||
cy.contains(
|
||||
`${amount} $VEGA tokens have been returned to Ethereum wallet`,
|
||||
txTimeout
|
||||
).should('be.visible');
|
||||
if (type === 'wallet') {
|
||||
cy.get(associateWalletRadioButton, { timeout: 30000 }).click();
|
||||
} else if (type === 'contract') {
|
||||
cy.get(associateContractRadioButton, { timeout: 30000 }).click();
|
||||
} else {
|
||||
cy.highlight(`${type} is not association option`);
|
||||
}
|
||||
cy.get(tokenAmountInputBox, { timeout: 10000 }).type(amount);
|
||||
|
||||
cy.get(tokenSubmitButton, txTimeout).should('be.enabled').click();
|
||||
|
||||
if (type === 'wallet') {
|
||||
cy.contains(
|
||||
@ -130,7 +127,6 @@ Cypress.Commands.add('staking_page_disassociate_tokens', (amount, options) => {
|
||||
Cypress.Commands.add('staking_page_disassociate_all_tokens', () => {
|
||||
cy.highlight(`Disassociating all tokens via Staking Page`);
|
||||
cy.get(ethWalletDissociateButton).first().click();
|
||||
cy.get(associateWalletRadioButton, epochTimeout).click();
|
||||
cy.get(stakeMaximumTokens, epochTimeout).click();
|
||||
cy.get(tokenSubmitButton, epochTimeout).click();
|
||||
cy.contains(
|
||||
|
@ -170,7 +170,7 @@ export const DisassociatePage = ({
|
||||
'Use this form to disassociate VEGA tokens with a Vega key. This returns them to either the Ethereum wallet that used the Staking bridge or the vesting contract.'
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
<p data-testid="disassociation-warning">
|
||||
<span className="text-vega-red">{t('Warning')}:</span>{' '}
|
||||
{t(
|
||||
'Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.'
|
||||
|
Loading…
Reference in New Issue
Block a user