chore: fixes for staking flow tests (#2303)

* chore: fixes for staking flow tests

* chore: remove commented code

* chore: fix lint
This commit is contained in:
Joe Tsang 2022-12-02 09:20:30 +00:00 committed by GitHub
parent 30c440439e
commit 6352400598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 44 deletions

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" />
const stakeValidatorListTotalStake = '[col-id="stake"] > div > span';
const stakeValidatorListTotalShare = '[col-id="stakeShare"] > div > span';
const stakeValidatorListValidatorStake = '[col-id="validatorStake"]';
const stakeValidatorListValidatorStake = '[col-id="stake"] > div > span';
const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]';
const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]';
const stakeTokenSubmitButton = '[data-testid="token-input-submit-button"]';
@ -11,7 +11,6 @@ const stakeAddStakeRadioButton = '[data-testid="add-stake-radio"]';
const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]';
const totalStake = '[data-testid="total-stake"]';
const stakeShare = '[data-testid="stake-percentage"]';
const nominatedStake = '[data-testid="nominated-stake"]';
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
const vegaWalletUnstakedBalance =
@ -96,16 +95,9 @@ context(
.contains(2.0, epochTimeout)
.should('be.visible');
cy.get(nominatedStake).should('have.text', '2.00'); // 2001-STKE-017 2002-SINC-007
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
cy.validate_validator_list_total_stake_and_share('0', '2.00', '100%');
});
it('Able to stake against a validator - using vega from vesting contract', function () {
@ -152,12 +144,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
cy.validate_validator_list_total_stake_and_share('0', '2.00', '100%');
});
it('Able to stake against a validator - using vega from both wallet and vesting contract', function () {
@ -217,12 +204,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'6.00',
'100%'
);
cy.validate_validator_list_total_stake_and_share('0', '6.00', '100%');
});
it('Able to stake against multiple validators', function () {
@ -366,12 +348,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
cy.validate_validator_list_total_stake_and_share('0', '2.00', '100%');
}
);
@ -428,7 +405,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '0.00', '-');
cy.validate_validator_list_total_stake_and_share('0', '0.00', '0%');
});
it('Unable to remove a stake with a negative value for a validator', function () {
@ -452,7 +429,7 @@ context(
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain',
3.0,
1.0,
txTimeout
);
@ -565,7 +542,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '0.00', '-');
cy.validate_validator_list_total_stake_and_share('0', '0.00', '0%');
});
it('Disassociating all vesting contract tokens max - removes all staked tokens', function () {
@ -619,7 +596,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share('0', '', '0.00', '-');
cy.validate_validator_list_total_stake_and_share('0', '0.00', '0%');
});
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
@ -666,12 +643,7 @@ context(
cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share(
'0',
'',
'2.00',
'100%'
);
cy.validate_validator_list_total_stake_and_share('0', '2.00', '100%');
});
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {

View File

@ -170,12 +170,7 @@ Cypress.Commands.add(
Cypress.Commands.add(
'validate_validator_list_total_stake_and_share',
(
positionOnList,
expectedValidatorName,
expectedTotalStake,
expectedTotalShare
) => {
(positionOnList, expectedTotalStake, expectedTotalShare) => {
cy.wait_for_spinner();
cy.contains('Loading...', epochTimeout).should('not.exist');
cy.wait_for_beginning_of_epoch();