chore(governance): nightly e2e test fixes (#4038)
This commit is contained in:
parent
0d96c487d9
commit
a01e48d508
2
.github/workflows/cypress-run.yml
vendored
2
.github/workflows/cypress-run.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
project: ${{ fromJSON(inputs.projects) }}
|
project: ${{ fromJSON(inputs.projects) }}
|
||||||
name: ${{ matrix.project }}
|
name: ${{ matrix.project }}
|
||||||
runs-on: self-hosted-runner
|
runs-on: self-hosted-runner
|
||||||
timeout-minutes: 60
|
timeout-minutes: 100
|
||||||
steps:
|
steps:
|
||||||
# Checks if skip cache was requested
|
# Checks if skip cache was requested
|
||||||
- name: Set skip-nx-cache flag
|
- name: Set skip-nx-cache flag
|
||||||
|
@ -103,8 +103,6 @@ describe(
|
|||||||
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
const proposalTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
const proposalTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
// const currentDate = new Date(createTenDigitUnixTimeStampForSpecifiedDays(0) * 1000)
|
|
||||||
// const proposedDate = new Date(currentDate.getTime() + 60000)
|
|
||||||
|
|
||||||
submitUniqueRawProposal({
|
submitUniqueRawProposal({
|
||||||
proposalTitle: proposalTitle,
|
proposalTitle: proposalTitle,
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
createUpdateNetworkProposalTxBody,
|
createUpdateNetworkProposalTxBody,
|
||||||
createFreeFormProposalTxBody,
|
createFreeFormProposalTxBody,
|
||||||
} from '../../support/proposal.functions';
|
} from '../../support/proposal.functions';
|
||||||
|
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/staking.functions';
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ context(
|
|||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
ethereumWalletConnect();
|
ethereumWalletConnect();
|
||||||
|
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
closeDialog,
|
closeDialog,
|
||||||
|
dissociateFromSecondWalletKey,
|
||||||
navigateTo,
|
navigateTo,
|
||||||
navigation,
|
navigation,
|
||||||
turnTelemetryOff,
|
turnTelemetryOff,
|
||||||
@ -15,7 +16,11 @@ import {
|
|||||||
governanceProposalType,
|
governanceProposalType,
|
||||||
voteForProposal,
|
voteForProposal,
|
||||||
} from '../../support/governance.functions';
|
} from '../../support/governance.functions';
|
||||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/staking.functions';
|
import {
|
||||||
|
ensureSpecifiedUnstakedTokensAreAssociated,
|
||||||
|
stakingPageAssociateTokens,
|
||||||
|
stakingPageDisassociateAllTokens,
|
||||||
|
} from '../../support/staking.functions';
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||||
import {
|
import {
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
vegaWalletSetSpecifiedApprovalAmount,
|
||||||
@ -197,6 +202,9 @@ context(
|
|||||||
|
|
||||||
// 3003-PMAN-001
|
// 3003-PMAN-001
|
||||||
it('Able to submit valid new market proposal', function () {
|
it('Able to submit valid new market proposal', function () {
|
||||||
|
// Wait needed for test to pass in CI because of report name discrepancy when time passes
|
||||||
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||||
|
cy.wait(5000);
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
||||||
cy.get(newProposalTitle).type('Test new market proposal');
|
cy.get(newProposalTitle).type('Test new market proposal');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
@ -248,6 +256,9 @@ context(
|
|||||||
// Will fail if run after 'Able to submit update market proposal and vote for proposal'
|
// Will fail if run after 'Able to submit update market proposal and vote for proposal'
|
||||||
// 3002-PROP-022
|
// 3002-PROP-022
|
||||||
it('Unable to submit update market proposal without equity-like share in the market', function () {
|
it('Unable to submit update market proposal without equity-like share in the market', function () {
|
||||||
|
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
||||||
|
cy.get('[data-testid="select-keypair-button"]').eq(0).click(); // switch to second wallet pub key
|
||||||
|
stakingPageAssociateTokens('1');
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
||||||
cy.get(newProposalTitle).type('Test update market proposal - rejected');
|
cy.get(newProposalTitle).type('Test update market proposal - rejected');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
@ -269,7 +280,11 @@ context(
|
|||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
|
cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
|
||||||
validateDialogContentMsg('PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE');
|
validateDialogContentMsg('PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE');
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
closeDialog();
|
||||||
|
ethereumWalletConnect();
|
||||||
|
stakingPageDisassociateAllTokens();
|
||||||
|
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
||||||
|
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3002-PROP-020
|
// 3002-PROP-020
|
||||||
@ -525,6 +540,13 @@ context(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
after('Disassociate from second wallet key if present', function () {
|
||||||
|
cy.reload();
|
||||||
|
waitForSpinner();
|
||||||
|
ethereumWalletConnect();
|
||||||
|
dissociateFromSecondWalletKey();
|
||||||
|
});
|
||||||
|
|
||||||
function validateDialogContentMsg(expectedMsg: string) {
|
function validateDialogContentMsg(expectedMsg: string) {
|
||||||
cy.getByTestId('dialog-content')
|
cy.getByTestId('dialog-content')
|
||||||
.last()
|
.last()
|
||||||
|
@ -86,11 +86,12 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Newly created proposals list - shows title and portion of summary', function () {
|
it('Newly created proposals list - shows title and portion of summary', function () {
|
||||||
const proposalPath = '/proposals/new-market-raw.json';
|
const proposalPath = 'src/fixtures/proposals/new-market-raw.json';
|
||||||
const enactmentTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
const proposalTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
submitUniqueRawProposal({
|
submitUniqueRawProposal({
|
||||||
proposalBody: proposalPath,
|
proposalBody: proposalPath,
|
||||||
enactmentTimestamp: enactmentTimestamp,
|
enactmentTimestamp: proposalTimestamp,
|
||||||
|
closingTimestamp: proposalTimestamp,
|
||||||
}); // 3001-VOTE-052
|
}); // 3001-VOTE-052
|
||||||
// 3001-VOTE-008
|
// 3001-VOTE-008
|
||||||
// 3001-VOTE-034
|
// 3001-VOTE-034
|
||||||
|
@ -20,8 +20,10 @@ const vegaAssetAddress = '0x67175Da1D5e966e40D11c4B2519392B2058373de';
|
|||||||
const vegaWalletUnstakedBalance =
|
const vegaWalletUnstakedBalance =
|
||||||
'[data-testid="vega-wallet-balance-unstaked"]';
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
const rewardsTable = 'epoch-total-rewards-table';
|
const rewardsTable = 'epoch-total-rewards-table';
|
||||||
|
const rewardsStartEpoch = 380; // Use 30 running locally
|
||||||
|
const rewardsEndEpoch = 500; // Change to 200 running locally
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
const txTimeout = Cypress.env('txTimeout');
|
||||||
const rewardsTimeOut = { timeout: 60000 };
|
const rewardsTimeOut = { timeout: 5 * 60 * 1000 };
|
||||||
|
|
||||||
context('rewards - flow', { tags: '@slow' }, function () {
|
context('rewards - flow', { tags: '@slow' }, function () {
|
||||||
before('set up environment to allow rewards', function () {
|
before('set up environment to allow rewards', function () {
|
||||||
@ -29,18 +31,22 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
turnTelemetryOff();
|
turnTelemetryOff();
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
depositAsset(vegaAssetAddress, '1000', 18);
|
|
||||||
ethereumWalletConnect();
|
ethereumWalletConnect();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
|
depositAsset(vegaAssetAddress, '1000', 18);
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'contain.text',
|
||||||
|
'Collateral'
|
||||||
|
);
|
||||||
vegaWalletTeardown();
|
vegaWalletTeardown();
|
||||||
cy.associateTokensToVegaWallet('6000');
|
cy.associateTokensToVegaWallet('6000');
|
||||||
cy.VegaWalletTopUpRewardsPool(30, 200);
|
cy.VegaWalletTopUpRewardsPool(rewardsStartEpoch, rewardsEndEpoch);
|
||||||
navigateTo(navigation.validators);
|
|
||||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
'contain',
|
'contain',
|
||||||
'6,000.0',
|
'6,000.0',
|
||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
|
navigateTo(navigation.validators);
|
||||||
clickOnValidatorFromList(0);
|
clickOnValidatorFromList(0);
|
||||||
stakingValidatorPageAddStake('3000');
|
stakingValidatorPageAddStake('3000');
|
||||||
closeStakingDialog();
|
closeStakingDialog();
|
||||||
|
@ -109,6 +109,7 @@ context(
|
|||||||
cy.getByTestId(userStake, epochTimeout)
|
cy.getByTestId(userStake, epochTimeout)
|
||||||
.first()
|
.first()
|
||||||
.should('have.text', '2.00');
|
.should('have.text', '2.00');
|
||||||
|
waitForBeginningOfEpoch();
|
||||||
cy.getByTestId('total-stake').first().realHover();
|
cy.getByTestId('total-stake').first().realHover();
|
||||||
cy.getByTestId('staked-by-user-tooltip')
|
cy.getByTestId('staked-by-user-tooltip')
|
||||||
.first()
|
.first()
|
||||||
@ -379,6 +380,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
||||||
|
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||||
stakingPageAssociateTokens('3');
|
stakingPageAssociateTokens('3');
|
||||||
verifyUnstakedBalance(3.0);
|
verifyUnstakedBalance(3.0);
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
@ -485,6 +487,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach('Teardown Wallet', function () {
|
afterEach('Teardown Wallet', function () {
|
||||||
|
navigateTo(navigation.home);
|
||||||
vegaWalletTeardown();
|
vegaWalletTeardown();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ const ethWalletContainer = '[data-testid="ethereum-wallet"]';
|
|||||||
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
const vegaWalletUnstakedBalance =
|
const vegaWalletUnstakedBalance =
|
||||||
'[data-testid="vega-wallet-balance-unstaked"]';
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
const currencyTitle = '[data-testid="currency-title"]:visible';
|
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
const txTimeout = Cypress.env('txTimeout');
|
||||||
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
||||||
const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible';
|
const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible';
|
||||||
@ -39,7 +38,7 @@ const associatedKey = '[data-testid="associated-key"]';
|
|||||||
const associatedAmount = '[data-testid="associated-amount"]';
|
const associatedAmount = '[data-testid="associated-amount"]';
|
||||||
const associateCompleteText = '[data-testid="transaction-complete-body"]';
|
const associateCompleteText = '[data-testid="transaction-complete-body"]';
|
||||||
const disassociationWarning = '[data-testid="disassociation-warning"]';
|
const disassociationWarning = '[data-testid="disassociation-warning"]';
|
||||||
const vegaWallet = '[data-testid="vega-wallet"]';
|
const vegaWallet = 'aside [data-testid="vega-wallet"]';
|
||||||
|
|
||||||
context(
|
context(
|
||||||
'Token association flow - with eth and vega wallets connected',
|
'Token association flow - with eth and vega wallets connected',
|
||||||
@ -79,27 +78,15 @@ context(
|
|||||||
//0005-ETXN-003
|
//0005-ETXN-003
|
||||||
//0005-ETXN-005
|
//0005-ETXN-005
|
||||||
stakingPageAssociateTokens('2', { skipConfirmation: true });
|
stakingPageAssociateTokens('2', { skipConfirmation: true });
|
||||||
|
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.above', 4);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
validateWalletCurrency('Associated', '0.00');
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
validateWalletCurrency('Pending association', '2.00');
|
||||||
validateWalletCurrency('Total associated after pending', '2.00');
|
validateWalletCurrency('Total associated after pending', '2.00');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6);
|
|
||||||
|
|
||||||
// 0005-ETXN-002
|
// 0005-ETXN-002
|
||||||
verifyEthWalletAssociatedBalance('2.0');
|
verifyEthWalletAssociatedBalance('2.0');
|
||||||
|
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
verifyEthWalletTotalAssociatedBalance('2.0');
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -114,12 +101,11 @@ context(
|
|||||||
verifyEthWalletAssociatedBalance('2.0');
|
verifyEthWalletAssociatedBalance('2.0');
|
||||||
verifyEthWalletTotalAssociatedBalance('6,002.00');
|
verifyEthWalletTotalAssociatedBalance('6,002.00');
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.getByTestId('epoch-countdown').should('be.visible');
|
||||||
stakingPageDisassociateTokens('2');
|
stakingPageDisassociateTokens('2');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.above', 4);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
validateWalletCurrency('Associated', '2.00');
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
validateWalletCurrency('Pending association', '2.00');
|
||||||
validateWalletCurrency('Total associated after pending', '0.00');
|
validateWalletCurrency('Total associated after pending', '0.00');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6);
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-testid="eth-wallet-associated-balances"]:visible',
|
'[data-testid="eth-wallet-associated-balances"]:visible',
|
||||||
txTimeout
|
txTimeout
|
||||||
@ -132,9 +118,7 @@ context(
|
|||||||
stakingPageAssociateTokens('1001', { approve: true });
|
stakingPageAssociateTokens('1001', { approve: true });
|
||||||
verifyEthWalletAssociatedBalance('1,001.00');
|
verifyEthWalletAssociatedBalance('1,001.00');
|
||||||
verifyEthWalletTotalAssociatedBalance('7,001.00');
|
verifyEthWalletTotalAssociatedBalance('7,001.00');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.last()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
'contain',
|
'contain',
|
||||||
'1,001.00'
|
'1,001.00'
|
||||||
@ -144,25 +128,15 @@ context(
|
|||||||
|
|
||||||
it('Able to disassociate a partial amount of tokens currently associated', function () {
|
it('Able to disassociate a partial amount of tokens currently associated', function () {
|
||||||
stakingPageAssociateTokens('2');
|
stakingPageAssociateTokens('2');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.getByTestId('epoch-countdown').should('be.visible');
|
||||||
stakingPageDisassociateTokens('1');
|
stakingPageDisassociateTokens('1');
|
||||||
verifyEthWalletAssociatedBalance('1.0');
|
verifyEthWalletAssociatedBalance('1.0');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 1.0);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
1.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -171,15 +145,11 @@ context(
|
|||||||
const warningText =
|
const warningText =
|
||||||
'Warning: Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.';
|
'Warning: Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.';
|
||||||
stakingPageAssociateTokens('2');
|
stakingPageAssociateTokens('2');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.getByTestId('epoch-countdown').should('be.visible');
|
||||||
cy.get(ethWalletDissociateButton).click();
|
cy.get(ethWalletDissociateButton).click();
|
||||||
cy.get(disassociationWarning).should('contain', warningText);
|
cy.get(disassociationWarning).should('contain', warningText);
|
||||||
stakingPageDisassociateAllTokens();
|
stakingPageDisassociateAllTokens();
|
||||||
@ -197,13 +167,8 @@ context(
|
|||||||
'not.exist'
|
'not.exist'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 0.0);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
0.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -219,32 +184,22 @@ context(
|
|||||||
type: 'contract',
|
type: 'contract',
|
||||||
skipConfirmation: true,
|
skipConfirmation: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.above', 4);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
validateWalletCurrency('Associated', '0.00');
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
validateWalletCurrency('Pending association', '2.00');
|
||||||
validateWalletCurrency('Total associated after pending', '2.00');
|
validateWalletCurrency('Total associated after pending', '2.00');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6);
|
|
||||||
verifyEthWalletAssociatedBalance('2.0');
|
verifyEthWalletAssociatedBalance('2.0');
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
verifyEthWalletTotalAssociatedBalance('2.0');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
||||||
stakingPageDisassociateTokens('1', {
|
stakingPageDisassociateTokens('1', {
|
||||||
type: 'contract',
|
type: 'contract',
|
||||||
skipConfirmation: true,
|
skipConfirmation: true,
|
||||||
});
|
});
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.above', 4);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
validateWalletCurrency('Associated', '2.00');
|
||||||
validateWalletCurrency('Pending association', '1.00');
|
validateWalletCurrency('Pending association', '1.00');
|
||||||
validateWalletCurrency('Total associated after pending', '1.00');
|
validateWalletCurrency('Total associated after pending', '1.00');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6);
|
|
||||||
verifyEthWalletAssociatedBalance('1.0');
|
verifyEthWalletAssociatedBalance('1.0');
|
||||||
verifyEthWalletTotalAssociatedBalance('1.0');
|
verifyEthWalletTotalAssociatedBalance('1.0');
|
||||||
});
|
});
|
||||||
@ -256,6 +211,7 @@ context(
|
|||||||
// 1004-ASSO-022
|
// 1004-ASSO-022
|
||||||
stakingPageAssociateTokens('21', { type: 'wallet' });
|
stakingPageAssociateTokens('21', { type: 'wallet' });
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.getByTestId('epoch-countdown').should('be.visible');
|
||||||
stakingPageAssociateTokens('37', { type: 'contract' });
|
stakingPageAssociateTokens('37', { type: 'contract' });
|
||||||
cy.get(vestingContractSection)
|
cy.get(vestingContractSection)
|
||||||
.first()
|
.first()
|
||||||
@ -275,13 +231,8 @@ context(
|
|||||||
);
|
);
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
||||||
});
|
});
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 58);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
58
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
stakingPageDisassociateTokens('6', { type: 'contract' });
|
stakingPageDisassociateTokens('6', { type: 'contract' });
|
||||||
cy.get(vestingContractSection)
|
cy.get(vestingContractSection)
|
||||||
@ -289,13 +240,8 @@ context(
|
|||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
||||||
});
|
});
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 52);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
52
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
stakingPageDisassociateTokens('9', { type: 'wallet' });
|
stakingPageDisassociateTokens('9', { type: 'wallet' });
|
||||||
@ -304,13 +250,8 @@ context(
|
|||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
||||||
});
|
});
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 43);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
43
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -328,11 +269,9 @@ context(
|
|||||||
// 1004-ASSO-004
|
// 1004-ASSO-004
|
||||||
it('Pending association outside of app is shown', function () {
|
it('Pending association outside of app is shown', function () {
|
||||||
vegaWalletAssociate('2');
|
vegaWalletAssociate('2');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.above', 4);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
validateWalletCurrency('Associated', '0.00');
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
validateWalletCurrency('Pending association', '2.00');
|
||||||
validateWalletCurrency('Total associated after pending', '2.00');
|
validateWalletCurrency('Total associated after pending', '2.00');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
validateWalletCurrency('Associated', '2.00');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -341,11 +280,9 @@ context(
|
|||||||
cy.wrap(validateWalletCurrency('Associated', '2.00')).then(() => {
|
cy.wrap(validateWalletCurrency('Associated', '2.00')).then(() => {
|
||||||
vegaWalletDisassociate('2');
|
vegaWalletDisassociate('2');
|
||||||
});
|
});
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.above', 4);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
validateWalletCurrency('Associated', '2.00');
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
validateWalletCurrency('Pending association', '2.00');
|
||||||
validateWalletCurrency('Total associated after pending', '0.00');
|
validateWalletCurrency('Total associated after pending', '0.00');
|
||||||
cy.get(currencyTitle, txTimeout).should('have.length.at.least', 6);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
validateWalletCurrency('Associated', '0.00');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -364,13 +301,8 @@ context(
|
|||||||
Cypress.env('vegaWalletPublicKey2')
|
Cypress.env('vegaWalletPublicKey2')
|
||||||
);
|
);
|
||||||
stakingPageAssociateTokens('2');
|
stakingPageAssociateTokens('2');
|
||||||
cy.get(vegaWallet)
|
cy.get(vegaWallet).within(() => {
|
||||||
.first()
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
cy.get(associateCompleteText).should(
|
cy.get(associateCompleteText).should(
|
||||||
'have.text',
|
'have.text',
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import { stakingPageDisassociateAllTokens } from './staking.functions';
|
||||||
|
|
||||||
const tokenDropDown = 'state-trigger';
|
const tokenDropDown = 'state-trigger';
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
const txTimeout = Cypress.env('txTimeout');
|
||||||
|
|
||||||
export enum navigation {
|
export enum navigation {
|
||||||
section = 'nav',
|
section = 'nav',
|
||||||
|
home = '[href="/"]',
|
||||||
vesting = '[href="/token/redeem"]',
|
vesting = '[href="/token/redeem"]',
|
||||||
validators = '[href="/validators"]',
|
validators = '[href="/validators"]',
|
||||||
rewards = '[href="/rewards"]',
|
rewards = '[href="/rewards"]',
|
||||||
@ -18,6 +21,7 @@ export function convertTokenValueToNumber(subject: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const topLevelRoutes = [
|
const topLevelRoutes = [
|
||||||
|
navigation.home,
|
||||||
navigation.proposals,
|
navigation.proposals,
|
||||||
navigation.validators,
|
navigation.validators,
|
||||||
navigation.rewards,
|
navigation.rewards,
|
||||||
@ -97,3 +101,25 @@ export function turnTelemetryOff() {
|
|||||||
win.localStorage.setItem('vega_telemetry_on', 'false')
|
win.localStorage.setItem('vega_telemetry_on', 'false')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function dissociateFromSecondWalletKey() {
|
||||||
|
const secondWalletKey = Cypress.env('vegaWalletPublicKey2Short');
|
||||||
|
cy.getByTestId('vega-in-wallet')
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.getByTestId('eth-wallet-associated-balances')
|
||||||
|
.last()
|
||||||
|
.within(() => {
|
||||||
|
cy.getByTestId('associated-key')
|
||||||
|
.invoke('text')
|
||||||
|
.as('associatedPubKey');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
cy.get('@associatedPubKey').then((associatedPubKey) => {
|
||||||
|
if (associatedPubKey == secondWalletKey) {
|
||||||
|
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
||||||
|
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
|
||||||
|
stakingPageDisassociateAllTokens();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -59,12 +59,11 @@ export function submitUniqueRawProposal(proposalFields: {
|
|||||||
submit?: boolean;
|
submit?: boolean;
|
||||||
}) {
|
}) {
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
goToMakeNewProposal(governanceProposalType.RAW);
|
||||||
let proposalBodyPath = '/proposals/raw.json';
|
let proposalBodyPath = 'src/fixtures/proposals/raw.json';
|
||||||
if (proposalFields.proposalBody) {
|
if (proposalFields.proposalBody) {
|
||||||
proposalBodyPath = proposalFields.proposalBody;
|
proposalBodyPath = proposalFields.proposalBody;
|
||||||
}
|
}
|
||||||
cy.readFile(proposalBodyPath).then((rawProposal) => {
|
cy.readFile(proposalBodyPath).then((rawProposal) => {
|
||||||
if (!proposalFields.proposalBody) {
|
|
||||||
if (proposalFields.proposalTitle) {
|
if (proposalFields.proposalTitle) {
|
||||||
rawProposal.rationale.title = proposalFields.proposalTitle;
|
rawProposal.rationale.title = proposalFields.proposalTitle;
|
||||||
cy.wrap(proposalFields.proposalTitle).as('proposalTitle');
|
cy.wrap(proposalFields.proposalTitle).as('proposalTitle');
|
||||||
@ -74,14 +73,15 @@ export function submitUniqueRawProposal(proposalFields: {
|
|||||||
}
|
}
|
||||||
if (proposalFields.closingTimestamp) {
|
if (proposalFields.closingTimestamp) {
|
||||||
rawProposal.terms.closingTimestamp = proposalFields.closingTimestamp;
|
rawProposal.terms.closingTimestamp = proposalFields.closingTimestamp;
|
||||||
} else {
|
} else if (
|
||||||
|
!proposalFields.closingTimestamp &&
|
||||||
|
!proposalFields.proposalBody
|
||||||
|
) {
|
||||||
const minTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(2);
|
const minTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(2);
|
||||||
rawProposal.terms.closingTimestamp = minTimeStamp;
|
rawProposal.terms.closingTimestamp = minTimeStamp;
|
||||||
}
|
}
|
||||||
if (proposalFields.enactmentTimestamp) {
|
if (proposalFields.enactmentTimestamp) {
|
||||||
rawProposal.terms.enactmentTimestamp =
|
rawProposal.terms.enactmentTimestamp = proposalFields.enactmentTimestamp;
|
||||||
proposalFields.enactmentTimestamp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const proposalPayload = JSON.stringify(rawProposal);
|
const proposalPayload = JSON.stringify(rawProposal);
|
||||||
|
@ -236,8 +236,8 @@ export function validateWalletCurrency(
|
|||||||
currencyTitle: string,
|
currencyTitle: string,
|
||||||
expectedAmount: string
|
expectedAmount: string
|
||||||
) {
|
) {
|
||||||
cy.get("[data-testid='currency-title']")
|
cy.get("[data-testid='currency-title']", txTimeout)
|
||||||
.contains(currencyTitle)
|
.contains(currencyTitle, txTimeout)
|
||||||
.parent()
|
.parent()
|
||||||
.parent()
|
.parent()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
@ -19,7 +19,7 @@ const ethStakingBridgeContractAddress = Cypress.env(
|
|||||||
);
|
);
|
||||||
const ethProviderUrl = Cypress.env('ethProviderUrl');
|
const ethProviderUrl = Cypress.env('ethProviderUrl');
|
||||||
const getAccount = (number = 0) => `m/44'/60'/0'/0/${number}`;
|
const getAccount = (number = 0) => `m/44'/60'/0'/0/${number}`;
|
||||||
const transactionTimeout = 100000;
|
const transactionTimeout = { timeout: 100000, log: false };
|
||||||
const Erc20BridgeAddress = '0x9708FF7510D4A7B9541e1699d15b53Ecb1AFDc54';
|
const Erc20BridgeAddress = '0x9708FF7510D4A7B9541e1699d15b53Ecb1AFDc54';
|
||||||
|
|
||||||
const provider = new ethers.providers.JsonRpcProvider({ url: ethProviderUrl });
|
const provider = new ethers.providers.JsonRpcProvider({ url: ethProviderUrl });
|
||||||
@ -43,10 +43,7 @@ export async function depositAsset(
|
|||||||
const faucet = new Token(assetEthAddress, signer);
|
const faucet = new Token(assetEthAddress, signer);
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)),
|
faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)),
|
||||||
{
|
transactionTimeout
|
||||||
timeout: transactionTimeout,
|
|
||||||
log: false,
|
|
||||||
}
|
|
||||||
).then(() => {
|
).then(() => {
|
||||||
const collateralBridge = new CollateralBridge(Erc20BridgeAddress, signer);
|
const collateralBridge = new CollateralBridge(Erc20BridgeAddress, signer);
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
@ -55,7 +52,7 @@ export async function depositAsset(
|
|||||||
amount + '0'.repeat(decimalPlaces),
|
amount + '0'.repeat(decimalPlaces),
|
||||||
'0x' + vegaWalletPubKey
|
'0x' + vegaWalletPubKey
|
||||||
),
|
),
|
||||||
{ timeout: transactionTimeout, log: false }
|
transactionTimeout
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -79,13 +76,13 @@ export async function vegaWalletTeardown() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
cy.get(vegaWalletContainer).within(() => {
|
||||||
cy.get(associatedAmountInWallet, {
|
cy.get(associatedAmountInWallet, transactionTimeout).should(
|
||||||
timeout: transactionTimeout,
|
'have.length',
|
||||||
})
|
1
|
||||||
.should('have.length', 1, { timeout: transactionTimeout })
|
);
|
||||||
.contains('0.00', {
|
cy.get(associatedAmountInWallet)
|
||||||
timeout: transactionTimeout,
|
.first(transactionTimeout)
|
||||||
});
|
.should('have.text', '0.00');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -109,7 +106,7 @@ async function vegaWalletTeardownStaking(stakingBridgeContract: StakingBridge) {
|
|||||||
cy.highlight('Tearing down staking tokens from vega wallet if present');
|
cy.highlight('Tearing down staking tokens from vega wallet if present');
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
stakingBridgeContract.stake_balance(ethWalletPubKey, vegaWalletPubKey),
|
stakingBridgeContract.stake_balance(ethWalletPubKey, vegaWalletPubKey),
|
||||||
{ timeout: transactionTimeout }
|
transactionTimeout
|
||||||
).then((stakeBalance) => {
|
).then((stakeBalance) => {
|
||||||
if (Number(stakeBalance) != 0) {
|
if (Number(stakeBalance) != 0) {
|
||||||
cy.get(vegaWalletContainer).within(() => {
|
cy.get(vegaWalletContainer).within(() => {
|
||||||
@ -122,31 +119,25 @@ async function vegaWalletTeardownStaking(stakingBridgeContract: StakingBridge) {
|
|||||||
String(stakeBalance),
|
String(stakeBalance),
|
||||||
vegaWalletPubKey
|
vegaWalletPubKey
|
||||||
),
|
),
|
||||||
{ timeout: transactionTimeout }
|
transactionTimeout
|
||||||
);
|
);
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
vestingContract.stake_balance(ethWalletPubKey, vegaWalletPubKey),
|
vestingContract.stake_balance(ethWalletPubKey, vegaWalletPubKey),
|
||||||
{
|
transactionTimeout
|
||||||
timeout: transactionTimeout,
|
|
||||||
log: false,
|
|
||||||
}
|
|
||||||
).then((vestingAmount) => {
|
).then((vestingAmount) => {
|
||||||
if (Number(vestingAmount) != 0) {
|
if (Number(vestingAmount) != 0) {
|
||||||
cy.contains('Associated', {
|
cy.contains('Associated', transactionTimeout)
|
||||||
timeout: transactionTimeout,
|
|
||||||
})
|
|
||||||
.parent()
|
.parent()
|
||||||
.parent()
|
.parent()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId('currency-value', {
|
cy.getByTestId('currency-value', transactionTimeout)
|
||||||
timeout: transactionTimeout,
|
.first()
|
||||||
})
|
|
||||||
.should('have.length', 1)
|
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.as('displayedAmount');
|
.as('displayedAmount');
|
||||||
cy.get('@displayedAmount', {
|
cy.get('@displayedAmount', transactionTimeout).should(
|
||||||
timeout: transactionTimeout,
|
'not.eq',
|
||||||
}).should('not.eq', $associatedAmount);
|
$associatedAmount
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -158,14 +149,14 @@ async function vegaWalletTeardownStaking(stakingBridgeContract: StakingBridge) {
|
|||||||
|
|
||||||
async function vegaWalletTeardownVesting(vestingContract: TokenVesting) {
|
async function vegaWalletTeardownVesting(vestingContract: TokenVesting) {
|
||||||
cy.highlight('Tearing down vesting tokens from vega wallet if present');
|
cy.highlight('Tearing down vesting tokens from vega wallet if present');
|
||||||
cy.wrap(vestingContract.stake_balance(ethWalletPubKey, vegaWalletPubKey), {
|
cy.wrap(
|
||||||
timeout: transactionTimeout,
|
vestingContract.stake_balance(ethWalletPubKey, vegaWalletPubKey),
|
||||||
log: false,
|
transactionTimeout
|
||||||
}).then((vestingAmount) => {
|
).then((vestingAmount) => {
|
||||||
if (Number(vestingAmount) != 0) {
|
if (Number(vestingAmount) != 0) {
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
vestingContract.remove_stake(String(vestingAmount), vegaWalletPubKey),
|
vestingContract.remove_stake(String(vestingAmount), vegaWalletPubKey),
|
||||||
{ timeout: transactionTimeout }
|
transactionTimeout
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user