Test/governance suite expansion (#1372)

* test: initial commit

* test: commit

* test: extra tests and references added also new tag 0.55.0 for builds

* test: lint

* test: back to 0.54 for capsule cypress until tests fixed

* test: skip two tests since wallet name no longer shown soon to be fixed

* test: couple more tests to fulfill ACs

* test: lint

* test: more tests

* test: lint

* test: extra check within test

* test: lint

* test: minor

* test: improve test flake and skip test bugs outstanding

* test: lint and increase epoch length by second

* test: more tests

* test: lint

* test: lint

* test: lint

* test: teardown functionality

* test: lint

* test: epoch speed up and network restart stuff

* test: lint

* test: change epoch duration

* test: timing tweaks due to failures in CI

* test: lint

* test: more timing tweaks

* test: lint

* test: timing tweak

* test: lint

* test: lint

* test: config changes
This commit is contained in:
AndyWhiteVega 2022-09-16 18:12:08 +01:00 committed by GitHub
parent 666fe9aebb
commit d47d754ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 437 additions and 118 deletions

View File

@ -140,6 +140,7 @@ jobs:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }} CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_INCLUDE_FLOWS: ${{ github.event.inputs.includeFlows }} CYPRESS_INCLUDE_FLOWS: ${{ github.event.inputs.includeFlows }}
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
###### ######
## Upload logs ## Upload logs

View File

@ -125,6 +125,7 @@ jobs:
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }} CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_NIGHTLY_RUN: true CYPRESS_NIGHTLY_RUN: true
CYPRESS_INCLUDE_FLOWS: true CYPRESS_INCLUDE_FLOWS: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
###### ######
## Upload logs ## Upload logs

View File

@ -137,6 +137,7 @@ jobs:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }} CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_INCLUDE_FLOWS: false CYPRESS_INCLUDE_FLOWS: false
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
###### ######
## Upload logs ## Upload logs

View File

@ -42,7 +42,8 @@ module.exports = defineConfig({
vegaTokenContractAddress: '0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7', vegaTokenContractAddress: '0xF41bD86d462D36b997C0bbb4D97a0a3382f205B7',
vegaTokenAddress: '0x67175Da1D5e966e40D11c4B2519392B2058373de', vegaTokenAddress: '0x67175Da1D5e966e40D11c4B2519392B2058373de',
txTimeout: { timeout: 70000 }, txTimeout: { timeout: 70000 },
epochTimeout: { timeout: 11000 }, epochTimeout: { timeout: 6000 },
blockConfirmations: 3, blockConfirmations: 3,
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true,
}, },
}); });

View File

