chore(governance): update tests with vote changes (#4706)
This commit is contained in:
parent
4ed0e3a056
commit
81f7b0595e
@ -34,19 +34,20 @@ import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
|
|||||||
import { createSuccessorMarketProposalTxBody } from '../../support/proposal.functions';
|
import { createSuccessorMarketProposalTxBody } from '../../support/proposal.functions';
|
||||||
|
|
||||||
const proposalListItem = '[data-testid="proposals-list-item"]';
|
const proposalListItem = '[data-testid="proposals-list-item"]';
|
||||||
const proposalVoteProgressForPercentage =
|
const participationNotMet = 'token-participation-not-met';
|
||||||
'vote-progress-indicator-percentage-for';
|
const voteStatus = 'vote-status';
|
||||||
const proposalVoteProgressAgainstPercentage =
|
const voteMajorityNotMet = 'token-majority-not-met';
|
||||||
'vote-progress-indicator-percentage-against';
|
const numberOfVotesFor = 'num-votes-for';
|
||||||
const proposalVoteProgressForTokens = 'vote-progress-indicator-tokens-for';
|
const votesForPercentage = 'votes-for-percentage';
|
||||||
const proposalVoteProgressAgainstTokens =
|
const numberOfVotesAgainst = 'num-votes-against';
|
||||||
'vote-progress-indicator-tokens-against';
|
const votesAgainstPercentage = 'votes-against-percentage';
|
||||||
|
const totalVotedNumber = 'total-voted';
|
||||||
|
const totalVotedPercentage = 'total-voted-percentage';
|
||||||
const changeVoteButton = 'change-vote-button';
|
const changeVoteButton = 'change-vote-button';
|
||||||
const proposalDetailsTitle = 'proposal-title';
|
const proposalDetailsTitle = 'proposal-title';
|
||||||
const proposalDetailsDescription = 'proposal-description';
|
const proposalDetailsDescription = 'proposal-description';
|
||||||
const openProposals = 'open-proposals';
|
const openProposals = 'open-proposals';
|
||||||
const viewProposalButton = 'view-proposal-btn';
|
const viewProposalButton = 'view-proposal-btn';
|
||||||
const voteBreakdownToggle = 'vote-breakdown-toggle';
|
|
||||||
const proposalTermsToggle = 'proposal-json-toggle';
|
const proposalTermsToggle = 'proposal-json-toggle';
|
||||||
const marketDataToggle = 'proposal-market-data-toggle';
|
const marketDataToggle = 'proposal-market-data-toggle';
|
||||||
|
|
||||||
@ -150,29 +151,32 @@ describe(
|
|||||||
// 3001-VOTE-037
|
// 3001-VOTE-037
|
||||||
// 3001-VOTE-040
|
// 3001-VOTE-040
|
||||||
// 3001-VOTE-067
|
// 3001-VOTE-067
|
||||||
|
// 3001-VOTE-023
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
cy.getByTestId(viewProposalButton).click()
|
cy.getByTestId(viewProposalButton).click()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
|
cy.getByTestId(participationNotMet).should(
|
||||||
'be.visible'
|
'have.text',
|
||||||
|
'0.000000000000000000000015% participation threshold not met'
|
||||||
|
);
|
||||||
|
cy.getByTestId(voteMajorityNotMet).should(
|
||||||
|
'have.text',
|
||||||
|
'66% majority threshold not met'
|
||||||
|
);
|
||||||
|
cy.getByTestId(voteStatus).should(
|
||||||
|
'have.text',
|
||||||
|
'Currently expected to fail'
|
||||||
);
|
);
|
||||||
cy.getByTestId(voteBreakdownToggle).click();
|
|
||||||
getProposalInformationFromTable('Expected to pass')
|
|
||||||
.contains('👎')
|
|
||||||
.should('be.visible');
|
|
||||||
// 3001-VOTE-062
|
// 3001-VOTE-062
|
||||||
// 3001-VOTE-040
|
// 3001-VOTE-040
|
||||||
// 3001-VOTE-070
|
// 3001-VOTE-070
|
||||||
getProposalInformationFromTable('Token majority met')
|
|
||||||
.contains('👎')
|
|
||||||
.should('be.visible');
|
|
||||||
// 3001-VOTE-068
|
// 3001-VOTE-068
|
||||||
getProposalInformationFromTable('Token participation met')
|
cy.getByTestId(numberOfVotesFor).should('have.text', '0.0M');
|
||||||
.contains('👎')
|
cy.getByTestId(numberOfVotesAgainst).should('have.text', '0.0M');
|
||||||
.should('be.visible');
|
cy.getByTestId(totalVotedNumber).should('have.text', '0.0M');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-080 3001-VOTE-090 3001-VOTE-069 3001-VOTE-072 3001-VOTE-073
|
// 3001-VOTE-080 3001-VOTE-090 3001-VOTE-069 3001-VOTE-072 3001-VOTE-073
|
||||||
@ -197,43 +201,16 @@ describe(
|
|||||||
.contains(votedDate)
|
.contains(votedDate)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
cy.getByTestId(proposalVoteProgressForPercentage) // 3001-VOTE-072
|
cy.getByTestId(votesForPercentage) // 3001-VOTE-072
|
||||||
.contains('100.00%')
|
.should('have.text', '100%');
|
||||||
.and('be.visible');
|
cy.getByTestId(votesAgainstPercentage).should('have.text', '0%');
|
||||||
cy.getByTestId(proposalVoteProgressAgainstPercentage)
|
cy.getByTestId('token-majority-progress')
|
||||||
.contains('0.00%')
|
.should('have.attr', 'style')
|
||||||
.and('be.visible');
|
.and('eq', 'width: 100%;'); // 3001-VOTE-024
|
||||||
cy.getByTestId(proposalVoteProgressForTokens)
|
|
||||||
.contains('1.00')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(proposalVoteProgressAgainstTokens)
|
|
||||||
.contains('0.00')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(voteBreakdownToggle).click();
|
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
|
||||||
.should('have.text', (1).toFixed(2))
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Tokens against proposal')
|
|
||||||
.should('have.text', '0.00')
|
|
||||||
.and('be.visible');
|
|
||||||
// 3001-VOTE-061
|
|
||||||
getProposalInformationFromTable('Participation required')
|
|
||||||
.contains('0.00%')
|
|
||||||
.should('be.visible');
|
|
||||||
// 3001-VOTE-066
|
|
||||||
getProposalInformationFromTable('Majority Required') // 3001-VOTE-073
|
|
||||||
.contains(`${(66).toFixed(2)}%`)
|
|
||||||
.should('be.visible');
|
|
||||||
getProposalInformationFromTable('Number of voting parties')
|
|
||||||
.should('have.text', '1')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(changeVoteButton).should('be.visible').click();
|
cy.getByTestId(changeVoteButton).should('be.visible').click();
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
// 3001-VOTE-064
|
// 3001-VOTE-064
|
||||||
cy.getByTestId('user-voted-yes').should('exist');
|
cy.getByTestId('user-voted-yes').should('exist');
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
|
||||||
.should('have.text', (1).toFixed(2))
|
|
||||||
.and('be.visible');
|
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
||||||
@ -244,16 +221,7 @@ describe(
|
|||||||
});
|
});
|
||||||
cy.getByTestId(changeVoteButton).should('be.visible').click();
|
cy.getByTestId(changeVoteButton).should('be.visible').click();
|
||||||
voteForProposal('against');
|
voteForProposal('against');
|
||||||
cy.getByTestId(proposalVoteProgressAgainstPercentage)
|
cy.getByTestId(votesAgainstPercentage).should('have.text', '100%');
|
||||||
.contains('100.00%')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(voteBreakdownToggle).click();
|
|
||||||
getProposalInformationFromTable('Tokens against proposal')
|
|
||||||
.should('have.text', (1).toFixed(2))
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Number of voting parties')
|
|
||||||
.should('have.text', '1')
|
|
||||||
.and('be.visible');
|
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
||||||
@ -265,6 +233,7 @@ describe(
|
|||||||
|
|
||||||
// 3001-VOTE-042, 3001-VOTE-057, 3001-VOTE-058, 3001-VOTE-059, 3001-VOTE-060
|
// 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 () {
|
it('Newly created proposal details - ability to increase associated tokens - by voting again after association', function () {
|
||||||
|
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
@ -275,69 +244,28 @@ describe(
|
|||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
// 3001-VOTE-079
|
// 3001-VOTE-079
|
||||||
cy.contains('You voted: For').should('be.visible');
|
cy.contains('You voted: For').should('be.visible');
|
||||||
cy.getByTestId(proposalVoteProgressForTokens)
|
cy.getByTestId(numberOfVotesFor).should('have.text', '0.0M');
|
||||||
.contains('1')
|
cy.getByTestId(votesForPercentage).should('have.text', '100%');
|
||||||
.and('be.visible');
|
cy.getByTestId(totalVotedNumber).should('have.text', '0.0M');
|
||||||
cy.getByTestId(voteBreakdownToggle).click();
|
cy.getByTestId(totalVotedPercentage).should('have.text', '(0.00%)');
|
||||||
getProposalInformationFromTable('Total Supply')
|
ethereumWalletConnect();
|
||||||
.invoke('text')
|
stakingPageAssociateTokens('1000000', { approve: true });
|
||||||
.then((totalSupply) => {
|
navigateTo(navigation.proposals);
|
||||||
const tokensRequiredToAchieveResult = (
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
(Number(totalSupply.replace(/,/g, '')) * 0.001) /
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
100
|
cy.getByTestId(viewProposalButton).click()
|
||||||
).toFixed(2);
|
);
|
||||||
ethereumWalletConnect();
|
});
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated(
|
cy.getByTestId(votesForPercentage).should('have.text', '100%');
|
||||||
tokensRequiredToAchieveResult
|
cy.getByTestId(numberOfVotesFor).should('have.text', '0.0M');
|
||||||
);
|
cy.getByTestId(totalVotedNumber).should('have.text', '0.0M');
|
||||||
navigateTo(navigation.proposals);
|
cy.getByTestId(totalVotedPercentage).should('have.text', '(0.00%)');
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
// 3001-VOTE-065
|
||||||
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
cy.getByTestId(changeVoteButton).should('be.visible').click();
|
||||||
cy.getByTestId(viewProposalButton).click()
|
voteForProposal('for');
|
||||||
);
|
cy.getByTestId(numberOfVotesFor).should('have.text', '1.0M');
|
||||||
});
|
cy.getByTestId(totalVotedNumber).should('have.text', '1.0M');
|
||||||
cy.getByTestId(proposalVoteProgressForPercentage)
|
cy.getByTestId(totalVotedPercentage).should('have.text', '(1.54%)');
|
||||||
.contains('100.00%')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(proposalVoteProgressAgainstPercentage)
|
|
||||||
.contains('0.00%')
|
|
||||||
.and('be.visible');
|
|
||||||
// 3001-VOTE-065
|
|
||||||
cy.getByTestId(changeVoteButton).should('be.visible').click();
|
|
||||||
voteForProposal('for');
|
|
||||||
cy.getByTestId(proposalVoteProgressForTokens)
|
|
||||||
.contains(tokensRequiredToAchieveResult)
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(proposalVoteProgressAgainstTokens)
|
|
||||||
.contains('0.00')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(voteBreakdownToggle).click();
|
|
||||||
getProposalInformationFromTable('Total tokens voted percentage')
|
|
||||||
.should('have.text', '0.00%')
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
|
||||||
.should('have.text', tokensRequiredToAchieveResult)
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Tokens against proposal')
|
|
||||||
.should('have.text', '0.00')
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Number of voting parties')
|
|
||||||
.should('have.text', '1')
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Expected to pass')
|
|
||||||
.contains('👍')
|
|
||||||
.should('be.visible');
|
|
||||||
// 3001-VOTE-062
|
|
||||||
getProposalInformationFromTable('Token majority met')
|
|
||||||
.contains('👍')
|
|
||||||
.should('be.visible');
|
|
||||||
getProposalInformationFromTable('Token participation met')
|
|
||||||
.contains('👍')
|
|
||||||
.should('be.visible');
|
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
|
||||||
.contains(tokensRequiredToAchieveResult)
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to vote for proposal twice by switching public key', function () {
|
it('Able to vote for proposal twice by switching public key', function () {
|
||||||
@ -360,10 +288,6 @@ describe(
|
|||||||
voteForProposal('against');
|
voteForProposal('against');
|
||||||
cy.contains('You voted: Against').should('be.visible');
|
cy.contains('You voted: Against').should('be.visible');
|
||||||
switchVegaWalletPubKey();
|
switchVegaWalletPubKey();
|
||||||
cy.getByTestId(proposalVoteProgressForTokens).should(
|
|
||||||
'contain.text',
|
|
||||||
'1.00'
|
|
||||||
);
|
|
||||||
// Checking vote status for different public keys is displayed correctly
|
// Checking vote status for different public keys is displayed correctly
|
||||||
cy.contains('You voted: For').should('be.visible');
|
cy.contains('You voted: For').should('be.visible');
|
||||||
});
|
});
|
||||||
|
@ -22,12 +22,10 @@ const proposalListItem = '[data-testid="proposals-list-item"]';
|
|||||||
const closedProposals = 'closed-proposals';
|
const closedProposals = 'closed-proposals';
|
||||||
const proposalStatus = 'proposal-status';
|
const proposalStatus = 'proposal-status';
|
||||||
const viewProposalButton = 'view-proposal-btn';
|
const viewProposalButton = 'view-proposal-btn';
|
||||||
const votesTable = 'votes-table';
|
const votesTable = 'user-vote';
|
||||||
const openProposals = 'open-proposals';
|
const openProposals = 'open-proposals';
|
||||||
const proposalVoteProgressForPercentage =
|
const majorityVoteReached = 'token-majority-met';
|
||||||
'vote-progress-indicator-percentage-for';
|
const minParticipationReached = 'token-participation-met';
|
||||||
const majorityVoteReached = 'majority-reached';
|
|
||||||
const minParticipationReached = 'participation-reached';
|
|
||||||
const proposalTimeout = { timeout: 8000 };
|
const proposalTimeout = { timeout: 8000 };
|
||||||
|
|
||||||
context(
|
context(
|
||||||
@ -70,7 +68,6 @@ context(
|
|||||||
cy.getByTestId('proposal-type').should('have.text', 'New market');
|
cy.getByTestId('proposal-type').should('have.text', 'New market');
|
||||||
cy.getByTestId(proposalStatus).should('have.text', 'Enacted');
|
cy.getByTestId(proposalStatus).should('have.text', 'Enacted');
|
||||||
cy.getByTestId(votesTable).within(() => {
|
cy.getByTestId(votesTable).within(() => {
|
||||||
cy.contains('Vote passed.').should('be.visible');
|
|
||||||
cy.contains('Voting has ended.').should('be.visible');
|
cy.contains('Voting has ended.').should('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -92,7 +89,7 @@ context(
|
|||||||
// 3001-VOTE-019 time to vote is highlighted red
|
// 3001-VOTE-019 time to vote is highlighted red
|
||||||
cy.getByTestId('vote-details')
|
cy.getByTestId('vote-details')
|
||||||
.find('span')
|
.find('span')
|
||||||
.should('have.class', 'text-vega-pink');
|
.should('have.class', 'text-vega-orange');
|
||||||
cy.getByTestId(viewProposalButton).click();
|
cy.getByTestId(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -109,12 +106,9 @@ context(
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
cy.getByTestId(votesTable).within(() => {
|
cy.getByTestId(votesTable).within(() => {
|
||||||
cy.contains('Vote passed.').should('be.visible');
|
|
||||||
cy.contains('Voting has ended.').should('be.visible');
|
cy.contains('Voting has ended.').should('be.visible');
|
||||||
});
|
});
|
||||||
cy.getByTestId(proposalVoteProgressForPercentage)
|
cy.getByTestId('votes-for-percentage').should('have.text', '100%');
|
||||||
.contains('100.00%')
|
|
||||||
.and('be.visible');
|
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
|
@ -298,9 +298,6 @@ context(
|
|||||||
getProposalFromTitle(proposalTitle).within(() =>
|
getProposalFromTitle(proposalTitle).within(() =>
|
||||||
cy.getByTestId(viewProposalButton).click()
|
cy.getByTestId(viewProposalButton).click()
|
||||||
);
|
);
|
||||||
cy.contains('Vote breakdown').should('be.visible', {
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
cy.getByTestId(voteButtons).should('not.exist');
|
cy.getByTestId(voteButtons).should('not.exist');
|
||||||
cy.getByTestId('min-proposal-requirements').should(
|
cy.getByTestId('min-proposal-requirements').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
|
@ -52,8 +52,6 @@ const enactmentDeadlineError = 'enactment-before-voting-deadline';
|
|||||||
const proposalDownloadBtn = 'proposal-download-json';
|
const proposalDownloadBtn = 'proposal-download-json';
|
||||||
const feedbackError = '[data-testid="Error"]';
|
const feedbackError = '[data-testid="Error"]';
|
||||||
const viewProposalBtn = 'view-proposal-btn';
|
const viewProposalBtn = 'view-proposal-btn';
|
||||||
const liquidityVoteStatus = 'liquidity-votes-status';
|
|
||||||
const tokenVoteStatus = 'token-votes-status';
|
|
||||||
const proposalJsonToggle = 'proposal-json-toggle';
|
const proposalJsonToggle = 'proposal-json-toggle';
|
||||||
const proposalJsonSection = 'proposal-json';
|
const proposalJsonSection = 'proposal-json';
|
||||||
const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey');
|
const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey');
|
||||||
@ -421,27 +419,28 @@ context(
|
|||||||
cy.getByTestId(viewProposalBtn).click();
|
cy.getByTestId(viewProposalBtn).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cy.getByTestId(liquidityVoteStatus).should(
|
cy.getByTestId('lp-majority-not-met').should(
|
||||||
'contain.text',
|
'have.text',
|
||||||
'Currently expected to fail'
|
'66% majority threshold not met'
|
||||||
);
|
);
|
||||||
cy.getByTestId(tokenVoteStatus).should(
|
|
||||||
'contain.text',
|
cy.getByTestId('token-majority-not-met').should(
|
||||||
'Currently expected to fail'
|
'have.text',
|
||||||
|
'66% majority threshold not met'
|
||||||
);
|
);
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
cy.getByTestId(liquidityVoteStatus).should(
|
cy.getByTestId('lp-majority-met').should(
|
||||||
'contain.text',
|
'have.text',
|
||||||
'Currently expected to pass'
|
'66% majority threshold met'
|
||||||
);
|
);
|
||||||
cy.getByTestId(tokenVoteStatus).should(
|
cy.getByTestId('token-majority-met').should(
|
||||||
'contain.text',
|
'have.text',
|
||||||
'Currently expected to pass'
|
'66% majority threshold met'
|
||||||
|
);
|
||||||
|
cy.getByTestId('vote-status').should(
|
||||||
|
'have.text',
|
||||||
|
'Currently expected to pass by token vote'
|
||||||
);
|
);
|
||||||
cy.getByTestId('vote-breakdown-toggle').click();
|
|
||||||
getProposalInformationFromTable('Expected to pass')
|
|
||||||
.contains('👍 by token vote')
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001
|
// 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
enterRawProposalBody,
|
enterRawProposalBody,
|
||||||
generateFreeFormProposalTitle,
|
generateFreeFormProposalTitle,
|
||||||
getProposalFromTitle,
|
getProposalFromTitle,
|
||||||
getProposalInformationFromTable,
|
|
||||||
goToMakeNewProposal,
|
goToMakeNewProposal,
|
||||||
governanceProposalType,
|
governanceProposalType,
|
||||||
submitUniqueRawProposal,
|
submitUniqueRawProposal,
|
||||||
@ -30,7 +29,9 @@ const proposalType = 'proposal-type';
|
|||||||
const proposalStatus = 'proposal-status';
|
const proposalStatus = 'proposal-status';
|
||||||
const proposalClosingDate = 'vote-details';
|
const proposalClosingDate = 'vote-details';
|
||||||
const viewProposalButton = 'view-proposal-btn';
|
const viewProposalButton = 'view-proposal-btn';
|
||||||
const voteBreakDownToggle = 'vote-breakdown-toggle';
|
const voteMajorityNotMet = 'token-majority-not-met';
|
||||||
|
const voteMajorityMet = 'token-majority-met';
|
||||||
|
const votesForPercentage = 'votes-for-percentage';
|
||||||
|
|
||||||
describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
||||||
before('connect wallets and set approval limit', function () {
|
before('connect wallets and set approval limit', function () {
|
||||||
@ -121,10 +122,15 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
submitUniqueRawProposal({ proposalTitle: proposalTitle });
|
submitUniqueRawProposal({ proposalTitle: proposalTitle });
|
||||||
getProposalFromTitle(proposalTitle).within(() => {
|
getProposalFromTitle(proposalTitle).within(() => {
|
||||||
// 3001-VOTE-039
|
// 3001-VOTE-039
|
||||||
cy.getByTestId('participation-not-reached').should(
|
cy.getByTestId(voteMajorityNotMet).should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'Min. participation not reached'
|
'66% majority threshold not met'
|
||||||
);
|
);
|
||||||
|
cy.getByTestId('token-participation-not-met').should(
|
||||||
|
'have.text',
|
||||||
|
'0.000000000000000000000015% participation threshold not met'
|
||||||
|
);
|
||||||
|
cy.getByTestId(votesForPercentage).should('have.text', '0%');
|
||||||
cy.getByTestId(viewProposalButton).click();
|
cy.getByTestId(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
@ -134,16 +140,15 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
'have.text',
|
'have.text',
|
||||||
'Currently expected to pass'
|
'Currently expected to pass'
|
||||||
);
|
);
|
||||||
cy.getByTestId('user-voted-yes').should('exist');
|
cy.getByTestId(voteMajorityMet).should(
|
||||||
cy.getByTestId('participation-reached').should(
|
|
||||||
'have.text',
|
'have.text',
|
||||||
'Min. participation reached'
|
'66% majority threshold met'
|
||||||
|
);
|
||||||
|
cy.getByTestId(votesForPercentage).should('have.text', '100%');
|
||||||
|
cy.getByTestId('token-participation-met').should(
|
||||||
|
'have.text',
|
||||||
|
'0.000000000000000000000015% participation threshold met'
|
||||||
);
|
);
|
||||||
cy.getByTestId(viewProposalButton).click();
|
|
||||||
});
|
});
|
||||||
cy.getByTestId(voteBreakDownToggle).click();
|
|
||||||
getProposalInformationFromTable('Token participation met')
|
|
||||||
.contains('👍')
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -146,7 +146,7 @@ export function getProposalInformationFromTable(heading: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function voteForProposal(vote: string) {
|
export function voteForProposal(vote: string) {
|
||||||
cy.contains('Vote breakdown').should('be.visible', { timeout: 10000 });
|
cy.get(voteButtons).should('be.visible', { timeout: 10000 });
|
||||||
cy.get(voteButtons).contains(vote).click();
|
cy.get(voteButtons).contains(vote).click();
|
||||||
cy.get(dialogTitle, proposalTimeout).should(
|
cy.get(dialogTitle, proposalTimeout).should(
|
||||||
'have.text',
|
'have.text',
|
||||||
|
@ -219,7 +219,9 @@ export function ensureSpecifiedUnstakedTokensAreAssociated(
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.then((unstakedBalance) => {
|
.then((unstakedBalance) => {
|
||||||
if (parseFloat(unstakedBalance) != parseFloat(tokenAmount)) {
|
const tokenFloat = parseFloat(tokenAmount);
|
||||||
|
const unstakedFloat = parseFloat(unstakedBalance.replace(/,/g, ''));
|
||||||
|
if (tokenFloat != unstakedFloat) {
|
||||||
vegaWalletTeardown();
|
vegaWalletTeardown();
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).contains(
|
cy.get(vegaWalletAssociatedBalance, txTimeout).contains(
|
||||||
'0.00',
|
'0.00',
|
||||||
|
@ -308,7 +308,7 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => {
|
|||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span>{t('tokenVotesFor')}:</span>
|
<span>{t('tokenVotesFor')}:</span>
|
||||||
<Tooltip description={formatNumber(yesTokens, defaultDP)}>
|
<Tooltip description={formatNumber(yesTokens, defaultDP)}>
|
||||||
<button>
|
<button data-testid="num-votes-for">
|
||||||
{yesTokens.dividedBy(toBigNum(10 ** 6, 0)).toFixed(1)}M
|
{yesTokens.dividedBy(toBigNum(10 ** 6, 0)).toFixed(1)}M
|
||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -317,7 +317,9 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => {
|
|||||||
<Tooltip
|
<Tooltip
|
||||||
description={<span>{yesPercentage.toFixed(defaultDP)}%</span>}
|
description={<span>{yesPercentage.toFixed(defaultDP)}%</span>}
|
||||||
>
|
>
|
||||||
<button>{yesPercentage.toFixed(0)}%</button>
|
<button data-testid="votes-for-percentage">
|
||||||
|
{yesPercentage.toFixed(0)}%
|
||||||
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
</span>
|
</span>
|
||||||
@ -326,7 +328,7 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => {
|
|||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span>{t('tokenVotesAgainst')}:</span>
|
<span>{t('tokenVotesAgainst')}:</span>
|
||||||
<Tooltip description={formatNumber(noTokens, defaultDP)}>
|
<Tooltip description={formatNumber(noTokens, defaultDP)}>
|
||||||
<button>
|
<button data-testid="num-votes-against">
|
||||||
{noTokens.dividedBy(toBigNum(10 ** 6, 0)).toFixed(1)}M
|
{noTokens.dividedBy(toBigNum(10 ** 6, 0)).toFixed(1)}M
|
||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -335,7 +337,9 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => {
|
|||||||
<Tooltip
|
<Tooltip
|
||||||
description={<span>{noPercentage.toFixed(defaultDP)}%</span>}
|
description={<span>{noPercentage.toFixed(defaultDP)}%</span>}
|
||||||
>
|
>
|
||||||
<button>{noPercentage.toFixed(0)}%</button>
|
<button data-testid="votes-against-percentage">
|
||||||
|
{noPercentage.toFixed(0)}%
|
||||||
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
</span>
|
</span>
|
||||||
@ -364,11 +368,13 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => {
|
|||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span>{t('totalTokensVoted')}:</span>
|
<span>{t('totalTokensVoted')}:</span>
|
||||||
<Tooltip description={formatNumber(totalTokensVoted, defaultDP)}>
|
<Tooltip description={formatNumber(totalTokensVoted, defaultDP)}>
|
||||||
<button>
|
<button data-testid="total-voted">
|
||||||
{totalTokensVoted.dividedBy(toBigNum(10 ** 6, 0)).toFixed(1)}M
|
{totalTokensVoted.dividedBy(toBigNum(10 ** 6, 0)).toFixed(1)}M
|
||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<span>({totalTokensPercentage.toFixed(defaultDP)}%)</span>
|
<span data-testid="total-voted-percentage">
|
||||||
|
({totalTokensPercentage.toFixed(defaultDP)}%)
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -162,6 +162,8 @@ When looking to vote on the proposal, I...
|
|||||||
- **must** trigger a transaction that needs to be confirmed in users wallet (<a name="3001-VOTE-013" href="#3001-VOTE-013">3001-VOTE-013</a>)
|
- **must** trigger a transaction that needs to be confirmed in users wallet (<a name="3001-VOTE-013" href="#3001-VOTE-013">3001-VOTE-013</a>)
|
||||||
- **must** see that I need to confirm the transaction in my wallet to continue (<a name="3001-VOTE-014" href="#3001-VOTE-014">3001-VOTE-014</a>)
|
- **must** see that I need to confirm the transaction in my wallet to continue (<a name="3001-VOTE-014" href="#3001-VOTE-014">3001-VOTE-014</a>)
|
||||||
- **must** see option to change my vote (vote again in same or different direction) (<a name="3001-VOTE-090" href="#3001-VOTE-090">3001-VOTE-090</a>)
|
- **must** see option to change my vote (vote again in same or different direction) (<a name="3001-VOTE-090" href="#3001-VOTE-090">3001-VOTE-090</a>)
|
||||||
|
- **must** see two vote status bars, one showing majority voting yes/no, and the other showing participation progress. The maximum value for the progress bar should be the threshold for that proposal type. (<a name="3001-VOTE-023" href="#3001-VOTE-023">3001-VOTE-023</a>)
|
||||||
|
- **must** see when the participation bar reaches 100% (i.e. the network param threshold is met) the indicator text on top of it reads "[network param]% participation threshold met". Otherwise it says "[network param]% participation threshold not met". (<a name="3001-VOTE-024" href="#3001-VOTE-024">3001-VOTE-024</a>)
|
||||||
|
|
||||||
For open market change proposals, all of the above and:
|
For open market change proposals, all of the above and:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user