chore(governance): additional acs added for governance proposals (#3322)

This commit is contained in:
Joe Tsang 2023-03-30 17:18:41 +01:00 committed by GitHub
parent cd35a34246
commit 1daae6a233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 21 deletions

View File

@ -56,7 +56,7 @@ describe(
navigateTo(navigation.proposals); navigateTo(navigation.proposals);
}); });
// 3001-VOTE-055 // 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 () {
createRawProposal(); createRawProposal();
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => { cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {

View File

@ -128,7 +128,7 @@ context(
.and('be.visible'); .and('be.visible');
}); });
// 3001-VOTE-048 3001-VOTE-049 // 3001-VOTE-048 3001-VOTE-049 3001-VOTE-050
it('Able to fail proposal due to lack of participation', function () { it('Able to fail proposal due to lack of participation', function () {
const proposalTitle = 'Add New free form proposal with short enactment'; const proposalTitle = 'Add New free form proposal with short enactment';
const proposalTx = createFreeFormProposalTxBody(); const proposalTx = createFreeFormProposalTxBody();

View File

@ -19,6 +19,7 @@ import {
waitForSpinner, waitForSpinner,
navigateTo, navigateTo,
navigation, navigation,
closeDialog,
} from '../../support/common.functions'; } from '../../support/common.functions';
import { import {
clickOnValidatorFromList, clickOnValidatorFromList,
@ -41,7 +42,6 @@ const vegaWalletNameElement = '[data-testid="wallet-name"]';
const vegaWallet = '[data-testid="vega-wallet"]'; const vegaWallet = '[data-testid="vega-wallet"]';
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]'; const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
const newProposalSubmitButton = '[data-testid="proposal-submit"]'; const newProposalSubmitButton = '[data-testid="proposal-submit"]';
const dialogCloseButton = '[data-testid="dialog-close"]';
const viewProposalButton = '[data-testid="view-proposal-btn"]'; const viewProposalButton = '[data-testid="view-proposal-btn"]';
const rawProposalData = '[data-testid="proposal-data"]'; const rawProposalData = '[data-testid="proposal-data"]';
const minVoteButton = '[data-testid="min-vote"]'; const minVoteButton = '[data-testid="min-vote"]';
@ -177,7 +177,7 @@ context(
'be.visible' 'be.visible'
); );
cy.contains('Proposal rejected', proposalTimeout).should('be.visible'); cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); closeDialog();
waitForProposalSync(); waitForProposalSync();
navigateTo(navigation.proposals); navigateTo(navigation.proposals);
cy.get(rejectProposalsLink).click(); cy.get(rejectProposalsLink).click();
@ -214,7 +214,7 @@ context(
enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8)); enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8));
cy.contains('Transaction failed', proposalTimeout).should('be.visible'); cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError).should('have.text', errorMsg); cy.get(feedbackError).should('have.text', errorMsg);
cy.get(dialogCloseButton).click(); closeDialog();
}); });
// 3002-PROP-009 // 3002-PROP-009
@ -227,7 +227,7 @@ context(
enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8)); enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8));
cy.contains('Transaction failed', proposalTimeout).should('be.visible'); cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError).should('have.text', errorMsg); cy.get(feedbackError).should('have.text', errorMsg);
cy.get(dialogCloseButton).click(); closeDialog();
}); });
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () { it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
@ -251,7 +251,7 @@ context(
cy.contains('Transaction failed', proposalTimeout).should('be.visible'); cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError).should('have.text', errorMsg); cy.get(feedbackError).should('have.text', errorMsg);
cy.get(dialogCloseButton).click(); closeDialog();
cy.get(rawProposalData) cy.get(rawProposalData)
.invoke('val') .invoke('val')
.should('contain', "i shouldn't be here"); .should('contain', "i shouldn't be here");
@ -279,7 +279,7 @@ context(
cy.contains('Transaction failed', proposalTimeout).should('be.visible'); cy.contains('Transaction failed', proposalTimeout).should('be.visible');
cy.get(feedbackError).should('have.text', errorMsg); cy.get(feedbackError).should('have.text', errorMsg);
cy.get(dialogCloseButton).click(); closeDialog();
}); });
// 1005-PROP-009 // 1005-PROP-009

View File