@ -4,6 +4,12 @@ const vegaWalletUnstakedBalance =
'[data-testid="vega-wallet-balance-unstaked"]'; '[data-testid="vega-wallet-balance-unstaked"]';
const vegaWalletStakedBalances = const vegaWalletStakedBalances =
'[data-testid="vega-wallet-balance-staked-validators"]'; '[data-testid="vega-wallet-balance-staked-validators"]';
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
const vegaWalletNameElement = '[data-testid="wallet-name"]';
const vegaWallet = '[data-testid="vega-wallet"]';
const vegaWalletName = Cypress.env('vegaWalletName');
const vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase');
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
const newProposalButton = '[data-testid="new-proposal-link"]'; const newProposalButton = '[data-testid="new-proposal-link"]';
const newProposalDatabox = '[data-testid="proposal-data"]'; const newProposalDatabox = '[data-testid="proposal-data"]';
const newProposalSubmitButton = '[data-testid="proposal-submit"]'; const newProposalSubmitButton = '[data-testid="proposal-submit"]';
@ -11,7 +17,6 @@ const dialogCloseButton = '[data-testid="dialog-close"]';
const viewProposalButton = '[data-testid="view-proposal-btn"]'; const viewProposalButton = '[data-testid="view-proposal-btn"]';
const proposalInformationTableRows = '[data-testid="key-value-table-row"]'; const proposalInformationTableRows = '[data-testid="key-value-table-row"]';
const openProposals = '[data-testid="open-proposals"]'; const openProposals = '[data-testid="open-proposals"]';
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
const proposalResponseProposalIdPath = const proposalResponseProposalIdPath =
'response.body.data.busEvents.0.event.id'; 'response.body.data.busEvents.0.event.id';
const proposalVoteProgressForPercentage = const proposalVoteProgressForPercentage =
@ -26,10 +31,13 @@ const changeVoteButton = '[data-testid="change-vote-button"]';
const proposalDetailsTitle = '[data-testid="proposal-title"]'; const proposalDetailsTitle = '[data-testid="proposal-title"]';
const proposalDetailsDescription = '[data-testid="proposal-description"]'; const proposalDetailsDescription = '[data-testid="proposal-description"]';
const voteButtons = '[data-testid="vote-buttons"]'; const voteButtons = '[data-testid="vote-buttons"]';
const voteStatus = '[data-testid="vote-status"]';
const rejectProposalsLink = '[href="/governance/rejected"]'; const rejectProposalsLink = '[href="/governance/rejected"]';
const feedbackError = '[data-testid="Error"]'; const feedbackError = '[data-testid="Error"]';
const txTimeout = Cypress.env('txTimeout'); const txTimeout = Cypress.env('txTimeout');
const epochTimeout = Cypress.env('epochTimeout'); const epochTimeout = Cypress.env('epochTimeout');
const proposalTimeout = { timeout: 14000 };
const restConnectorForm = '[data-testid="rest-connector-form"]';
context('Governance flow - with eth and vega wallets connected', function () { context('Governance flow - with eth and vega wallets connected', function () {
before('connect wallets and set approval limit', function () { before('connect wallets and set approval limit', function () {
@ -103,8 +111,8 @@ context('Governance flow - with eth and vega wallets connected', function () {
} }
); );
beforeEach('visit staking tab', function () { beforeEach('visit governance tab', function () {
cy.navigate_to('staking'); cy.navigate_to('governance');
cy.wait_for_spinner(); cy.wait_for_spinner();
cy.intercept('POST', '/query', (req) => { cy.intercept('POST', '/query', (req) => {
if (req.body.operationName === 'ProposalEvent') { if (req.body.operationName === 'ProposalEvent') {
@ -113,12 +121,18 @@ context('Governance flow - with eth and vega wallets connected', function () {
}); });
}); });
it('Submit a proposal form - shows how many vega tokens are required to make a proposal', function () {
cy.get(newProposalButton).should('be.visible').click();
cy.contains(
`You must have at least ${this.minProposerBalance} VEGA associated to make a proposal`
).should('be.visible');
});
it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () { it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -132,7 +146,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
}); });
@ -140,6 +154,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
this.minProposerBalance, this.minProposerBalance,
@ -168,7 +183,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
}); });
@ -176,8 +191,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -188,7 +202,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -206,8 +220,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -218,7 +231,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -236,8 +249,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -250,7 +262,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -282,8 +294,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -294,7 +305,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -312,12 +323,110 @@ context('Governance flow - with eth and vega wallets connected', function () {
}); });
}); });
it('Newly created freeform proposal details - shows proposal title and full description', function () { it('Newly created freeform proposals list - proposals closest to closing date appear higher in list', function () {
// 1004-VOTE-005
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
// Ensuring that proposals are not posted in same order as sort order
let proposalDays = [
this.minCloseDays + 1,
this.maxCloseDays,
this.minCloseDays + 3,
this.minCloseDays + 2,
];
for (var index = 0; index < proposalDays.length; index++) {
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days(
proposalDays[index]
).then((closingDateTimestamp) => {
cy.enter_unique_freeform_proposal_body(closingDateTimestamp);
});
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible'
);
cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync();
}
let arrayOfProposals = [];
cy.navigate_to('governance'); cy.navigate_to('governance');
cy.wait_for_spinner(); cy.wait_for_spinner();
cy.get(proposalDetailsTitle)
.each((proposalTitleElement) => {
arrayOfProposals.push(proposalTitleElement.text());
})
.then(() => {
cy.get_sort_order_of_supplied_array(arrayOfProposals).should(
'equal',
'descending'
);
});
});
// Skipping test due to bug: #1320
it.skip('Newly created freeform proposals list - shows proposal parcipitation - both met and not', function () {
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => {
cy.enter_unique_freeform_proposal_body(closingDateTimestamp);
}
);
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible'
);
cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync();
cy.navigate_to('governance');
cy.wait_for_spinner();
cy.get_submitted_proposal_from_proposal_list()
.as('submittedProposal')
.within(() => {
// 1004-VOTE-039
cy.get(voteStatus).should('have.text', 'Participation not reached');
cy.get(viewProposalButton).click();
});
cy.vote_for_proposal('for');
cy.get_proposal_information_from_table('Total Supply')
.invoke('text')
.then((totalSupply) => {
let tokensRequiredToAcheiveResult = parseFloat(
(totalSupply.replace(/,/g, '') * this.requiredParticipation) / 100
).toFixed(2);
cy.ensure_specified_unstaked_tokens_are_associated(
tokensRequiredToAcheiveResult
);
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get('@submittedProposal').within(() =>
cy.get(viewProposalButton).click()
);
cy.get_proposal_information_from_table('Participation met')
.contains('👍')
.should('be.visible');
cy.navigate_to('governance');
cy.wait_for_spinner();
cy.get('@submittedProposal').within(() =>
cy.get(voteStatus).should('have.text', 'Participation met')
);
});
});
// Skipping test due to bug - should be solved when #1223 released
it.skip('Newly created freeform proposal details - shows proposal title and full description', function () {
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -330,7 +439,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -355,12 +464,12 @@ context('Governance flow - with eth and vega wallets connected', function () {
}); });
}); });
it('Newly created freeform proposal details - shows full link included in description', function () { // Skipping test due to bug - should be solved when #1223 released
it.skip('Newly created freeform proposal details - shows full link included in description', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -373,7 +482,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -386,11 +495,10 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get(viewProposalButton).should('be.visible').click(); cy.get(viewProposalButton).should('be.visible').click();
}); });
}); });
cy.get('@freeformProposal').then((freeformProposal) => { cy.get('@freeformProposal').then(() => {
// 1004-VOTE-055 // 1004-VOTE-055
cy.get(proposalDetailsDescription) cy.get(proposalDetailsDescription)
.should('contain', freeformProposal.rationale.description) .should('have.attr', 'href')
.and('have.attr', 'href')
.and( .and(
'equal', 'equal',
'https://dweb.link/ipfs/bafybeigwwctpv37xdcwacqxvekr6e4kaemqsrv34em6glkbiceo3fcy4si' 'https://dweb.link/ipfs/bafybeigwwctpv37xdcwacqxvekr6e4kaemqsrv34em6glkbiceo3fcy4si'
@ -404,8 +512,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -416,7 +523,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -445,8 +552,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('9').then( cy.create_ten_digit_unix_timestamp_for_specified_days('9').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -456,7 +562,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should(
'be.visible'
);
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -486,13 +594,11 @@ context('Governance flow - with eth and vega wallets connected', function () {
it('Newly created freeform proposal details - shows default status set to fail', function () { it('Newly created freeform proposal details - shows default status set to fail', function () {
// 1004-VOTE-037 // 1004-VOTE-037
// 1004-VOTE-039
// 1004-VOTE-040 // 1004-VOTE-040
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -503,7 +609,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -519,6 +625,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
.contains('👎') .contains('👎')
.should('be.visible'); .should('be.visible');
// 1004-VOTE-062 // 1004-VOTE-062
// 1004-VOTE-040
cy.get_proposal_information_from_table('Majority met') cy.get_proposal_information_from_table('Majority met')
.contains('👎') .contains('👎')
.should('be.visible'); .should('be.visible');
@ -531,8 +638,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -543,7 +649,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -551,6 +657,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get_submitted_proposal_from_proposal_list() cy.get_submitted_proposal_from_proposal_list()
.as('submittedProposal') .as('submittedProposal')
.within(() => cy.get(viewProposalButton).click()); .within(() => cy.get(viewProposalButton).click());
// 1004-VOTE-080
cy.get(voteButtons).contains('against').should('be.visible');
cy.get(voteButtons).contains('for').should('be.visible');
cy.vote_for_proposal('for'); cy.vote_for_proposal('for');
cy.get_governance_proposal_date_format_for_specified_days( cy.get_governance_proposal_date_format_for_specified_days(
'0', '0',
@ -598,8 +707,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -610,7 +718,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -662,8 +770,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -674,7 +781,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -719,8 +826,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -731,7 +837,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -742,7 +848,6 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.vote_for_proposal('for'); cy.vote_for_proposal('for');
cy.get(changeVoteButton).should('be.visible').click(); cy.get(changeVoteButton).should('be.visible').click();
cy.wait_for_spinner(); cy.wait_for_spinner();
// 1004-VOTE-080
cy.vote_for_proposal('against'); cy.vote_for_proposal('against');
cy.get(proposalVoteProgressForPercentage) cy.get(proposalVoteProgressForPercentage)
.contains('0.00%') .contains('0.00%')
@ -775,8 +880,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then( cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -787,7 +891,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', epochTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -795,8 +899,9 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get_submitted_proposal_from_proposal_list() cy.get_submitted_proposal_from_proposal_list()
.as('submittedProposal') .as('submittedProposal')
.within(() => cy.get(viewProposalButton).click()); .within(() => cy.get(viewProposalButton).click());
// 1004-VOTE-080
cy.vote_for_proposal('for'); cy.vote_for_proposal('for');
// 1004-VOTE-079
cy.contains('You voted: For').should('be.visible');
cy.get_proposal_information_from_table('Total Supply') cy.get_proposal_information_from_table('Total Supply')
.invoke('text') .invoke('text')
.then((totalSupply) => { .then((totalSupply) => {
@ -806,8 +911,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
tokensRequiredToAcheiveResult tokensRequiredToAcheiveResult
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get('@submittedProposal').within(() => cy.get('@submittedProposal').within(() =>
cy.get(viewProposalButton).click() cy.get(viewProposalButton).click()
); );
@ -818,7 +922,6 @@ context('Governance flow - with eth and vega wallets connected', function () {
.contains('0.00%') .contains('0.00%')
.and('be.visible'); .and('be.visible');
// 1004-VOTE-065 // 1004-VOTE-065
// 1004-VOTE-079
cy.get(proposalVoteProgressForTokens) cy.get(proposalVoteProgressForTokens)
.contains(tokensRequiredToAcheiveResult) .contains(tokensRequiredToAcheiveResult)
.and('be.visible'); .and('be.visible');
@ -857,8 +960,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days( cy.create_ten_digit_unix_timestamp_for_specified_days(
this.minCloseDays - 1 this.minCloseDays - 1
@ -869,7 +971,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal rejected', epochTimeout).should('be.visible'); cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -885,8 +987,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days( cy.create_ten_digit_unix_timestamp_for_specified_days(
this.maxCloseDays + 1 this.maxCloseDays + 1
@ -897,7 +998,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal rejected', epochTimeout).should('be.visible'); cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -913,8 +1014,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance this.minProposerBalance
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days( cy.create_ten_digit_unix_timestamp_for_specified_days(
this.maxCloseDays + 1 this.maxCloseDays + 1
@ -925,7 +1025,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.contains('Awaiting network confirmation', epochTimeout).should( cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible' 'be.visible'
); );
cy.contains('Proposal rejected', epochTimeout).should('be.visible'); cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync(); cy.wait_for_proposal_sync();
cy.navigate_to('governance'); cy.navigate_to('governance');
@ -953,8 +1053,6 @@ context('Governance flow - with eth and vega wallets connected', function () {
'0.000000000000000000', '0.000000000000000000',
txTimeout txTimeout
); );
cy.navigate_to('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('1').then( cy.create_ten_digit_unix_timestamp_for_specified_days('1').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -963,7 +1061,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
); );
cy.get(newProposalSubmitButton).should('be.visible').click(); cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Transaction failed', epochTimeout).should('be.visible'); cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError) cy.get(feedbackError)
.contains( .contains(
'Party has insufficient associated governance tokens in their staking account to submit proposal request' 'Party has insufficient associated governance tokens in their staking account to submit proposal request'
@ -975,8 +1073,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.ensure_specified_unstaked_tokens_are_associated( cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance - 0.000001 this.minProposerBalance - 0.000001
); );
cy.navigate_to('governance'); cy.navigate_to_page_if_not_allready_loaded('governance');
cy.wait_for_spinner();
cy.get(newProposalButton).should('be.visible').click(); cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('1').then( cy.create_ten_digit_unix_timestamp_for_specified_days('1').then(
(closingDateTimestamp) => { (closingDateTimestamp) => {
@ -985,7 +1082,7 @@ context('Governance flow - with eth and vega wallets connected', function () {
); );
cy.get(newProposalSubmitButton).should('be.visible').click(); cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Transaction failed', epochTimeout).should('be.visible'); cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError) cy.get(feedbackError)
.contains( .contains(
'Party has insufficient associated governance tokens in their staking account to submit proposal request' 'Party has insufficient associated governance tokens in their staking account to submit proposal request'
@ -993,6 +1090,158 @@ context('Governance flow - with eth and vega wallets connected', function () {
.should('be.visible'); .should('be.visible');
}); });
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
// 1004-VOTE-038
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('1').then(
(closingDateTimestamp) => {
cy.fixture('/proposals/freeform.json').then((freeformProposal) => {
freeformProposal.terms.closingTimestamp = closingDateTimestamp;
freeformProposal.unexpectfield = `i shouldn't be here`;
let proposalPayload = JSON.stringify(freeformProposal);
cy.get(newProposalDatabox).type(proposalPayload, {
parseSpecialCharSequences: false,
delay: 2,
});
});
}
);
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError)
.contains('Unknown field unexpectfield in vega commands')
.should('be.visible');
});
it('Unable to create a freeform proposal - when json terms section contains unexpected field', function () {
// 1004-VOTE-038
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('1').then(
(closingDateTimestamp) => {
cy.fixture('/proposals/freeform.json').then((freeformProposal) => {
freeformProposal.terms.closingTimestamp = closingDateTimestamp;
freeformProposal.terms.unexpectfield = `i shouldn't be here`;
let proposalPayload = JSON.stringify(freeformProposal);
cy.get(newProposalDatabox).type(proposalPayload, {
parseSpecialCharSequences: false,
delay: 2,
});
});
}
);
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError)
.contains('Unknown field unexpectfield in vega proposal terms')
.should('be.visible');
});
// Have to skip because #1326 bug doesn't handle below scenario
it.skip('Unable to vote on a freeform proposal - when some but not enough vega associated', function () {
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => {
cy.enter_unique_freeform_proposal_body(closingDateTimestamp);
}
);
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible'
);
cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync();
cy.staking_page_disassociate_tokens('0.0001');
cy.get(vegaWallet).within(() => {
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
'contain',
'0.999900000000000000'
);
});
cy.navigate_to('governance');
cy.wait_for_spinner();
cy.get_submitted_proposal_from_proposal_list()
.as('submittedProposal')
.within(() => cy.get(viewProposalButton).click());
cy.contains('Vote breakdown').should('be.visible', { timeout: 10000 });
cy.get(voteButtons).contains('for').should('not.exist');
cy.get(voteButtons).contains('against').should('not.exist');
});
it('Unable to vote on a freeform proposal - when vega wallet disconnected - option to connect from within', function () {
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.navigate_to_page_if_not_allready_loaded('governance');
cy.get(newProposalButton).should('be.visible').click();
cy.create_ten_digit_unix_timestamp_for_specified_days('7').then(
(closingDateTimestamp) => {
cy.enter_unique_freeform_proposal_body(closingDateTimestamp);
}
);
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.contains('Awaiting network confirmation', epochTimeout).should(
'be.visible'
);
cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click();
cy.wait_for_proposal_sync();
cy.navigate_to('governance');
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());
// 1004-VOTE-075
// 1004-VOTE-076
cy.get(connectToVegaWalletButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet')
.click();
cy.contains('rest provider').click();
cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(vegaWalletName);
cy.get('#passphrase').click().type(vegaWalletPassphrase);
cy.get('button').contains('Connect').click();
});
cy.get(vegaWalletNameElement).should('be.visible');
cy.get(connectToVegaWalletButton).should('not.exist');
// 1004-VOTE-100
cy.get(vegaWalletAssociatedBalance, txTimeout).contains(
'1.000000000000000000',
txTimeout
);
cy.vote_for_proposal('against');
// 1004-VOTE-079
cy.contains('You voted: Against').should('be.visible');
});
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restartVegacapsuleNetwork();
}
}
);
Cypress.Commands.add( Cypress.Commands.add(
'convert_unix_timestamp_to_governance_data_table_date_format', 'convert_unix_timestamp_to_governance_data_table_date_format',
(unixTimestamp, monthTextLength = 'longMonth') => { (unixTimestamp, monthTextLength = 'longMonth') => {
@ -1101,15 +1350,6 @@ context('Governance flow - with eth and vega wallets connected', function () {
cy.get(voteButtons).contains(vote).click(); cy.get(voteButtons).contains(vote).click();
cy.contains('Casting vote...').should('be.visible'); cy.contains('Casting vote...').should('be.visible');
cy.contains('Casting vote...', txTimeout).should('not.exist'); cy.contains('Casting vote...', txTimeout).should('not.exist');
// below section temporary until #1090 fixed Casting vote in vegacapsule always says:
// Something went wrong, and your vote was not seen by the network - despite vote success
cy.navigate_to('governance');
cy.wait_for_spinner();
cy.get('@submittedProposal').within(() =>
cy.get(viewProposalButton).click()
);
cy.wait_for_spinner();
}); });
Cypress.Commands.add('wait_for_proposal_sync', () => { Cypress.Commands.add('wait_for_proposal_sync', () => {
@ -1137,5 +1377,32 @@ context('Governance flow - with eth and vega wallets connected', function () {
} }
}); });
}); });
Cypress.Commands.add(
'navigate_to_page_if_not_allready_loaded',
(section) => {
cy.url().then((url) => {
if (url != `http://localhost:4210/${section}`) {
cy.navigate_to(section);
cy.wait_for_spinner();
}
});
}
);
Cypress.Commands.add(
'get_sort_order_of_supplied_array',
(suppliedArray) => {
const tempArray = [];
for (let index = 1; index < suppliedArray.length; index++) {
tempArray.push(
suppliedArray[index - 1].localeCompare(suppliedArray[index])
);
}
if (tempArray.every((n) => n <= 0)) return 'ascending';
else if (tempArray.every((n) => n >= 0)) return 'descending';
else return 'unsorted';
}
);
}); });
}); });

View File

@ -17,10 +17,6 @@ const vegaWalletUnstakedBalance =
'[data-testid="vega-wallet-balance-unstaked"]'; '[data-testid="vega-wallet-balance-unstaked"]';
const vegaWalletStakedBalances = const vegaWalletStakedBalances =
'[data-testid="vega-wallet-balance-staked-validators"]'; '[data-testid="vega-wallet-balance-staked-validators"]';
const vegaWalletThisEpochBalances =
'[data-testid="vega-wallet-balance-this-epoch"]';
const vegaWalletNextEpochBalances =
'[data-testid="vega-wallet-balance-next-epoch"]';
const ethWalletAssociatedBalances = const ethWalletAssociatedBalances =
'[data-testid="eth-wallet-associated-balances"]'; '[data-testid="eth-wallet-associated-balances"]';
const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]'; const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]';
@ -81,12 +77,6 @@ context('Staking Tab - with eth and vega wallets connected', function () {
// 1002-STKE-033, 1002-STKE-034, 1002-STKE-037 // 1002-STKE-033, 1002-STKE-034, 1002-STKE-037
cy.staking_validator_page_add_stake('2'); cy.staking_validator_page_add_stake('2');
// 1002-STKE-038
cy.get(vegaWalletNextEpochBalances, txTimeout)
.should('contain', 2.0, txTimeout)
.and('contain', partValidatorId)
.and('contain', 'Next epoch');
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
1.0, 1.0,
@ -331,17 +321,6 @@ context('Staking Tab - with eth and vega wallets connected', function () {
// 1002-STKE-049 // 1002-STKE-049
cy.get(stakeNextEpochValue, epochTimeout).contains(2.0, epochTimeout); cy.get(stakeNextEpochValue, epochTimeout).contains(2.0, epochTimeout);
cy.get(vegaWalletNextEpochBalances, txTimeout).should(
'contain',
2.0,
txTimeout
);
cy.get(vegaWalletThisEpochBalances, txTimeout)
.should('contain', 3.0, txTimeout)
.and('contain', partValidatorId)
.and('contain', 'This Epoch');
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
2.0, 2.0,
@ -401,12 +380,6 @@ context('Staking Tab - with eth and vega wallets connected', function () {
.contains(0.0, epochTimeout) .contains(0.0, epochTimeout)
.should('be.visible'); .should('be.visible');
cy.get(vegaWalletThisEpochBalances, txTimeout).should(
'contain',
1.0,
txTimeout
);
cy.get(vegaWalletUnstakedBalance, txTimeout).should( cy.get(vegaWalletUnstakedBalance, txTimeout).should(
'contain', 'contain',
3.0, 3.0,
@ -865,9 +838,11 @@ context('Staking Tab - with eth and vega wallets connected', function () {
}); });
after( after(
'teardown wallet so state/results dont bleed into other test suites', 'teardown environment to prevent test data bleeding into other tests',
function () { function () {
cy.vega_wallet_teardown(); if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restartVegacapsuleNetwork();
}
} }
); );
}); });

View File

@ -33,7 +33,6 @@ context(
cy.ethereum_wallet_connect(); cy.ethereum_wallet_connect();
cy.navigate_to('staking'); cy.navigate_to('staking');
cy.wait_for_spinner(); cy.wait_for_spinner();
cy.wait_for_begining_of_epoch();
}); });
describe('Eth wallet - contains VEGA tokens', function () { describe('Eth wallet - contains VEGA tokens', function () {
@ -276,6 +275,15 @@ context(
cy.get(tokenAmountInputBox, { timeout: 10000 }).type(6500000); cy.get(tokenAmountInputBox, { timeout: 10000 }).type(6500000);
cy.get(tokenSubmitButton, txTimeout).should('be.disabled'); cy.get(tokenSubmitButton, txTimeout).should('be.disabled');
}); });
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restartVegacapsuleNetwork();
}
}
);
}); });
} }
); );

