Test/1484 update token smoke tests (#1571)

* test: added smoke tests from flows

* chore: move failing test
This commit is contained in:
Joe Tsang 2022-10-03 15:29:52 +01:00 committed by GitHub
parent 620bf1bab4
commit ae8ef6001c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 227 additions and 199 deletions

View File

@ -36,6 +36,8 @@ const txTimeout = Cypress.env('txTimeout');
const epochTimeout = Cypress.env('epochTimeout'); const epochTimeout = Cypress.env('epochTimeout');
const proposalTimeout = { timeout: 14000 }; const proposalTimeout = { timeout: 14000 };
const restConnectorForm = '[data-testid="rest-connector-form"]'; const restConnectorForm = '[data-testid="rest-connector-form"]';
const noOpenProposals = '[data-testid="no-open-proposals"]';
const noClosedProposals = '[data-testid="no-closed-proposals"]';
const governanceProposalType = { const governanceProposalType = {
NETWORK_PARAMETER: 'Network parameter', NETWORK_PARAMETER: 'Network parameter',
@ -140,6 +142,16 @@ context(
}); });
}); });
it('should be able to see that no proposals exist', function () {
// 1004-VOTE-003
cy.get(noOpenProposals)
.should('be.visible')
.and('have.text', 'There are no open or yet to enact proposals');
cy.get(noClosedProposals)
.should('be.visible')
.and('have.text', 'There are no enacted or rejected proposals');
});
it('Submit a proposal form - shows how many vega tokens are required to make a proposal', function () { it('Submit a proposal form - shows how many vega tokens are required to make a proposal', function () {
cy.go_to_make_new_proposal(governanceProposalType.NEW_MARKET); cy.go_to_make_new_proposal(governanceProposalType.NEW_MARKET);
cy.contains( cy.contains(
@ -147,23 +159,29 @@ context(
).should('be.visible'); ).should('be.visible');
}); });
it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () { it(
cy.ensure_specified_unstaked_tokens_are_associated( 'Able to submit a valid freeform proposal - with minimum required tokens associated',
this.minProposerBalance { tags: '@smoke' },
); function () {
cy.navigate_to_page_if_not_already_loaded('governance'); cy.ensure_specified_unstaked_tokens_are_associated(
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM); this.minProposerBalance
cy.enter_unique_freeform_proposal_body('50'); );
cy.get(newProposalSubmitButton).should('be.visible').click(); cy.navigate_to_page_if_not_already_loaded('governance');
cy.contains('Confirm transaction in wallet', epochTimeout).should( cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
'be.visible' cy.enter_unique_freeform_proposal_body('50');
); cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Confirm transaction in wallet', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', proposalTimeout).should('be.visible'); cy.contains('Awaiting network confirmation', epochTimeout).should(
cy.get(dialogCloseButton).click(); 'be.visible'
}); );
cy.contains('Proposal submitted', proposalTimeout).should(
'be.visible'
);
cy.get(dialogCloseButton).click();
}
);
it('Able to submit a valid freeform proposal - with minimum required tokens associated - but also staked', function () { it('Able to submit a valid freeform proposal - with minimum required tokens associated - but also staked', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(

View File

@ -54,60 +54,64 @@ context(
} }
); );
it('Able to stake against a validator - using vega from wallet', function () { it(
cy.staking_page_associate_tokens('3'); 'Able to stake against a validator - using vega from wallet',
{ tags: '@smoke' },
function () {
cy.staking_page_associate_tokens('3');
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
3.0, 3.0,
txTimeout txTimeout
); );
cy.get(ethWalletTotalAssociatedBalance, txTimeout) cy.get(ethWalletTotalAssociatedBalance, txTimeout)
.contains('3.0', txTimeout) .contains('3.0', txTimeout)
.should('be.visible'); .should('be.visible');
cy.get(ethWalletAssociatedBalances, txTimeout) cy.get(ethWalletAssociatedBalances, txTimeout)
.contains(vegaWalletPublicKeyShort, txTimeout) .contains(vegaWalletPublicKeyShort, txTimeout)
.parent() .parent()
.should('contain', 3.0, 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();
// 2001-STKE-031 // 2001-STKE-031
cy.click_on_validator_from_list(0); cy.click_on_validator_from_list(0);
// 2001-STKE-033, 2001-STKE-034, 2001-STKE-037 // 2001-STKE-033, 2001-STKE-034, 2001-STKE-037
cy.staking_validator_page_add_stake('2'); cy.staking_validator_page_add_stake('2');
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
1.0, 1.0,
txTimeout txTimeout
); );
// 2001-STKE-039 // 2001-STKE-039
cy.get(vegaWalletStakedBalances, txTimeout) cy.get(vegaWalletStakedBalances, txTimeout)
.should('contain', 2.0, txTimeout) .should('contain', 2.0, txTimeout)
.and('contain', partValidatorId); .and('contain', partValidatorId);
cy.get(stakeNextEpochValue, epochTimeout) // 2001-STKE-016 cy.get(stakeNextEpochValue, epochTimeout) // 2001-STKE-016
.contains(2.0, epochTimeout) .contains(2.0, epochTimeout)
.should('be.visible'); .should('be.visible');
cy.get(stakeThisEpochValue, epochTimeout) // 2001-STKE-013 cy.get(stakeThisEpochValue, epochTimeout) // 2001-STKE-013
.contains(2.0, epochTimeout) .contains(2.0, epochTimeout)
.should('be.visible'); .should('be.visible');
cy.navigate_to('staking'); cy.navigate_to('staking');
cy.validate_validator_list_total_stake_and_share( cy.validate_validator_list_total_stake_and_share(
'0', '0',
'', '',
'2.00', '2.00',
'100%' '100%'
); );
}); }
);
it('Able to stake against a validator - using vega from vesting contract', function () { it('Able to stake against a validator - using vega from vesting contract', function () {
cy.staking_page_associate_tokens('3', { type: 'contract' }); cy.staking_page_associate_tokens('3', { type: 'contract' });

View File

@ -1,5 +1,3 @@
const noOpenProposals = '[data-testid="no-open-proposals"]';
const noClosedProposals = '[data-testid="no-closed-proposals"]';
const proposalDocumentationLink = '[data-testid="external-link"]'; const proposalDocumentationLink = '[data-testid="external-link"]';
const newProposalButton = '[data-testid="new-proposal-link"]'; const newProposalButton = '[data-testid="new-proposal-link"]';
const newProposalLink = '[data-testid="new-proposal-link"]'; const newProposalLink = '[data-testid="new-proposal-link"]';
@ -53,16 +51,6 @@ context(
.and('equal', '/governance/propose'); .and('equal', '/governance/propose');
}); });
it('should be able to see that no proposals exist', function () {
// 1004-VOTE-003
cy.get(noOpenProposals)
.should('be.visible')
.and('have.text', 'There are no open or yet to enact proposals');
cy.get(noClosedProposals)
.should('be.visible')
.and('have.text', 'There are no enacted or rejected proposals');
});
// Skipping this test for now, the new proposal button no longer takes a user directly // Skipping this test for now, the new proposal button no longer takes a user directly
// to a proposal form, instead it takes them to a page where they can select a proposal type. // to a proposal form, instead it takes them to a page where they can select a proposal type.
// Keeping this test here for now as it can be repurposed to test the new proposal forms. // Keeping this test here for now as it can be repurposed to test the new proposal forms.

View File

@ -14,120 +14,124 @@ const stakeNumberRegex = /^\d*\.?\d*$/;
const ownStake = '[data-testid="own-stake"]'; const ownStake = '[data-testid="own-stake"]';
const nominatedStake = '[data-testid="nominated-stake"]'; const nominatedStake = '[data-testid="nominated-stake"]';
context( context('Staking Page - verify elements on page', function () {
'Staking Page - verify elements on page', before('navigate to staking page', function () {
{ tags: '@smoke' }, cy.visit('/').navigate_to('staking');
function () { });
before('navigate to staking page', function () {
cy.visit('/').navigate_to('staking');
});
describe('with wallets disconnected', function () { describe('with wallets disconnected', { tags: '@smoke' }, function () {
describe('description section', function () { describe('description section', function () {
it('should have staking tab highlighted', function () { it('should have staking tab highlighted', function () {
cy.verify_tab_highlighted('staking'); cy.verify_tab_highlighted('staking');
});
it('should have STAKING ON VEGA header visible', function () {
cy.verify_page_header('Staking');
});
it('should have Staking Guide link visible', function () {
// 2001-STKE-003
cy.get(guideLink)
.should('be.visible')
.and('have.text', 'Read more about staking on Vega')
.and(
'have.attr',
'href',
'https://docs.vega.xyz/docs/mainnet/concepts/vega-chain/#staking-on-vega'
);
});
}); });
describe('Should be able to see validator list from the staking page', function () { it('should have STAKING ON VEGA header visible', function () {
// 2001-STKE-050 cy.verify_page_header('Staking');
it('Should be able to see validator names', function () { });
cy.get('[col-id="validator"]')
.should('have.length.at.least', 1)
.each(($name) => {
cy.wrap($name).should('not.be.empty');
});
});
it('Should be able to see validator status', function () { it('should have Staking Guide link visible', function () {
cy.get('[col-id="status"]') // 2001-STKE-003
.should('have.length.at.least', 1) cy.get(guideLink)
.each(($status) => { .should('be.visible')
cy.wrap($status).should('not.be.empty'); .and('have.text', 'Read more about staking on Vega')
}); .and(
}); 'have.attr',
'href',
it('Should be able to see total stake for this epoch', function () { 'https://docs.vega.xyz/docs/mainnet/concepts/vega-chain/#staking-on-vega'
cy.get('[col-id="totalStakeThisEpoch"]') );
.should('have.length.at.least', 1)
.each(($totalStaked) => {
cy.wrap($totalStaked).should('not.be.empty');
});
});
it('Should be able to see validator staked for this epoch', function () {
cy.get('[col-id="validatorStake"]')
.should('have.length.at.least', 1)
.each(($validatorStake) => {
cy.wrap($validatorStake).should('not.be.empty');
});
});
it('Should be able to see validator staked for next epoch', function () {
cy.get('[col-id="pendingStake"]')
.should('have.length.at.least', 1)
.each(($pendingStake) => {
cy.wrap($pendingStake).should('not.be.empty');
});
});
// 2001-STKE-021
it('Should be able to see validator ranking score', function () {
cy.get('.ag-body-horizontal-scroll-viewport').scrollTo('right');
cy.get('[col-id="rankingScore"]')
.should('have.length.at.least', 1)
.each(($rankingScore) => {
cy.wrap($rankingScore).should('not.be.empty');
});
});
// 2001-STKE-022
it('Should be able to see validator stake score', function () {
cy.get('[col-id="stakeScore"]')
.should('have.length.at.least', 1)
.each(($stakeScore) => {
cy.wrap($stakeScore).should('not.be.empty');
});
});
// 2001-STKE-023
it('Should be able to see validator performance score', function () {
cy.get('[col-id="performanceScore"]')
.should('have.length.at.least', 1)
.each(($performanceScore) => {
cy.wrap($performanceScore).should('not.be.empty');
});
});
// 2001-STKE-024
it('Should be able to see validator voting power score', function () {
cy.get('[col-id="votingPower"]')
.should('have.length.at.least', 1)
.each(($votingPower) => {
cy.wrap($votingPower).should('not.be.empty');
});
});
}); });
}); });
});
// 2001-STKE-050 describe(
describe('Should be able to see static information about a validator', function () { 'Should be able to see validator list from the staking page',
{ tags: '@regression' },
function () {
// 2001-STKE-050
it('Should be able to see validator names', function () {
cy.get('[col-id="validator"]')
.should('have.length.at.least', 1)
.each(($name) => {
cy.wrap($name).should('not.be.empty');
});
});
it('Should be able to see validator status', function () {
cy.get('[col-id="status"]')
.should('have.length.at.least', 1)
.each(($status) => {
cy.wrap($status).should('not.be.empty');
});
});
it('Should be able to see total stake for this epoch', function () {
cy.get('[col-id="totalStakeThisEpoch"]')
.should('have.length.at.least', 1)
.each(($totalStaked) => {
cy.wrap($totalStaked).should('not.be.empty');
});
});
it('Should be able to see validator staked for this epoch', function () {
cy.get('[col-id="validatorStake"]')
.should('have.length.at.least', 1)
.each(($validatorStake) => {
cy.wrap($validatorStake).should('not.be.empty');
});
});
it('Should be able to see validator staked for next epoch', function () {
cy.get('[col-id="pendingStake"]')
.should('have.length.at.least', 1)
.each(($pendingStake) => {
cy.wrap($pendingStake).should('not.be.empty');
});
});
// 2001-STKE-021
it('Should be able to see validator ranking score', function () {
cy.get('.ag-body-horizontal-scroll-viewport').scrollTo('right');
cy.get('[col-id="rankingScore"]')
.should('have.length.at.least', 1)
.each(($rankingScore) => {
cy.wrap($rankingScore).should('not.be.empty');
});
});
// 2001-STKE-022
it('Should be able to see validator stake score', function () {
cy.get('[col-id="stakeScore"]')
.should('have.length.at.least', 1)
.each(($stakeScore) => {
cy.wrap($stakeScore).should('not.be.empty');
});
});
// 2001-STKE-023
it('Should be able to see validator performance score', function () {
cy.get('[col-id="performanceScore"]')
.should('have.length.at.least', 1)
.each(($performanceScore) => {
cy.wrap($performanceScore).should('not.be.empty');
});
});
// 2001-STKE-024
it('Should be able to see validator voting power score', function () {
cy.get('[col-id="votingPower"]')
.should('have.length.at.least', 1)
.each(($votingPower) => {
cy.wrap($votingPower).should('not.be.empty');
});
});
}
);
// 2001-STKE-050
describe(
'Should be able to see static information about a validator',
{ tags: '@smoke' },
function () {
before('connect wallets and click on validator', function () { before('connect wallets and click on validator', function () {
cy.vega_wallet_import(); cy.vega_wallet_import();
cy.vega_wallet_connect(); cy.vega_wallet_connect();
@ -210,6 +214,6 @@ context(
cy.get(nextEpochInfo).should('contain.text', 'Next epoch'); cy.get(nextEpochInfo).should('contain.text', 'Next epoch');
}); });
}); });
}); }
} );
); });

