test(2072): proposal deadline changes (#2073)
* test: mostly passing * test: more fixes
This commit is contained in:
parent
8d292c8f95
commit
c50efe02a6
@ -13,8 +13,6 @@ const newProposalSubmitButton = '[data-testid="proposal-submit"]';
|
||||
const dialogCloseButton = '[data-testid="dialog-close"]';
|
||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||
const openProposals = '[data-testid="open-proposals"]';
|
||||
const proposalResponseProposalIdPath =
|
||||
'response.body.data.busEvents.0.event.id';
|
||||
const proposalVoteProgressForPercentage =
|
||||
'[data-testid="vote-progress-indicator-percentage-for"]';
|
||||
const proposalVoteProgressAgainstPercentage =
|
||||
@ -141,11 +139,6 @@ context(
|
||||
beforeEach('visit governance tab', function () {
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.intercept('POST', '/query', (req) => {
|
||||
if (req.body.operationName === 'ProposalEvent') {
|
||||
req.alias = 'proposalSubmissionCompletion';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to see that no proposals exist', function () {
|
||||
@ -184,7 +177,7 @@ context(
|
||||
'contain.text',
|
||||
'we add 2 minutes of extra time'
|
||||
);
|
||||
cy.enter_unique_freeform_proposal_body('50');
|
||||
cy.enter_unique_freeform_proposal_body('50', generateProposalTitle());
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
// 3002-PROP-012
|
||||
// 3002-PROP-016
|
||||
@ -192,84 +185,6 @@ context(
|
||||
}
|
||||
);
|
||||
|
||||
it('Able to submit a valid freeform proposal - with minimum required tokens associated - but also staked', function () {
|
||||
cy.ensure_specified_unstaked_tokens_are_associated('2');
|
||||
cy.navigate_to_page_if_not_already_loaded('governance');
|
||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', '2');
|
||||
cy.navigate_to('staking');
|
||||
cy.wait_for_spinner();
|
||||
cy.click_on_validator_from_list(0);
|
||||
cy.staking_validator_page_add_stake('2');
|
||||
|
||||
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
|
||||
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.enter_unique_freeform_proposal_body('50');
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
cy.wait_for_proposal_submitted();
|
||||
});
|
||||
|
||||
it('Newly created proposals list - able to filter by proposerID to show it in list', function () {
|
||||
createFreeformProposal(this.minProposerBalance);
|
||||
cy.wait('@proposalSubmissionCompletion').then((proposal) => {
|
||||
let proposerId = proposal.request.body.variables.partyId;
|
||||
let proposalId = proposal.response.body.data.busEvents[0].event.id;
|
||||
cy.get('[data-testid="set-proposals-filter-visible"]').click();
|
||||
cy.get('[data-testid="filter-input"]').type(proposerId);
|
||||
cy.get(`#${proposalId}`).should('contain', proposalId);
|
||||
});
|
||||
});
|
||||
|
||||
it('Newly created proposals list - shows title and portion of summary', function () {
|
||||
createRawProposal(this.minProposerBalance); // 3001-VOTE-052
|
||||
cy.wait('@proposalSubmissionCompletion')
|
||||
.its(proposalResponseProposalIdPath)
|
||||
.then((proposalId) => {
|
||||
cy.get(openProposals).within(() => {
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
// 3001-VOTE-008
|
||||
// 3001-VOTE-034
|
||||
cy.get(`#${proposalId}`)
|
||||
// 3001-VOTE-097
|
||||
.should('contain', rawProposal.rationale.title)
|
||||
.and('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 () {
|
||||
// 3001-VOTE-004
|
||||
// 3001-VOTE-035
|
||||
createRawProposal(this.minProposerBalance);
|
||||
cy.wait('@proposalSubmissionCompletion')
|
||||
.its(proposalResponseProposalIdPath)
|
||||
.then((proposalId) => {
|
||||
cy.get(openProposals).within(() => {
|
||||
cy.get(`#${proposalId}`).within(() => {
|
||||
cy.get(viewProposalButton).should('be.visible').click();
|
||||
});
|
||||
});
|
||||
cy.get_proposal_information_from_table('ID')
|
||||
.contains(proposalId)
|
||||
.and('be.visible');
|
||||
cy.get_proposal_information_from_table('State')
|
||||
.contains('STATE_OPEN')
|
||||
.and('be.visible');
|
||||
cy.get_proposal_information_from_table('Type')
|
||||
.contains('NewFreeform')
|
||||
.and('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('Newly created proposals list - proposals closest to closing date appear higher in list', function () {
|
||||
// 3001-VOTE-005
|
||||
cy.ensure_specified_unstaked_tokens_are_associated(
|
||||
@ -315,6 +230,85 @@ context(
|
||||
});
|
||||
});
|
||||
|
||||
it('Able to submit a valid freeform proposal - with minimum required tokens associated - but also staked', function () {
|
||||
cy.ensure_specified_unstaked_tokens_are_associated('2');
|
||||
cy.navigate_to_page_if_not_already_loaded('governance');
|
||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', '2');
|
||||
cy.navigate_to('staking');
|
||||
cy.wait_for_spinner();
|
||||
cy.click_on_validator_from_list(0);
|
||||
cy.staking_validator_page_add_stake('2');
|
||||
|
||||
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
|
||||
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.enter_unique_freeform_proposal_body('50', generateProposalTitle());
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
cy.wait_for_proposal_submitted();
|
||||
});
|
||||
|
||||
it('Newly created proposals list - able to filter by proposerID to show it in list', function () {
|
||||
const proposerId = Cypress.env('vegaWalletPublicKey');
|
||||
const proposalTitle = generateProposalTitle();
|
||||
|
||||
createFreeformProposal(this.minProposerBalance, proposalTitle);
|
||||
cy.get_proposal_id_from_list(proposalTitle);
|
||||
cy.get('@proposalIdText').then((proposalId) => {
|
||||
cy.get('[data-testid="set-proposals-filter-visible"]').click();
|
||||
cy.get('[data-testid="filter-input"]').type(proposerId);
|
||||
cy.get(`#${proposalId}`).should('contain', proposalId);
|
||||
});
|
||||
});
|
||||
|
||||
it('Newly created proposals list - shows title and portion of summary', function () {
|
||||
createRawProposal(this.minProposerBalance); // 3001-VOTE-052
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_proposal_id_from_list(rawProposal.rationale.title);
|
||||
cy.get('@proposalIdText').then((proposalId) => {
|
||||
cy.get(openProposals).within(() => {
|
||||
// 3001-VOTE-008
|
||||
// 3001-VOTE-034
|
||||
cy.get(`#${proposalId}`)
|
||||
// 3001-VOTE-097
|
||||
.should('contain', rawProposal.rationale.title)
|
||||
.and('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 () {
|
||||
// 3001-VOTE-004
|
||||
// 3001-VOTE-035
|
||||
createRawProposal(this.minProposerBalance);
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_submitted_proposal_from_proposal_list(
|
||||
rawProposal.rationale.title
|
||||
).within(() => {
|
||||
cy.get(viewProposalButton).should('be.visible').click();
|
||||
});
|
||||
cy.get('@proposalIdText').then((proposalId) => {
|
||||
cy.get_proposal_information_from_table('ID')
|
||||
.contains(proposalId)
|
||||
.and('be.visible');
|
||||
});
|
||||
cy.get_proposal_information_from_table('State')
|
||||
.contains('STATE_OPEN')
|
||||
.and('be.visible');
|
||||
cy.get_proposal_information_from_table('Type')
|
||||
.contains('NewFreeform')
|
||||
.and('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
// Skipping test due to bug: #1320
|
||||
it.skip('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
|
||||
createFreeformProposal(this.minProposerBalance);
|
||||
@ -352,51 +346,51 @@ context(
|
||||
|
||||
it('Newly created raw proposal details - shows proposal title and full description', function () {
|
||||
createRawProposal(this.minProposerBalance);
|
||||
cy.wait('@proposalSubmissionCompletion')
|
||||
.its(proposalResponseProposalIdPath)
|
||||
.then((proposalId) => {
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_proposal_id_from_list(rawProposal.rationale.title);
|
||||
cy.get('@proposalIdText').then((proposalId) => {
|
||||
cy.get(openProposals).within(() => {
|
||||
cy.get(`#${proposalId}`).within(() => {
|
||||
cy.get(viewProposalButton).should('be.visible').click();
|
||||
});
|
||||
});
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
// 3001-VOTE-054
|
||||
cy.get(proposalDetailsTitle)
|
||||
.should('contain', rawProposal.rationale.title)
|
||||
.and('be.visible');
|
||||
cy.get(proposalDetailsDescription)
|
||||
.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"');
|
||||
});
|
||||
});
|
||||
cy.get(proposalDetailsTitle)
|
||||
.should('contain', rawProposal.rationale.title)
|
||||
.and('be.visible');
|
||||
cy.get(proposalDetailsDescription)
|
||||
.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"');
|
||||
});
|
||||
});
|
||||
|
||||
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
||||
const closingVoteHrs = '72';
|
||||
const proposalTitle = generateProposalTitle();
|
||||
cy.ensure_specified_unstaked_tokens_are_associated(
|
||||
this.minProposerBalance
|
||||
);
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.create_ten_digit_unix_timestamp_for_specified_days('3').then(
|
||||
(closingDateTimestamp) => {
|
||||
cy.enter_unique_freeform_proposal_body(closingVoteHrs);
|
||||
cy.enter_unique_freeform_proposal_body(
|
||||
closingVoteHrs,
|
||||
proposalTitle
|
||||
);
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
|
||||
cy.wait_for_proposal_submitted();
|
||||
cy.wait_for_proposal_sync();
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.get_submitted_proposal_from_proposal_list().within(() =>
|
||||
cy.get(viewProposalButton).click()
|
||||
cy.get_submitted_proposal_from_proposal_list(proposalTitle).within(
|
||||
() => cy.get(viewProposalButton).click()
|
||||
);
|
||||
cy.convert_unix_timestamp_to_governance_data_table_date_format(
|
||||
closingDateTimestamp
|
||||
@ -420,21 +414,23 @@ context(
|
||||
// 3001-VOTE-037
|
||||
// 3001-VOTE-040
|
||||
createRawProposal(this.minProposerBalance);
|
||||
cy.get_submitted_proposal_from_proposal_list().within(() =>
|
||||
cy.get(viewProposalButton).click()
|
||||
);
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_submitted_proposal_from_proposal_list(
|
||||
rawProposal.rationale.title
|
||||
).within(() => cy.get(viewProposalButton).click());
|
||||
});
|
||||
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get_proposal_information_from_table('Will pass')
|
||||
cy.get_proposal_information_from_table('Expected to pass')
|
||||
.contains('👎')
|
||||
.should('be.visible');
|
||||
// 3001-VOTE-062
|
||||
// 3001-VOTE-040
|
||||
cy.get_proposal_information_from_table('Majority met')
|
||||
cy.get_proposal_information_from_table('Token majority met')
|
||||
.contains('👎')
|
||||
.should('be.visible');
|
||||
cy.get_proposal_information_from_table('Participation met')
|
||||
cy.get_proposal_information_from_table('Token participation met')
|
||||
.contains('👎')
|
||||
.should('be.visible');
|
||||
});
|
||||
@ -442,9 +438,11 @@ context(
|
||||
// 3001-VOTE-080 3001-VOTE-090
|
||||
it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () {
|
||||
createRawProposal(this.minProposerBalance);
|
||||
cy.get_submitted_proposal_from_proposal_list()
|
||||
.as('submittedProposal')
|
||||
.within(() => cy.get(viewProposalButton).click());
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_submitted_proposal_from_proposal_list(
|
||||
rawProposal.rationale.title
|
||||
).within(() => cy.get(viewProposalButton).click());
|
||||
});
|
||||
// 3001-VOTE-080
|
||||
cy.get(voteButtons).contains('against').should('be.visible');
|
||||
cy.get(voteButtons).contains('for').should('be.visible');
|
||||
@ -511,14 +509,20 @@ context(
|
||||
.and('be.visible');
|
||||
});
|
||||
|
||||
it('Newly created proposal details - ability to increase associated tokens - so that vote sways result', function () {
|
||||
// 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 () {
|
||||
createRawProposal(this.minProposerBalance);
|
||||
cy.get_submitted_proposal_from_proposal_list()
|
||||
.as('submittedProposal')
|
||||
.within(() => cy.get(viewProposalButton).click());
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_submitted_proposal_from_proposal_list(
|
||||
rawProposal.rationale.title
|
||||
)
|
||||
.as('submittedProposal')
|
||||
.within(() => cy.get(viewProposalButton).click());
|
||||
});
|
||||
cy.vote_for_proposal('for');
|
||||
// 3001-VOTE-079
|
||||
cy.contains('You voted: For').should('be.visible');
|
||||
cy.get(proposalVoteProgressForTokens).contains('1').and('be.visible');
|
||||
cy.get_proposal_information_from_table('Total Supply')
|
||||
.invoke('text')
|
||||
.then((totalSupply) => {
|
||||
@ -539,6 +543,8 @@ context(
|
||||
.contains('0.00%')
|
||||
.and('be.visible');
|
||||
// 3001-VOTE-065
|
||||
cy.get(changeVoteButton).should('be.visible').click();
|
||||
cy.vote_for_proposal('for');
|
||||
cy.get(proposalVoteProgressForTokens)
|
||||
.contains(tokensRequiredToAchieveResult)
|
||||
.and('be.visible');
|
||||
@ -554,22 +560,19 @@ context(
|
||||
cy.get_proposal_information_from_table('Number of voting parties')
|
||||
.should('have.text', '1')
|
||||
.and('be.visible');
|
||||
cy.get_proposal_information_from_table('Will pass')
|
||||
cy.get_proposal_information_from_table('Expected to pass')
|
||||
.contains('👍')
|
||||
.should('be.visible');
|
||||
// 3001-VOTE-062
|
||||
cy.get_proposal_information_from_table('Majority met')
|
||||
cy.get_proposal_information_from_table('Token majority met')
|
||||
.contains('👍')
|
||||
.should('be.visible');
|
||||
cy.get_proposal_information_from_table('Participation met')
|
||||
cy.get_proposal_information_from_table('Token participation met')
|
||||
.contains('👍')
|
||||
.should('be.visible');
|
||||
// 3001-VOTE-042
|
||||
// 3001-VOTE-057
|
||||
// 3001-VOTE-058
|
||||
// 3001-VOTE-059
|
||||
// 3001-VOTE-060
|
||||
cy.contains('Currently set to pass').should('be.visible');
|
||||
cy.get_proposal_information_from_table('Tokens for proposal')
|
||||
.contains(tokensRequiredToAchieveResult)
|
||||
.and('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
@ -578,7 +581,7 @@ context(
|
||||
this.minProposerBalance
|
||||
);
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.enter_unique_freeform_proposal_body('40');
|
||||
cy.enter_unique_freeform_proposal_body('40', generateProposalTitle());
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
||||
'not.exist'
|
||||
@ -590,7 +593,10 @@ context(
|
||||
this.minProposerBalance
|
||||
);
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.enter_unique_freeform_proposal_body('100000');
|
||||
cy.enter_unique_freeform_proposal_body(
|
||||
'100000',
|
||||
generateProposalTitle()
|
||||
);
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
||||
'not.exist'
|
||||
@ -617,10 +623,14 @@ context(
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.get(rejectProposalsLink).click().wait_for_spinner();
|
||||
cy.get_submitted_proposal_from_proposal_list().within(() => {
|
||||
cy.contains('Rejected').should('be.visible');
|
||||
cy.contains('Close time too late').should('be.visible');
|
||||
cy.get(viewProposalButton).click();
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_submitted_proposal_from_proposal_list(
|
||||
rawProposal.rationale.title
|
||||
).within(() => {
|
||||
cy.contains('Rejected').should('be.visible');
|
||||
cy.contains('Close time too late').should('be.visible');
|
||||
cy.get(viewProposalButton).click();
|
||||
});
|
||||
});
|
||||
cy.get_proposal_information_from_table('State')
|
||||
.contains('STATE_REJECTED')
|
||||
@ -651,6 +661,7 @@ context(
|
||||
'have.text',
|
||||
'party has insufficient associated governance tokens in their staking account to submit proposal request'
|
||||
);
|
||||
cy.get(dialogCloseButton).click();
|
||||
});
|
||||
|
||||
it('Unable to create a proposal - when some but not enough tokens are associated', function () {
|
||||
@ -669,6 +680,7 @@ context(
|
||||
'have.text',
|
||||
'party has insufficient associated governance tokens in their staking account to submit proposal request'
|
||||
);
|
||||
cy.get(dialogCloseButton).click();
|
||||
});
|
||||
|
||||
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
|
||||
@ -697,6 +709,7 @@ context(
|
||||
'have.text',
|
||||
'*: unknown field "unexpected" in vega.commands.v1.ProposalSubmission'
|
||||
);
|
||||
cy.get(dialogCloseButton).click();
|
||||
});
|
||||
|
||||
it('Unable to create a freeform proposal - when json terms section contains unexpected field', function () {
|
||||
@ -726,15 +739,18 @@ context(
|
||||
'have.text',
|
||||
'*: unknown field "unexpectedField" in vega.ProposalTerms'
|
||||
);
|
||||
cy.get(dialogCloseButton).click();
|
||||
});
|
||||
|
||||
// 1005-PROP-009
|
||||
it('Unable to vote on a freeform proposal - when some but not enough vega associated', function () {
|
||||
const proposalTitle = generateProposalTitle();
|
||||
|
||||
cy.ensure_specified_unstaked_tokens_are_associated(
|
||||
this.minProposerBalance
|
||||
);
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.enter_unique_freeform_proposal_body('50');
|
||||
cy.enter_unique_freeform_proposal_body('50', proposalTitle);
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
cy.wait_for_proposal_submitted();
|
||||
cy.wait_for_proposal_sync();
|
||||
@ -747,9 +763,9 @@ context(
|
||||
});
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
cy.get_submitted_proposal_from_proposal_list()
|
||||
.as('submittedProposal')
|
||||
.within(() => cy.get(viewProposalButton).click());
|
||||
cy.get_submitted_proposal_from_proposal_list(proposalTitle).within(() =>
|
||||
cy.get(viewProposalButton).click()
|
||||
);
|
||||
cy.contains('Vote breakdown').should('be.visible', { timeout: 10000 });
|
||||
cy.get(voteButtons).should('not.exist');
|
||||
cy.getByTestId('min-proposal-requirements').should(
|
||||
@ -763,9 +779,11 @@ context(
|
||||
cy.wait_for_spinner();
|
||||
cy.get('[data-testid="manage-vega-wallet"]').click();
|
||||
cy.get('[data-testid="disconnect"]').click();
|
||||
cy.get_submitted_proposal_from_proposal_list()
|
||||
.as('submittedProposal')
|
||||
.within(() => cy.get(viewProposalButton).click());
|
||||
cy.get('@rawProposal').then((rawProposal) => {
|
||||
cy.get_submitted_proposal_from_proposal_list(
|
||||
rawProposal.rationale.title
|
||||
).within(() => cy.get(viewProposalButton).click());
|
||||
});
|
||||
// 3001-VOTE-075
|
||||
// 3001-VOTE-076
|
||||
cy.get(connectToVegaWalletButton)
|
||||
@ -806,17 +824,23 @@ context(
|
||||
cy.wait_for_spinner();
|
||||
}
|
||||
|
||||
function createFreeformProposal(proposerBalance) {
|
||||
function createFreeformProposal(proposerBalance, proposalTitle) {
|
||||
cy.ensure_specified_unstaked_tokens_are_associated(proposerBalance);
|
||||
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||
cy.enter_unique_freeform_proposal_body('50');
|
||||
cy.enter_unique_freeform_proposal_body('50', proposalTitle);
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
cy.wait_for_proposal_submitted();
|
||||
cy.wait_for_proposal_sync();
|
||||
cy.get(proposalDetailsTitle).invoke('text').as('proposalTitle');
|
||||
cy.navigate_to('governance');
|
||||
cy.wait_for_spinner();
|
||||
}
|
||||
|
||||
function generateProposalTitle() {
|
||||
const randomNum = Math.floor(Math.random() * 1000) + 1;
|
||||
return randomNum + ': Freeform e2e proposal';
|
||||
}
|
||||
|
||||
after(
|
||||
'teardown environment to prevent test data bleeding into other tests',
|
||||
function () {
|
||||
|
@ -18,6 +18,8 @@ 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 enactmentDeadlineError =
|
||||
'[data-testid="enactment-before-voting-deadline"]';
|
||||
const feedbackError = '[data-testid="Error"]';
|
||||
const epochTimeout = Cypress.env('epochTimeout');
|
||||
const proposalTimeout = { timeout: 14000 };
|
||||
@ -104,6 +106,31 @@ context(
|
||||
);
|
||||
});
|
||||
|
||||
it('Unable to submit network parameter proposal with vote deadline above enactment deadline', function () {
|
||||
cy.navigate_to_page_if_not_already_loaded('governance');
|
||||
cy.go_to_make_new_proposal(governanceProposalType.NETWORK_PARAMETER);
|
||||
cy.get(newProposalTitle).type('Test update network parameter proposal');
|
||||
cy.get(newProposalDescription).type('invalid deadlines');
|
||||
cy.get(proposalParameterSelect).select(
|
||||
'spam_protection_proposal_min_tokens'
|
||||
);
|
||||
cy.get(newProposedParameterValue).type('0');
|
||||
cy.get(proposalVoteDeadline).clear().type('0');
|
||||
cy.get(maxVoteDeadline).click();
|
||||
cy.get(enactmentDeadlineError).should(
|
||||
'have.text',
|
||||
'Proposal will fail if enactment is earlier than the voting deadline'
|
||||
);
|
||||
cy.get(newProposalSubmitButton).click();
|
||||
cy.get(feedbackError).should(
|
||||
'have.text',
|
||||
'proposal_submission.terms.closing_timestamp: cannot be after enactment time'
|
||||
);
|
||||
cy.get(dialogCloseButton).click();
|
||||
cy.get(minVoteDeadline).click();
|
||||
cy.get(enactmentDeadlineError).should('not.exist');
|
||||
});
|
||||
|
||||
// Skipping because unclear what the required json is yet for new market proposal, will update once docs have been updated
|
||||
// 3003-todo-PMAN-001
|
||||
it.skip('Able to submit valid new market proposal', function () {
|
||||
@ -138,7 +165,7 @@ context(
|
||||
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
||||
cy.get(feedbackError).should(
|
||||
'have.text',
|
||||
'*: unknown field "settlementPriceProperty" in vega.OracleSpecToFutureBinding'
|
||||
'*: unknown field "signers" in vega.DataSourceDefinition'
|
||||
);
|
||||
});
|
||||
|
||||
@ -222,8 +249,7 @@ context(
|
||||
cy.wait_for_proposal_submitted();
|
||||
});
|
||||
|
||||
// Skipping until #1837 is fixed
|
||||
it.skip('Able to submit update asset proposal using max deadline', function () {
|
||||
it('Able to submit update asset proposal using max deadline', function () {
|
||||
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET);
|
||||
enterUpdateAssetProposalDetails();
|
||||
cy.get(maxVoteDeadline).click();
|
||||
|
@ -2,11 +2,10 @@ const newProposalButton = '[data-testid="new-proposal-link"]';
|
||||
const proposalInformationTableRows = '[data-testid="key-value-table-row"]';
|
||||
const newProposalTitle = '[data-testid="proposal-title"]';
|
||||
const newProposalDescription = '[data-testid="proposal-description"]';
|
||||
const proposalDetails = '[data-testid="proposal-details"]';
|
||||
const rawProposalData = '[data-testid="proposal-data"]';
|
||||
const proposalResponseProposalIdPath =
|
||||
'response.body.data.busEvents.0.event.id';
|
||||
const voteButtons = '[data-testid="vote-buttons"]';
|
||||
const txTimeout = Cypress.env('txTimeout');
|
||||
const dialogTitle = '[data-testid="dialog-title"]';
|
||||
const proposalVoteDeadline = '[data-testid="proposal-vote-deadline"]';
|
||||
const dialogCloseButton = '[data-testid="dialog-close"]';
|
||||
const epochTimeout = Cypress.env('epochTimeout');
|
||||
@ -65,20 +64,42 @@ Cypress.Commands.add('enter_raw_proposal_body', (timestamp) => {
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('enter_unique_freeform_proposal_body', (timestamp) => {
|
||||
cy.get(newProposalTitle).type(`${timestamp} test freeform proposal`);
|
||||
cy.get(newProposalDescription).type(
|
||||
'this is a e2e freeform proposal description'
|
||||
);
|
||||
cy.get(proposalVoteDeadline).clear().click().type(timestamp);
|
||||
});
|
||||
Cypress.Commands.add(
|
||||
'enter_unique_freeform_proposal_body',
|
||||
(timestamp, proposalTitle) => {
|
||||
cy.get(newProposalTitle).type(proposalTitle);
|
||||
cy.get(newProposalDescription).type(
|
||||
'this is a e2e freeform proposal description'
|
||||
);
|
||||
cy.get(proposalVoteDeadline).clear().click().type(timestamp);
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add('get_submitted_proposal_from_proposal_list', () => {
|
||||
cy.wait('@proposalSubmissionCompletion')
|
||||
.its(proposalResponseProposalIdPath)
|
||||
.then((proposalId) => {
|
||||
Cypress.Commands.add(
|
||||
'get_submitted_proposal_from_proposal_list',
|
||||
(proposalTitle) => {
|
||||
cy.get_proposal_id_from_list(proposalTitle);
|
||||
cy.get('@proposalIdText').then((proposalId) => {
|
||||
return cy.get(`#${proposalId}`);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add('get_proposal_id_from_list', (proposalTitle) => {
|
||||
cy.contains(proposalTitle)
|
||||
.parent()
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get(proposalDetails)
|
||||
.invoke('text')
|
||||
.then((proposalIdText) => {
|
||||
let newProposalId;
|
||||
if (proposalIdText.includes('Freeform proposal')) {
|
||||
newProposalId = proposalIdText.replace('Freeform proposal: ', '');
|
||||
}
|
||||
cy.wrap(newProposalId).as('proposalIdText');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
@ -102,8 +123,8 @@ Cypress.Commands.add('get_proposal_information_from_table', (heading) => {
|
||||
Cypress.Commands.add('vote_for_proposal', (vote) => {
|
||||
cy.contains('Vote breakdown').should('be.visible', { timeout: 10000 });
|
||||
cy.get(voteButtons).contains(vote).click();
|
||||
cy.contains('Casting vote...').should('be.visible');
|
||||
cy.contains('Casting vote...', txTimeout).should('not.exist');
|
||||
cy.get(dialogTitle).should('have.text', 'Transaction complete');
|
||||
cy.get(dialogCloseButton).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('wait_for_proposal_sync', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user