View File

@ -1,7 +1,10 @@
const noOpenProposals = '[data-testid="no-open-proposals"]'; const noOpenProposals = '[data-testid="no-open-proposals"]';
const noClosedProposals = '[data-testid="no-closed-proposals"]'; const noClosedProposals = '[data-testid="no-closed-proposals"]';
const proposalDocumentationLink = '[data-testid="external-link"]'; const proposalDocumentationLink = '[data-testid="external-link"]';
const newProposalButton = '[data-testid="new-proposal-link"]';
const newProposalLink = '[data-testid="new-proposal-link"]'; const newProposalLink = '[data-testid="new-proposal-link"]';
const governanceDocsUrl = 'https://vega.xyz/governance';
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
context('Governance Page - verify elements on page', function () { context('Governance Page - verify elements on page', function () {
before('navigate to governance page', function () { before('navigate to governance page', function () {
@ -17,13 +20,25 @@ context('Governance Page - verify elements on page', function () {
cy.verify_page_header('Governance'); cy.verify_page_header('Governance');
}); });
it('should be able to see link for - Find out more about Vega governance', function () { it('should be able to see a working link for - find out more about Vega governance', function () {
// 1004-VOTE-001 // 1004-VOTE-001
cy.get(proposalDocumentationLink) cy.get(proposalDocumentationLink)
.should('be.visible') .should('be.visible')
.and('have.text', 'Find out more about Vega governance') .and('have.text', 'Find out more about Vega governance')
.and('have.attr', 'href') .and('have.attr', 'href')
.and('equal', 'https://vega.xyz/governance'); .and('equal', governanceDocsUrl);
cy.request(governanceDocsUrl)
.its('body')
.then((body) => {
if (!body.includes('Govern the network')) {
assert.include(
body,
'Govern the network',
`Checking that governance link destination includes 'Govern the network' text`
);
}
});
}); });
it('should be able to see button for - new proposal', function () { it('should be able to see button for - new proposal', function () {
@ -44,5 +59,14 @@ context('Governance Page - verify elements on page', function () {
.should('be.visible') .should('be.visible')
.and('have.text', 'There are no enacted or rejected proposals'); .and('have.text', 'There are no enacted or rejected proposals');
}); });
it('should be able to see a connect wallet button - if vega wallet disconnected and new proposal button selected', function () {
cy.get(newProposalButton).should('be.visible').click();
cy.get(connectToVegaWalletButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
cy.navigate_to('governance');
cy.wait_for_spinner();
});
}); });
}); });

View File

@ -181,7 +181,11 @@ context('Ethereum Wallet - verify elements on widget', function () {
.as('unlocked'); .as('unlocked');
}) })
.then(function () { .then(function () {
expect(this.value).to.equal(this.locked + this.unlocked); expect(parseFloat(this.value).toFixed(1)).to.equal(
parseFloat(
Math.round((this.locked + this.unlocked) * 100) / 100
).toFixed(1)
);
}); });
}); });
}); });