View File

@ -29,7 +29,7 @@ const txTimeout = Cypress.env('txTimeout');
context( context(
'Vega Wallet - verify elements on widget', 'Vega Wallet - verify elements on widget',
{ tags: '@smoke' }, { tags: '@regression' },
function () { function () {
before('visit token home page', function () { before('visit token home page', function () {
cy.visit('/'); cy.visit('/');
@ -145,7 +145,13 @@ context(
describe('when vega wallet connected', function () { describe('when vega wallet connected', function () {
before('connect vega wallet', function () { before('connect vega wallet', function () {
cy.vega_wallet_import(); cy.vega_wallet_import();
cy.visit('/');
cy.get(walletContainer).within(() => {
cy.get(connectButton).click();
});
cy.get(connectorsList).within(() => {
cy.get('button').click();
});
// cy.vega_wallet_connect(); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838 // cy.vega_wallet_connect(); - to be changed when dialog state is fixed - https://github.com/vegaprotocol/frontend-monorepo/issues/838
// then code below can be removed // then code below can be removed
cy.get(restConnectorForm).within(() => { cy.get(restConnectorForm).within(() => {
@ -165,13 +171,17 @@ context(
}); });
}); });
it('should have truncated account number visible', function () { it(
cy.get(walletContainer).within(() => { 'should have truncated account number visible',
cy.get(accountNo) { tags: '@smoke' },
.should('be.visible') function () {
.and('have.text', Cypress.env('vegaWalletPublicKeyShort')); cy.get(walletContainer).within(() => {
}); cy.get(accountNo)
}); .should('be.visible')
.and('have.text', Cypress.env('vegaWalletPublicKeyShort'));
});
}
);
it.skip('should have wallet name visible', function () { it.skip('should have wallet name visible', function () {
cy.get(walletContainer).within(() => { cy.get(walletContainer).within(() => {
@ -189,15 +199,19 @@ context(
}); });
}); });
it('should have Vega Associated currency value visible', function () { it(
cy.get(walletContainer).within(() => { 'should have Vega Associated currency value visible',
cy.get(currencyValue) { tags: '@smoke' },
.should('be.visible') function () {
.and('have.text', `0.000000000000000000`); cy.get(walletContainer).within(() => {
}); cy.get(currencyValue)
}); .should('be.visible')
.and('have.text', `0.000000000000000000`);
});
}
);
it('should have Unstaked value visible', function () { it('should have Unstaked value visible', { tags: '@smoke' }, function () {
cy.get(walletContainer).within(() => { cy.get(walletContainer).within(() => {
cy.get(vegaUnstaked) cy.get(vegaUnstaked)
.should('be.visible') .should('be.visible')

View File

@ -166,5 +166,5 @@ Cypress.Commands.add('get_sort_order_of_supplied_array', (suppliedArray) => {
Cypress.Commands.add('go_to_make_new_proposal', (proposalType) => { Cypress.Commands.add('go_to_make_new_proposal', (proposalType) => {
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.get('a.underline').contains(proposalType).click(); cy.get('li').contains(proposalType).click();
}); });