From 6ad470fcb3ff568bf774f84b4b92366a92800319 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Wed, 16 Nov 2022 17:38:20 +0000 Subject: [PATCH] chore(2027): update smoke tests (#2099) * chore: update smoke tests * chore: remove tag from test --- .../integration/flow/governance-flow.cy.js | 248 +++++++++--------- .../src/integration/flow/staking-flow.cy.js | 196 +++++++------- 2 files changed, 225 insertions(+), 219 deletions(-) diff --git a/apps/token-e2e/src/integration/flow/governance-flow.cy.js b/apps/token-e2e/src/integration/flow/governance-flow.cy.js index ebc1cdda3..5fac9ce0f 100644 --- a/apps/token-e2e/src/integration/flow/governance-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/governance-flow.cy.js @@ -162,28 +162,24 @@ context( }); // 3002-PROP-011 - it( - 'Able to submit a valid freeform proposal - with minimum required tokens associated', - { tags: '@smoke' }, - function () { - cy.ensure_specified_unstaked_tokens_are_associated( - this.minProposerBalance - ); - cy.go_to_make_new_proposal(governanceProposalType.FREEFORM); - cy.get(minVoteButton).should('be.visible'); // 3002-PROP-008 - cy.get(maxVoteButton).should('be.visible'); - cy.get(votingDate).should('not.be.empty'); - cy.get(voteTwoMinExtraNote).should( - 'contain.text', - 'we add 2 minutes of extra time' - ); - cy.enter_unique_freeform_proposal_body('50', generateProposalTitle()); - cy.get(newProposalSubmitButton).should('be.visible').click(); - // 3002-PROP-012 - // 3002-PROP-016 - cy.wait_for_proposal_submitted(); - } - ); + it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () { + cy.ensure_specified_unstaked_tokens_are_associated( + this.minProposerBalance + ); + cy.go_to_make_new_proposal(governanceProposalType.FREEFORM); + cy.get(minVoteButton).should('be.visible'); // 3002-PROP-008 + cy.get(maxVoteButton).should('be.visible'); + cy.get(votingDate).should('not.be.empty'); + cy.get(voteTwoMinExtraNote).should( + 'contain.text', + 'we add 2 minutes of extra time' + ); + cy.enter_unique_freeform_proposal_body('50', generateProposalTitle()); + cy.get(newProposalSubmitButton).should('be.visible').click(); + // 3002-PROP-012 + // 3002-PROP-016 + cy.wait_for_proposal_submitted(); + }); it('Newly created proposals list - proposals closest to closing date appear higher in list', function () { // 3001-VOTE-005 @@ -436,78 +432,82 @@ context( }); // 3001-VOTE-080 3001-VOTE-090 - it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () { - createRawProposal(this.minProposerBalance); - cy.get('@rawProposal').then((rawProposal) => { - cy.get_submitted_proposal_from_proposal_list( - rawProposal.rationale.title - ).within(() => cy.get(viewProposalButton).click()); - }); - // 3001-VOTE-080 - cy.get(voteButtons).contains('against').should('be.visible'); - cy.get(voteButtons).contains('for').should('be.visible'); - cy.vote_for_proposal('for'); - cy.get_governance_proposal_date_format_for_specified_days( - '0', - 'shortMonth' - ).then((votedDate) => { - // 3001-VOTE-051 - // 3001-VOTE-093 - cy.contains('You voted:') - .siblings() - .contains('For') - .siblings() - .contains(votedDate) + it( + 'Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', + { tags: '@smoke' }, + function () { + createRawProposal(this.minProposerBalance); + cy.get('@rawProposal').then((rawProposal) => { + cy.get_submitted_proposal_from_proposal_list( + rawProposal.rationale.title + ).within(() => cy.get(viewProposalButton).click()); + }); + // 3001-VOTE-080 + cy.get(voteButtons).contains('against').should('be.visible'); + cy.get(voteButtons).contains('for').should('be.visible'); + cy.vote_for_proposal('for'); + cy.get_governance_proposal_date_format_for_specified_days( + '0', + 'shortMonth' + ).then((votedDate) => { + // 3001-VOTE-051 + // 3001-VOTE-093 + cy.contains('You voted:') + .siblings() + .contains('For') + .siblings() + .contains(votedDate) + .should('be.visible'); + }); + cy.get(proposalVoteProgressForPercentage) + .contains('100.00%') + .and('be.visible'); + cy.get(proposalVoteProgressAgainstPercentage) + .contains('0.00%') + .and('be.visible'); + cy.get(proposalVoteProgressForTokens) + .contains('1.00') + .and('be.visible'); + cy.get(proposalVoteProgressAgainstTokens) + .contains('0.00') + .and('be.visible'); + cy.get_proposal_information_from_table('Tokens for proposal') + .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) + .and('be.visible'); + cy.get_proposal_information_from_table('Tokens against proposal') + .should('have.text', '0.00') + .and('be.visible'); + // 3001-VOTE-061 + cy.get_proposal_information_from_table('Participation required') + .contains(`${this.requiredParticipation}%`) .should('be.visible'); - }); - cy.get(proposalVoteProgressForPercentage) - .contains('100.00%') - .and('be.visible'); - cy.get(proposalVoteProgressAgainstPercentage) - .contains('0.00%') - .and('be.visible'); - cy.get(proposalVoteProgressForTokens) - .contains('1.00') - .and('be.visible'); - cy.get(proposalVoteProgressAgainstTokens) - .contains('0.00') - .and('be.visible'); - cy.get_proposal_information_from_table('Tokens for proposal') - .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) - .and('be.visible'); - cy.get_proposal_information_from_table('Tokens against proposal') - .should('have.text', '0.00') - .and('be.visible'); - // 3001-VOTE-061 - cy.get_proposal_information_from_table('Participation required') - .contains(`${this.requiredParticipation}%`) - .should('be.visible'); - // 3001-VOTE-066 - cy.get_proposal_information_from_table('Majority Required') - .contains(`${parseFloat(this.requiredMajority).toFixed(2)}%`) - .should('be.visible'); - cy.get_proposal_information_from_table('Number of voting parties') - .should('have.text', '1') - .and('be.visible'); - cy.get(changeVoteButton).should('be.visible').click(); - cy.vote_for_proposal('for'); - // 3001-VOTE-064 - cy.get_proposal_information_from_table('Tokens for proposal') - .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) - .and('be.visible'); - cy.wait_for_spinner(); - cy.get(changeVoteButton).should('be.visible').click(); - cy.vote_for_proposal('against'); - cy.get(proposalVoteProgressAgainstPercentage) - .contains('100.00%') - .and('be.visible'); - cy.get_proposal_information_from_table('Tokens against proposal') - .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) - .and('be.visible'); - cy.get_proposal_information_from_table('Number of voting parties') - .should('have.text', '1') - .and('be.visible'); - }); + // 3001-VOTE-066 + cy.get_proposal_information_from_table('Majority Required') + .contains(`${parseFloat(this.requiredMajority).toFixed(2)}%`) + .should('be.visible'); + cy.get_proposal_information_from_table('Number of voting parties') + .should('have.text', '1') + .and('be.visible'); + cy.get(changeVoteButton).should('be.visible').click(); + cy.vote_for_proposal('for'); + // 3001-VOTE-064 + cy.get_proposal_information_from_table('Tokens for proposal') + .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) + .and('be.visible'); + cy.wait_for_spinner(); + cy.get(changeVoteButton).should('be.visible').click(); + cy.vote_for_proposal('against'); + cy.get(proposalVoteProgressAgainstPercentage) + .contains('100.00%') + .and('be.visible'); + cy.get_proposal_information_from_table('Tokens against proposal') + .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) + .and('be.visible'); + cy.get_proposal_information_from_table('Number of voting parties') + .should('have.text', '1') + .and('be.visible'); + } + ); // 3001-VOTE-042, 3001-VOTE-057, 3001-VOTE-058, 3001-VOTE-059, 3001-VOTE-060 it('Newly created proposal details - ability to increase associated tokens - by voting again after association', function () { @@ -743,36 +743,42 @@ context( }); // 1005-PROP-009 - it('Unable to vote on a freeform proposal - when some but not enough vega associated', function () { - const proposalTitle = generateProposalTitle(); + it( + 'Unable to vote on a freeform proposal - when some but not enough vega associated', + { tags: '@smoke' }, + function () { + const proposalTitle = generateProposalTitle(); - cy.ensure_specified_unstaked_tokens_are_associated( - this.minProposerBalance - ); - cy.go_to_make_new_proposal(governanceProposalType.FREEFORM); - cy.enter_unique_freeform_proposal_body('50', proposalTitle); - cy.get(newProposalSubmitButton).should('be.visible').click(); - cy.wait_for_proposal_submitted(); - cy.wait_for_proposal_sync(); - cy.staking_page_disassociate_tokens('0.0001'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should( - 'contain', - '0.999900000000000000' + cy.ensure_specified_unstaked_tokens_are_associated( + this.minProposerBalance ); - }); - cy.navigate_to('governance'); - cy.wait_for_spinner(); - cy.get_submitted_proposal_from_proposal_list(proposalTitle).within(() => - cy.get(viewProposalButton).click() - ); - cy.contains('Vote breakdown').should('be.visible', { timeout: 10000 }); - cy.get(voteButtons).should('not.exist'); - cy.getByTestId('min-proposal-requirements').should( - 'have.text', - `You must have at least ${this.minVoterBalance} VEGA associated to vote on this proposal` - ); - }); + cy.go_to_make_new_proposal(governanceProposalType.FREEFORM); + cy.enter_unique_freeform_proposal_body('50', proposalTitle); + cy.get(newProposalSubmitButton).should('be.visible').click(); + cy.wait_for_proposal_submitted(); + cy.wait_for_proposal_sync(); + cy.staking_page_disassociate_tokens('0.0001'); + cy.get(vegaWallet).within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + '0.999900000000000000' + ); + }); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.get_submitted_proposal_from_proposal_list(proposalTitle).within( + () => cy.get(viewProposalButton).click() + ); + cy.contains('Vote breakdown').should('be.visible', { + timeout: 10000, + }); + cy.get(voteButtons).should('not.exist'); + cy.getByTestId('min-proposal-requirements').should( + 'have.text', + `You must have at least ${this.minVoterBalance} VEGA associated to vote on this proposal` + ); + } + ); it('Unable to vote on a proposal - when vega wallet disconnected - option to connect from within', function () { createRawProposal(this.minProposerBalance); 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 2f3b8aa72..66393c0d9 100644 --- a/apps/token-e2e/src/integration/flow/staking-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/staking-flow.cy.js @@ -55,65 +55,61 @@ context( } ); - it( - 'Able to stake against a validator - using vega from wallet', - { tags: '@smoke' }, - function () { - cy.staking_page_associate_tokens('3'); + it('Able to stake against a validator - using vega from wallet', function () { + cy.staking_page_associate_tokens('3'); - cy.get(vegaWalletUnstakedBalance, txTimeout).should( - 'contain', - 3.0, - txTimeout - ); + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); - cy.get(ethWalletTotalAssociatedBalance, txTimeout) - .contains('3.0', txTimeout) - .should('be.visible'); + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('3.0', txTimeout) + .should('be.visible'); - cy.get(ethWalletAssociatedBalances, txTimeout) - .contains(vegaWalletPublicKeyShort, txTimeout) - .parent() - .should('contain', 3.0, txTimeout); + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort, txTimeout) + .parent() + .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 - cy.click_on_validator_from_list(0); + // 2001-STKE-031 + cy.click_on_validator_from_list(0); - // 2001-STKE-033, 2001-STKE-034, 2001-STKE-037 - cy.staking_validator_page_add_stake('2'); + // 2001-STKE-033, 2001-STKE-034, 2001-STKE-037 + cy.staking_validator_page_add_stake('2'); - cy.get(vegaWalletUnstakedBalance, txTimeout).should( - 'contain', - 1.0, - txTimeout - ); - // 2001-STKE-039 - cy.get(vegaWalletStakedBalances, txTimeout) - .should('contain', 2.0, txTimeout) - .and('contain', partValidatorId); + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout + ); + // 2001-STKE-039 + cy.get(vegaWalletStakedBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', partValidatorId); - cy.get(stakeNextEpochValue, epochTimeout) // 2001-STKE-016 2001-STKE-038 - .contains(2.0, epochTimeout) - .should('be.visible'); + cy.get(stakeNextEpochValue, epochTimeout) // 2001-STKE-016 2001-STKE-038 + .contains(2.0, epochTimeout) + .should('be.visible'); - cy.get(stakeThisEpochValue, epochTimeout) // 2001-STKE-013 - .contains(2.0, epochTimeout) - .should('be.visible'); + cy.get(stakeThisEpochValue, epochTimeout) // 2001-STKE-013 + .contains(2.0, epochTimeout) + .should('be.visible'); - cy.get(nominatedStake).should('have.text', '2.000000000000000000'); // 2001-STKE-017 2002-SINC-007 + cy.get(nominatedStake).should('have.text', '2.000000000000000000'); // 2001-STKE-017 2002-SINC-007 - cy.navigate_to('staking'); + 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 () { cy.staking_page_associate_tokens('3', { type: 'contract' }); @@ -310,73 +306,77 @@ context( }); // 2001-STKE-041 - it('Able to remove part of a stake against a validator', function () { - cy.staking_page_associate_tokens('4'); + it( + 'Able to remove part of a stake against a validator', + { tags: '@smoke' }, + function () { + cy.staking_page_associate_tokens('4'); - cy.get(vegaWalletUnstakedBalance, txTimeout).should( - 'contain', - 4.0, - txTimeout - ); + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 4.0, + txTimeout + ); - cy.get('button').contains('Select a validator to nominate').click(); + cy.get('button').contains('Select a validator to nominate').click(); - cy.click_on_validator_from_list(0); + cy.click_on_validator_from_list(0); - cy.staking_validator_page_add_stake('3'); + cy.staking_validator_page_add_stake('3'); - cy.get(stakeNextEpochValue, epochTimeout) - .contains(3.0, epochTimeout) - .should('be.visible'); + cy.get(stakeNextEpochValue, epochTimeout) + .contains(3.0, epochTimeout) + .should('be.visible'); - cy.get(vegaWalletUnstakedBalance, txTimeout).should( - 'contain', - 1.0, - txTimeout - ); + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout + ); - cy.navigate_to('staking'); - // 2001-STKE-040 - cy.click_on_validator_from_list(0); + cy.navigate_to('staking'); + // 2001-STKE-040 + cy.click_on_validator_from_list(0); - // 2001-STKE-044, 2001-STKE-048 - cy.staking_validator_page_remove_stake('1'); + // 2001-STKE-044, 2001-STKE-048 + cy.staking_validator_page_remove_stake('1'); - // 2001-STKE-049 - cy.get(stakeNextEpochValue, epochTimeout).contains(2.0, epochTimeout); + // 2001-STKE-049 + cy.get(stakeNextEpochValue, epochTimeout).contains(2.0, epochTimeout); - cy.get(vegaWalletUnstakedBalance, txTimeout).should( - 'contain', - 2.0, - txTimeout - ); + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout + ); - cy.get(vegaWalletStakedBalances, txTimeout).should( - 'contain', - 2.0, - txTimeout - ); + cy.get(vegaWalletStakedBalances, txTimeout).should( + 'contain', + 2.0, + txTimeout + ); - cy.get(stakeNextEpochValue, epochTimeout) - .contains(2.0, epochTimeout) - .should('be.visible'); + cy.get(stakeNextEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); - cy.get(stakeThisEpochValue, epochTimeout) - .contains(2.0, epochTimeout) - .should('be.visible'); + cy.get(stakeThisEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); - cy.get(totalStake, epochTimeout).should('contain.text', '2'); - cy.get(stakeShare, epochTimeout).should('have.text', '100%'); + cy.get(totalStake, epochTimeout).should('contain.text', '2'); + cy.get(stakeShare, epochTimeout).should('have.text', '100%'); - cy.navigate_to('staking'); + 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%' + ); + } + ); // 2001-STKE-045 it('Able to remove a full stake against a validator', function () {