test(governance): e2e network upgrade proposal tests (#3477)
This commit is contained in:
parent
b0f1aeedae
commit
a1bfe7f1a7
38
apps/governance-e2e/src/fixtures/mocks/network-upgrade.ts
Normal file
38
apps/governance-e2e/src/fixtures/mocks/network-upgrade.ts
Normal file
@ -0,0 +1,38 @@
|
||||
export const upgradeProposalsData = {
|
||||
lastBlockHeight: '2014133',
|
||||
protocolUpgradeProposals: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
upgradeBlockHeight: '2015942',
|
||||
vegaReleaseTag: 'v1',
|
||||
approvers: [
|
||||
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
|
||||
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
|
||||
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
|
||||
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
|
||||
],
|
||||
status: 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED',
|
||||
__typename: 'ProtocolUpgradeProposal',
|
||||
},
|
||||
__typename: 'ProtocolUpgradeProposalEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
upgradeBlockHeight: '1955065',
|
||||
vegaReleaseTag: 'v0.71.0+dev-12156-bca1d57e',
|
||||
approvers: [
|
||||
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
|
||||
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
|
||||
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
|
||||
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
|
||||
],
|
||||
status: 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED',
|
||||
__typename: 'ProtocolUpgradeProposal',
|
||||
},
|
||||
__typename: 'ProtocolUpgradeProposalEdge',
|
||||
},
|
||||
],
|
||||
__typename: 'ProtocolUpgradeProposalConnection',
|
||||
},
|
||||
};
|
117
apps/governance-e2e/src/fixtures/mocks/nodes.ts
Normal file
117
apps/governance-e2e/src/fixtures/mocks/nodes.ts
Normal file
@ -0,0 +1,117 @@
|
||||
export const nodeData = {
|
||||
epoch: {
|
||||
id: '204731',
|
||||
timestamps: {
|
||||
start: '2023-04-14T09:30:09.452005Z',
|
||||
end: null,
|
||||
expiry: '2023-04-14T09:31:09.452005Z',
|
||||
__typename: 'EpochTimestamps',
|
||||
},
|
||||
__typename: 'Epoch',
|
||||
},
|
||||
nodesConnection: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
avatarUrl:
|
||||
'https://www.gravatar.com/avatar/y2hwc4xjds7zvlam3y4in94q2rcdimsn?d=identicon',
|
||||
id: 'f337b5cc50c49a928e49129a2eca62277a81b4b7336b6e4131f8f0431e8db029',
|
||||
name: 'lovely-fisherman',
|
||||
pubkey:
|
||||
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
|
||||
stakedByOperator: '3000000000000000000000',
|
||||
stakedByDelegates: '0',
|
||||
stakedTotal: '3000000000000000000000',
|
||||
pendingStake: '0',
|
||||
rankingScore: {
|
||||
rankingScore: '0.4999166805532412',
|
||||
stakeScore: '0.2499583402766206',
|
||||
performanceScore: '1',
|
||||
votingPower: '2499',
|
||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
||||
__typename: 'RankingScore',
|
||||
},
|
||||
__typename: 'Node',
|
||||
},
|
||||
__typename: 'NodeEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
avatarUrl:
|
||||
'https://www.gravatar.com/avatar/g1tw70qnoo0tf8ror30jefwhae92zy16?d=identicon',
|
||||
id: 'cdadcf885556e372b6b39679d6ad46854d1d9c1e982da7ff2929544df01f9088',
|
||||
name: 'magnificent-door',
|
||||
pubkey:
|
||||
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
|
||||
stakedByOperator: '3000000000000000000000',
|
||||
stakedByDelegates: '0',
|
||||
stakedTotal: '3000000000000000000000',
|
||||
pendingStake: '0',
|
||||
rankingScore: {
|
||||
rankingScore: '0.4999166805532412',
|
||||
stakeScore: '0.2499583402766206',
|
||||
performanceScore: '1',
|
||||
votingPower: '2499',
|
||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
||||
__typename: 'RankingScore',
|
||||
},
|
||||
__typename: 'Node',
|
||||
},
|
||||
__typename: 'NodeEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
avatarUrl:
|
||||
'https://www.gravatar.com/avatar/s2e7hp7soq5zdhxeap7p21onetsjiy6w?d=identicon',
|
||||
id: '9a13de2548fef30d928e71e76004c98ec7ad9d8fc3ddcd16ddee210b28ea4cfc',
|
||||
name: 'helpful-tree',
|
||||
pubkey:
|
||||
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
|
||||
stakedByOperator: '3000000000000000000000',
|
||||
stakedByDelegates: '2000000000000000000',
|
||||
stakedTotal: '3002000000000000000000',
|
||||
pendingStake: '0',
|
||||
rankingScore: {
|
||||
rankingScore: '0.5002499583402766',
|
||||
stakeScore: '0.2501249791701383',
|
||||
performanceScore: '1',
|
||||
votingPower: '2501',
|
||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
||||
__typename: 'RankingScore',
|
||||
},
|
||||
__typename: 'Node',
|
||||
},
|
||||
__typename: 'NodeEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
avatarUrl:
|
||||
'https://www.gravatar.com/avatar/3gop683kg2cvd8rpv286hzagqt3yjsdq?d=identicon',
|
||||
id: '93ac271ab95038333587e47d11461e6edc0126e6e77156281c545f4c5650a6d0',
|
||||
name: 'easy-cookie',
|
||||
pubkey:
|
||||
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
|
||||
stakedByOperator: '3000000000000000000000',
|
||||
stakedByDelegates: '0',
|
||||
stakedTotal: '3000000000000000000000',
|
||||
pendingStake: '0',
|
||||
rankingScore: {
|
||||
rankingScore: '0.4999166805532412',
|
||||
stakeScore: '0.2499583402766206',
|
||||
performanceScore: '1',
|
||||
votingPower: '2499',
|
||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
||||
__typename: 'RankingScore',
|
||||
},
|
||||
__typename: 'Node',
|
||||
},
|
||||
__typename: 'NodeEdge',
|
||||
},
|
||||
],
|
||||
__typename: 'NodesConnection',
|
||||
},
|
||||
nodeData: {
|
||||
stakedTotal: '12002000000000000000000',
|
||||
__typename: 'NodeData',
|
||||
},
|
||||
};
|
325
apps/governance-e2e/src/fixtures/mocks/proposals.ts
Normal file
325
apps/governance-e2e/src/fixtures/mocks/proposals.ts
Normal file
@ -0,0 +1,325 @@
|
||||
export const proposalsData = {
|
||||
proposalsConnection: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
id: 'e8ba9d268e12514644fd1fc7ff289292f4ce6489cc32cc73133aea52c04aef89',
|
||||
rationale: {
|
||||
title: 'Add asset Wrapped Ether',
|
||||
description: 'Proposal to add asset WETH to Vega network',
|
||||
__typename: 'ProposalRationale',
|
||||
},
|
||||
reference: '',
|
||||
state: 'STATE_OPEN',
|
||||
datetime: '2026-12-01T11:41:28.654288Z',
|
||||
rejectionReason: null,
|
||||
party: {
|
||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
||||
__typename: 'Party',
|
||||
},
|
||||
errorDetails: null,
|
||||
terms: {
|
||||
closingDatetime: '2026-12-01T11:45:33Z',
|
||||
enactmentDatetime: '2026-12-01T11:45:43Z',
|
||||
change: {
|
||||
name: 'Wrapped Ether',
|
||||
symbol: 'WETH',
|
||||
decimals: 18,
|
||||
quantum: '0.0008',
|
||||
source: {
|
||||
contractAddress: '0x9B18C6CaD886D5653783E2B25759124760F4407F',
|
||||
withdrawThreshold: '1',
|
||||
lifetimeLimit: '400000000000000000',
|
||||
__typename: 'ERC20',
|
||||
},
|
||||
__typename: 'NewAsset',
|
||||
},
|
||||
__typename: 'ProposalTerms',
|
||||
},
|
||||
votes: {
|
||||
yes: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
no: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
__typename: 'ProposalVotes',
|
||||
},
|
||||
__typename: 'Proposal',
|
||||
},
|
||||
__typename: 'ProposalEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
id: 'd848fc7881f13d366df5f61ab139d5fcfa72bf838151bb51b54381870e357931',
|
||||
rationale: {
|
||||
title: 'Add asset Dai Stablecoin',
|
||||
description: 'Proposal to add asset DAI to Vega network',
|
||||
__typename: 'ProposalRationale',
|
||||
},
|
||||
reference: '',
|
||||
state: 'STATE_ENACTED',
|
||||
datetime: '2022-11-29T15:49:57.80978Z',
|
||||
rejectionReason: null,
|
||||
party: {
|
||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
||||
__typename: 'Party',
|
||||
},
|
||||
errorDetails: null,
|
||||
terms: {
|
||||
closingDatetime: '2023-04-13T15:52:58Z',
|
||||
enactmentDatetime: '2023-04-13T15:53:08Z',
|
||||
change: {
|
||||
name: 'Dai Stablecoin',
|
||||
symbol: 'DAI',
|
||||
decimals: 18,
|
||||
quantum: '1',
|
||||
source: {
|
||||
contractAddress: '0xad018fB8ec00bfd622B91C83E684a6AC7bB8fbA4',
|
||||
withdrawThreshold: '1',
|
||||
lifetimeLimit: '500000000000000000000',
|
||||
__typename: 'ERC20',
|
||||
},
|
||||
__typename: 'NewAsset',
|
||||
},
|
||||
__typename: 'ProposalTerms',
|
||||
},
|
||||
votes: {
|
||||
yes: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
no: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
__typename: 'ProposalVotes',
|
||||
},
|
||||
__typename: 'Proposal',
|
||||
},
|
||||
__typename: 'ProposalEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
id: 'ccbd651b4a1167fd73c4a0340ac759fa0a31ca487ad46a13254b741ad71947ed',
|
||||
rationale: {
|
||||
title: 'New DAI market',
|
||||
description: 'New DAI market',
|
||||
__typename: 'ProposalRationale',
|
||||
},
|
||||
reference: '0VFQusmmESdrP5GuL8naB6lxfoE3RPGaEeo7abdN',
|
||||
state: 'STATE_ENACTED',
|
||||
datetime: '2022-11-26T19:36:19.26034Z',
|
||||
rejectionReason: null,
|
||||
party: {
|
||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
||||
__typename: 'Party',
|
||||
},
|
||||
errorDetails: null,
|
||||
terms: {
|
||||
closingDatetime: '2022-11-26T19:36:42Z',
|
||||
enactmentDatetime: '2023-03-22T13:57:37Z',
|
||||
change: {
|
||||
instrument: {
|
||||
name: 'UNIDAI Monthly (Dec 2022)',
|
||||
code: 'UNIDAI.MF21',
|
||||
futureProduct: {
|
||||
settlementAsset: { symbol: 'tDAI', __typename: 'Asset' },
|
||||
__typename: 'FutureProduct',
|
||||
},
|
||||
__typename: 'InstrumentConfiguration',
|
||||
},
|
||||
__typename: 'NewMarket',
|
||||
},
|
||||
__typename: 'ProposalTerms',
|
||||
},
|
||||
votes: {
|
||||
yes: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
no: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
__typename: 'ProposalVotes',
|
||||
},
|
||||
__typename: 'Proposal',
|
||||
},
|
||||
__typename: 'ProposalEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
id: 'bc70383f0e9515b15542cf4c63590cd2ca46b3363ba7c4a72af0e62112b3951b',
|
||||
rationale: {
|
||||
title: 'USDC-III',
|
||||
description: 'USDC-III D List test',
|
||||
__typename: 'ProposalRationale',
|
||||
},
|
||||
reference: '',
|
||||
state: 'STATE_ENACTED',
|
||||
datetime: '2022-11-22T15:17:28.829605Z',
|
||||
rejectionReason: null,
|
||||
party: {
|
||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
||||
__typename: 'Party',
|
||||
},
|
||||
errorDetails: null,
|
||||
terms: {
|
||||
closingDatetime: '2022-11-22T15:18:56Z',
|
||||
enactmentDatetime: '2022-11-22T15:19:06Z',
|
||||
change: {
|
||||
name: 'USDC-III',
|
||||
symbol: 'USDC-III',
|
||||
decimals: 18,
|
||||
quantum: '1',
|
||||
source: {
|
||||
contractAddress: '0x1F1A067aEC530b66BA5128C9Db76825eC22c3C6b',
|
||||
withdrawThreshold: '100000000000000000000000000',
|
||||
lifetimeLimit: '1000000000000000000000000000',
|
||||
__typename: 'ERC20',
|
||||
},
|
||||
__typename: 'NewAsset',
|
||||
},
|
||||
__typename: 'ProposalTerms',
|
||||
},
|
||||
votes: {
|
||||
yes: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
no: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
__typename: 'ProposalVotes',
|
||||
},
|
||||
__typename: 'Proposal',
|
||||
},
|
||||
__typename: 'ProposalEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
id: '9d9b2a9d0179d0e4ccb317f6c4a5db0b905d893190bfb5e5499985ef313281c8',
|
||||
rationale: {
|
||||
title: 'New BTC market',
|
||||
description: 'New BTC market',
|
||||
__typename: 'ProposalRationale',
|
||||
},
|
||||
reference: 'AXeRWS3TvLBFDgWOSHQpKFJf3NTbnWK6310q02fZ',
|
||||
state: 'STATE_ENACTED',
|
||||
datetime: '2022-11-26T19:36:19.26034Z',
|
||||
rejectionReason: null,
|
||||
party: {
|
||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
||||
__typename: 'Party',
|
||||
},
|
||||
errorDetails: null,
|
||||
terms: {
|
||||
closingDatetime: '2022-11-26T19:36:42Z',
|
||||
enactmentDatetime: '2023-03-22T13:57:37Z',
|
||||
change: {
|
||||
instrument: {
|
||||
name: 'ETHBTC Quarterly (Feb 2023)',
|
||||
code: 'ETHBTC.QM21',
|
||||
futureProduct: {
|
||||
settlementAsset: { symbol: 'tBTC', __typename: 'Asset' },
|
||||
__typename: 'FutureProduct',
|
||||
},
|
||||
__typename: 'InstrumentConfiguration',
|
||||
},
|
||||
__typename: 'NewMarket',
|
||||
},
|
||||
__typename: 'ProposalTerms',
|
||||
},
|
||||
votes: {
|
||||
yes: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
no: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
__typename: 'ProposalVotes',
|
||||
},
|
||||
__typename: 'Proposal',
|
||||
},
|
||||
__typename: 'ProposalEdge',
|
||||
},
|
||||
{
|
||||
node: {
|
||||
id: '9c48796e7988769ededc2b2b02220b00e93f65f23e8141bf1fd23a6983d95943',
|
||||
rationale: {
|
||||
title: 'Update governance.proposal.asset.requiredMajority',
|
||||
description:
|
||||
'Proposal to update governance.proposal.asset.requiredMajority to 300}',
|
||||
__typename: 'ProposalRationale',
|
||||
},
|
||||
reference: '',
|
||||
state: 'STATE_ENACTED',
|
||||
datetime: '2022-11-22T13:22:52.370655Z',
|
||||
rejectionReason: null,
|
||||
party: {
|
||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
||||
__typename: 'Party',
|
||||
},
|
||||
errorDetails: null,
|
||||
terms: {
|
||||
closingDatetime: '2022-11-22T13:27:13Z',
|
||||
enactmentDatetime: '2022-11-22T13:27:33Z',
|
||||
change: {
|
||||
networkParameter: {
|
||||
key: 'governance.proposal.asset.requiredParticipation',
|
||||
value: '0.000001',
|
||||
__typename: 'NetworkParameter',
|
||||
},
|
||||
__typename: 'UpdateNetworkParameter',
|
||||
},
|
||||
__typename: 'ProposalTerms',
|
||||
},
|
||||
votes: {
|
||||
yes: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
no: {
|
||||
totalTokens: '0',
|
||||
totalNumber: '0',
|
||||
totalEquityLikeShareWeight: '0',
|
||||
__typename: 'ProposalVoteSide',
|
||||
},
|
||||
__typename: 'ProposalVotes',
|
||||
},
|
||||
__typename: 'Proposal',
|
||||
},
|
||||
__typename: 'ProposalEdge',
|
||||
},
|
||||
],
|
||||
__typename: 'ProposalsConnection',
|
||||
},
|
||||
};
|
@ -3,11 +3,14 @@ import {
|
||||
navigation,
|
||||
verifyPageHeader,
|
||||
verifyTabHighlighted,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
goToMakeNewProposal,
|
||||
governanceProposalType,
|
||||
} from '../../support/governance.functions';
|
||||
import { mockNetworkUpgradeProposal } from '../../support/proposal.functions';
|
||||
|
||||
const proposalDocumentationLink = '[data-testid="proposal-documentation-link"]';
|
||||
const newProposalButton = '[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"]';
|
||||
@ -21,56 +24,140 @@ context(
|
||||
navigateTo(navigation.proposals);
|
||||
});
|
||||
|
||||
describe('with no network change proposals', function () {
|
||||
it('should have governance tab highlighted', function () {
|
||||
verifyTabHighlighted(navigation.proposals);
|
||||
it('should have governance tab highlighted', function () {
|
||||
verifyTabHighlighted(navigation.proposals);
|
||||
});
|
||||
|
||||
it('should have GOVERNANCE header visible', function () {
|
||||
verifyPageHeader('Proposals');
|
||||
});
|
||||
|
||||
it('should be able to see a working link for - find out more about Vega governance', function () {
|
||||
// 3001-VOTE-001
|
||||
cy.get(proposalDocumentationLink)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Find out more about Vega governance')
|
||||
.and('have.attr', 'href')
|
||||
.and('equal', governanceDocsUrl);
|
||||
|
||||
// 3002-PROP-001
|
||||
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 () {
|
||||
// 3001-VOTE-002
|
||||
cy.get(newProposalLink)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'New proposal')
|
||||
.and('have.attr', 'href')
|
||||
.and('equal', '/proposals/propose');
|
||||
});
|
||||
|
||||
it('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () {
|
||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
||||
cy.get(connectToVegaWalletButton)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Connect Vega wallet');
|
||||
});
|
||||
|
||||
it('should see open network upgrade proposal on homepage', function () {
|
||||
mockNetworkUpgradeProposal();
|
||||
cy.visit('/');
|
||||
cy.getByTestId('home-proposal-list').within(() => {
|
||||
cy.getByTestId('protocol-upgrade-proposals-list-item').should('exist');
|
||||
cy.getByTestId('protocol-upgrade-proposal-title').should(
|
||||
'have.text',
|
||||
'Vega release v1'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('should have GOVERNANCE header visible', function () {
|
||||
verifyPageHeader('Proposals');
|
||||
});
|
||||
|
||||
it('should be able to see a working link for - find out more about Vega governance', function () {
|
||||
// 3001-VOTE-001
|
||||
cy.get(proposalDocumentationLink)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Find out more about Vega governance')
|
||||
.and('have.attr', 'href')
|
||||
.and('equal', governanceDocsUrl);
|
||||
|
||||
// 3002-PROP-001
|
||||
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 see network upgrade proposals in proposals list', function () {
|
||||
mockNetworkUpgradeProposal();
|
||||
navigateTo(navigation.proposals);
|
||||
cy.getByTestId('open-proposals').within(() => {
|
||||
cy.get('li')
|
||||
.eq(0)
|
||||
.should(
|
||||
'have.attr',
|
||||
'data-testid',
|
||||
'protocol-upgrade-proposals-list-item'
|
||||
)
|
||||
.within(() => {
|
||||
cy.get('h2').should('have.text', 'Vega release v1');
|
||||
cy.getByTestId('protocol-upgrade-proposal-type').should(
|
||||
'have.text',
|
||||
'Network Upgrade'
|
||||
);
|
||||
cy.getByTestId('protocol-upgrade-proposal-release-tag').should(
|
||||
'have.text',
|
||||
'Vega release tagv1'
|
||||
);
|
||||
cy.getByTestId('protocol-upgrade-proposal-block-height').should(
|
||||
'have.text',
|
||||
'Upgrade block height2015942'
|
||||
);
|
||||
cy.getByTestId('protocol-upgrade-proposal-status').should(
|
||||
'have.text',
|
||||
'Approved'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to see button for - new proposal', function () {
|
||||
// 3001-VOTE-002
|
||||
cy.get(newProposalLink)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'New proposal')
|
||||
.and('have.attr', 'href')
|
||||
.and('equal', '/proposals/propose');
|
||||
cy.getByTestId('closed-proposals').within(() => {
|
||||
cy.getByTestId('protocol-upgrade-proposals-list-item').should(
|
||||
'have.length',
|
||||
1
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// Skipping this test for now, the new proposal button no longer takes a user directly
|
||||
// to a proposal form, instead it takes them to a page where they can select a proposal type.
|
||||
// Keeping this test here for now as it can be repurposed to test the new proposal forms.
|
||||
it.skip('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');
|
||||
navigateTo(navigation.proposals);
|
||||
waitForSpinner();
|
||||
it('should see details of network upgrade proposal', function () {
|
||||
mockNetworkUpgradeProposal();
|
||||
navigateTo(navigation.proposals);
|
||||
cy.getByTestId('protocol-upgrade-proposals-list-item')
|
||||
.first()
|
||||
.find('[data-testid="view-proposal-btn"]')
|
||||
.click();
|
||||
cy.getByTestId('protocol-upgrade-proposal').within(() => {
|
||||
cy.get('h1').should('have.text', 'Vega Release v1');
|
||||
cy.getByTestId('protocol-upgrade-block-height').should(
|
||||
'have.text',
|
||||
'2015942 (currently 2014133)'
|
||||
);
|
||||
cy.getByTestId('protocol-upgrade-state').should(
|
||||
'have.text',
|
||||
'Approved'
|
||||
);
|
||||
cy.getByTestId('protocol-upgrade-release-tag').should(
|
||||
'have.text',
|
||||
'v1'
|
||||
);
|
||||
cy.getByTestId('protocol-upgrade-approval-status')
|
||||
.should('contain.text', '99.98% approval (% validator voting power)')
|
||||
.and('contain.text', '(67% voting power required)');
|
||||
cy.get('h2').should('contain.text', 'Approvers (4/4 validators)');
|
||||
cy.getByTestId('validator-name')
|
||||
.should('have.length', 4)
|
||||
.each(($validator) => {
|
||||
cy.wrap($validator).find('a').should('have.attr', 'href');
|
||||
});
|
||||
cy.getByTestId('validator-voting-power').each(
|
||||
($validatorVotingPower) => {
|
||||
cy.wrap($validatorVotingPower)
|
||||
.invoke('text')
|
||||
.should('contain', '%');
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { addSeconds, millisecondsToSeconds } from 'date-fns';
|
||||
import type { ProposalSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
||||
import { upgradeProposalsData } from '../fixtures/mocks/network-upgrade';
|
||||
import { proposalsData } from '../fixtures/mocks/proposals';
|
||||
import { nodeData } from '../fixtures/mocks/nodes';
|
||||
|
||||
export function createUpdateNetworkProposalTxBody(): ProposalSubmissionBody {
|
||||
const MIN_CLOSE_SEC = 5;
|
||||
@ -80,3 +84,11 @@ export function createFreeFormProposalTxBody(): ProposalSubmissionBody {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function mockNetworkUpgradeProposal() {
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'Nodes', nodeData);
|
||||
aliasGQLQuery(req, 'Proposals', proposalsData);
|
||||
aliasGQLQuery(req, 'ProtocolUpgrades', upgradeProposalsData);
|
||||
});
|
||||
}
|
||||
|
@ -57,10 +57,7 @@ export const ProtocolUpdateProposalDetailApprovals = ({
|
||||
noBorder={index === consensusApprovals?.length - 1}
|
||||
key={validator.pubkey}
|
||||
>
|
||||
<div
|
||||
className="-mb-3 mt-1"
|
||||
data-testid={`validator-${validator.id}`}
|
||||
>
|
||||
<div className="-mb-3 mt-1" data-testid={'validator-name'}>
|
||||
<ValidatorDetailsLink
|
||||
id={validator.id}
|
||||
avatarUrl={validator.avatarUrl}
|
||||
@ -68,7 +65,7 @@ export const ProtocolUpdateProposalDetailApprovals = ({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span>
|
||||
<span data-testid="validator-voting-power">
|
||||
{getNormalisedVotingPower(
|
||||
validator.rankingScore.votingPower,
|
||||
2
|
||||
|
@ -63,7 +63,7 @@ describe('ProtocolUpdateProposalDetailApprovals', () => {
|
||||
|
||||
it('renders the correct number of consensus approvers', () => {
|
||||
renderComponent();
|
||||
const validators = screen.getAllByTestId(/validator-/i);
|
||||
const validators = screen.getAllByTestId(/validator-name/);
|
||||
expect(validators.length).toBe(mockValidators.length);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user