View File

@ -36,3 +36,36 @@ Cypress.Commands.add('verify_page_header', (text) => {
Cypress.Commands.add('wait_for_spinner', () => { Cypress.Commands.add('wait_for_spinner', () => {
cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist'); cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
}); });
Cypress.Commands.add('restartVegacapsuleNetwork', () => {
Cypress.on('uncaught:exception', () => {
// stopping the network causes errors with pending transactions
// This stops those errors from preventing the teardown
return false;
});
// We stop the network twice - since it does not always shutdown correctly on first attempt
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false })
.its('stderr')
.should('contain', 'network cleaning up success');
cy.exec(
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
{ failOnNonZeroExit: false, timeout: 100000 }
)
.its('stderr')
.then((response) => {
if (!response.includes('starting network success')) {
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
cy.exec(
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
{ failOnNonZeroExit: false, timeout: 100000 }
)
.its('stderr')
.then((response) => {
return response;
});
}
})
.should('contain', 'starting network success');
});

View File

@ -15,4 +15,8 @@ Cypress.Commands.add('ethereum_wallet_connect', () => {
// this check is required since it ensures the wallet is fully (not partially) loaded // this check is required since it ensures the wallet is fully (not partially) loaded
cy.contains('Locked', { timeout: 15000 }).should('be.visible'); cy.contains('Locked', { timeout: 15000 }).should('be.visible');
}); });
// Even once eth wallet connected - attempting a transaction will fail
// It needs a few seconds before becoming operational
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(4000);
}); });

View File

@ -32,7 +32,7 @@ Cypress.Commands.add('vega_wallet_connect', () => {
.and('be.visible') .and('be.visible')
.click({ force: true }); .click({ force: true });
}); });
cy.get('button').contains('rest provider').click(); cy.contains('rest provider').click();
cy.get(restConnectorForm).within(() => { cy.get(restConnectorForm).within(() => {
cy.get('#wallet').click().type(vegaWalletName); cy.get('#wallet').click().type(vegaWalletName);
cy.get('#passphrase').click().type(vegaWalletPassphrase); cy.get('#passphrase').click().type(vegaWalletPassphrase);

View File

@ -213,7 +213,7 @@
"spam.protection.proposal.min.tokens": "1000000000000000000", "spam.protection.proposal.min.tokens": "1000000000000000000",
"spam.protection.voting.min.tokens": "1000000000000000000", "spam.protection.voting.min.tokens": "1000000000000000000",
"validators.delegation.minAmount": "100000000000000000", "validators.delegation.minAmount": "100000000000000000",
"validators.epoch.length": "6s", "validators.epoch.length": "5s",
"validators.vote.required": "0.67" "validators.vote.required": "0.67"
}, },
"network_limits": { "network_limits": {