test: tweaks

This commit is contained in:
AndyWhiteVega 2022-07-01 13:28:17 +01:00
parent 056edfe132
commit cda6caccec
2 changed files with 58 additions and 29 deletions

View File

@ -16,48 +16,63 @@ context('Staking Tab - with vega wallet connected', function () {
cy.get(navigation.staking).first().click();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.get(staking.validatorNames).first().invoke('text').as('validatorName');
cy.wrap(Cypress.env('vega_wallet_public_key_short')).as('vegaPublicKeyShort');
cy.wrap(Cypress.env('vega_wallet_public_key_short')).as(
'vegaPublicKeyShort'
);
});
describe('Vega wallet - contains VEGA tokens', function () {
beforeEach('teardown wallet & drill into a specific validator', function () {
beforeEach(
'teardown wallet & drill into a specific validator',
function () {
cy.vega_wallet_teardown();
cy.get(navigation.staking).first().click();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.contains('Your Stake On Node (This Epoch)').should('be.visible');
})
}
);
it('Able to associate tokens', function () {
cy.ethereum_wallet_associate_tokens('2');
cy.ethereum_wallet_check_associated_vega_key_value_is(this.vegaPublicKeyShort, '2.000000000000000000');
cy.ethereum_wallet_check_associated_vega_key_value_is(
this.vegaPublicKeyShort,
'2.000000000000000000'
);
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
})
});
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
cy.ethereum_wallet_associate_tokens('1001', 'Approve');
cy.ethereum_wallet_check_associated_vega_key_value_is(this.vegaPublicKeyShort, '1,001.000000000000000000');
cy.ethereum_wallet_check_associated_vega_key_value_is(
this.vegaPublicKeyShort,
'1,001.000000000000000000'
);
cy.vega_wallet_check_associated_value_is('1,001.000000000000000000');
})
});
it('Able to disassociate a partial amount of tokens currently associated', function () {
cy.ethereum_wallet_associate_tokens('2');
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
cy.ethereum_wallet_disassociate_tokens('1');
cy.ethereum_wallet_check_associated_vega_key_value_is(this.vegaPublicKeyShort, '1.000000000000000000');
cy.ethereum_wallet_check_associated_vega_key_value_is(
this.vegaPublicKeyShort,
'1.000000000000000000'
);
cy.vega_wallet_check_associated_value_is('1.000000000000000000');
})
});
it('Able to disassociate all tokens', function () {
cy.ethereum_wallet_associate_tokens('2');
cy.vega_wallet_check_associated_value_is('2.000000000000000000');
cy.ethereum_wallet_disassociate_all_tokens();
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(this.vegaPublicKeyShort);
cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing(
this.vegaPublicKeyShort
);
cy.vega_wallet_check_associated_value_is('0.000000000000000000');
})
});
it('Able to stake against a validator', function () {
cy.ethereum_wallet_associate_tokens('3');
@ -67,7 +82,10 @@ context('Staking Tab - with vega wallet connected', function () {
cy.get(staking.validatorNames).contains(this.validatorName).click();
cy.staking_validator_page_add_stake('2');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(this.validatorName, '2.000000000000000000');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(
this.validatorName,
'2.000000000000000000'
);
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
});
@ -80,7 +98,10 @@ context('Staking Tab - with vega wallet connected', function () {
cy.staking_validator_page_add_stake('1');
cy.staking_validator_page_check_stake_next_epoch_value('1.0');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(this.validatorName, '1.000000000000000000');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(
this.validatorName,
'1.000000000000000000'
);
cy.vega_wallet_check_unstaked_value_is('2.000000000000000000');
cy.get(navigation.staking).first().click();
@ -88,7 +109,10 @@ context('Staking Tab - with vega wallet connected', function () {
cy.staking_validator_page_removeStake('1');
cy.staking_validator_page_check_stake_next_epoch_value('0.0');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(this.validatorName, '0.000000000000000000');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(
this.validatorName,
'0.000000000000000000'
);
cy.vega_wallet_check_unstaked_value_is('3.000000000000000000');
});
@ -101,7 +125,10 @@ context('Staking Tab - with vega wallet connected', function () {
cy.staking_validator_page_add_stake('2');
cy.staking_validator_page_check_stake_next_epoch_value('2.0');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(this.validatorName, '2.000000000000000000');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(
this.validatorName,
'2.000000000000000000'
);
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
cy.get(navigation.staking).first().click();
@ -124,7 +151,10 @@ context('Staking Tab - with vega wallet connected', function () {
cy.staking_validator_page_add_stake('2');
cy.staking_validator_page_check_stake_next_epoch_value('2.0');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(this.validatorName, '2.000000000000000000');
cy.vega_wallet_check_validator_stake_next_epoch_value_is(
this.validatorName,
'2.000000000000000000'
);
cy.vega_wallet_check_unstaked_value_is('1.000000000000000000');
cy.get(navigation.staking).first().click();
@ -134,7 +164,7 @@ context('Staking Tab - with vega wallet connected', function () {
cy.contains('Waiting for next epoch to start', { timeout: 10000 });
cy.get(staking.tokenInputSubmit)
.should('be.disabled', { timeout: 8000 })
.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');
});
});

View File

@ -3,7 +3,6 @@ import '@vegaprotocol/cypress';
// Hide fetch/XHR requests - They create a lot of noise in command log
const app = window.top;
if (!app.document.head.querySelector('[data-hide-command-log-request]')) {
const style = app.document.createElement('style');
style.innerHTML =