test(governance): 3790 proposal tests refactor (#3838)
This commit is contained in:
parent
22a43249ea
commit
2533e5ec44
113
apps/governance-e2e/src/fixtures/proposals/new-market-raw.json
Normal file
113
apps/governance-e2e/src/fixtures/proposals/new-market-raw.json
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"rationale": {
|
||||||
|
"title": "New Market Proposal E2E submission",
|
||||||
|
"description": "E2E new market proposal"
|
||||||
|
},
|
||||||
|
"terms": {
|
||||||
|
"newMarket": {
|
||||||
|
"changes": {
|
||||||
|
"decimalPlaces": "5",
|
||||||
|
"positionDecimalPlaces": "5",
|
||||||
|
"linearSlippageFactor": "0.001",
|
||||||
|
"quadraticSlippageFactor": "0",
|
||||||
|
"lpPriceRange": "10",
|
||||||
|
"instrument": {
|
||||||
|
"name": "Token test market",
|
||||||
|
"code": "TEST.24h",
|
||||||
|
"future": {
|
||||||
|
"settlementAsset": "73174a6fb1d5802ba0ac7bd7ab79e0a3a4837b262de0a4e80815a55442692bd0",
|
||||||
|
"quoteName": "fBTC",
|
||||||
|
"dataSourceSpecForSettlementData": {
|
||||||
|
"external": {
|
||||||
|
"oracle": {
|
||||||
|
"signers": [
|
||||||
|
{
|
||||||
|
"pubKey": {
|
||||||
|
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"name": "prices.ETH.value",
|
||||||
|
"type": "TYPE_INTEGER",
|
||||||
|
"numberDecimalPlaces": "0"
|
||||||
|
},
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"operator": "OPERATOR_GREATER_THAN",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dataSourceSpecForTradingTermination": {
|
||||||
|
"external": {
|
||||||
|
"oracle": {
|
||||||
|
"signers": [
|
||||||
|
{
|
||||||
|
"pubKey": {
|
||||||
|
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"name": "trading.terminated.ETH5",
|
||||||
|
"type": "TYPE_BOOLEAN"
|
||||||
|
},
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"operator": "OPERATOR_EQUALS",
|
||||||
|
"value": "true"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dataSourceSpecBinding": {
|
||||||
|
"settlementDataProperty": "prices.ETH.value",
|
||||||
|
"tradingTerminationProperty": "trading.terminated.ETH5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"metadata": ["sector:energy", "sector:tech", "source:docs.vega.xyz"],
|
||||||
|
"priceMonitoringParameters": {
|
||||||
|
"triggers": [
|
||||||
|
{
|
||||||
|
"horizon": "43200",
|
||||||
|
"probability": "0.9999999",
|
||||||
|
"auctionExtension": "600"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"liquidityMonitoringParameters": {
|
||||||
|
"targetStakeParameters": {
|
||||||
|
"timeWindow": "3600",
|
||||||
|
"scalingFactor": 10
|
||||||
|
},
|
||||||
|
"triggeringRatio": "0.7",
|
||||||
|
"auctionExtension": "1"
|
||||||
|
},
|
||||||
|
"logNormal": {
|
||||||
|
"tau": 0.0001140771161,
|
||||||
|
"riskAversionParameter": 0.01,
|
||||||
|
"params": {
|
||||||
|
"mu": 0,
|
||||||
|
"r": 0.016,
|
||||||
|
"sigma": 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"closingTimestamp": 0,
|
||||||
|
"enactmentTimestamp": 0
|
||||||
|
}
|
||||||
|
}
|
@ -7,17 +7,12 @@ import {
|
|||||||
import {
|
import {
|
||||||
createRawProposal,
|
createRawProposal,
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays,
|
createTenDigitUnixTimeStampForSpecifiedDays,
|
||||||
enterUniqueFreeFormProposalBody,
|
|
||||||
generateFreeFormProposalTitle,
|
generateFreeFormProposalTitle,
|
||||||
getDateFormatForSpecifiedDays,
|
getDateFormatForSpecifiedDays,
|
||||||
getProposalIdFromList,
|
getProposalFromTitle,
|
||||||
getProposalInformationFromTable,
|
getProposalInformationFromTable,
|
||||||
getSubmittedProposalFromProposalList,
|
submitUniqueRawProposal,
|
||||||
goToMakeNewProposal,
|
|
||||||
governanceProposalType,
|
|
||||||
voteForProposal,
|
voteForProposal,
|
||||||
waitForProposalSubmitted,
|
|
||||||
waitForProposalSync,
|
|
||||||
} from '../../../../governance-e2e/src/support/governance.functions';
|
} from '../../../../governance-e2e/src/support/governance.functions';
|
||||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../../../governance-e2e/src/support/staking.functions';
|
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../../../governance-e2e/src/support/staking.functions';
|
||||||
import { ethereumWalletConnect } from '../../../../governance-e2e/src/support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../../../governance-e2e/src/support/wallet-eth.functions';
|
||||||
@ -38,6 +33,8 @@ const proposalDetailsTitle = '[data-testid="proposal-title"]';
|
|||||||
const proposalDetailsDescription = '[data-testid="proposal-description"]';
|
const proposalDetailsDescription = '[data-testid="proposal-description"]';
|
||||||
const openProposals = '[data-testid="open-proposals"]';
|
const openProposals = '[data-testid="open-proposals"]';
|
||||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||||
|
const voteBreakdownToggle = 'vote-breakdown-toggle';
|
||||||
|
const proposalTermsToggle = 'proposal-terms-toggle';
|
||||||
|
|
||||||
describe(
|
describe(
|
||||||
'Governance flow for proposal details',
|
'Governance flow for proposal details',
|
||||||
@ -62,23 +59,25 @@ describe(
|
|||||||
|
|
||||||
// 3001-VOTE-050 3001-VOTE-054 3001-VOTE-055 3002-PROP-019
|
// 3001-VOTE-050 3001-VOTE-054 3001-VOTE-055 3002-PROP-019
|
||||||
it('Newly created raw proposal details - shows proposal title and full description', function () {
|
it('Newly created raw proposal details - shows proposal title and full description', function () {
|
||||||
|
const proposalDescription =
|
||||||
|
'I propose that everyone evaluate the following IPFS document and vote Yes if they agree. bafybeigwwctpv37xdcwacqxvekr6e4kaemqsrv34em6glkbiceo3fcy4si';
|
||||||
|
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getProposalIdFromList(rawProposal.rationale.title);
|
cy.get(openProposals).within(() => {
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(viewProposalButton).should('be.visible').click();
|
||||||
cy.get(`#${proposalId}`).within(() => {
|
|
||||||
cy.get(viewProposalButton).should('be.visible').click();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cy.get(proposalDetailsTitle)
|
cy.get(proposalDetailsTitle).should(
|
||||||
.should('contain', rawProposal.rationale.title)
|
'contain.text',
|
||||||
.and('be.visible');
|
rawProposal.rationale.title
|
||||||
|
);
|
||||||
cy.get(proposalDetailsDescription)
|
cy.get(proposalDetailsDescription)
|
||||||
.should('contain', rawProposal.rationale.description)
|
.find('p')
|
||||||
.and('be.visible');
|
.should('have.text', proposalDescription);
|
||||||
});
|
});
|
||||||
|
cy.getByTestId(proposalTermsToggle).click();
|
||||||
// 3001-VOTE-052
|
// 3001-VOTE-052
|
||||||
cy.get('code.language-json')
|
cy.get('code.language-json')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
@ -89,33 +88,36 @@ describe(
|
|||||||
|
|
||||||
// 3001-VOTE-043
|
// 3001-VOTE-043
|
||||||
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
||||||
const closingVoteHrs = '72';
|
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
const proposalTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
const proposalTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
|
// const currentDate = new Date(createTenDigitUnixTimeStampForSpecifiedDays(0) * 1000)
|
||||||
|
// const proposedDate = new Date(currentDate.getTime() + 60000)
|
||||||
|
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
submitUniqueRawProposal({
|
||||||
enterUniqueFreeFormProposalBody(closingVoteHrs, proposalTitle);
|
proposalTitle: proposalTitle,
|
||||||
waitForProposalSubmitted();
|
closingTimestamp: proposalTimeStamp,
|
||||||
waitForProposalSync();
|
});
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() =>
|
getProposalFromTitle(proposalTitle).within(() =>
|
||||||
cy.get(viewProposalButton).click()
|
cy.get(viewProposalButton).click()
|
||||||
);
|
);
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
formatDateWithLocalTimezone(new Date(proposalTimeStamp * 1000))
|
formatDateWithLocalTimezone(new Date(proposalTimeStamp * 1000))
|
||||||
).then((closingDate) => {
|
).then((closingDate) => {
|
||||||
getProposalInformationFromTable('Closes on')
|
getProposalInformationFromTable('Closes on').should(
|
||||||
.contains(closingDate)
|
'have.text',
|
||||||
.should('be.visible');
|
closingDate
|
||||||
|
);
|
||||||
});
|
});
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
formatDateWithLocalTimezone(
|
formatDateWithLocalTimezone(
|
||||||
new Date(createTenDigitUnixTimeStampForSpecifiedDays(0) * 1000)
|
new Date(createTenDigitUnixTimeStampForSpecifiedDays(0) * 1000)
|
||||||
)
|
)
|
||||||
).then((proposalDate) => {
|
).then((proposalDate) => {
|
||||||
getProposalInformationFromTable('Proposed on')
|
getProposalInformationFromTable('Proposed on').should(
|
||||||
.contains(proposalDate)
|
'have.text',
|
||||||
.should('be.visible');
|
proposalDate
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -125,13 +127,14 @@ describe(
|
|||||||
// 3001-VOTE-067
|
// 3001-VOTE-067
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
rawProposal.rationale.title
|
cy.get(viewProposalButton).click()
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
);
|
||||||
});
|
});
|
||||||
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
|
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
);
|
);
|
||||||
|
cy.getByTestId(voteBreakdownToggle).click();
|
||||||
getProposalInformationFromTable('Expected to pass')
|
getProposalInformationFromTable('Expected to pass')
|
||||||
.contains('👎')
|
.contains('👎')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
@ -151,9 +154,9 @@ describe(
|
|||||||
it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () {
|
it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () {
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
rawProposal.rationale.title
|
cy.get(viewProposalButton).click()
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
);
|
||||||
});
|
});
|
||||||
// 3001-VOTE-080
|
// 3001-VOTE-080
|
||||||
cy.getByTestId('vote-buttons').contains('against').should('be.visible');
|
cy.getByTestId('vote-buttons').contains('against').should('be.visible');
|
||||||
@ -179,6 +182,7 @@ describe(
|
|||||||
cy.get(proposalVoteProgressAgainstTokens)
|
cy.get(proposalVoteProgressAgainstTokens)
|
||||||
.contains('0.00')
|
.contains('0.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
|
cy.getByTestId(voteBreakdownToggle).click();
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
getProposalInformationFromTable('Tokens for proposal')
|
||||||
.should('have.text', (1).toFixed(2))
|
.should('have.text', (1).toFixed(2))
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
@ -220,14 +224,15 @@ describe(
|
|||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
rawProposal.rationale.title
|
cy.get(viewProposalButton).click()
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
);
|
||||||
});
|
});
|
||||||
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.get(proposalVoteProgressForTokens).contains('1').and('be.visible');
|
cy.get(proposalVoteProgressForTokens).contains('1').and('be.visible');
|
||||||
|
cy.getByTestId(voteBreakdownToggle).click();
|
||||||
getProposalInformationFromTable('Total Supply')
|
getProposalInformationFromTable('Total Supply')
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.then((totalSupply) => {
|
.then((totalSupply) => {
|
||||||
@ -235,14 +240,15 @@ describe(
|
|||||||
(Number(totalSupply.replace(/,/g, '')) * 0.001) /
|
(Number(totalSupply.replace(/,/g, '')) * 0.001) /
|
||||||
100
|
100
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
|
ethereumWalletConnect();
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated(
|
ensureSpecifiedUnstakedTokensAreAssociated(
|
||||||
tokensRequiredToAchieveResult
|
tokensRequiredToAchieveResult
|
||||||
);
|
);
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
rawProposal.rationale.title
|
cy.get(viewProposalButton).click()
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
);
|
||||||
});
|
});
|
||||||
cy.get(proposalVoteProgressForPercentage)
|
cy.get(proposalVoteProgressForPercentage)
|
||||||
.contains('100.00%')
|
.contains('100.00%')
|
||||||
@ -259,6 +265,7 @@ describe(
|
|||||||
cy.get(proposalVoteProgressAgainstTokens)
|
cy.get(proposalVoteProgressAgainstTokens)
|
||||||
.contains('0.00')
|
.contains('0.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
|
cy.getByTestId(voteBreakdownToggle).click();
|
||||||
getProposalInformationFromTable('Total tokens voted percentage')
|
getProposalInformationFromTable('Total tokens voted percentage')
|
||||||
.should('have.text', '0.00%')
|
.should('have.text', '0.00%')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
|
@ -58,14 +58,12 @@ context(
|
|||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
.last()
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(proposalStatus).should('have.text', 'Enacted ');
|
cy.get(proposalStatus).should('have.text', 'Enacted');
|
||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cy.getByTestId('proposal-type').should('have.text', 'New market');
|
cy.getByTestId('proposal-type').should('have.text', 'New market');
|
||||||
getProposalInformationFromTable('State')
|
cy.get(proposalStatus).should('have.text', 'Enacted');
|
||||||
.contains('Enacted')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.get(votesTable).within(() => {
|
cy.get(votesTable).within(() => {
|
||||||
cy.contains('Vote passed.').should('be.visible');
|
cy.contains('Vote passed.').should('be.visible');
|
||||||
cy.contains('Voting has ended.').should('be.visible');
|
cy.contains('Voting has ended.').should('be.visible');
|
||||||
@ -87,16 +85,10 @@ context(
|
|||||||
.last()
|
.last()
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get(proposalStatus).should('have.text', 'Open');
|
||||||
.contains('Open')
|
|
||||||
.and('be.visible');
|
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
getProposalInformationFromTable('State') // 3001-VOTE-047
|
cy.get(proposalStatus, proposalTimeout).should('have.text', 'Passed');
|
||||||
.contains('Passed', proposalTimeout)
|
cy.get(proposalStatus, proposalTimeout).should('have.text', 'Enacted');
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('State')
|
|
||||||
.contains('Enacted', proposalTimeout)
|
|
||||||
.and('be.visible');
|
|
||||||
cy.get(votesTable).within(() => {
|
cy.get(votesTable).within(() => {
|
||||||
cy.contains('Vote passed.').should('be.visible');
|
cy.contains('Vote passed.').should('be.visible');
|
||||||
cy.contains('Voting has ended.').should('be.visible');
|
cy.contains('Voting has ended.').should('be.visible');
|
||||||
@ -121,13 +113,9 @@ context(
|
|||||||
.last()
|
.last()
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get(proposalStatus).should('have.text', 'Open');
|
||||||
.contains('Open')
|
|
||||||
.and('be.visible');
|
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
getProposalInformationFromTable('State')
|
cy.get(proposalStatus, proposalTimeout).should('have.text', 'Enacted');
|
||||||
.contains('Enacted', proposalTimeout)
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-048 3001-VOTE-049 3001-VOTE-050
|
// 3001-VOTE-048 3001-VOTE-049 3001-VOTE-050
|
||||||
@ -144,12 +132,8 @@ context(
|
|||||||
.last()
|
.last()
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get(proposalStatus).should('have.text', 'Open');
|
||||||
.contains('Open')
|
cy.get(proposalStatus, proposalTimeout).should('have.text', 'Declined');
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('State') // 3001-VOTE-047
|
|
||||||
.contains('Declined', proposalTimeout)
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Rejection reason')
|
getProposalInformationFromTable('Rejection reason')
|
||||||
.contains('PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED')
|
.contains('PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
|
@ -5,10 +5,11 @@ import {
|
|||||||
enterRawProposalBody,
|
enterRawProposalBody,
|
||||||
enterUniqueFreeFormProposalBody,
|
enterUniqueFreeFormProposalBody,
|
||||||
generateFreeFormProposalTitle,
|
generateFreeFormProposalTitle,
|
||||||
|
getProposalFromTitle,
|
||||||
getProposalInformationFromTable,
|
getProposalInformationFromTable,
|
||||||
getSubmittedProposalFromProposalList,
|
|
||||||
goToMakeNewProposal,
|
goToMakeNewProposal,
|
||||||
governanceProposalType,
|
governanceProposalType,
|
||||||
|
submitUniqueRawProposal,
|
||||||
voteForProposal,
|
voteForProposal,
|
||||||
waitForProposalSubmitted,
|
waitForProposalSubmitted,
|
||||||
waitForProposalSync,
|
waitForProposalSync,
|
||||||
@ -81,7 +82,6 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||||
cy.associateTokensToVegaWallet('1');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
@ -95,7 +95,8 @@ context(
|
|||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to see that no proposals exist', function () {
|
// Test can only pass if run before other proposal tests.
|
||||||
|
it.skip('Should be able to see that no proposals exist', function () {
|
||||||
// 3001-VOTE-003
|
// 3001-VOTE-003
|
||||||
cy.get(noOpenProposals)
|
cy.get(noOpenProposals)
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
@ -107,7 +108,7 @@ context(
|
|||||||
|
|
||||||
// 3002-PROP-002
|
// 3002-PROP-002
|
||||||
// 3002-PROP-003
|
// 3002-PROP-003
|
||||||
it('Submit a proposal form - shows how many vega tokens are required to make a proposal', function () {
|
it('Proposal form - shows how many vega tokens are required to make a proposal', function () {
|
||||||
// 3002-PROP-005
|
// 3002-PROP-005
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
||||||
cy.contains(
|
cy.contains(
|
||||||
@ -115,8 +116,9 @@ context(
|
|||||||
).should('be.visible');
|
).should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Skipping as currently unable to propose using forms other than raw
|
||||||
// 3002-PROP-011
|
// 3002-PROP-011
|
||||||
it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () {
|
it.skip('Able to submit a valid freeform proposal - with minimum required tokens associated', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
||||||
cy.get(minVoteButton).should('be.visible'); // 3002-PROP-008
|
cy.get(minVoteButton).should('be.visible'); // 3002-PROP-008
|
||||||
cy.get(maxVoteButton).should('be.visible');
|
cy.get(maxVoteButton).should('be.visible');
|
||||||
@ -140,16 +142,13 @@ context(
|
|||||||
closeStakingDialog();
|
closeStakingDialog();
|
||||||
|
|
||||||
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
|
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
|
||||||
|
createRawProposal();
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
|
||||||
enterUniqueFreeFormProposalBody('50', generateFreeFormProposalTitle());
|
|
||||||
waitForProposalSubmitted();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Creating a proposal - proposal rejected - when closing time sooner than system default', function () {
|
it.skip('Creating a proposal - proposal rejected - when closing time sooner than system default', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody('0.1', generateFreeFormProposalTitle());
|
enterUniqueFreeFormProposalBody('0.1', generateFreeFormProposalTitle());
|
||||||
|
|
||||||
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
||||||
'not.exist'
|
'not.exist'
|
||||||
);
|
);
|
||||||
@ -158,7 +157,7 @@ context(
|
|||||||
.should('equal', 'Value must be greater than or equal to 1.');
|
.should('equal', 'Value must be greater than or equal to 1.');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Creating a proposal - proposal rejected - when closing time later than system default', function () {
|
it.skip('Creating a proposal - proposal rejected - when closing time later than system default', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody(
|
enterUniqueFreeFormProposalBody(
|
||||||
'100000',
|
'100000',
|
||||||
@ -185,17 +184,13 @@ context(
|
|||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.get(rejectProposalsLink).click();
|
cy.get(rejectProposalsLink).click();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
||||||
rawProposal.rationale.title
|
|
||||||
).within(() => {
|
|
||||||
cy.contains('Rejected').should('be.visible');
|
cy.contains('Rejected').should('be.visible');
|
||||||
cy.contains('Close time too late').should('be.visible');
|
cy.contains('Close time too late').should('be.visible');
|
||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.getByTestId('proposal-status').should('have.text', 'Rejected');
|
||||||
.contains('Rejected')
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Rejection reason')
|
getProposalInformationFromTable('Rejection reason')
|
||||||
.contains('PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE')
|
.contains('PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
@ -290,18 +285,19 @@ context(
|
|||||||
const proposalTitle = generateFreeFormProposalTitle();
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
submitUniqueRawProposal({ proposalTitle: proposalTitle });
|
||||||
enterUniqueFreeFormProposalBody('50', proposalTitle);
|
ethereumWalletConnect();
|
||||||
waitForProposalSubmitted();
|
|
||||||
stakingPageDisassociateTokens('0.0001');
|
stakingPageDisassociateTokens('0.0001');
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.get(vegaWallet)
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
.first()
|
||||||
'contain',
|
.within(() => {
|
||||||
'0.9999'
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
);
|
'contain',
|
||||||
});
|
'0.9999'
|
||||||
|
);
|
||||||
|
});
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() =>
|
getProposalFromTitle(proposalTitle).within(() =>
|
||||||
cy.get(viewProposalButton).click()
|
cy.get(viewProposalButton).click()
|
||||||
);
|
);
|
||||||
cy.contains('Vote breakdown').should('be.visible', {
|
cy.contains('Vote breakdown').should('be.visible', {
|
||||||
@ -319,9 +315,9 @@ context(
|
|||||||
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
||||||
cy.get('[data-testid="disconnect"]').click();
|
cy.get('[data-testid="disconnect"]').click();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
getProposalFromTitle(rawProposal.rationale.title).within(() =>
|
||||||
rawProposal.rationale.title
|
cy.get(viewProposalButton).click()
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
);
|
||||||
});
|
});
|
||||||
// 3001-VOTE-075
|
// 3001-VOTE-075
|
||||||
// 3001-VOTE-076
|
// 3001-VOTE-076
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
getProposalInformationFromTable,
|
getProposalInformationFromTable,
|
||||||
goToMakeNewProposal,
|
goToMakeNewProposal,
|
||||||
|
governanceProposalType,
|
||||||
voteForProposal,
|
voteForProposal,
|
||||||
waitForProposalSubmitted,
|
waitForProposalSubmitted,
|
||||||
} from '../../support/governance.functions';
|
} from '../../support/governance.functions';
|
||||||
@ -56,18 +57,8 @@ const fUSDCId =
|
|||||||
const epochTimeout = Cypress.env('epochTimeout');
|
const epochTimeout = Cypress.env('epochTimeout');
|
||||||
const proposalTimeout = { timeout: 14000 };
|
const proposalTimeout = { timeout: 14000 };
|
||||||
|
|
||||||
const governanceProposalType = {
|
|
||||||
NETWORK_PARAMETER: 'Network parameter',
|
|
||||||
NEW_MARKET: 'New market',
|
|
||||||
UPDATE_MARKET: 'Update market',
|
|
||||||
NEW_ASSET: 'New asset',
|
|
||||||
UPDATE_ASSET: 'Update asset',
|
|
||||||
FREEFORM: 'Freeform',
|
|
||||||
RAW: 'raw proposal',
|
|
||||||
};
|
|
||||||
|
|
||||||
// 3001-VOTE-007
|
// 3001-VOTE-007
|
||||||
context(
|
context.skip(
|
||||||
'Governance flow - form validations for different governance proposals',
|
'Governance flow - form validations for different governance proposals',
|
||||||
{ tags: '@slow' },
|
{ tags: '@slow' },
|
||||||
function () {
|
function () {
|
||||||
|
@ -6,16 +6,15 @@ import {
|
|||||||
waitForSpinner,
|
waitForSpinner,
|
||||||
} from '../../support/common.functions';
|
} from '../../support/common.functions';
|
||||||
import {
|
import {
|
||||||
createFreeformProposal,
|
|
||||||
createRawProposal,
|
createRawProposal,
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays,
|
createTenDigitUnixTimeStampForSpecifiedDays,
|
||||||
enterRawProposalBody,
|
enterRawProposalBody,
|
||||||
generateFreeFormProposalTitle,
|
generateFreeFormProposalTitle,
|
||||||
getProposalIdFromList,
|
getProposalFromTitle,
|
||||||
getProposalInformationFromTable,
|
getProposalInformationFromTable,
|
||||||
getSubmittedProposalFromProposalList,
|
|
||||||
goToMakeNewProposal,
|
goToMakeNewProposal,
|
||||||
governanceProposalType,
|
governanceProposalType,
|
||||||
|
submitUniqueRawProposal,
|
||||||
voteForProposal,
|
voteForProposal,
|
||||||
waitForProposalSubmitted,
|
waitForProposalSubmitted,
|
||||||
waitForProposalSync,
|
waitForProposalSync,
|
||||||
@ -24,10 +23,14 @@ import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/stakin
|
|||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
||||||
|
|
||||||
|
const proposalListItem = 'proposals-list-item';
|
||||||
const openProposals = '[data-testid="open-proposals"]';
|
const openProposals = '[data-testid="open-proposals"]';
|
||||||
const voteStatus = '[data-testid="vote-status"]';
|
const voteStatus = 'vote-status';
|
||||||
|
const proposalType = 'proposal-type';
|
||||||
|
const proposalStatus = 'proposal-status';
|
||||||
const proposalClosingDate = '[data-testid="vote-details"]';
|
const proposalClosingDate = '[data-testid="vote-details"]';
|
||||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||||
|
const voteBreakDownToggle = 'vote-breakdown-toggle';
|
||||||
|
|
||||||
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 () {
|
||||||
@ -60,12 +63,12 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
|
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.get(proposalClosingDate).first().should('contain.text', 'year');
|
|
||||||
cy.get(proposalClosingDate).should('contain.text', 'months');
|
|
||||||
cy.get(proposalClosingDate)
|
cy.get(proposalClosingDate)
|
||||||
.last()
|
.first()
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.should('match', /days|minutes/);
|
.should('match', /days|minutes/);
|
||||||
|
cy.get(proposalClosingDate).should('contain.text', 'months');
|
||||||
|
cy.get(proposalClosingDate).last().should('contain.text', 'year');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -73,36 +76,27 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
const proposerId = Cypress.env('vegaWalletPublicKey');
|
const proposerId = Cypress.env('vegaWalletPublicKey');
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
|
|
||||||
createFreeformProposal(proposalTitle);
|
submitUniqueRawProposal({ proposalTitle: proposalTitle });
|
||||||
getProposalIdFromList(proposalTitle);
|
cy.get('[data-testid="set-proposals-filter-visible"]').click();
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
cy.get('[data-testid="filter-input"]').type(proposerId);
|
||||||
cy.get('[data-testid="set-proposals-filter-visible"]').click();
|
// cy.get(`#${proposalId}`).should('contain', proposalId);
|
||||||
cy.get('[data-testid="filter-input"]').type(proposerId);
|
cy.contains(proposalTitle).should('be.visible');
|
||||||
cy.get(`#${proposalId}`).should('contain', proposalId);
|
cy.get('[data-testid="filter-input"]').type('123');
|
||||||
});
|
cy.getByTestId(proposalListItem).should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Newly created proposals list - shows title and portion of summary', function () {
|
it('Newly created proposals list - shows title and portion of summary', function () {
|
||||||
createRawProposal(this.minProposerBalance); // 3001-VOTE-052
|
const proposalPath = '/proposals/new-market-raw.json';
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
const enactmentTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
getProposalIdFromList(rawProposal.rationale.title);
|
submitUniqueRawProposal({
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
proposalBody: proposalPath,
|
||||||
cy.get(openProposals).within(() => {
|
enactmentTimestamp: enactmentTimestamp,
|
||||||
// 3001-VOTE-008
|
}); // 3001-VOTE-052
|
||||||
// 3001-VOTE-034
|
// 3001-VOTE-008
|
||||||
cy.get(`#${proposalId}`)
|
// 3001-VOTE-034
|
||||||
// 3001-VOTE-097
|
// 3001-VOTE-097
|
||||||
.should('contain', rawProposal.rationale.title)
|
cy.contains('New Market Proposal E2E submission');
|
||||||
.and('be.visible');
|
cy.contains('Code: TEST.24h. fBTC settled future.').should('be.visible');
|
||||||
cy.get(`#${proposalId}`)
|
|
||||||
.should(
|
|
||||||
'contain',
|
|
||||||
rawProposal.rationale.description.substring(0, 59)
|
|
||||||
)
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Newly created proposals list - shows open proposals in an open state', function () {
|
it('Newly created proposals list - shows open proposals in an open state', function () {
|
||||||
@ -110,23 +104,11 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
// 3001-VOTE-035
|
// 3001-VOTE-035
|
||||||
createRawProposal(this.minProposerBalance);
|
createRawProposal(this.minProposerBalance);
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(rawProposal.rationale.title).within(
|
getProposalFromTitle(rawProposal.rationale.title).within(() => {
|
||||||
() => {
|
cy.get(viewProposalButton).should('be.visible');
|
||||||
cy.get(viewProposalButton).should('be.visible').click();
|
cy.getByTestId(proposalType).should('have.text', 'Freeform');
|
||||||
}
|
cy.getByTestId(proposalStatus).should('have.text', 'Open');
|
||||||
);
|
|
||||||
|
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
|
||||||
getProposalInformationFromTable('ID')
|
|
||||||
.contains(String(proposalId))
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
|
||||||
.contains('Open')
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Type')
|
|
||||||
.contains('Freeform')
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -134,18 +116,22 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
it('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
|
it('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
|
|
||||||
createFreeformProposal(proposalTitle);
|
submitUniqueRawProposal({ proposalTitle: proposalTitle });
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() => {
|
getProposalFromTitle(proposalTitle).within(() => {
|
||||||
// 3001-VOTE-039
|
// 3001-VOTE-039
|
||||||
cy.get(voteStatus).should('have.text', 'Participation not reached');
|
cy.getByTestId(voteStatus).should(
|
||||||
|
'have.text',
|
||||||
|
'Participation not reached'
|
||||||
|
);
|
||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() => {
|
getProposalFromTitle(proposalTitle).within(() => {
|
||||||
cy.get(voteStatus).should('have.text', 'Set to pass');
|
cy.getByTestId(voteStatus).should('have.text', 'Set to pass');
|
||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
|
cy.getByTestId(voteBreakDownToggle).click();
|
||||||
getProposalInformationFromTable('Token participation met')
|
getProposalInformationFromTable('Token participation met')
|
||||||
.contains('👍')
|
.contains('👍')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
|
@ -96,7 +96,7 @@ context(
|
|||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
|
|
||||||
// 2002-SINC-007
|
// 2002-SINC-007
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,002.00', '50.02%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to view validators staked by me', function () {
|
it('Able to view validators staked by me', function () {
|
||||||
@ -146,7 +146,7 @@ context(
|
|||||||
verifyThisEpochValue(2.0);
|
verifyThisEpochValue(2.0);
|
||||||
closeStakingDialog();
|
closeStakingDialog();
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,002.00', '50.02%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to stake against a validator - using vega from both wallet and vesting contract', function () {
|
it('Able to stake against a validator - using vega from both wallet and vesting contract', function () {
|
||||||
@ -166,10 +166,11 @@ context(
|
|||||||
verifyThisEpochValue(6.0);
|
verifyThisEpochValue(6.0);
|
||||||
closeStakingDialog();
|
closeStakingDialog();
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
validateValidatorListTotalStakeAndShare('0', '6.00', '100.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,006.00', '50.05%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to stake against multiple validators', function () {
|
it('Able to stake against multiple validators', function () {
|
||||||
|
vegaWalletTeardown();
|
||||||
stakingPageAssociateTokens('5');
|
stakingPageAssociateTokens('5');
|
||||||
verifyUnstakedBalance(5.0);
|
verifyUnstakedBalance(5.0);
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
@ -197,14 +198,10 @@ context(
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
cy.getByTestId(stakeValidatorListTotalStake)
|
||||||
.should('have.text', '2.00')
|
.should('have.text', '3,002.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.getByTestId(stakeValidatorListTotalShare)
|
cy.getByTestId(stakeValidatorListTotalShare)
|
||||||
.should('have.text', '66.67%')
|
.should('have.text', '50.01%')
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('have.text', '2.00')
|
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
cy.get(`[row-id="${1}"]`)
|
cy.get(`[row-id="${1}"]`)
|
||||||
@ -212,14 +209,10 @@ context(
|
|||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
cy.getByTestId(stakeValidatorListTotalStake)
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('have.text', '1.00')
|
.should('have.text', '3,001.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.getByTestId(stakeValidatorListTotalShare)
|
cy.getByTestId(stakeValidatorListTotalShare)
|
||||||
.should('have.text', '33.33%')
|
.should('have.text', '49.99%')
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('have.text', '1.00')
|
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -282,7 +275,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
validateValidatorListTotalStakeAndShare('0', '0.00', '0.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,000.00', '50.00%');
|
||||||
|
|
||||||
cy.getByTestId(userStakeBtn).should('not.exist');
|
cy.getByTestId(userStakeBtn).should('not.exist');
|
||||||
cy.getByTestId(userStake).should('not.exist');
|
cy.getByTestId(userStake).should('not.exist');
|
||||||
@ -354,7 +347,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
validateValidatorListTotalStakeAndShare('0', '0.00', '0.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,000.00', '50.00%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Disassociating all vesting contract tokens max - removes all staked tokens', function () {
|
it('Disassociating all vesting contract tokens max - removes all staked tokens', function () {
|
||||||
@ -382,7 +375,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
validateValidatorListTotalStakeAndShare('0', '0.00', '0.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,000.00', '50.00%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
||||||
@ -404,7 +397,7 @@ context(
|
|||||||
});
|
});
|
||||||
verifyStakedBalance(2.0);
|
verifyStakedBalance(2.0);
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
validateValidatorListTotalStakeAndShare('0', '3,002.00', '50.02%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
||||||
|
@ -111,10 +111,10 @@ context(
|
|||||||
// 1004-ASSO-028
|
// 1004-ASSO-028
|
||||||
// 1004-ASSO-029
|
// 1004-ASSO-029
|
||||||
// 1004-ASSO-031
|
// 1004-ASSO-031
|
||||||
|
vegaWalletTeardown();
|
||||||
stakingPageAssociateTokens('2');
|
stakingPageAssociateTokens('2');
|
||||||
verifyEthWalletAssociatedBalance('2.0');
|
verifyEthWalletAssociatedBalance('2.0');
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
verifyEthWalletTotalAssociatedBalance('6,002.00');
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
stakingPageDisassociateTokens('2');
|
stakingPageDisassociateTokens('2');
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
@ -125,17 +125,18 @@ context(
|
|||||||
validateWalletCurrency('Pending association', '2.00');
|
validateWalletCurrency('Pending association', '2.00');
|
||||||
validateWalletCurrency('Total associated after pending', '0.00');
|
validateWalletCurrency('Total associated after pending', '0.00');
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||||
cy.getByTestId('eth-wallet-associated-balances', txTimeout).should(
|
cy.get(
|
||||||
'not.exist'
|
'[data-testid="eth-wallet-associated-balances"]:visible',
|
||||||
);
|
txTimeout
|
||||||
verifyEthWalletTotalAssociatedBalance('0.00');
|
).should('have.length', 2);
|
||||||
|
verifyEthWalletTotalAssociatedBalance('6,000.00');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
||||||
//1004-ASSO-011
|
//1004-ASSO-011
|
||||||
stakingPageAssociateTokens('1001', { approve: true });
|
stakingPageAssociateTokens('1001', { approve: true });
|
||||||
verifyEthWalletAssociatedBalance('1,001.00');
|
verifyEthWalletAssociatedBalance('1,001.00');
|
||||||
verifyEthWalletTotalAssociatedBalance('1,001.00');
|
verifyEthWalletTotalAssociatedBalance('7,001.00');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet)
|
||||||
.last()
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
@ -47,11 +47,8 @@ context(
|
|||||||
function () {
|
function () {
|
||||||
before('visit withdrawals and connect vega wallet', function () {
|
before('visit withdrawals and connect vega wallet', function () {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
// When running tests locally, will fail if run without restarting capsule
|
ethereumWalletConnect();
|
||||||
cy.updateCapsuleMultiSig().then(() => {
|
depositAsset(usdcEthAddress, '1000', 5);
|
||||||
ethereumWalletConnect();
|
|
||||||
depositAsset(usdcEthAddress, '1000', 5);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('Navigate to withdrawal page', function () {
|
beforeEach('Navigate to withdrawal page', function () {
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
enterUniqueFreeFormProposalBody,
|
enterUniqueFreeFormProposalBody,
|
||||||
goToMakeNewProposal,
|
goToMakeNewProposal,
|
||||||
|
governanceProposalType,
|
||||||
} from '../../support/governance.functions';
|
} from '../../support/governance.functions';
|
||||||
import { vegaWalletFaucetAssetsWithoutCheck } from '../../support/wallet-vega.functions';
|
import { vegaWalletFaucetAssetsWithoutCheck } from '../../support/wallet-vega.functions';
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ context('View functionality with public key', { tags: '@smoke' }, function () {
|
|||||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
goToMakeNewProposal('Freeform');
|
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody('50', 'pub key proposal test');
|
enterUniqueFreeFormProposalBody('50', 'pub key proposal test');
|
||||||
cy.getByTestId('dialog-content')
|
cy.getByTestId('dialog-content')
|
||||||
.first()
|
.first()
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { closeDialog, navigateTo, navigation } from './common.functions';
|
import {
|
||||||
|
closeDialog,
|
||||||
|
navigateTo,
|
||||||
|
navigation,
|
||||||
|
waitForSpinner,
|
||||||
|
} from './common.functions';
|
||||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from './staking.functions';
|
import { ensureSpecifiedUnstakedTokensAreAssociated } from './staking.functions';
|
||||||
|
|
||||||
const newProposalButton = '[data-testid="new-proposal-link"]';
|
|
||||||
const proposalInformationTableRows = '[data-testid="key-value-table-row"]';
|
const proposalInformationTableRows = '[data-testid="key-value-table-row"]';
|
||||||
const proposalListItem = '[data-testid="proposals-list-item"]';
|
const proposalListItem = '[data-testid="proposals-list-item"]';
|
||||||
const newProposalTitle = '[data-testid="proposal-title"]';
|
const newProposalTitle = '[data-testid="proposal-title"]';
|
||||||
@ -46,6 +50,53 @@ export function enterRawProposalBody(timestamp: number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function submitUniqueRawProposal(proposalFields: {
|
||||||
|
proposalBody?: string;
|
||||||
|
proposalTitle?: string;
|
||||||
|
proposalDescription?: string;
|
||||||
|
closingTimestamp?: number;
|
||||||
|
enactmentTimestamp?: number;
|
||||||
|
submit?: boolean;
|
||||||
|
}) {
|
||||||
|
goToMakeNewProposal(governanceProposalType.RAW);
|
||||||
|
let proposalBodyPath = '/proposals/raw.json';
|
||||||
|
if (proposalFields.proposalBody) {
|
||||||
|
proposalBodyPath = proposalFields.proposalBody;
|
||||||
|
}
|
||||||
|
cy.fixture(proposalBodyPath).then((rawProposal) => {
|
||||||
|
if (proposalFields.proposalTitle) {
|
||||||
|
rawProposal.rationale.title = proposalFields.proposalTitle;
|
||||||
|
cy.wrap(proposalFields.proposalTitle).as('proposalTitle');
|
||||||
|
}
|
||||||
|
if (proposalFields.proposalDescription) {
|
||||||
|
rawProposal.rationale.description = proposalFields.proposalDescription;
|
||||||
|
}
|
||||||
|
if (proposalFields.closingTimestamp) {
|
||||||
|
rawProposal.terms.closingTimestamp = proposalFields.closingTimestamp;
|
||||||
|
} else {
|
||||||
|
const minTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(2);
|
||||||
|
rawProposal.terms.closingTimestamp = minTimeStamp;
|
||||||
|
}
|
||||||
|
if (proposalFields.enactmentTimestamp) {
|
||||||
|
rawProposal.terms.enactmentTimestamp = proposalFields.enactmentTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
const proposalPayload = JSON.stringify(rawProposal);
|
||||||
|
cy.get(rawProposalData).type(proposalPayload, {
|
||||||
|
parseSpecialCharSequences: false,
|
||||||
|
delay: 2,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (proposalFields.submit !== false) {
|
||||||
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
|
cy.wrap(rawProposal).as('rawProposal');
|
||||||
|
waitForProposalSubmitted();
|
||||||
|
waitForProposalSync();
|
||||||
|
navigateTo(navigation.proposals);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function enterUniqueFreeFormProposalBody(
|
export function enterUniqueFreeFormProposalBody(
|
||||||
timestamp: string,
|
timestamp: string,
|
||||||
proposalTitle: string
|
proposalTitle: string
|
||||||
@ -58,6 +109,10 @@ export function enterUniqueFreeFormProposalBody(
|
|||||||
cy.getByTestId('proposal-submit').should('be.visible').click();
|
cy.getByTestId('proposal-submit').should('be.visible').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getProposalFromTitle(proposalTitle: string) {
|
||||||
|
return cy.contains(proposalTitle).parentsUntil(proposalListItem).last();
|
||||||
|
}
|
||||||
|
|
||||||
export function getSubmittedProposalFromProposalList(proposalTitle: string) {
|
export function getSubmittedProposalFromProposalList(proposalTitle: string) {
|
||||||
getProposalIdFromList(proposalTitle);
|
getProposalIdFromList(proposalTitle);
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
cy.get('@proposalIdText').then((proposalId) => {
|
||||||
@ -120,13 +175,17 @@ export function waitForProposalSync() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function goToMakeNewProposal(proposalType: string) {
|
export function goToMakeNewProposal(proposalType: governanceProposalType) {
|
||||||
navigateTo(navigation.proposals);
|
cy.visit('/proposals/propose');
|
||||||
cy.get(newProposalButton).should('be.visible').click();
|
waitForSpinner();
|
||||||
cy.url().should('include', '/proposals/propose');
|
cy.url().should('include', '/proposals/propose');
|
||||||
cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
|
cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
|
||||||
cy.get('li').should('contain.text', proposalType).and('be.visible');
|
if (proposalType == governanceProposalType.RAW) {
|
||||||
cy.get('li').contains(proposalType).click();
|
cy.get('[href="/proposals/propose/raw"]').click();
|
||||||
|
} else {
|
||||||
|
cy.get('li').should('contain.text', proposalType).and('be.visible');
|
||||||
|
cy.get('li').contains(proposalType).click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function waitForProposalSubmitted() {
|
export function waitForProposalSubmitted() {
|
||||||
@ -163,11 +222,12 @@ export function createFreeformProposal(proposalTitle: string) {
|
|||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const governanceProposalType = {
|
export enum governanceProposalType {
|
||||||
NETWORK_PARAMETER: 'Network parameter',
|
NETWORK_PARAMETER = 'Network parameter',
|
||||||
NEW_MARKET: 'New market',
|
NEW_MARKET = 'New market',
|
||||||
UPDATE_MARKET: 'Update market',
|
UPDATE_MARKET = 'Update market',
|
||||||
NEW_ASSET: 'New asset',
|
NEW_ASSET = 'New asset',
|
||||||
FREEFORM: 'Freeform',
|
UPDATE_ASSET = 'Update asset',
|
||||||
RAW: 'raw proposal',
|
FREEFORM = 'Freeform',
|
||||||
};
|
RAW = 'raw proposal',
|
||||||
|
}
|
||||||
|
@ -85,6 +85,132 @@ export function createFreeFormProposalTxBody(): ProposalSubmissionBody {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createNewMarketProposalTxBody(): ProposalSubmissionBody {
|
||||||
|
const MIN_CLOSE_SEC = 5;
|
||||||
|
const MIN_ENACT_SEC = 7;
|
||||||
|
|
||||||
|
const closingDate = addSeconds(new Date(), MIN_CLOSE_SEC);
|
||||||
|
const enactmentDate = addSeconds(closingDate, MIN_ENACT_SEC);
|
||||||
|
const closingTimestamp = millisecondsToSeconds(closingDate.getTime());
|
||||||
|
const enactmentTimestamp = millisecondsToSeconds(enactmentDate.getTime());
|
||||||
|
return {
|
||||||
|
proposalSubmission: {
|
||||||
|
rationale: {
|
||||||
|
title: 'New Market Proposal E2E submission',
|
||||||
|
description: 'E2E new market proposal',
|
||||||
|
},
|
||||||
|
terms: {
|
||||||
|
newMarket: {
|
||||||
|
changes: {
|
||||||
|
decimalPlaces: '5',
|
||||||
|
positionDecimalPlaces: '5',
|
||||||
|
linearSlippageFactor: '0.001',
|
||||||
|
quadraticSlippageFactor: '0',
|
||||||
|
lpPriceRange: '10',
|
||||||
|
instrument: {
|
||||||
|
name: 'Token test market',
|
||||||
|
code: 'TEST.24h',
|
||||||
|
future: {
|
||||||
|
settlementAsset:
|
||||||
|
'73174a6fb1d5802ba0ac7bd7ab79e0a3a4837b262de0a4e80815a55442692bd0',
|
||||||
|
quoteName: 'fBTC',
|
||||||
|
dataSourceSpecForSettlementData: {
|
||||||
|
external: {
|
||||||
|
oracle: {
|
||||||
|
signers: [
|
||||||
|
{
|
||||||
|
pubKey: {
|
||||||
|
key: '70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
key: {
|
||||||
|
name: 'prices.ETH.value',
|
||||||
|
type: 'TYPE_INTEGER' as const,
|
||||||
|
numberDecimalPlaces: '0',
|
||||||
|
},
|
||||||
|
conditions: [
|
||||||
|
{
|
||||||
|
operator: 'OPERATOR_GREATER_THAN' as const,
|
||||||
|
value: '0',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dataSourceSpecForTradingTermination: {
|
||||||
|
external: {
|
||||||
|
oracle: {
|
||||||
|
signers: [
|
||||||
|
{
|
||||||
|
pubKey: {
|
||||||
|
key: '70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
key: {
|
||||||
|
name: 'trading.terminated.ETH5',
|
||||||
|
type: 'TYPE_BOOLEAN' as const,
|
||||||
|
},
|
||||||
|
conditions: [
|
||||||
|
{
|
||||||
|
operator: 'OPERATOR_EQUALS' as const,
|
||||||
|
value: 'true',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dataSourceSpecBinding: {
|
||||||
|
settlementDataProperty: 'prices.ETH.value',
|
||||||
|
tradingTerminationProperty: 'trading.terminated.ETH5',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
metadata: ['sector:energy', 'sector:tech', 'source:docs.vega.xyz'],
|
||||||
|
priceMonitoringParameters: {
|
||||||
|
triggers: [
|
||||||
|
{
|
||||||
|
horizon: '43200',
|
||||||
|
probability: '0.9999999',
|
||||||
|
auctionExtension: '600',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
targetStakeParameters: {
|
||||||
|
timeWindow: '3600',
|
||||||
|
scalingFactor: 10,
|
||||||
|
},
|
||||||
|
triggeringRatio: '0.7',
|
||||||
|
auctionExtension: '1',
|
||||||
|
},
|
||||||
|
logNormal: {
|
||||||
|
tau: 0.0001140771161,
|
||||||
|
riskAversionParameter: 0.01,
|
||||||
|
params: {
|
||||||
|
mu: 0,
|
||||||
|
r: 0.016,
|
||||||
|
sigma: 0.5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
closingTimestamp,
|
||||||
|
enactmentTimestamp,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function mockNetworkUpgradeProposal() {
|
export function mockNetworkUpgradeProposal() {
|
||||||
cy.mockGQL((req) => {
|
cy.mockGQL((req) => {
|
||||||
aliasGQLQuery(req, 'Nodes', nodeData);
|
aliasGQLQuery(req, 'Nodes', nodeData);
|
||||||
|
@ -67,7 +67,6 @@ export async function faucetAsset(assetEthAddress: string) {
|
|||||||
|
|
||||||
export async function vegaWalletTeardown() {
|
export async function vegaWalletTeardown() {
|
||||||
cy.get(associatedAmountInWallet)
|
cy.get(associatedAmountInWallet)
|
||||||
.should('be.visible')
|
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.then((associatedAmount) => {
|
.then((associatedAmount) => {
|
||||||
cy.get('body').then(($body) => {
|
cy.get('body').then(($body) => {
|
||||||
@ -82,9 +81,11 @@ export async function vegaWalletTeardown() {
|
|||||||
cy.get(vegaWalletContainer).within(() => {
|
cy.get(vegaWalletContainer).within(() => {
|
||||||
cy.get(associatedAmountInWallet, {
|
cy.get(associatedAmountInWallet, {
|
||||||
timeout: transactionTimeout,
|
timeout: transactionTimeout,
|
||||||
}).contains('0.00', {
|
})
|
||||||
timeout: transactionTimeout,
|
.should('have.length', 1, { timeout: transactionTimeout })
|
||||||
});
|
.contains('0.00', {
|
||||||
|
timeout: transactionTimeout,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user