From 63524005981f1078394b7fd84f7411b22306e319 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Fri, 2 Dec 2022 09:20:30 +0000 Subject: [PATCH] chore: fixes for staking flow tests (#2303) * chore: fixes for staking flow tests * chore: remove commented code * chore: fix lint --- .../src/integration/flow/staking-flow.cy.js | 48 ++++--------------- .../src/support/staking.functions.js | 7 +-- 2 files changed, 11 insertions(+), 44 deletions(-) diff --git a/apps/token-e2e/src/integration/flow/staking-flow.cy.js b/apps/token-e2e/src/integration/flow/staking-flow.cy.js index da5f6849a..b644cc5ab 100644 --- a/apps/token-e2e/src/integration/flow/staking-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/staking-flow.cy.js @@ -1,7 +1,7 @@ /// 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 () { diff --git a/apps/token-e2e/src/support/staking.functions.js b/apps/token-e2e/src/support/staking.functions.js index 9f4cee6db..9d41b6e74 100644 --- a/apps/token-e2e/src/support/staking.functions.js +++ b/apps/token-e2e/src/support/staking.functions.js @@ -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();