test: check enhancements

This commit is contained in:
AndyWhiteVega 2022-06-27 17:28:42 +01:00
parent 8d2d1f8a6a
commit 9e7802c9eb
2 changed files with 25 additions and 25 deletions

View File

@ -25,6 +25,7 @@ context('Staking Tab - with vega wallet connected', function () {
beforeEach('drill into a specific validator', function () {
cy.vega_wallet_teardown();
// cy.vega_wallet_teardown_ui();
cy.get(navigation.staking).first().click();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.get(staking.validatorNames).contains(this.validatorName).click();
@ -33,66 +34,66 @@ context('Staking Tab - with vega wallet connected', function () {
it('Able to associate tokens for first time - requires approval', function () {
cy.ethereum_wallet_approveAndAssociateTokens('2');
cy.vega_wallet_check_associatedValue_is('2.0');
cy.vega_wallet_check_associatedValue_is('2.000000000000000000');
})
it('Able to associate tokens - having previously approved', function () {
cy.ethereum_wallet_associateTokens('2');
cy.vega_wallet_check_associatedValue_is('2.0');
cy.vega_wallet_check_associatedValue_is('2.000000000000000000');
})
it('Able to disassociate all tokens', function () {
cy.ethereum_wallet_associateTokens('2');
cy.vega_wallet_check_associatedValue_is('2.0');
cy.vega_wallet_check_associatedValue_is('2.000000000000000000');
cy.ethereum_wallet_disassociateAllTokens();
cy.vega_wallet_check_associatedValue_is('0.0');
cy.vega_wallet_check_associatedValue_is('0.000000000000000000');
})
it('Able to stake against a validator', function () {
cy.ethereum_wallet_associateTokens('3');
cy.vega_wallet_check_unstakedValue_is('3.0');
cy.vega_wallet_check_unstakedValue_is('3.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.staking_validator_page_addStake('2');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '2.0');
cy.vega_wallet_check_unstakedValue_is('1.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '2.000000000000000000');
cy.vega_wallet_check_unstakedValue_is('1.000000000000000000');
});
it('Able to remove stake against a validator', function () {
cy.ethereum_wallet_associateTokens('3');
cy.vega_wallet_check_unstakedValue_is('3.0');
cy.vega_wallet_check_unstakedValue_is('3.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.staking_validator_page_addStake('1');
cy.staking_validator_page_check_stakeNextEpochValue('1.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '1.0');
cy.vega_wallet_check_unstakedValue_is('2.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '1.000000000000000000');
cy.vega_wallet_check_unstakedValue_is('2.000000000000000000');
cy.get(navigation.staking).first().click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.staking_validator_page_removeStake('1');
cy.staking_validator_page_check_stakeNextEpochValue('0.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '0.0');
cy.vega_wallet_check_unstakedValue_is('3.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '0.000000000000000000');
cy.vega_wallet_check_unstakedValue_is('3.000000000000000000');
});
it('Unable to remove a stake with a negative value for a validator', function () {
cy.ethereum_wallet_associateTokens('3');
cy.vega_wallet_check_unstakedValue_is('3.0');
cy.vega_wallet_check_unstakedValue_is('3.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.staking_validator_page_addStake('2');
cy.staking_validator_page_check_stakeNextEpochValue('2.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '2.0');
cy.vega_wallet_check_unstakedValue_is('1.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '2.000000000000000000');
cy.vega_wallet_check_unstakedValue_is('1.000000000000000000');
cy.get(navigation.staking).first().click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
@ -107,15 +108,15 @@ context('Staking Tab - with vega wallet connected', function () {
it('Unable to remove a stake greater than staked amount next epoch for a validator', function () {
cy.ethereum_wallet_associateTokens('3');
cy.vega_wallet_check_unstakedValue_is('3.0');
cy.vega_wallet_check_unstakedValue_is('3.000000000000000000');
cy.get('button').contains('Select a validator to nominate').click();
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.staking_validator_page_addStake('2');
cy.staking_validator_page_check_stakeNextEpochValue('2.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '2.0');
cy.vega_wallet_check_unstakedValue_is('1.0');
cy.vega_wallet_check_validator_stakeNextEpochValue_is(this.validatorName, '2.000000000000000000');
cy.vega_wallet_check_unstakedValue_is('1.000000000000000000');
cy.get(navigation.staking).first().click();
cy.get(staking.validatorNames).contains(this.validatorName).click();

View File

@ -11,14 +11,13 @@ const vegaWalletPassphrase = Cypress.env("VEGA_WALLET_PASSPHRASE");
Cypress.Commands.add('vega_wallet_teardown', function () {
const token = new StakingBridge();
cy.log(token)
// const vegaPubKey = '0bd8d51ac46d563af70e4c92fdc53552f800ad527109146e9dff72f6413c10c9';
// const ethPubKey = '0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F';
const vegaPubKey = '0bd8d51ac46d563af70e4c92fdc53552f800ad527109146e9dff72f6413c10c9';
const ethPubKey = '0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F';
// token.stakeBalance(ethPubKey, vegaPubKey).then((amount => {
// cy.log(amount)
// token.removeStake(amount, vegaPubKey)
// }))
token.stakeBalance(ethPubKey, vegaPubKey).then((amount => {
cy.log(amount)
token.removeStake(amount, vegaPubKey)
}))
})
// ----------------------------------------------------------------------