test(governance): e2e tests updated to cypress 12 (#3582)
This commit is contained in:
parent
ca46861fd8
commit
288f075cac
@ -9,7 +9,7 @@
|
|||||||
"name": "Token test market",
|
"name": "Token test market",
|
||||||
"code": "Token.24h",
|
"code": "Token.24h",
|
||||||
"future": {
|
"future": {
|
||||||
"settlementAsset": "fBTC",
|
"settlementAsset": "73174a6fb1d5802ba0ac7bd7ab79e0a3a4837b262de0a4e80815a55442692bd0",
|
||||||
"quoteName": "fBTC",
|
"quoteName": "fBTC",
|
||||||
"dataSourceSpecForSettlementData": {
|
"dataSourceSpecForSettlementData": {
|
||||||
"external": {
|
"external": {
|
||||||
|
@ -49,6 +49,7 @@ describe(
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit proposals tab', function () {
|
beforeEach('visit proposals tab', function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
@ -217,9 +218,9 @@ describe(
|
|||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(rawProposal.rationale.title)
|
getSubmittedProposalFromProposalList(
|
||||||
.as('submittedProposal')
|
rawProposal.rationale.title
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
).within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
voteForProposal('for');
|
voteForProposal('for');
|
||||||
// 3001-VOTE-079
|
// 3001-VOTE-079
|
||||||
@ -237,9 +238,9 @@ describe(
|
|||||||
);
|
);
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(rawProposal.rationale.title)
|
getSubmittedProposalFromProposalList(
|
||||||
.as('submittedProposal')
|
rawProposal.rationale.title
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
).within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
cy.get(proposalVoteProgressForPercentage)
|
cy.get(proposalVoteProgressForPercentage)
|
||||||
.contains('100.00%')
|
.contains('100.00%')
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
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';
|
||||||
|
|
||||||
|
const proposalListItem = '[data-testid="proposals-list-item"]';
|
||||||
const closedProposals = '[data-testid="closed-proposals"]';
|
const closedProposals = '[data-testid="closed-proposals"]';
|
||||||
const proposalStatus = '[data-testid="proposal-status"]';
|
const proposalStatus = '[data-testid="proposal-status"]';
|
||||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||||
@ -35,6 +36,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit proposals', function () {
|
beforeEach('visit proposals', function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
@ -51,7 +53,8 @@ context(
|
|||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.get(closedProposals).within(() => {
|
cy.get(closedProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil('[data-testid="proposals-list-item"]')
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(proposalStatus).should('have.text', 'Enacted ');
|
cy.get(proposalStatus).should('have.text', 'Enacted ');
|
||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
@ -78,7 +81,8 @@ context(
|
|||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil('[data-testid="proposals-list-item"]')
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
getProposalInformationFromTable('State')
|
||||||
@ -111,7 +115,8 @@ context(
|
|||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.get(openProposals, { timeout: 6000 }).within(() => {
|
cy.get(openProposals, { timeout: 6000 }).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil('[data-testid="proposals-list-item"]')
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
getProposalInformationFromTable('State')
|
||||||
@ -133,7 +138,8 @@ context(
|
|||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil('[data-testid="proposals-list-item"]')
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
getProposalInformationFromTable('State')
|
||||||
|
@ -84,6 +84,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
|
@ -76,6 +76,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
@ -304,7 +305,10 @@ context(
|
|||||||
cy.get('dd').eq(0).should('have.text', 'Test market 1');
|
cy.get('dd').eq(0).should('have.text', 'Test market 1');
|
||||||
cy.get('dd').eq(1).should('have.text', 'TEST.24h');
|
cy.get('dd').eq(1).should('have.text', 'TEST.24h');
|
||||||
cy.get('dd').eq(2).should('not.be.empty');
|
cy.get('dd').eq(2).should('not.be.empty');
|
||||||
cy.get('dd').eq(2).invoke('text').as('EnactedMarketId');
|
cy.get('dd')
|
||||||
|
.eq(2)
|
||||||
|
.invoke('text')
|
||||||
|
.as('EnactedMarketId', { type: 'static' });
|
||||||
});
|
});
|
||||||
cy.get('@EnactedMarketId').then((marketId) => {
|
cy.get('@EnactedMarketId').then((marketId) => {
|
||||||
cy.VegaWalletSubmitLiquidityProvision(String(marketId), '1');
|
cy.VegaWalletSubmitLiquidityProvision(String(marketId), '1');
|
||||||
@ -322,6 +326,7 @@ context(
|
|||||||
cy.get('@EnactedMarketId').then((marketId) => {
|
cy.get('@EnactedMarketId').then((marketId) => {
|
||||||
cy.contains(String(marketId))
|
cy.contains(String(marketId))
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId(viewProposalBtn).click();
|
cy.getByTestId(viewProposalBtn).click();
|
||||||
});
|
});
|
||||||
@ -375,16 +380,19 @@ context(
|
|||||||
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');
|
||||||
cy.getByTestId('dialog-content').within(() => {
|
cy.getByTestId('dialog-content')
|
||||||
cy.get('p').should(
|
.last()
|
||||||
'have.text',
|
.within(() => {
|
||||||
'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE'
|
cy.get('p').should(
|
||||||
);
|
'have.text',
|
||||||
});
|
'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE'
|
||||||
|
);
|
||||||
|
});
|
||||||
closeDialog();
|
closeDialog();
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId(viewProposalBtn).click();
|
cy.getByTestId(viewProposalBtn).click();
|
||||||
});
|
});
|
||||||
@ -422,6 +430,7 @@ context(
|
|||||||
cy.get(proposalType)
|
cy.get(proposalType)
|
||||||
.contains('Update asset')
|
.contains('Update asset')
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(proposalDetails).should('contain.text', assetId); // 3001-VOTE-029
|
cy.get(proposalDetails).should('contain.text', assetId); // 3001-VOTE-029
|
||||||
cy.getByTestId(viewProposalBtn).click();
|
cy.getByTestId(viewProposalBtn).click();
|
||||||
|
@ -35,6 +35,7 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit proposals tab', function () {
|
beforeEach('visit proposals tab', function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
@ -59,7 +60,10 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.get(proposalClosingDate).first().should('contain.text', 'year');
|
cy.get(proposalClosingDate).first().should('contain.text', 'year');
|
||||||
cy.get(proposalClosingDate).should('contain.text', 'months');
|
cy.get(proposalClosingDate).should('contain.text', 'months');
|
||||||
cy.get(proposalClosingDate).last().should('contain.text', 'days');
|
cy.get(proposalClosingDate)
|
||||||
|
.last()
|
||||||
|
.invoke('text')
|
||||||
|
.should('match', /days|minutes/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,9 +25,10 @@ const rewardsTimeOut = { timeout: 60000 };
|
|||||||
|
|
||||||
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 () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
depositAsset(vegaAssetAddress, '1000');
|
depositAsset(vegaAssetAddress, '1000', 18);
|
||||||
cy.validatorsSelfDelegate();
|
cy.validatorsSelfDelegate();
|
||||||
ethereumWalletConnect();
|
ethereumWalletConnect();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
@ -56,7 +57,7 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
cy.getByTestId(rewardsTable)
|
cy.getByTestId(rewardsTable)
|
||||||
.first()
|
.first()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId('asset').should('have.text', 'Vega');
|
cy.getByTestId('asset', rewardsTimeOut).should('have.text', 'Vega');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD').should('have.text', '1');
|
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD').should('have.text', '1');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE').should(
|
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
@ -93,13 +94,13 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('h2').first().should('contain.text', 'EPOCH');
|
cy.get('h2').first().should('contain.text', 'EPOCH');
|
||||||
cy.getByTestId('individual-rewards-asset').should('have.text', 'Vega');
|
cy.getByTestId('individual-rewards-asset').should('have.text', 'Vega');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD')
|
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD', rewardsTimeOut)
|
||||||
.should('contain.text', '0.1177')
|
.should('contain.text', '0.4415')
|
||||||
.and('contain.text', '(11.7733%)');
|
.and('contain.text', '(44.15%)');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE')
|
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE')
|
||||||
.should('contain.text', '0.0001')
|
.should('contain.text', '0.0004')
|
||||||
.and('contain.text', '(11.7733%)');
|
.and('contain.text', '(44.15%)');
|
||||||
cy.getByTestId('total').should('have.text', '0.1179');
|
cy.getByTestId('total').should('have.text', '0.4419');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@ context(
|
|||||||
beforeEach(
|
beforeEach(
|
||||||
'teardown wallet & drill into a specific validator',
|
'teardown wallet & drill into a specific validator',
|
||||||
function () {
|
function () {
|
||||||
cy.clearAllLocalStorage();
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
|
@ -53,6 +53,7 @@ context(
|
|||||||
beforeEach(
|
beforeEach(
|
||||||
'teardown wallet & drill into a specific validator',
|
'teardown wallet & drill into a specific validator',
|
||||||
function () {
|
function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
@ -90,9 +91,14 @@ context(
|
|||||||
|
|
||||||
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);
|
||||||
});
|
});
|
||||||
@ -128,26 +134,38 @@ context(
|
|||||||
stakingPageAssociateTokens('1001', { approve: true });
|
stakingPageAssociateTokens('1001', { approve: true });
|
||||||
verifyEthWalletAssociatedBalance('1,001.00');
|
verifyEthWalletAssociatedBalance('1,001.00');
|
||||||
verifyEthWalletTotalAssociatedBalance('1,001.00');
|
verifyEthWalletTotalAssociatedBalance('1,001.00');
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.get(vegaWallet)
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
.last()
|
||||||
'contain',
|
.within(() => {
|
||||||
'1,001.00'
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
);
|
'contain',
|
||||||
});
|
'1,001.00'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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).within(() => {
|
cy.get(vegaWallet)
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
.first()
|
||||||
});
|
.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();
|
||||||
stakingPageDisassociateTokens('1');
|
stakingPageDisassociateTokens('1');
|
||||||
verifyEthWalletAssociatedBalance('1.0');
|
verifyEthWalletAssociatedBalance('1.0');
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.get(vegaWallet)
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 1.0);
|
.first()
|
||||||
});
|
.within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to disassociate all tokens - using max', function () {
|
it('Able to disassociate all tokens - using max', function () {
|
||||||
@ -155,26 +173,40 @@ 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).within(() => {
|
cy.get(vegaWallet)
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
.first()
|
||||||
});
|
.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.get(ethWalletDissociateButton).click();
|
cy.get(ethWalletDissociateButton).click();
|
||||||
cy.get(disassociationWarning).should('contain', warningText);
|
cy.get(disassociationWarning).should('contain', warningText);
|
||||||
stakingPageDisassociateAllTokens();
|
stakingPageDisassociateAllTokens();
|
||||||
cy.get(ethWalletContainer).within(() => {
|
cy.get(ethWalletContainer)
|
||||||
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
.first()
|
||||||
'not.exist'
|
.within(() => {
|
||||||
);
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
});
|
'not.exist'
|
||||||
cy.get(ethWalletContainer).within(() => {
|
);
|
||||||
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
});
|
||||||
'not.exist'
|
cy.get(ethWalletContainer)
|
||||||
);
|
.first()
|
||||||
});
|
.within(() => {
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 0.0);
|
'not.exist'
|
||||||
});
|
);
|
||||||
|
});
|
||||||
|
cy.get(vegaWallet)
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to associate and disassociate vesting contract tokens', function () {
|
it('Able to associate and disassociate vesting contract tokens', function () {
|
||||||
@ -200,9 +232,14 @@ context(
|
|||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||||
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);
|
||||||
stakingPageDisassociateTokens('1', {
|
stakingPageDisassociateTokens('1', {
|
||||||
type: 'contract',
|
type: 'contract',
|
||||||
@ -228,38 +265,61 @@ context(
|
|||||||
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();
|
||||||
stakingPageAssociateTokens('37', { type: 'contract' });
|
stakingPageAssociateTokens('37', { type: 'contract' });
|
||||||
cy.get(vestingContractSection).within(() => {
|
cy.get(vestingContractSection)
|
||||||
cy.get(associatedKey).should(
|
.first()
|
||||||
'contain',
|
.within(() => {
|
||||||
Cypress.env('vegaWalletPublicKeyShort')
|
cy.get(associatedKey).should(
|
||||||
);
|
'contain',
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 37);
|
Cypress.env('vegaWalletPublicKeyShort')
|
||||||
});
|
);
|
||||||
cy.get(vegaInWalletSection).within(() => {
|
cy.get(associatedAmount, txTimeout).should('contain', 37);
|
||||||
cy.get(associatedKey).should(
|
});
|
||||||
'contain',
|
cy.get(vegaInWalletSection)
|
||||||
Cypress.env('vegaWalletPublicKeyShort')
|
.first()
|
||||||
);
|
.within(() => {
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
cy.get(associatedKey).should(
|
||||||
});
|
'contain',
|
||||||
cy.get(vegaWallet).within(() => {
|
Cypress.env('vegaWalletPublicKeyShort')
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 58);
|
);
|
||||||
});
|
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
||||||
|
});
|
||||||
|
cy.get(vegaWallet)
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
58
|
||||||
|
);
|
||||||
|
});
|
||||||
stakingPageDisassociateTokens('6', { type: 'contract' });
|
stakingPageDisassociateTokens('6', { type: 'contract' });
|
||||||
cy.get(vestingContractSection).within(() => {
|
cy.get(vestingContractSection)
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
.first()
|
||||||
});
|
.within(() => {
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 52);
|
});
|
||||||
});
|
cy.get(vegaWallet)
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
52
|
||||||
|
);
|
||||||
|
});
|
||||||
navigateTo(navigation.validators);
|
navigateTo(navigation.validators);
|
||||||
stakingPageDisassociateTokens('9', { type: 'wallet' });
|
stakingPageDisassociateTokens('9', { type: 'wallet' });
|
||||||
cy.get(vegaInWalletSection).within(() => {
|
cy.get(vegaInWalletSection)
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
.first()
|
||||||
});
|
.within(() => {
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 43);
|
});
|
||||||
});
|
cy.get(vegaWallet)
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
43
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Not able to associate more tokens than owned', function () {
|
it('Not able to associate more tokens than owned', function () {
|
||||||
@ -318,9 +378,14 @@ context(
|
|||||||
Cypress.env('vegaWalletPublicKey2')
|
Cypress.env('vegaWalletPublicKey2')
|
||||||
);
|
);
|
||||||
stakingPageAssociateTokens('2');
|
stakingPageAssociateTokens('2');
|
||||||
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(associateCompleteText).should(
|
cy.get(associateCompleteText).should(
|
||||||
'have.text',
|
'have.text',
|
||||||
`Vega key ${Cypress.env(
|
`Vega key ${Cypress.env(
|
||||||
|
@ -4,10 +4,7 @@ import {
|
|||||||
waitForSpinner,
|
waitForSpinner,
|
||||||
} from '../../support/common.functions';
|
} from '../../support/common.functions';
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||||
import {
|
import { depositAsset } from '../../support/wallet-teardown.functions';
|
||||||
depositAsset,
|
|
||||||
vegaWalletTeardown,
|
|
||||||
} from '../../support/wallet-teardown.functions';
|
|
||||||
|
|
||||||
const withdraw = 'withdraw';
|
const withdraw = 'withdraw';
|
||||||
const withdrawalForm = 'withdraw-form';
|
const withdrawalForm = 'withdraw-form';
|
||||||
@ -25,6 +22,13 @@ const withdrawalAmount = 'withdrawal-amount';
|
|||||||
const withdrawalRecipient = 'withdrawal-recipient';
|
const withdrawalRecipient = 'withdrawal-recipient';
|
||||||
const withdrawFundsButton = 'withdraw-funds';
|
const withdrawFundsButton = 'withdraw-funds';
|
||||||
const completeWithdrawalButton = 'complete-withdrawal';
|
const completeWithdrawalButton = 'complete-withdrawal';
|
||||||
|
const tableTxHash = '[col-id="txHash"]';
|
||||||
|
const tableAssetSymbol = '[col-id="asset.symbol"]';
|
||||||
|
const tableAmount = '[col-id="amount"]';
|
||||||
|
const tableReceiverAddress = '[col-id="details.receiverAddress"]';
|
||||||
|
const tableWithdrawnTimeStamp = '[col-id="withdrawnTimestamp"]';
|
||||||
|
const tableWithdrawnStatus = '[col-id="status"]';
|
||||||
|
const tableCreatedTimeStamp = '[col-id="createdTimestamp"]';
|
||||||
const usdtName = 'USDC (local)';
|
const usdtName = 'USDC (local)';
|
||||||
const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0';
|
const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0';
|
||||||
const usdcSymbol = 'tUSDC';
|
const usdcSymbol = 'tUSDC';
|
||||||
@ -42,26 +46,23 @@ context(
|
|||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
// When running tests locally, will fail if run without restarting capsule
|
// When running tests locally, will fail if run without restarting capsule
|
||||||
cy.updateCapsuleMultiSig().then(() => {
|
cy.updateCapsuleMultiSig().then(() => {
|
||||||
depositAsset(usdcEthAddress, '100');
|
ethereumWalletConnect();
|
||||||
|
depositAsset(usdcEthAddress, '1000', 5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('Navigate to withdrawal page', function () {
|
beforeEach('Navigate to withdrawal page', function () {
|
||||||
|
cy.clearLocalStorage();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
navigateTo(navigation.withdraw);
|
navigateTo(navigation.withdraw);
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
ethereumWalletConnect();
|
ethereumWalletConnect();
|
||||||
vegaWalletTeardown();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to open withdrawal form with vega wallet connected', function () {
|
it('Able to open withdrawal form with vega wallet connected', function () {
|
||||||
// needs to reload page for withdrawal form to be displayed in ci - not reproducible outside of ci
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
ethereumWalletConnect();
|
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
cy.getByTestId(withdrawalForm).within(() => {
|
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
||||||
cy.get('select').find('option').should('have.length.at.least', 2);
|
cy.get('select').find('option').should('have.length.at.least', 2);
|
||||||
cy.getByTestId(ethAddressInput).should('be.visible');
|
cy.getByTestId(ethAddressInput).should('be.visible');
|
||||||
cy.getByTestId(amountInput).should('be.visible');
|
cy.getByTestId(amountInput).should('be.visible');
|
||||||
@ -70,7 +71,7 @@ context(
|
|||||||
|
|
||||||
it('Unable to submit withdrawal with invalid fields', function () {
|
it('Unable to submit withdrawal with invalid fields', function () {
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
cy.getByTestId(withdrawalForm).within(() => {
|
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
cy.get('select').select(usdtSelectValue, { force: true });
|
||||||
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
@ -94,7 +95,7 @@ context(
|
|||||||
it('Able to withdraw asset: -eth wallet connected -withdraw funds button', function () {
|
it('Able to withdraw asset: -eth wallet connected -withdraw funds button', function () {
|
||||||
// fill in withdrawal form
|
// fill in withdrawal form
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
cy.getByTestId(withdrawalForm).within(() => {
|
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
cy.get('select').select(usdtSelectValue, { force: true });
|
||||||
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
cy.getByTestId(withdrawalThreshold).should(
|
cy.getByTestId(withdrawalThreshold).should(
|
||||||
@ -102,7 +103,7 @@ context(
|
|||||||
'100,000.00000T'
|
'100,000.00000T'
|
||||||
);
|
);
|
||||||
cy.getByTestId(delayTime).should('have.text', 'None');
|
cy.getByTestId(delayTime).should('have.text', 'None');
|
||||||
cy.getByTestId(amountInput).click().type('100');
|
cy.getByTestId(amountInput).click().type('120');
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ context(
|
|||||||
.should('have.attr', 'href')
|
.should('have.attr', 'href')
|
||||||
.and('contain', '/txs/');
|
.and('contain', '/txs/');
|
||||||
cy.getByTestId(withdrawalAssetSymbol).should('have.text', usdcSymbol);
|
cy.getByTestId(withdrawalAssetSymbol).should('have.text', usdcSymbol);
|
||||||
cy.getByTestId(withdrawalAmount).should('have.text', '100.00');
|
cy.getByTestId(withdrawalAmount).should('have.text', '120.00');
|
||||||
cy.getByTestId(withdrawalRecipient)
|
cy.getByTestId(withdrawalRecipient)
|
||||||
.should('have.text', truncatedWithdrawalEthAddress)
|
.should('have.text', truncatedWithdrawalEthAddress)
|
||||||
.and('have.attr', 'href')
|
.and('have.attr', 'href')
|
||||||
@ -128,26 +129,20 @@ context(
|
|||||||
'Withdraw asset complete'
|
'Withdraw asset complete'
|
||||||
);
|
);
|
||||||
cy.getByTestId(dialogClose).click();
|
cy.getByTestId(dialogClose).click();
|
||||||
|
|
||||||
// need to reload page to see withdrawal history complete
|
|
||||||
cy.reload();
|
|
||||||
waitForAssetsDisplayed(usdtName);
|
|
||||||
|
|
||||||
// withdrawal history for complete withdrawal displayed
|
// withdrawal history for complete withdrawal displayed
|
||||||
cy.get('[col-id="txHash"]', txTimeout)
|
cy.get(tableWithdrawnStatus)
|
||||||
.should('have.length.above', 1)
|
.eq(1, txTimeout)
|
||||||
.eq(1)
|
.should('have.text', 'Completed')
|
||||||
.parent()
|
.parent()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('[col-id="asset.symbol"]').should('have.text', usdcSymbol);
|
cy.get(tableAssetSymbol).should('have.text', usdcSymbol);
|
||||||
cy.get('[col-id="amount"]').should('have.text', '100.00');
|
cy.get(tableAmount).should('have.text', '120.00');
|
||||||
cy.get('[col-id="details.receiverAddress"]')
|
cy.get(tableReceiverAddress)
|
||||||
.find('a')
|
.find('a')
|
||||||
.should('have.attr', 'href')
|
.should('have.attr', 'href')
|
||||||
.and('contain', 'https://sepolia.etherscan.io/address/');
|
.and('contain', 'https://sepolia.etherscan.io/address/');
|
||||||
cy.get('[col-id="withdrawnTimestamp"]').should('not.be.empty');
|
cy.get(tableWithdrawnTimeStamp).should('not.be.empty');
|
||||||
cy.get('[col-id="status"]').should('have.text', 'Completed');
|
cy.get(tableTxHash)
|
||||||
cy.get('[col-id="txHash"]')
|
|
||||||
.find('a')
|
.find('a')
|
||||||
.should('have.attr', 'href')
|
.should('have.attr', 'href')
|
||||||
.and('contain', 'https://sepolia.etherscan.io/tx/');
|
.and('contain', 'https://sepolia.etherscan.io/tx/');
|
||||||
@ -155,16 +150,16 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Skipping because of bug #1857
|
// Skipping because of bug #1857
|
||||||
it.skip('Able to withdraw asset: -eth wallet not connected', function () {
|
it('Able to withdraw asset: -eth wallet not connected', function () {
|
||||||
const ethWalletAddress = Cypress.env('ethWalletPublicKey');
|
const ethWalletAddress = Cypress.env('ethWalletPublicKey');
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForAssetsDisplayed(usdtName);
|
waitForAssetsDisplayed(usdtName);
|
||||||
// fill in withdrawal form
|
// fill in withdrawal form
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
cy.getByTestId(withdrawalForm).within(() => {
|
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
cy.get('select').select(usdtSelectValue, { force: true });
|
||||||
cy.getByTestId(ethAddressInput).should('be.empty');
|
cy.getByTestId(ethAddressInput).should('be.empty');
|
||||||
cy.getByTestId(amountInput).click().type('100');
|
cy.getByTestId(amountInput).click().type('110');
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
|
||||||
// Need eth address to submit withdrawal
|
// Need eth address to submit withdrawal
|
||||||
@ -180,20 +175,20 @@ context(
|
|||||||
'Transaction complete'
|
'Transaction complete'
|
||||||
);
|
);
|
||||||
cy.getByTestId(dialogClose).click();
|
cy.getByTestId(dialogClose).click();
|
||||||
|
cy.get(tableTxHash)
|
||||||
cy.getByTestId(completeWithdrawalButton)
|
.eq(1)
|
||||||
.eq(0)
|
.should('have.text', 'Complete withdrawal')
|
||||||
.parent()
|
|
||||||
.parent()
|
.parent()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('[col-id="asset.symbol"]').should('have.text', usdcSymbol);
|
cy.get(tableAssetSymbol).should('have.text', usdcSymbol);
|
||||||
cy.get('[col-id="amount"]').should('have.text', '100.00');
|
cy.get(tableAmount).should('have.text', '110.00');
|
||||||
cy.get('[col-id="details.receiverAddress"]')
|
cy.get(tableReceiverAddress)
|
||||||
.find('a')
|
.find('a')
|
||||||
.should('have.attr', 'href')
|
.should('have.attr', 'href')
|
||||||
.and('contain', 'https://sepolia.etherscan.io/address/');
|
.and('contain', 'https://sepolia.etherscan.io/address/');
|
||||||
cy.get('[col-id="createdTimestamp"]').should('not.be.empty');
|
cy.get(tableCreatedTimeStamp).should('not.be.empty');
|
||||||
cy.getByTestId(completeWithdrawalButton).click();
|
cy.getByTestId(completeWithdrawalButton).click();
|
||||||
|
// Unable to complete withdrawal in Capsule
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -202,26 +197,28 @@ context(
|
|||||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
// Disconnect vega wallet
|
// Disconnect vega wallet
|
||||||
cy.getByTestId('manage-vega-wallet').click();
|
cy.getByTestId('manage-vega-wallet').last().click();
|
||||||
cy.getByTestId('disconnect').click();
|
cy.getByTestId('disconnect').click();
|
||||||
|
|
||||||
cy.connectPublicKey(vegaWalletPubKey);
|
cy.connectPublicKey(vegaWalletPubKey);
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
cy.getByTestId(withdrawalForm).within(() => {
|
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
cy.get('select').select(usdtSelectValue, { force: true });
|
||||||
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
cy.getByTestId(amountInput).click().type('100');
|
cy.getByTestId(amountInput).click().type('100');
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.getByTestId('dialog-content').within(() => {
|
cy.getByTestId('dialog-content')
|
||||||
cy.get('h1').should('have.text', 'Transaction failed');
|
.last()
|
||||||
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
.within(() => {
|
||||||
});
|
cy.get('h1').should('have.text', 'Transaction failed');
|
||||||
|
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function waitForAssetsDisplayed(expectedAsset: string) {
|
function waitForAssetsDisplayed(expectedAsset: string) {
|
||||||
cy.contains(expectedAsset, txTimeout).should('be.visible');
|
cy.getByTestId('currency-title').should('contain.text', expectedAsset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -90,6 +90,7 @@ export function getSubmittedProposalFromProposalList(proposalTitle: string) {
|
|||||||
export function getProposalIdFromList(proposalTitle: string) {
|
export function getProposalIdFromList(proposalTitle: string) {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(proposalDetails)
|
cy.get(proposalDetails)
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
@ -133,7 +134,7 @@ export function waitForProposalSync() {
|
|||||||
// before proposal appears in the list - so rather than hard coded wait - we just wait on the
|
// before proposal appears in the list - so rather than hard coded wait - we just wait on the
|
||||||
// delegation checks that are performed on the governance page.
|
// delegation checks that are performed on the governance page.
|
||||||
|
|
||||||
cy.intercept('POST', '/query', (req) => {
|
cy.intercept('POST', '/graphql', (req) => {
|
||||||
if (req.body.operationName === 'Delegations') {
|
if (req.body.operationName === 'Delegations') {
|
||||||
req.alias = 'proposalDelegationsCompletion';
|
req.alias = 'proposalDelegationsCompletion';
|
||||||
}
|
}
|
||||||
@ -143,7 +144,7 @@ export function waitForProposalSync() {
|
|||||||
cy.wait(['@proposalDelegationsCompletion', '@proposalDelegationsCompletion']);
|
cy.wait(['@proposalDelegationsCompletion', '@proposalDelegationsCompletion']);
|
||||||
|
|
||||||
// Turn off this intercept from here on in
|
// Turn off this intercept from here on in
|
||||||
cy.intercept('POST', '/query', (req) => {
|
cy.intercept('POST', '/graphql', (req) => {
|
||||||
if (req.body.operationName === 'Delegations') {
|
if (req.body.operationName === 'Delegations') {
|
||||||
req.continue();
|
req.continue();
|
||||||
}
|
}
|
||||||
|
@ -35,18 +35,25 @@ const stakingBridgeContract = new StakingBridge(
|
|||||||
);
|
);
|
||||||
const vestingContract = new TokenVesting(vegaTokenContractAddress, signer);
|
const vestingContract = new TokenVesting(vegaTokenContractAddress, signer);
|
||||||
|
|
||||||
export async function depositAsset(assetEthAddress: string, amount: string) {
|
export async function depositAsset(
|
||||||
|
assetEthAddress: string,
|
||||||
|
amount: string,
|
||||||
|
decimalPlaces: number
|
||||||
|
) {
|
||||||
// Approve asset
|
// Approve asset
|
||||||
const faucet = new TokenFaucetable(assetEthAddress, signer);
|
const faucet = new TokenFaucetable(assetEthAddress, signer);
|
||||||
cy.wrap(faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(19)), {
|
cy.wrap(
|
||||||
timeout: transactionTimeout,
|
faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)),
|
||||||
log: false,
|
{
|
||||||
}).then(() => {
|
timeout: transactionTimeout,
|
||||||
|
log: false,
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
const collateralBridge = new CollateralBridge(Erc20BridgeAddress, signer);
|
const collateralBridge = new CollateralBridge(Erc20BridgeAddress, signer);
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
collateralBridge.deposit_asset(
|
collateralBridge.deposit_asset(
|
||||||
assetEthAddress,
|
assetEthAddress,
|
||||||
amount + '0'.repeat(18),
|
amount + '0'.repeat(decimalPlaces),
|
||||||
'0x' + vegaWalletPubKey
|
'0x' + vegaWalletPubKey
|
||||||
),
|
),
|
||||||
{ timeout: transactionTimeout, log: false }
|
{ timeout: transactionTimeout, log: false }
|
||||||
@ -102,27 +109,49 @@ 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, log: false }
|
{ timeout: transactionTimeout }
|
||||||
).then((stakeBalance) => {
|
).then((stakeBalance) => {
|
||||||
if (Number(stakeBalance) != 0) {
|
if (Number(stakeBalance) != 0) {
|
||||||
cy.get('[data-testid="vega-wallet-balance-unstaked"]:visible').within(
|
cy.get(vegaWalletContainer).within(() => {
|
||||||
() => {
|
cy.getByTestId('currency-value')
|
||||||
cy.get(associatedAmountInWallet)
|
.first()
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.then(($walletAmount) => {
|
.then(($associatedAmount) => {
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
stakingBridgeContract.remove_stake(
|
stakingBridgeContract.remove_stake(
|
||||||
String(stakeBalance),
|
String(stakeBalance),
|
||||||
vegaWalletPubKey
|
vegaWalletPubKey
|
||||||
),
|
),
|
||||||
{ timeout: transactionTimeout, log: false }
|
{ timeout: transactionTimeout }
|
||||||
);
|
);
|
||||||
cy.get(associatedAmountInWallet, {
|
cy.wrap(
|
||||||
|
vestingContract.stake_balance(ethWalletPubKey, vegaWalletPubKey),
|
||||||
|
{
|
||||||
timeout: transactionTimeout,
|
timeout: transactionTimeout,
|
||||||
}).should('not.have.text', $walletAmount);
|
log: false,
|
||||||
|
}
|
||||||
|
).then((vestingAmount) => {
|
||||||
|
if (Number(vestingAmount) != 0) {
|
||||||
|
cy.contains('Associated', {
|
||||||
|
timeout: transactionTimeout,
|
||||||
|
})
|
||||||
|
.parent()
|
||||||
|
.parent()
|
||||||
|
.within(() => {
|
||||||
|
cy.getByTestId('currency-value', {
|
||||||
|
timeout: transactionTimeout,
|
||||||
|
})
|
||||||
|
.should('have.length', 1)
|
||||||
|
.invoke('text')
|
||||||
|
.as('displayedAmount');
|
||||||
|
cy.get('@displayedAmount', {
|
||||||
|
timeout: transactionTimeout,
|
||||||
|
}).should('not.eq', $associatedAmount);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -136,7 +165,7 @@ async function vegaWalletTeardownVesting(vestingContract: TokenVesting) {
|
|||||||
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, log: false }
|
{ timeout: transactionTimeout }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user