Test/746 expand coverage of tfe tests (#759)
* test: adding extra checks within tests * test: lint * test: refactor to bring assertions inline with new wallet locators * test: lint * test: lint correction * test: formatting for lint * test: formatting for lint * test: fix test and make use of common functions * test: lint
This commit is contained in:
parent
fdc22ed1f4
commit
85c3eff31e
@ -1,28 +1,44 @@
|
|||||||
const pageSpinner = 'splash-loader';
|
/// <reference types="cypress" />
|
||||||
const menuBar = 'nav';
|
const stakeValidatorList = '[data-testid="node-list-item-name"]';
|
||||||
const validatorList = '[data-testid="node-list-item-name"]';
|
const stakeValidatorWithinList = '[data-testid="node-list-item"]';
|
||||||
const removeStakeRadioButton = '[data-testid="remove-stake-radio"]';
|
const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]';
|
||||||
const tokenAmountInputBox = '[data-testid="token-amount-input"]';
|
const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]';
|
||||||
const tokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
const stakeTokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
||||||
const stakeNextEpochValue = '[data-testid="stake-next-epoch"]';
|
const stakeNextEpochValue = '[data-testid="stake-next-epoch"]';
|
||||||
const vegaWalletContainer = '[data-testid="vega-wallet"]';
|
const stakeThisEpochValue = '[data-testid="stake-this-epoch"]';
|
||||||
|
const stakeAddStakeRadioButton = '[data-testid="add-stake-radio"]';
|
||||||
|
const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]';
|
||||||
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
||||||
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
|
const vegaWalletUnstakedBalance =
|
||||||
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
|
const vegaWalletStakedBalances =
|
||||||
|
'[data-testid="vega-wallet-balance-staked-validators"]';
|
||||||
|
const vegaWalletThisEpochBalances =
|
||||||
|
'[data-testid="vega-wallet-balance-this-epoch"]';
|
||||||
|
const vegaWalletNextEpochBalances =
|
||||||
|
'[data-testid="vega-wallet-balance-next-epoch"]';
|
||||||
|
const ethWalletAssociatedBalances =
|
||||||
|
'[data-testid="eth-wallet-associated-balances"]';
|
||||||
|
const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]';
|
||||||
|
const ethWalletContainer = '[data-testid="ethereum-wallet"]';
|
||||||
|
const txTimeout = { timeout: 40000 };
|
||||||
|
const epochTimeout = { timeout: 10000 };
|
||||||
|
|
||||||
context('Staking Flow - with eth and vega wallets connected', function () {
|
context('Staking Flow - with eth and vega wallets connected', function () {
|
||||||
before('visit staking tab and connect vega wallet', function () {
|
before('visit staking tab and connect vega wallet', function () {
|
||||||
cy.vega_wallet_import();
|
cy.vega_wallet_import();
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.get(menuBar, { timeout: 20000 }).should('be.visible');
|
cy.verify_page_header('The $VEGA token');
|
||||||
cy.vega_wallet_connect();
|
cy.vega_wallet_connect();
|
||||||
cy.vega_wallet_set_specified_approval_amount('1000');
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
cy.reload();
|
cy.reload();
|
||||||
cy.get(menuBar, { timeout: 20000 }).should('be.visible');
|
cy.verify_page_header('The $VEGA token');
|
||||||
cy.ethereum_wallet_connect();
|
cy.ethereum_wallet_connect();
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(pageSpinner, { timeout: 20000 }).should('not.exist');
|
cy.wait_for_spinner();
|
||||||
cy.get(validatorList).first().invoke('text').as('validatorName');
|
cy.get(stakeValidatorList).first().invoke('text').as('validatorName');
|
||||||
cy.get(validatorList).last().invoke('text').as('otherValidatorName');
|
cy.get(stakeValidatorList).last().invoke('text').as('otherValidatorName');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Eth wallet - contains VEGA tokens', function () {
|
describe('Eth wallet - contains VEGA tokens', function () {
|
||||||
@ -36,219 +52,505 @@ context('Staking Flow - with eth and vega wallets connected', function () {
|
|||||||
|
|
||||||
it('Able to stake against a validator', function () {
|
it('Able to stake against a validator', function () {
|
||||||
cy.staking_page_associate_tokens('3');
|
cy.staking_page_associate_tokens('3');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
cy.ethereum_wallet_check_associated_value_is('3.0');
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
'contain',
|
||||||
vegaWalletPublicKeyShort,
|
3.0,
|
||||||
'3.000000000000000000'
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('3.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 3.0, txTimeout);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
|
||||||
this.validatorName,
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
'2.000000000000000000'
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
|
|
||||||
vega_wallet_check_validator_staked_value_is(
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
this.validatorName,
|
.should('contain', 2.0, txTimeout)
|
||||||
'2.000000000000000000'
|
.and('contain', this.validatorName);
|
||||||
);
|
|
||||||
staking_validator_page_check_stake_next_epoch_value('2.0');
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
staking_validator_page_check_stake_this_epoch_value('2.0');
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.validatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '2.0')
|
||||||
|
.and('contain', '100%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to stake against mulitple validators', function () {
|
it('Able to stake against mulitple validators', function () {
|
||||||
cy.staking_page_associate_tokens('5');
|
cy.staking_page_associate_tokens('5');
|
||||||
cy.vega_wallet_check_unstaked_value_is('5.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
5.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
vega_wallet_check_validator_staked_value_is(
|
|
||||||
this.validatorName,
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
'2.000000000000000000'
|
.contains(this.validatorName, txTimeout)
|
||||||
);
|
.parent()
|
||||||
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(validatorList).contains(this.otherValidatorName).click();
|
cy.get(stakeValidatorList).contains(this.otherValidatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('1');
|
cy.staking_validator_page_add_stake('1');
|
||||||
vega_wallet_check_validator_staked_value_is(
|
|
||||||
this.otherValidatorName,
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
'1.000000000000000000'
|
.should('have.length', 2, txTimeout)
|
||||||
|
.contains(this.otherValidatorName, txTimeout)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 1.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.contains(this.validatorName, txTimeout)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_unstaked_value_is('2.000000000000000000');
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.validatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '2.0')
|
||||||
|
.and('contain', '66.67%');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.otherValidatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '1.0')
|
||||||
|
.and('contain', '33.33%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Able to remove part of a stake against a validator', function () {
|
it('Able to remove part of a stake against a validator', function () {
|
||||||
cy.staking_page_associate_tokens('4');
|
cy.staking_page_associate_tokens('4');
|
||||||
cy.vega_wallet_check_unstaked_value_is('4.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
4.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('3');
|
cy.staking_validator_page_add_stake('3');
|
||||||
staking_validator_page_check_stake_next_epoch_value('3.0');
|
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
this.validatorName,
|
.contains(3.0, epochTimeout)
|
||||||
'3.000000000000000000'
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
|
.should('contain', 3.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
|
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_removeStake('1');
|
cy.staking_validator_page_remove_stake('1');
|
||||||
staking_validator_page_check_stake_next_epoch_value('2.0');
|
|
||||||
staking_validator_page_check_stake_this_epoch_value('3.0');
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
.contains(2.0, epochTimeout)
|
||||||
this.validatorName,
|
.should('be.visible');
|
||||||
'2.000000000000000000'
|
|
||||||
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletThisEpochBalances, txTimeout)
|
||||||
|
.should('contain', 3.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'This Epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
vega_wallet_check_validator_stake_this_epoch_value_is(
|
|
||||||
this.validatorName,
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
'3.000000000000000000'
|
.should('contain', 2.0, txTimeout)
|
||||||
);
|
.and('contain', this.validatorName);
|
||||||
cy.vega_wallet_check_unstaked_value_is('2.000000000000000000');
|
|
||||||
vega_wallet_check_validator_staked_value_is(
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
this.validatorName,
|
.contains(2.0, epochTimeout)
|
||||||
'2.000000000000000000'
|
.should('be.visible');
|
||||||
);
|
|
||||||
staking_validator_page_check_stake_next_epoch_value('2.0');
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
staking_validator_page_check_stake_this_epoch_value('2.0');
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.validatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '2.0')
|
||||||
|
.and('contain', '100%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to remove a full stake against a validator', function () {
|
it('Able to remove a full stake against a validator', function () {
|
||||||
cy.staking_page_associate_tokens('3');
|
cy.staking_page_associate_tokens('3');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('1');
|
cy.staking_validator_page_add_stake('1');
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
|
||||||
this.validatorName,
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
'1.000000000000000000'
|
.should('contain', 1.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_unstaked_value_is('2.000000000000000000');
|
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
|
|
||||||
cy.staking_validator_page_removeStake('1');
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
staking_validator_page_check_stake_next_epoch_value('0.0');
|
|
||||||
|
|
||||||
vega_wallet_check_validator_stake_this_epoch_value_is(
|
cy.staking_validator_page_remove_stake('1');
|
||||||
this.validatorName,
|
|
||||||
'1.000000000000000000'
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(0.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletThisEpochBalances, txTimeout)
|
||||||
|
.should('contain', 1.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'This Epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
|
.should('contain', 0.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
|
||||||
this.validatorName,
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
'0.000000000000000000'
|
.contains(0.0, epochTimeout)
|
||||||
);
|
.should('be.visible');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
staking_validator_page_check_stake_next_epoch_value('0.0');
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
staking_validator_page_check_stake_this_epoch_value('0.0');
|
.contains(0.0, epochTimeout)
|
||||||
vega_wallet_check_validator_no_longer_showing(this.validatorName);
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.contains(this.validatorName, txTimeout)
|
||||||
|
.should('not.exist', txTimeout);
|
||||||
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.validatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '0.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Unable to remove a stake with a negative value for a validator', function () {
|
it('Unable to remove a stake with a negative value for a validator', function () {
|
||||||
cy.staking_page_associate_tokens('3');
|
cy.staking_page_associate_tokens('3');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
staking_validator_page_check_stake_next_epoch_value('2.0');
|
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
this.validatorName,
|
.contains(2.0, epochTimeout)
|
||||||
'2.000000000000000000'
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
|
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
cy.get(removeStakeRadioButton).click({ force: true });
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
cy.get(tokenAmountInputBox).type('-0.1');
|
|
||||||
cy.contains('Waiting for next epoch to start', { timeout: 10000 });
|
cy.get(stakeRemoveStakeRadioButton).click({ force: true });
|
||||||
cy.get(tokenSubmitButton)
|
|
||||||
.should('be.disabled', { timeout: 8000 })
|
cy.get(stakeTokenAmountInputBox).type('-0.1');
|
||||||
|
|
||||||
|
cy.contains('Waiting for next epoch to start', epochTimeout);
|
||||||
|
|
||||||
|
cy.get(stakeTokenSubmitButton)
|
||||||
|
.should('be.disabled', epochTimeout)
|
||||||
.and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`)
|
.and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Unable to remove a stake greater than staked amount next epoch for a validator', function () {
|
it('Unable to remove a stake greater than staked amount next epoch for a validator', function () {
|
||||||
cy.staking_page_associate_tokens('3');
|
cy.staking_page_associate_tokens('3');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
staking_validator_page_check_stake_next_epoch_value('2.0');
|
|
||||||
vega_wallet_check_validator_stake_next_epoch_value_is(
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
this.validatorName,
|
.contains(2.0, epochTimeout)
|
||||||
'2.000000000000000000'
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletNextEpochBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName)
|
||||||
|
.and('contain', 'Next epoch');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
|
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
cy.get(removeStakeRadioButton).click({ force: true });
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
cy.get(tokenAmountInputBox).type(4);
|
|
||||||
cy.contains('Waiting for next epoch to start', { timeout: 10000 });
|
cy.get(stakeRemoveStakeRadioButton).click({ force: true });
|
||||||
cy.get(tokenSubmitButton)
|
|
||||||
.should('be.disabled', { timeout: 8000 })
|
cy.get(stakeTokenAmountInputBox).type(4);
|
||||||
|
|
||||||
|
cy.contains('Waiting for next epoch to start', epochTimeout);
|
||||||
|
|
||||||
|
cy.get(stakeTokenSubmitButton)
|
||||||
|
.should('be.disabled', epochTimeout)
|
||||||
.and('contain', `Remove 4 $VEGA tokens at the end of epoch`)
|
.and('contain', `Remove 4 $VEGA tokens at the end of epoch`)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Disassociating all tokens - removes all staked tokens', function () {
|
it('Disassociating all tokens - removes all staked tokens', function () {
|
||||||
cy.staking_page_associate_tokens('3');
|
cy.staking_page_associate_tokens('3');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
|
||||||
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
|
|
||||||
vega_wallet_check_validator_staked_value_is(
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
this.validatorName,
|
'contain',
|
||||||
'2.000000000000000000'
|
1.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName);
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
cy.staking_page_disassociate_all_tokens();
|
cy.staking_page_disassociate_all_tokens();
|
||||||
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(
|
|
||||||
vegaWalletPublicKeyShort
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
|
'not.exist'
|
||||||
);
|
);
|
||||||
cy.ethereum_wallet_check_associated_value_is('0.0');
|
});
|
||||||
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
|
|
||||||
vega_wallet_check_validator_no_longer_showing(this.validatorName);
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('0.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'0.000000000000000000',
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.contains(this.validatorName, txTimeout)
|
||||||
|
.should('not.exist', txTimeout);
|
||||||
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.validatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '0.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
||||||
cy.staking_page_associate_tokens('3');
|
cy.staking_page_associate_tokens('3');
|
||||||
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
cy.get(validatorList).contains(this.validatorName).click();
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
cy.staking_validator_page_add_stake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
vega_wallet_check_validator_staked_value_is(
|
'contain',
|
||||||
this.validatorName,
|
1.0,
|
||||||
'2.000000000000000000'
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName);
|
||||||
|
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
cy.staking_page_disassociate_tokens('1');
|
cy.staking_page_disassociate_tokens('1');
|
||||||
cy.ethereum_wallet_check_associated_value_is('2.0');
|
|
||||||
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
vega_wallet_check_validator_staked_value_is(
|
.contains('2.0', txTimeout)
|
||||||
this.validatorName,
|
.should('be.visible');
|
||||||
'2.000000000000000000'
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'2.000000000000000000',
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', this.validatorName);
|
||||||
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorWithinList, epochTimeout)
|
||||||
|
.contains(this.validatorName)
|
||||||
|
.parent()
|
||||||
|
.contains('Total stake')
|
||||||
|
.parent()
|
||||||
|
.should('contain', '2.0')
|
||||||
|
.and('contain', '100%');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Selecting use maximum where tokens are allready staked - suggests the unstaked token amount', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.get(stakeValidatorList).contains(this.validatorName).click();
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
|
cy.get(stakeValidatorList).contains(this.otherValidatorName).click();
|
||||||
|
|
||||||
|
cy.get(stakeAddStakeRadioButton).click({ force: true });
|
||||||
|
|
||||||
|
cy.get(stakeMaximumTokens, { timeout: 60000 }).click();
|
||||||
|
|
||||||
|
cy.get(stakeTokenSubmitButton).should('contain', 'Add 1 $VEGA tokens');
|
||||||
});
|
});
|
||||||
|
|
||||||
after(
|
after(
|
||||||
@ -259,77 +561,3 @@ context('Staking Flow - with eth and vega wallets connected', function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function staking_validator_page_check_stake_next_epoch_value(expectedVal) {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking Staking Page - Validator Stake Next Epoch Value is ${expectedVal}`
|
|
||||||
);
|
|
||||||
cy.get(stakeNextEpochValue, { timeout: 10000 })
|
|
||||||
.contains(expectedVal, { timeout: 10000 })
|
|
||||||
.should('be.visible');
|
|
||||||
}
|
|
||||||
|
|
||||||
function staking_validator_page_check_stake_this_epoch_value(expectedVal) {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking Staking Page - Validator Stake This Epoch Value is ${expectedVal}`
|
|
||||||
);
|
|
||||||
cy.get(stakeNextEpochValue, { timeout: 10000 })
|
|
||||||
.contains(expectedVal, { timeout: 10000 })
|
|
||||||
.should('be.visible');
|
|
||||||
}
|
|
||||||
|
|
||||||
function vega_wallet_check_validator_stake_next_epoch_value_is(
|
|
||||||
validatorName,
|
|
||||||
expectedVal
|
|
||||||
) {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking vega wallet - Stake Next Epoch Value for ${validatorName} is ${expectedVal}`
|
|
||||||
);
|
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
|
||||||
cy.contains(`${validatorName} (Next epoch)`, { timeout: 40000 })
|
|
||||||
.siblings()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function vega_wallet_check_validator_stake_this_epoch_value_is(
|
|
||||||
validatorName,
|
|
||||||
expectedVal
|
|
||||||
) {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking vega wallet - Stake This Epoch Value for ${validatorName} is ${expectedVal}`
|
|
||||||
);
|
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
|
||||||
cy.contains(`${validatorName} (This Epoch)`, { timeout: 40000 })
|
|
||||||
.siblings()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function vega_wallet_check_validator_no_longer_showing(validatorName) {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking Validator and therefore stake removed for ${validatorName}`
|
|
||||||
);
|
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
|
||||||
cy.contains(`${validatorName}`, { timeout: 40000 }).should('not.exist', {
|
|
||||||
timeout: 40000,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function vega_wallet_check_validator_staked_value_is(
|
|
||||||
validatorName,
|
|
||||||
expectedVal
|
|
||||||
) {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking Validator Stake Value for ${validatorName} is ${expectedVal}`
|
|
||||||
);
|
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
|
||||||
cy.contains(`${validatorName}`, { timeout: 40000 })
|
|
||||||
.siblings()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
const pageSpinner = 'splash-loader';
|
|
||||||
const menuBar = 'nav';
|
|
||||||
const validatorList = '[data-testid="node-list-item-name"]';
|
const validatorList = '[data-testid="node-list-item-name"]';
|
||||||
|
const ethWalletContainer = '[data-testid="ethereum-wallet"]';
|
||||||
|
const ethWalletAssociatedBalances =
|
||||||
|
'[data-testid="eth-wallet-associated-balances"]';
|
||||||
|
const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]';
|
||||||
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
|
const vegaWalletUnstakedBalance =
|
||||||
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
|
const txTimeout = { timeout: 40000 };
|
||||||
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
||||||
|
|
||||||
context(
|
context(
|
||||||
@ -10,14 +15,14 @@ context(
|
|||||||
before('visit staking tab and connect vega wallet', function () {
|
before('visit staking tab and connect vega wallet', function () {
|
||||||
cy.vega_wallet_import();
|
cy.vega_wallet_import();
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.get(menuBar, { timeout: 20000 }).should('be.visible');
|
cy.verify_page_header('The $VEGA token');
|
||||||
cy.vega_wallet_connect();
|
cy.vega_wallet_connect();
|
||||||
cy.vega_wallet_set_specified_approval_amount('1000');
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
cy.reload();
|
cy.reload();
|
||||||
cy.get(menuBar, { timeout: 20000 }).should('be.visible');
|
cy.verify_page_header('The $VEGA token');
|
||||||
cy.ethereum_wallet_connect();
|
cy.ethereum_wallet_connect();
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(pageSpinner, { timeout: 20000 }).should('not.exist');
|
cy.wait_for_spinner();
|
||||||
cy.get(validatorList).first().invoke('text').as('validatorName');
|
cy.get(validatorList).first().invoke('text').as('validatorName');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -27,71 +32,140 @@ context(
|
|||||||
function () {
|
function () {
|
||||||
cy.vega_wallet_teardown();
|
cy.vega_wallet_teardown();
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
cy.get(pageSpinner, { timeout: 20000 }).should('not.exist');
|
cy.wait_for_spinner();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it('Able to associate tokens', function () {
|
it('Able to associate tokens', function () {
|
||||||
cy.staking_page_associate_tokens('2');
|
cy.staking_page_associate_tokens('2');
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
|
||||||
vegaWalletPublicKeyShort,
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
'2.000000000000000000'
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('2.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.ethereum_wallet_check_associated_value_is('2.0');
|
|
||||||
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
|
||||||
cy.vega_wallet_check_unstaked_value_is('2.000000000000000000');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to disassociate tokens', function () {
|
it('Able to disassociate tokens', function () {
|
||||||
cy.staking_page_associate_tokens('2');
|
cy.staking_page_associate_tokens('2');
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
|
||||||
vegaWalletPublicKeyShort,
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
'2.000000000000000000'
|
.contains(vegaWalletPublicKeyShort)
|
||||||
);
|
.parent()
|
||||||
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('2.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
cy.staking_page_disassociate_tokens('1');
|
cy.staking_page_disassociate_tokens('1');
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
|
||||||
vegaWalletPublicKeyShort,
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
'1.000000000000000000'
|
.contains(vegaWalletPublicKeyShort)
|
||||||
);
|
.parent()
|
||||||
cy.ethereum_wallet_check_associated_value_is('1.0');
|
.should('contain', 1.0, txTimeout);
|
||||||
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('1.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
||||||
cy.staking_page_associate_tokens('1001', true);
|
cy.staking_page_associate_tokens('1001', true);
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
|
||||||
vegaWalletPublicKeyShort,
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
'1,001.000000000000000000'
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent()
|
||||||
|
.should('contain', '1,001.000000000000000000', txTimeout);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('1,001.00', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'1,001.000000000000000000',
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.ethereum_wallet_check_associated_value_is('1,001.00');
|
|
||||||
cy.vega_wallet_check_associated_value_is('1,001.000000000000000000');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to disassociate a partial amount of tokens currently associated', function () {
|
it('Able to disassociate a partial amount of tokens currently associated', function () {
|
||||||
cy.staking_page_associate_tokens('2');
|
cy.staking_page_associate_tokens('2');
|
||||||
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
cy.staking_page_disassociate_tokens('1');
|
'contain',
|
||||||
cy.ethereum_wallet_check_associated_vega_key_value_is(
|
2.0,
|
||||||
vegaWalletPublicKeyShort,
|
txTimeout
|
||||||
'1.000000000000000000'
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_tokens('1');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 1.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 1.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.ethereum_wallet_check_associated_value_is('1.0');
|
|
||||||
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to disassociate all tokens', function () {
|
it('Able to disassociate all tokens', function () {
|
||||||
cy.staking_page_associate_tokens('2');
|
cy.staking_page_associate_tokens('2');
|
||||||
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
cy.staking_page_disassociate_all_tokens();
|
'contain',
|
||||||
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(
|
2.0,
|
||||||
vegaWalletPublicKeyShort
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_all_tokens();
|
||||||
|
|
||||||
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
|
'not.exist'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
|
'not.exist'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.ethereum_wallet_check_associated_value_is('0.0');
|
|
||||||
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ const navigation = {
|
|||||||
rewards: '[href="/rewards"]',
|
rewards: '[href="/rewards"]',
|
||||||
withdraw: '[href="/withdraw"]',
|
withdraw: '[href="/withdraw"]',
|
||||||
governance: '[href="/governance"]',
|
governance: '[href="/governance"]',
|
||||||
|
pageSpinner: 'splash-loader',
|
||||||
};
|
};
|
||||||
|
|
||||||
Cypress.Commands.add('navigate_to', (page) => {
|
Cypress.Commands.add('navigate_to', (page) => {
|
||||||
@ -31,3 +32,7 @@ Cypress.Commands.add('verify_tab_highlighted', (page) => {
|
|||||||
Cypress.Commands.add('verify_page_header', (text) => {
|
Cypress.Commands.add('verify_page_header', (text) => {
|
||||||
return cy.get('header h1').should('be.visible').and('have.text', text);
|
return cy.get('header h1').should('be.visible').and('have.text', text);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('wait_for_spinner', () => {
|
||||||
|
cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
|
||||||
|
});
|
||||||
|
@ -9,7 +9,6 @@ const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]';
|
|||||||
const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]';
|
const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]';
|
||||||
|
|
||||||
Cypress.Commands.add('wait_for_begining_of_epoch', () => {
|
Cypress.Commands.add('wait_for_begining_of_epoch', () => {
|
||||||
cy.highlight(`Waiting for next epoch to start`);
|
|
||||||
cy.contains('Waiting for next epoch to start', { timeout: 10000 }).should(
|
cy.contains('Waiting for next epoch to start', { timeout: 10000 }).should(
|
||||||
'not.exist'
|
'not.exist'
|
||||||
);
|
);
|
||||||
@ -26,13 +25,9 @@ Cypress.Commands.add('staking_validator_page_add_stake', (stake) => {
|
|||||||
.and('contain', `Add ${stake} $VEGA tokens`)
|
.and('contain', `Add ${stake} $VEGA tokens`)
|
||||||
.and('be.visible')
|
.and('be.visible')
|
||||||
.click();
|
.click();
|
||||||
cy.contains(
|
|
||||||
'At the beginning of the next epoch your $VEGA will be nominated to the validator',
|
|
||||||
{ timeout: 20000 }
|
|
||||||
).should('be.visible');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('staking_validator_page_removeStake', (stake) => {
|
Cypress.Commands.add('staking_validator_page_remove_stake', (stake) => {
|
||||||
cy.highlight(`Removing a stake of ${stake}`);
|
cy.highlight(`Removing a stake of ${stake}`);
|
||||||
cy.get(removeStakeRadioButton).click({ force: true });
|
cy.get(removeStakeRadioButton).click({ force: true });
|
||||||
cy.get(tokenAmountInputBox).type(stake);
|
cy.get(tokenAmountInputBox).type(stake);
|
||||||
@ -42,9 +37,6 @@ Cypress.Commands.add('staking_validator_page_removeStake', (stake) => {
|
|||||||
.and('contain', `Remove ${stake} $VEGA tokens at the end of epoch`)
|
.and('contain', `Remove ${stake} $VEGA tokens at the end of epoch`)
|
||||||
.and('be.visible')
|
.and('be.visible')
|
||||||
.click();
|
.click();
|
||||||
cy.contains(`${stake} $VEGA has been removed from validator`).should(
|
|
||||||
'be.visible'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
|
@ -16,42 +16,3 @@ Cypress.Commands.add('ethereum_wallet_connect', () => {
|
|||||||
cy.contains('Locked', { timeout: 15000 }).should('be.visible');
|
cy.contains('Locked', { timeout: 15000 }).should('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
'ethereum_wallet_check_associated_value_is',
|
|
||||||
(expectedVal) => {
|
|
||||||
cy.highlight(`Checking Eth Wallet - Associated Value is ${expectedVal}`);
|
|
||||||
cy.get(ethWalletContainer).within(() => {
|
|
||||||
cy.contains('Associated', { timeout: 20000 })
|
|
||||||
.parent()
|
|
||||||
.siblings()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
'ethereum_wallet_check_associated_vega_key_value_is',
|
|
||||||
(vegaShortPublicKey, expectedVal) => {
|
|
||||||
cy.highlight(
|
|
||||||
`Checking Eth Wallet - Vega Key Associated Value is ${expectedVal} for key ${vegaShortPublicKey}`
|
|
||||||
);
|
|
||||||
cy.get(ethWalletContainer).within(() => {
|
|
||||||
cy.contains(vegaShortPublicKey, { timeout: 20000 })
|
|
||||||
.parent()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
|
||||||
'ethereum_wallet_check_associated_vega_key_is_no_longer_showing',
|
|
||||||
(vegaShortPublicKey) => {
|
|
||||||
cy.highlight('Checking Eth Wallet - Vega Key Associated is not showing');
|
|
||||||
cy.get(ethWalletContainer).within(() => {
|
|
||||||
cy.contains(vegaShortPublicKey, { timeout: 20000 }).should('not.exist');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
} from '@vegaprotocol/smart-contracts';
|
} from '@vegaprotocol/smart-contracts';
|
||||||
import { ethers, Wallet } from 'ethers';
|
import { ethers, Wallet } from 'ethers';
|
||||||
|
|
||||||
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic');
|
const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic');
|
||||||
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
||||||
const vegaTokenContractAddress = Cypress.env('vegaTokenContractAddress');
|
const vegaTokenContractAddress = Cypress.env('vegaTokenContractAddress');
|
||||||
@ -41,7 +42,12 @@ before('Vega wallet teardown prep', function () {
|
|||||||
Cypress.Commands.add('vega_wallet_teardown', function () {
|
Cypress.Commands.add('vega_wallet_teardown', function () {
|
||||||
cy.vega_wallet_teardown_staking(this.stakingBridgeContract);
|
cy.vega_wallet_teardown_staking(this.stakingBridgeContract);
|
||||||
cy.vega_wallet_teardown_vesting(this.vestingContract);
|
cy.vega_wallet_teardown_vesting(this.vestingContract);
|
||||||
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
|
|
||||||
|
cy.get(vegaWalletAssociatedBalance, { timeout: transactionTimeout }).should(
|
||||||
|
'contain',
|
||||||
|
'0.000000000000000000',
|
||||||
|
{ timeout: transactionTimeout }
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
|
@ -33,24 +33,3 @@ Cypress.Commands.add('vega_wallet_connect', () => {
|
|||||||
});
|
});
|
||||||
cy.contains(`${vegaWalletName} key`, { timeout: 20000 }).should('be.visible');
|
cy.contains(`${vegaWalletName} key`, { timeout: 20000 }).should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('vega_wallet_check_unstaked_value_is', (expectedVal) => {
|
|
||||||
cy.highlight(`Checking vega wallet - Unstaked Value is ${expectedVal}`);
|
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
|
||||||
cy.contains('Unstaked', { timeout: 40000 })
|
|
||||||
.siblings()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add('vega_wallet_check_associated_value_is', (expectedVal) => {
|
|
||||||
cy.highlight(`Checking vega wallet - Associated Value is ${expectedVal}`);
|
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
|
||||||
cy.contains('Associated', { timeout: 40000 })
|
|
||||||
.parent()
|
|
||||||
.siblings()
|
|
||||||
.contains(expectedVal, { timeout: 40000 })
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
@ -83,12 +83,14 @@ const AssociatedAmounts = ({
|
|||||||
/>
|
/>
|
||||||
{vestingAssociationByVegaKey.map(([key, amount]) => {
|
{vestingAssociationByVegaKey.map(([key, amount]) => {
|
||||||
return (
|
return (
|
||||||
|
<div data-testid="eth-wallet-associated-balances">
|
||||||
<WalletCardRow
|
<WalletCardRow
|
||||||
key={key}
|
key={key}
|
||||||
label={removeLeadingAddressSymbol(key)}
|
label={removeLeadingAddressSymbol(key)}
|
||||||
value={amount}
|
value={amount}
|
||||||
dark={true}
|
dark={true}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
@ -154,13 +154,16 @@ const VegaWalletConnected = ({ vegaKeys }: VegaWalletConnectedProps) => {
|
|||||||
balance={currentStakeAvailable}
|
balance={currentStakeAvailable}
|
||||||
dark={true}
|
dark={true}
|
||||||
/>
|
/>
|
||||||
|
<div data-testid="vega-wallet-balance-unstaked">
|
||||||
<WalletCardRow label={t('unstaked')} value={unstaked} dark={true} />
|
<WalletCardRow label={t('unstaked')} value={unstaked} dark={true} />
|
||||||
|
</div>
|
||||||
{delegatedNodes.length ? (
|
{delegatedNodes.length ? (
|
||||||
<WalletCardRow label={t('stakedValidators')} dark={true} bold={true} />
|
<WalletCardRow label={t('stakedValidators')} dark={true} bold={true} />
|
||||||
) : null}
|
) : null}
|
||||||
{delegatedNodes.map((d) => (
|
{delegatedNodes.map((d) => (
|
||||||
<div key={d.nodeId}>
|
<div key={d.nodeId} data-testid="vega-wallet-balance-staked-validators">
|
||||||
{d.currentEpochStake && d.currentEpochStake.isGreaterThan(0) && (
|
{d.currentEpochStake && d.currentEpochStake.isGreaterThan(0) && (
|
||||||
|
<div data-testid="vega-wallet-balance-this-epoch">
|
||||||
<WalletCardRow
|
<WalletCardRow
|
||||||
label={`${d.name || truncateMiddle(d.nodeId)} ${
|
label={`${d.name || truncateMiddle(d.nodeId)} ${
|
||||||
d.hasStakePending ? `(${t('thisEpoch')})` : ''
|
d.hasStakePending ? `(${t('thisEpoch')})` : ''
|
||||||
@ -169,8 +172,10 @@ const VegaWalletConnected = ({ vegaKeys }: VegaWalletConnectedProps) => {
|
|||||||
value={d.currentEpochStake}
|
value={d.currentEpochStake}
|
||||||
dark={true}
|
dark={true}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{d.hasStakePending && (
|
{d.hasStakePending && (
|
||||||
|
<div data-testid="vega-wallet-balance-next-epoch">
|
||||||
<WalletCardRow
|
<WalletCardRow
|
||||||
label={`${d.name || truncateMiddle(d.nodeId)} (${t(
|
label={`${d.name || truncateMiddle(d.nodeId)} (${t(
|
||||||
'nextEpoch'
|
'nextEpoch'
|
||||||
@ -179,6 +184,7 @@ const VegaWalletConnected = ({ vegaKeys }: VegaWalletConnectedProps) => {
|
|||||||
value={d.nextEpochStake}
|
value={d.nextEpochStake}
|
||||||
dark={true}
|
dark={true}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
Loading…
Reference in New Issue
Block a user