Test/884 token e2e adjust staking flow tests to new implementation of validators table (#990)
* test: flake fixes since ui revamp * test: lint * test: fix broken locator since locator revamp * test: unrelated flake preventing PR - fix
This commit is contained in:
parent
416805c2a2
commit
db3aa7c17b
@ -71,7 +71,7 @@ context('Node switcher', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach('Close node switcher', function () {
|
afterEach('Close node switcher', function () {
|
||||||
cy.getByTestId(closeDialogBtn).should('be.visible').click();
|
cy.getByTestId(closeDialogBtn).should('be.enabled').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
function validateNodeError(errortype, errorMsg) {
|
function validateNodeError(errortype, errorMsg) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
const stakeValidatorListTotalStake = '[col-id="totalStakeThisEpoch"]';
|
const stakeValidatorListTotalStake = '[col-id="totalStakeThisEpoch"]';
|
||||||
const stakeValidatorListTotalShare = '[col-id="share"]';
|
const stakeValidatorListTotalShare = '[col-id="share"]';
|
||||||
const stakeValdatorListValidatorStake = '[col-id="validatorStake"]';
|
const stakeValidatorListValidatorStake = '[col-id="validatorStake"]';
|
||||||
const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]';
|
const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]';
|
||||||
const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]';
|
const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]';
|
||||||
const stakeTokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
const stakeTokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
||||||
@ -50,6 +50,7 @@ context('Staking Tab - with eth and vega wallets connected', function () {
|
|||||||
function () {
|
function () {
|
||||||
cy.vega_wallet_teardown();
|
cy.vega_wallet_teardown();
|
||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
|
cy.wait_for_spinner();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -153,15 +154,30 @@ context('Staking Tab - with eth and vega wallets connected', function () {
|
|||||||
cy.navigate_to('staking');
|
cy.navigate_to('staking');
|
||||||
|
|
||||||
cy.get(`[row-id="${0}"]`).within(() => {
|
cy.get(`[row-id="${0}"]`).within(() => {
|
||||||
cy.get(stakeValidatorListTotalStake).should('have.text', '3.00');
|
cy.get(stakeValidatorListTotalStake)
|
||||||
cy.get(stakeValidatorListTotalShare).should('have.text', '66.67%');
|
.should('have.text', '2.00')
|
||||||
cy.get(stakeValdatorListValidatorStake).should('have.text', '2.00');
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListTotalShare)
|
||||||
|
.should('have.text', '66.67%')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListValidatorStake)
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('have.text', '2.00')
|
||||||
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.get(`[row-id="${1}"]`).within(() => {
|
cy.get(`[row-id="${1}"]`).within(() => {
|
||||||
cy.get(stakeValidatorListTotalStake).should('have.text', '3.00');
|
cy.get(stakeValidatorListTotalStake)
|
||||||
cy.get(stakeValidatorListTotalShare).should('have.text', '33.33%');
|
.scrollIntoView()
|
||||||
cy.get(stakeValdatorListValidatorStake).should('have.text', '1.00');
|
.should('have.text', '1.00')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListTotalShare)
|
||||||
|
.should('have.text', '33.33%')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListValidatorStake)
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('have.text', '1.00')
|
||||||
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ const navigation = {
|
|||||||
rewards: '[href="/rewards"]',
|
rewards: '[href="/rewards"]',
|
||||||
withdraw: '[href="/withdraw"]',
|
withdraw: '[href="/withdraw"]',
|
||||||
governance: '[href="/governance"]',
|
governance: '[href="/governance"]',
|
||||||
pageSpinner: 'splash-loader',
|
pageSpinner: '[data-testid="splash-loader"]',
|
||||||
};
|
};
|
||||||
|
|
||||||
Cypress.Commands.add('navigate_to', (page) => {
|
Cypress.Commands.add('navigate_to', (page) => {
|
||||||
|
@ -22,7 +22,7 @@ Cypress.Commands.add('wait_for_begining_of_epoch', () => {
|
|||||||
|
|
||||||
Cypress.Commands.add('staking_validator_page_add_stake', (stake) => {
|
Cypress.Commands.add('staking_validator_page_add_stake', (stake) => {
|
||||||
cy.highlight(`Adding a stake of ${stake}`);
|
cy.highlight(`Adding a stake of ${stake}`);
|
||||||
cy.get(addStakeRadioButton).click({ force: true });
|
cy.get(addStakeRadioButton, { timeout: 8000 }).click({ force: true });
|
||||||
cy.get(tokenAmountInputBox).type(stake);
|
cy.get(tokenAmountInputBox).type(stake);
|
||||||
cy.wait_for_begining_of_epoch();
|
cy.wait_for_begining_of_epoch();
|
||||||
cy.get(tokenSubmitButton, { timeout: 8000 })
|
cy.get(tokenSubmitButton, { timeout: 8000 })
|
||||||
@ -34,7 +34,7 @@ Cypress.Commands.add('staking_validator_page_add_stake', (stake) => {
|
|||||||
|
|
||||||
Cypress.Commands.add('staking_validator_page_remove_stake', (stake) => {
|
Cypress.Commands.add('staking_validator_page_remove_stake', (stake) => {
|
||||||
cy.highlight(`Removing a stake of ${stake}`);
|
cy.highlight(`Removing a stake of ${stake}`);
|
||||||
cy.get(removeStakeRadioButton).click();
|
cy.get(removeStakeRadioButton, { timeout: 8000 }).click();
|
||||||
cy.get(tokenAmountInputBox).type(stake);
|
cy.get(tokenAmountInputBox).type(stake);
|
||||||
cy.wait_for_begining_of_epoch();
|
cy.wait_for_begining_of_epoch();
|
||||||
cy.get(tokenSubmitButton)
|
cy.get(tokenSubmitButton)
|
||||||
@ -94,6 +94,8 @@ Cypress.Commands.add(
|
|||||||
'click_on_validator_from_list',
|
'click_on_validator_from_list',
|
||||||
(validatorNumber, validatorName = null) => {
|
(validatorNumber, validatorName = null) => {
|
||||||
cy.contains('Waiting for next epoch to start').should('not.exist');
|
cy.contains('Waiting for next epoch to start').should('not.exist');
|
||||||
|
// below is to ensure validator list is shown
|
||||||
|
cy.get(stakeValidatorListName, { timeout: 10000 }).should('exist');
|
||||||
cy.get(stakeValidatorListPendingStake, txTimeout).should(
|
cy.get(stakeValidatorListPendingStake, txTimeout).should(
|
||||||
'not.contain',
|
'not.contain',
|
||||||
'2,000,000,000,000,000,000.00' // number due to bug #936
|
'2,000,000,000,000,000,000.00' // number due to bug #936
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
} from '@vegaprotocol/smart-contracts';
|
} from '@vegaprotocol/smart-contracts';
|
||||||
import { ethers, Wallet } from 'ethers';
|
import { ethers, Wallet } from 'ethers';
|
||||||
|
|
||||||
|
const vegaWalletContainer = '[data-testid="vega-wallet"]';
|
||||||
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic');
|
const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic');
|
||||||
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
||||||
@ -40,14 +41,24 @@ before('Vega wallet teardown prep', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('vega_wallet_teardown', function () {
|
Cypress.Commands.add('vega_wallet_teardown', function () {
|
||||||
cy.vega_wallet_teardown_staking(this.stakingBridgeContract);
|
cy.get(vegaWalletContainer).within(() => {
|
||||||
cy.vega_wallet_teardown_vesting(this.vestingContract);
|
cy.get(vegaWalletAssociatedBalance)
|
||||||
|
.invoke('text')
|
||||||
|
.then((balance) => {
|
||||||
|
if (balance != '0.000000000000000000') {
|
||||||
|
cy.vega_wallet_teardown_staking(this.stakingBridgeContract);
|
||||||
|
cy.vega_wallet_teardown_vesting(this.vestingContract);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
cy.get(vegaWalletAssociatedBalance, { timeout: transactionTimeout }).should(
|
cy.get(vegaWalletContainer).within(() => {
|
||||||
'contain',
|
cy.get(vegaWalletAssociatedBalance, { timeout: transactionTimeout }).should(
|
||||||
'0.000000000000000000',
|
'contain',
|
||||||
{ timeout: transactionTimeout }
|
'0.000000000000000000',
|
||||||
);
|
{ timeout: transactionTimeout }
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
|
Loading…
Reference in New Issue
Block a user