@ -1,4 +1,5 @@
import { import {
closeDialog,
navigateTo, navigateTo,
navigation, navigation,
waitForSpinner, waitForSpinner,
@ -39,7 +40,6 @@ const maxVoteDeadline = '[data-testid="max-vote"]';
const minValidationDeadline = '[data-testid="min-validation"]'; const minValidationDeadline = '[data-testid="min-validation"]';
const minEnactDeadline = '[data-testid="min-enactment"]'; const minEnactDeadline = '[data-testid="min-enactment"]';
const maxEnactDeadline = '[data-testid="max-enactment"]'; const maxEnactDeadline = '[data-testid="max-enactment"]';
const dialogCloseButton = '[data-testid="dialog-close"]';
const inputError = '[data-testid="input-error-text"]'; const inputError = '[data-testid="input-error-text"]';
const enactmentDeadlineError = const enactmentDeadlineError =
'[data-testid="enactment-before-voting-deadline"]'; '[data-testid="enactment-before-voting-deadline"]';
@ -48,6 +48,7 @@ const feedbackError = '[data-testid="Error"]';
const viewProposalBtn = 'view-proposal-btn'; const viewProposalBtn = 'view-proposal-btn';
const liquidityVoteStatus = 'liquidity-votes-status'; const liquidityVoteStatus = 'liquidity-votes-status';
const tokenVoteStatus = 'token-votes-status'; const tokenVoteStatus = 'token-votes-status';
const proposalTermsSection = 'proposal';
const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey'); const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey');
const epochTimeout = Cypress.env('epochTimeout'); const epochTimeout = Cypress.env('epochTimeout');
const proposalTimeout = { timeout: 14000 }; const proposalTimeout = { timeout: 14000 };
@ -68,7 +69,6 @@ context(
{ tags: '@slow' }, { tags: '@slow' },
function () { function () {
before('connect wallets and set approval limit', function () { before('connect wallets and set approval limit', function () {
cy.createMarket();
cy.visit('/'); cy.visit('/');
vegaWalletSetSpecifiedApprovalAmount('1000'); vegaWalletSetSpecifiedApprovalAmount('1000');
}); });
@ -78,6 +78,7 @@ context(
waitForSpinner(); waitForSpinner();
cy.connectVegaWallet(); cy.connectVegaWallet();
ethereumWalletConnect(); ethereumWalletConnect();
cy.createMarket();
ensureSpecifiedUnstakedTokensAreAssociated('1'); ensureSpecifiedUnstakedTokensAreAssociated('1');
navigateTo(navigation.proposals); navigateTo(navigation.proposals);
}); });
@ -194,7 +195,7 @@ context(
'have.text', 'have.text',
'Invalid params: proposal_submission.terms.closing_timestamp (cannot be after enactment time)' 'Invalid params: proposal_submission.terms.closing_timestamp (cannot be after enactment time)'
); );
cy.get(dialogCloseButton).click(); closeDialog();
cy.get(minVoteDeadline).click(); cy.get(minVoteDeadline).click();
cy.get(enactmentDeadlineError).should('not.exist'); cy.get(enactmentDeadlineError).should('not.exist');
}); });
@ -286,7 +287,7 @@ context(
); );
}); });
// 3001-VOTE-092 // 3001-VOTE-092 3004-PMAC-001
it('Able to submit update market proposal and vote for proposal', function () { it('Able to submit update market proposal and vote for proposal', function () {
vegaWalletFaucetAssetsWithoutCheck( vegaWalletFaucetAssetsWithoutCheck(
'fUSDC', 'fUSDC',
@ -347,8 +348,9 @@ context(
// 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001 // 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001
it('Able to submit new asset proposal using min deadlines', function () { it('Able to submit new asset proposal using min deadlines', function () {
const proposalTitle = 'Test new asset proposal';
goToMakeNewProposal(governanceProposalType.NEW_ASSET); goToMakeNewProposal(governanceProposalType.NEW_ASSET);
cy.get(newProposalTitle).type('Test new asset proposal'); cy.get(newProposalTitle).type(proposalTitle);
cy.get(newProposalDescription).type('E2E test for proposals'); cy.get(newProposalDescription).type('E2E test for proposals');
cy.fixture('/proposals/new-asset').then((newAssetProposal) => { cy.fixture('/proposals/new-asset').then((newAssetProposal) => {
const newAssetPayload = JSON.stringify(newAssetProposal); const newAssetPayload = JSON.stringify(newAssetProposal);
@ -367,7 +369,7 @@ context(
cy.contains('Proposal waiting for node vote', proposalTimeout).should( cy.contains('Proposal waiting for node vote', proposalTimeout).should(
'be.visible' 'be.visible'
); );
cy.get(dialogCloseButton).click(); closeDialog();
cy.get(newProposalSubmitButton).should('be.visible').click(); cy.get(newProposalSubmitButton).should('be.visible').click();
// cannot submit a proposal with ERC20 address already in use // cannot submit a proposal with ERC20 address already in use
cy.contains('Proposal rejected', proposalTimeout).should('be.visible'); cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
@ -377,6 +379,17 @@ context(
'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE' 'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE'
); );
}); });
closeDialog();
navigateTo(navigation.proposals);
cy.contains(proposalTitle)
.parentsUntil(proposalListItem)
.within(() => {
cy.getByTestId(viewProposalBtn).click();
});
cy.getByTestId(proposalTermsSection).within(() => {
cy.contains('USDT Coin').should('be.visible');
cy.contains('USDT').should('be.visible');
});
}); });
it('Unable to submit new asset proposal with missing/invalid fields', function () { it('Unable to submit new asset proposal with missing/invalid fields', function () {
@ -415,9 +428,15 @@ context(
getProposalInformationFromTable('Proposed enactment') // 3001-VOTE-044 getProposalInformationFromTable('Proposed enactment') // 3001-VOTE-044
.invoke('text') .invoke('text')
.should('not.be.empty'); .should('not.be.empty');
// 3001-VOTE-030 3001-VOTE-031
cy.getByTestId(proposalTermsSection).within(() => {
cy.contains('UpdateAsset').should('be.visible');
cy.contains('UpdateERC20').should('be.visible');
cy.contains('"lifetimeLimit": "10"').should('be.visible');
});
}); });
it('Able to submit update asset proposal using max deadline', function () { it.only('Able to submit update asset proposal using max deadline', function () {
goToMakeNewProposal(governanceProposalType.UPDATE_ASSET); goToMakeNewProposal(governanceProposalType.UPDATE_ASSET);
enterUpdateAssetProposalDetails(); enterUpdateAssetProposalDetails();
cy.get(maxVoteDeadline).click(); cy.get(maxVoteDeadline).click();

View File

@ -183,6 +183,7 @@ context(
// 1004-ASSO-018 // 1004-ASSO-018
// 1004-ASSO-024 // 1004-ASSO-024
// 1004-ASSO-023 // 1004-ASSO-023
// 1004-ASSO-032
stakingPageAssociateTokens('2', { stakingPageAssociateTokens('2', {
type: 'contract', type: 'contract',

View File

@ -84,3 +84,7 @@ export function verifyEthWalletAssociatedBalance(amount: string) {
.parent(txTimeout) .parent(txTimeout)
.should('contain', amount, txTimeout); .should('contain', amount, txTimeout);
} }
export function closeDialog() {
cy.getByTestId('dialog-close').click();
}

View File

@ -1,4 +1,4 @@
import { navigateTo, navigation } from './common.functions'; import { closeDialog, navigateTo, navigation } from './common.functions';
import { ensureSpecifiedUnstakedTokensAreAssociated } from './staking.functions'; import { ensureSpecifiedUnstakedTokensAreAssociated } from './staking.functions';
const newProposalButton = '[data-testid="new-proposal-link"]'; const newProposalButton = '[data-testid="new-proposal-link"]';
@ -12,7 +12,6 @@ const voteButtons = '[data-testid="vote-buttons"]';
const dialogTitle = '[data-testid="dialog-title"]'; const dialogTitle = '[data-testid="dialog-title"]';
const proposalVoteDeadline = '[data-testid="proposal-vote-deadline"]'; const proposalVoteDeadline = '[data-testid="proposal-vote-deadline"]';
const newProposalSubmitButton = '[data-testid="proposal-submit"]'; const newProposalSubmitButton = '[data-testid="proposal-submit"]';
const dialogCloseButton = '[data-testid="dialog-close"]';
const epochTimeout = Cypress.env('epochTimeout'); const epochTimeout = Cypress.env('epochTimeout');
const proposalTimeout = { timeout: 14000 }; const proposalTimeout = { timeout: 14000 };
@ -125,7 +124,7 @@ export function voteForProposal(vote: string) {
'have.text', 'have.text',
'Transaction complete' 'Transaction complete'
); );
cy.get(dialogCloseButton).click(); closeDialog();
} }
export function waitForProposalSync() { export function waitForProposalSync() {
@ -176,7 +175,7 @@ export function waitForProposalSubmitted() {
'be.visible' 'be.visible'
); );
cy.contains('Proposal submitted', proposalTimeout).should('be.visible'); cy.contains('Proposal submitted', proposalTimeout).should('be.visible');
cy.get(dialogCloseButton).click(); closeDialog();
} }
export function createRawProposal(proposerBalance?: string) { export function createRawProposal(proposerBalance?: string) {

View File

@ -1,3 +1,4 @@
import { closeDialog } from './common.functions';
import { vegaWalletTeardown } from './wallet-teardown.functions'; import { vegaWalletTeardown } from './wallet-teardown.functions';
const tokenAmountInputBox = '[data-testid="token-amount-input"]'; const tokenAmountInputBox = '[data-testid="token-amount-input"]';
@ -18,7 +19,6 @@ const stakeValidatorListTotalStake = 'total-stake';
const stakeValidatorListTotalShare = 'total-stake-share'; const stakeValidatorListTotalShare = 'total-stake-share';
const stakeValidatorListName = '[col-id="validator"]'; const stakeValidatorListName = '[col-id="validator"]';
const vegaKeySelector = '#vega-key-selector'; const vegaKeySelector = '#vega-key-selector';
const dialogCloseButton = '[data-testid="dialog-close"]';
const txTimeout = Cypress.env('txTimeout'); const txTimeout = Cypress.env('txTimeout');
const epochTimeout = Cypress.env('epochTimeout'); const epochTimeout = Cypress.env('epochTimeout');
@ -54,7 +54,7 @@ export function stakingValidatorPageRemoveStake(stake: string) {
.and('contain', `Remove ${stake} $VEGA tokens at the end of epoch`) .and('contain', `Remove ${stake} $VEGA tokens at the end of epoch`)
.and('be.visible') .and('be.visible')
.click(); .click();
cy.get(dialogCloseButton).click(); closeDialog();
} }
export function stakingPageAssociateTokens( export function stakingPageAssociateTokens(