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 487142a27..631357b79 100644 --- a/apps/token-e2e/src/integration/flow/governance-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/governance-flow.cy.js @@ -61,7 +61,7 @@ context( cy.verify_page_header('The $VEGA token'); cy.get_network_parameters().then((network_parameters) => { cy.wrap( - network_parameters['spam.protection.voting.min.tokens'] / + network_parameters['spam.protection.proposal.min.tokens'] / 1000000000000000000 ).as('minProposerBalance'); cy.wrap( @@ -115,6 +115,11 @@ context( 0.00001, 'Asserting that value is at least 0.00001 for network parameter minProposerBalance' ); + assert.isAtLeast( + parseInt(this.minVoterBalance), + 0.00001, + 'Asserting that value is at least 0.00001 for network parameter minVoterBalance' + ); assert.isAtLeast( parseFloat(this.requiredParticipation), 0.00001, @@ -227,6 +232,7 @@ context( // 3001-VOTE-008 // 3001-VOTE-034 cy.get(`#${proposalId}`) + // 3001-VOTE-097 .should('contain', rawProposal.rationale.title) .and('be.visible'); cy.get(`#${proposalId}`) @@ -363,6 +369,14 @@ context( .should('contain', rawProposal.rationale.description) .and('be.visible'); }); + // 3001-VOTE-052 + cy.get('code.language-json') + .should('exist') + .within(() => { + cy.get('.hljs-string') + .eq(0) + .should('have.text', '"ProposalTerms"'); + }); }); }); @@ -717,9 +731,8 @@ context( ); }); - // Have to skip because #1326 bug doesn't handle below scenario - // 1005-todo-PROP-009 - it.skip('Unable to vote on a freeform proposal - when some but not enough vega associated', function () { + // 1005-PROP-009 + it('Unable to vote on a freeform proposal - when some but not enough vega associated', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -741,8 +754,11 @@ context( .as('submittedProposal') .within(() => cy.get(viewProposalButton).click()); cy.contains('Vote breakdown').should('be.visible', { timeout: 10000 }); - cy.get(voteButtons).contains('for').should('not.exist'); - cy.get(voteButtons).contains('against').should('not.exist'); + 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 () { diff --git a/apps/token-e2e/src/integration/flow/governance-forms-flow.cy.js b/apps/token-e2e/src/integration/flow/governance-forms-flow.cy.js index 0e651fd66..cb7c9e3ab 100644 --- a/apps/token-e2e/src/integration/flow/governance-forms-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/governance-forms-flow.cy.js @@ -2,7 +2,6 @@ const newProposalSubmitButton = '[data-testid="proposal-submit"]'; const proposalVoteDeadline = '[data-testid="proposal-vote-deadline"]'; const proposalValidationDeadline = '[data-testid="proposal-validation-deadline"]'; -const proposalEnactmentDeadline = '[data-testid="proposal-enactment-deadline"]'; const proposalParameterSelect = '[data-testid="proposal-parameter-select"]'; const proposalMarketSelect = '[data-testid="proposal-market-select"]'; const newProposalTitle = '[data-testid="proposal-title"]'; @@ -12,6 +11,11 @@ const currentParameterValue = '[data-testid="selected-proposal-param-current-value"]'; const newProposedParameterValue = '[data-testid="selected-proposal-param-new-value"]'; +const minVoteDeadline = '[data-testid="min-vote"]'; +const maxVoteDeadline = '[data-testid="max-vote"]'; +const minValidationDeadline = '[data-testid="min-validation"]'; +const minEnactDeadline = '[data-testid="min-enactment"]'; +const maxEnactDeadline = '[data-testid="max-enactment"]'; const dialogCloseButton = '[data-testid="dialog-close"]'; const inputError = '[data-testid="input-error-text"]'; const feedbackError = '[data-testid="Error"]'; @@ -163,7 +167,7 @@ context( }); // 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001 - it('Able to submit new asset proposal', function () { + it('Able to submit new asset proposal using min deadlines', function () { cy.go_to_make_new_proposal(governanceProposalType.NEW_ASSET); cy.get(newProposalTitle).type('Test new asset proposal'); cy.get(newProposalDescription).type('E2E test for proposals'); @@ -174,6 +178,9 @@ context( delay: 2, }); }); + cy.get(minVoteDeadline).click(); + cy.get(minValidationDeadline).click(); + cy.get(minEnactDeadline).click(); cy.get(newProposalSubmitButton).should('be.visible').click(); cy.contains('Awaiting network confirmation', epochTimeout).should( 'be.visible' @@ -206,19 +213,21 @@ context( ); }); - it('Able to submit update asset proposal', function () { + it('Able to submit update asset proposal using min deadline', function () { cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET); - cy.get(newProposalTitle).type('Test update asset proposal'); - cy.get(newProposalDescription).type('E2E test for proposals'); - cy.fixture('/proposals/update-asset').then((newAssetProposal) => { - let newAssetPayload = JSON.stringify(newAssetProposal); - cy.get(newProposalTerms).type(newAssetPayload, { - parseSpecialCharSequences: false, - delay: 2, - }); - }); - cy.get(proposalVoteDeadline).clear().click().type('50'); - cy.get(proposalEnactmentDeadline).clear().click().type('50'); + enterUpdateAssetProposalDetails(); + cy.get(minVoteDeadline).click(); + cy.get(minEnactDeadline).click(); + cy.get(newProposalSubmitButton).should('be.visible').click(); + cy.wait_for_proposal_submitted(); + }); + + // Skipping until #1837 is fixed + it.skip('Able to submit update asset proposal using max deadline', function () { + cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET); + enterUpdateAssetProposalDetails(); + cy.get(maxVoteDeadline).click(); + cy.get(maxEnactDeadline).click(); cy.get(newProposalSubmitButton).should('be.visible').click(); cy.wait_for_proposal_submitted(); }); @@ -228,5 +237,17 @@ context( cy.get(newProposalSubmitButton).should('be.visible').click(); cy.get(inputError).should('have.length', 3); }); + + function enterUpdateAssetProposalDetails() { + cy.get(newProposalTitle).type('Test update asset proposal'); + cy.get(newProposalDescription).type('E2E test for proposals'); + cy.fixture('/proposals/update-asset').then((newAssetProposal) => { + let newAssetPayload = JSON.stringify(newAssetProposal); + cy.get(newProposalTerms).type(newAssetPayload, { + parseSpecialCharSequences: false, + delay: 2, + }); + }); + } } );