test(token-e2e): lint

This commit is contained in:
AndyWhiteVega 2022-06-23 14:43:17 +01:00
parent 9500c522de
commit f0d1c1d15d
8 changed files with 350 additions and 251 deletions

View File

@ -4,72 +4,104 @@ import staking from '../../locators/staking.locators';
import '../../support/staking.functions';
import '../../support/wallet.functions';
context('Staking Tab - with vega wallet connected', function() {
context('Staking Tab - with vega wallet connected', function () {
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_connect();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
});
before('visit staking tab and connect vega wallet', function() {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click()
cy.walletVega_connect();
cy.get(navigation.spinner, {timeout : 20000}).should('not.exist')
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
})
describe('vega wallet contains VEGA tokens', function () {
before('ensure environment fit for test', function () {
assert.isAtLeast(
parseInt(this.initialUnstakedBalance),
0.1,
'Checking we have at least 0.1 unstaked vega to play with'
);
assert.isAtLeast(
this.validatorNames.length,
2,
'Checking we have at least 2 validators'
);
// Ensure we are not in last minute - as this adds flake
cy.get(staking.epochEndingText)
.contains('Next epoch in 1 minutes', { timeout: 65000 })
.should('not.exist');
});
describe('vega wallet contains VEGA tokens', function() {
before('drill into a specific validator - and note values', function () {
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue)
.invoke('text')
.as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue)
.invoke('text')
.as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)')
.parent()
.siblings()
.invoke('text')
.as('initialValidatorStake');
});
before('ensure environment fit for test', function() {
assert.isAtLeast(parseInt(this.initialUnstakedBalance), 0.1, 'Checking we have at least 0.1 unstaked vega to play with');
assert.isAtLeast(this.validatorNames.length, 2, 'Checking we have at least 2 validators');
// Ensure we are not in last minute - as this adds flake
cy.get(staking.epochEndingText).contains('Next epoch in 1 minutes', {timeout:65000}).should('not.exist');
})
describe('Able to stake against a validator', function () {
it('Check - ability to fill in fields and request a stake of 0.1 tokens', function () {
cy.get(staking.addStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
cy.get('button').contains('Add 0.1 $VEGA tokens').click();
});
before('drill into a specific validator - and note values', function() {
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue).invoke('text').as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue).invoke('text').as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)').parent().siblings().invoke('text').as('initialValidatorStake');
})
it('Check - relevant successfull feedback provided after staking', function () {
// Wallet auto approves at this stage
cy.contains(
`Adding 0.1 $VEGA to validator ${this.validatorNames[0]}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
'At the beginning of the next epoch your $VEGA will be nominated to the validator'
);
});
describe('Able to stake against a validator', function() {
it('Check - staking page - stake on node (next epoch) - updates to reflect stake', function () {
let expectedStakeNextEpochValue =
parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.get(staking.stakeNextEpochValue, { timeout: 10000 }).contains(
expectedStakeNextEpochValue.toFixed(2),
{ timeout: 10000 }
);
});
it('Check - ability to fill in fields and request a stake of 0.1 tokens', function() {
cy.get(staking.addStakeRadioButton).click({force:true});
cy.get(staking.tokenAmountInput).type('0.1');
cy.get('button').contains('Add 0.1 $VEGA tokens').click();
})
it('Check - wallet - next epoch amount - updates balance for validator', function () {
let expectedValStakeNextEpochValue =
parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.walletVega_getNextEpochStakeForSpecifiedValidator(
this.validatorNames[0]
).then((actualNextEpochStake) => {
assert.equal(
parseFloat(actualNextEpochStake).toPrecision(12),
parseFloat(expectedValStakeNextEpochValue).toPrecision(12)
);
});
});
it('Check - relevant successfull feedback provided after staking', function() {
// Wallet auto approves at this stage
cy.contains(`Adding 0.1 $VEGA to validator ${this.validatorNames[0]}`).should('be.visible');
cy.contains('Waiting for confirmation that your change in nomination has been received').should('be.visible');
cy.contains('Waiting for confirmation that your change in nomination has been received', {timeout: 120000}).should('not.exist');
cy.contains('At the beginning of the next epoch your $VEGA will be nominated to the validator');
})
it('Check - staking page - stake on node (next epoch) - updates to reflect stake', function() {
let expectedStakeNextEpochValue = parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.get(staking.stakeNextEpochValue, {timeout:10000})
.contains(expectedStakeNextEpochValue.toFixed(2), {timeout:10000})
})
it('Check - wallet - next epoch amount - updates balance for validator', function() {
let expectedValStakeNextEpochValue = parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.walletVega_getNextEpochStakeForSpecifiedValidator(this.validatorNames[0])
.then(actualNextEpochStake => {
assert.equal(
parseFloat(actualNextEpochStake).toPrecision(12),
parseFloat(expectedValStakeNextEpochValue).toPrecision(12)
)
})
})
it.skip('Check - wallet - unstaked amount - updates balance', function() {
// Skipping until capsule can enable this test
cy.walletVega_getUnstakedAmount().should('equal', this.initialUnstakedBalance - 0.1)
})
})
})
})
it.skip('Check - wallet - unstaked amount - updates balance', function () {
// Skipping until capsule can enable this test
cy.walletVega_getUnstakedAmount().should(
'equal',
this.initialUnstakedBalance - 0.1
);
});
});
});
});

View File

@ -4,77 +4,107 @@ import staking from '../../locators/staking.locators';
import '../../support/staking.functions';
import '../../support/wallet.functions';
context('Staking Tab - with vega wallet connected', function() {
context('Staking Tab - with vega wallet connected', function () {
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_connect();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
});
before('visit staking tab and connect vega wallet', function() {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_connect();
cy.get(navigation.spinner, {timeout : 20000}).should('not.exist');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
})
describe('vega wallet contains VEGA tokens', function () {
before('ensure environment fit for test', function () {
assert.isAtLeast(
this.validatorNames.length,
2,
'Checking we have at least 2 validators'
);
// Ensure we are not in last minute - as this adds flake
cy.get(staking.epochEndingText)
.contains('Next epoch in 1 minutes', { timeout: 65000 })
.should('not.exist');
});
describe('vega wallet contains VEGA tokens', function() {
before('drill into a specific validator - and note values', function () {
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue)
.invoke('text')
.as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue)
.invoke('text')
.as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)')
.parent()
.siblings()
.invoke('text')
.as('initialValidatorStake');
});
before('ensure environment fit for test', function() {
assert.isAtLeast(this.validatorNames.length, 2, 'Checking we have at least 2 validators');
// Ensure we are not in last minute - as this adds flake
cy.get(staking.epochEndingText).contains('Next epoch in 1 minutes', {timeout:65000}).should('not.exist');
})
describe('Able to remove a stake against a validator', function () {
it('Check - validator has tokens to remove', function () {
let tokensToRemove = parseFloat(this.initialStakeNextEpoch);
assert.isAtLeast(
tokensToRemove,
0.1,
'Checking we have tokens to remove'
);
});
before('drill into a specific validator - and note values', function() {
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue).invoke('text').as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue).invoke('text').as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)').parent().siblings().invoke('text').as('initialValidatorStake');
})
it('Check - ability to fill in fields and request a stake of 0.1 tokens', function () {
cy.get(staking.removeStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
cy.get('button').contains('Remove 0.1 $VEGA tokens').click();
});
describe('Able to remove a stake against a validator', function() {
it('Check - relevant successfull feedback provided after staking', function () {
// Wallet auto approves at this stage
cy.contains(
`Removing 0.1 $VEGA from validator ${this.validatorNames[0]}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
`0.1 $VEGA has been removed from validator ${this.validatorNames[0]}`
);
});
it('Check - validator has tokens to remove', function() {
let tokensToRemove = parseFloat(this.initialStakeNextEpoch);
assert.isAtLeast(tokensToRemove, 0.10, 'Checking we have tokens to remove');
})
it('Check - staking page - stake on node (next epoch) - updates to reflect stake', function () {
let expectedStakeNextEpochValue =
parseFloat(this.initialStakeNextEpoch) - 0.1;
cy.get(staking.stakeNextEpochValue, { timeout: 10000 })
.contains(expectedStakeNextEpochValue.toFixed(2), { timeout: 10000 })
.should('be.visible');
});
it('Check - ability to fill in fields and request a stake of 0.1 tokens', function() {
cy.get(staking.removeStakeRadioButton).click({force:true});
cy.get(staking.tokenAmountInput).type('0.1');
cy.get('button').contains('Remove 0.1 $VEGA tokens').click();
})
it('Check - wallet - next epoch amount - updates balance for validator', function () {
let expectedValStakeNextEpochValue =
parseFloat(this.initialStakeNextEpoch) - 0.1;
cy.walletVega_getNextEpochStakeForSpecifiedValidator(
this.validatorNames[0]
).then((actualNextEpochStake) => {
assert.equal(
parseFloat(actualNextEpochStake).toPrecision(12),
parseFloat(expectedValStakeNextEpochValue).toPrecision(12)
);
});
});
it('Check - relevant successfull feedback provided after staking', function() {
// Wallet auto approves at this stage
cy.contains(`Removing 0.1 $VEGA from validator ${this.validatorNames[0]}`).should('be.visible');
cy.contains('Waiting for confirmation that your change in nomination has been received').should('be.visible');
cy.contains('Waiting for confirmation that your change in nomination has been received', {timeout: 120000}).should('not.exist');
cy.contains(`0.1 $VEGA has been removed from validator ${this.validatorNames[0]}`);
})
it('Check - staking page - stake on node (next epoch) - updates to reflect stake', function() {
let expectedStakeNextEpochValue = parseFloat(this.initialStakeNextEpoch) - 0.1;
cy.get(staking.stakeNextEpochValue, {timeout:10000})
.contains(expectedStakeNextEpochValue.toFixed(2), {timeout:10000})
.should('be.visible')
})
it('Check - wallet - next epoch amount - updates balance for validator', function() {
let expectedValStakeNextEpochValue = parseFloat(this.initialStakeNextEpoch) - 0.1;
cy.walletVega_getNextEpochStakeForSpecifiedValidator(this.validatorNames[0])
.then(actualNextEpochStake => {
assert.equal(
parseFloat(actualNextEpochStake).toPrecision(12),
parseFloat(expectedValStakeNextEpochValue).toPrecision(12)
)
})
})
it.skip('Check - wallet - unstaked amount - updates balance', function() {
// Skipping until capsule can enable this test
cy.walletVega_getUnstakedAmount().should('equal', this.initialUnstakedBalance - 0.1)
})
})
})
})
it.skip('Check - wallet - unstaked amount - updates balance', function () {
// Skipping until capsule can enable this test
cy.walletVega_getUnstakedAmount().should(
'equal',
this.initialUnstakedBalance - 0.1
);
});
});
});
});

View File

@ -4,67 +4,96 @@ import staking from '../../locators/staking.locators';
import '../../support/staking.functions';
import '../../support/wallet.functions';
context('Staking Tab - with vega wallet connected', function() {
context('Staking Tab - with vega wallet connected', function () {
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click();
cy.walletVega_connect();
cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist');
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
});
before('visit staking tab and connect vega wallet', function() {
cy.visit('/');
cy.get(navigation.section, { timeout: 20000 }).should('be.visible');
cy.get(navigation.staking).first().click()
cy.walletVega_connect();
cy.get(navigation.spinner, {timeout : 20000}).should('not.exist')
cy.walletVega_getUnstakedAmount().as('initialUnstakedBalance');
cy.stakingPage_getValidatorNamesSorted().as('validatorNames');
})
describe('vega wallet contains VEGA tokens', function () {
before('ensure environment fit for test', function () {
assert.isAtLeast(
parseInt(this.initialUnstakedBalance),
0.1,
'Checking we have at least 0.1 unstaked vega to play with'
);
assert.isAtLeast(
this.validatorNames.length,
2,
'Checking we have at least 2 validators'
);
// Ensure we are not in last minute - as this adds flake
cy.get(staking.epochEndingText)
.contains('Next epoch in 1 minutes', { timeout: 65000 })
.should('not.exist');
});
describe('vega wallet contains VEGA tokens', function() {
before('drill into a specific validator - and note values', function () {
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue)
.invoke('text')
.as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue)
.invoke('text')
.as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)')
.parent()
.siblings()
.invoke('text')
.as('initialValidatorStake');
});
before('ensure environment fit for test', function() {
assert.isAtLeast(parseInt(this.initialUnstakedBalance), 0.1, 'Checking we have at least 0.1 unstaked vega to play with');
assert.isAtLeast(this.validatorNames.length, 2, 'Checking we have at least 2 validators');
// Ensure we are not in last minute - as this adds flake
cy.get(staking.epochEndingText).contains('Next epoch in 1 minutes', {timeout:65000}).should('not.exist');
})
describe('Able to stake against a validator', function () {
it('Able to stake against a validator', function () {
// Check - ability to fill in fields and request a stake of 0.1 tokens
cy.get(staking.addStakeRadioButton).click({ force: true });
cy.get(staking.tokenAmountInput).type('0.1');
cy.get('button').contains('Add 0.1 $VEGA tokens').click();
before('drill into a specific validator - and note values', function() {
cy.get(staking.validatorNames).contains(this.validatorNames[0]).click();
cy.contains('Manage your stake').should('be.visible');
cy.get(staking.stakeNextEpochValue).invoke('text').as('initialStakeNextEpoch');
cy.get(staking.stakeThisEpochValue).invoke('text').as('initialStakeThisEpoch');
cy.contains('OWN STAKE (THIS EPOCH)').parent().siblings().invoke('text').as('initialValidatorStake');
})
// Check - relevant successfull feedback provided after staking - Note: Wallet auto approves at this stage
cy.contains(
`Adding 0.1 $VEGA to validator ${this.validatorNames[0]}`
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received'
).should('be.visible');
cy.contains(
'Waiting for confirmation that your change in nomination has been received',
{ timeout: 120000 }
).should('not.exist');
cy.contains(
'At the beginning of the next epoch your $VEGA will be nominated to the validator'
);
describe('Able to stake against a validator', function() {
// Check - staking page - stake on node (next epoch) - updates to reflect stake
let expectedStakeNextEpochValue =
parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.get(staking.stakeNextEpochValue, { timeout: 10000 }).contains(
expectedStakeNextEpochValue.toFixed(2),
{ timeout: 10000 }
);
it('Able to stake against a validator', function() {
// Check - ability to fill in fields and request a stake of 0.1 tokens
cy.get(staking.addStakeRadioButton).click({force:true});
cy.get(staking.tokenAmountInput).type('0.1');
cy.get('button').contains('Add 0.1 $VEGA tokens').click();
//Check - wallet staked amount - updates balance for validator
let expectedValStakeNextEpochValue =
parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.walletVega_getNextEpochStakeForSpecifiedValidator(
this.validatorNames[0]
).then((actualNextEpochStake) => {
assert.equal(
parseFloat(actualNextEpochStake).toPrecision(12),
parseFloat(expectedValStakeNextEpochValue).toPrecision(12)
);
});
// Check - relevant successfull feedback provided after staking - Note: Wallet auto approves at this stage
cy.contains(`Adding 0.1 $VEGA to validator ${this.validatorNames[0]}`).should('be.visible');
cy.contains('Waiting for confirmation that your change in nomination has been received').should('be.visible');
cy.contains('Waiting for confirmation that your change in nomination has been received', {timeout: 120000}).should('not.exist');
cy.contains('At the beginning of the next epoch your $VEGA will be nominated to the validator');
// Check - staking page - stake on node (next epoch) - updates to reflect stake
let expectedStakeNextEpochValue = parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.get(staking.stakeNextEpochValue, {timeout:10000})
.contains(expectedStakeNextEpochValue.toFixed(2), {timeout:10000})
//Check - wallet staked amount - updates balance for validator
let expectedValStakeNextEpochValue = parseFloat(this.initialStakeNextEpoch) + 0.1;
cy.walletVega_getNextEpochStakeForSpecifiedValidator(this.validatorNames[0])
.then(actualNextEpochStake => {
assert.equal(
parseFloat(actualNextEpochStake).toPrecision(12),
parseFloat(expectedValStakeNextEpochValue).toPrecision(12)
)
})
//Check - wallet unstaked amount - updates balance - Note: Skipping until capsule can enable this test
// cy.walletVega_getUnstakedAmount().should('equal', this.initialUnstakedBalance - 0.1);
})
})
})
})
//Check - wallet unstaked amount - updates balance - Note: Skipping until capsule can enable this test
// cy.walletVega_getUnstakedAmount().should('equal', this.initialUnstakedBalance - 0.1);
});
});
});
});

View File

@ -1,10 +1,10 @@
export default {
section: 'nav',
home: '[href="/"]',
vesting: '[href="/vesting"]',
staking: '[href="/staking"]',
rewards: '[href="/rewards"]',
withdraw: '[href="/withdraw"]',
governance: '[href="/governance"]',
spinner: 'splash-loader'
section: 'nav',
home: '[href="/"]',
vesting: '[href="/vesting"]',
staking: '[href="/staking"]',
rewards: '[href="/rewards"]',
withdraw: '[href="/withdraw"]',
governance: '[href="/governance"]',
spinner: 'splash-loader',
};

View File

@ -1,10 +1,10 @@
export default {
validatorNames: '[data-testid="node-list-item"] > :nth-child(1)',
epochEndingText: '[data-testid="epoch-countdown"]',
addStakeRadioButton: '[data-testid="add-stake-radio"]',
removeStakeRadioButton: '[data-testid="remove-stake-radio"]',
tokenAmountInput: '[data-testid="token-amount-input"]',
stakedAmounts: '[data-testid="staked-validator-item"]',
stakeNextEpochValue: '[data-testid="stake-next-epoch"]',
stakeThisEpochValue: '[data-testid="stake-this-epoch"]',
validatorNames: '[data-testid="node-list-item"] > :nth-child(1)',
epochEndingText: '[data-testid="epoch-countdown"]',
addStakeRadioButton: '[data-testid="add-stake-radio"]',
removeStakeRadioButton: '[data-testid="remove-stake-radio"]',
tokenAmountInput: '[data-testid="token-amount-input"]',
stakedAmounts: '[data-testid="staked-validator-item"]',
stakeNextEpochValue: '[data-testid="stake-next-epoch"]',
stakeThisEpochValue: '[data-testid="stake-this-epoch"]',
};

View File

@ -1,6 +1,6 @@
export default {
connectRestForm: '[data-testid="rest-connector-form"]',
name: '#wallet',
passphrase: '#passphrase',
vegawallet: '.vega-wallet'
connectRestForm: '[data-testid="rest-connector-form"]',
name: '#wallet',
passphrase: '#passphrase',
vegawallet: '.vega-wallet',
};

View File

@ -1,10 +1,12 @@
import staking from '../locators/staking.locators';
import staking from '../locators/staking.locators';
Cypress.Commands.add("stakingPage_getValidatorNamesSorted", function() {
let validatorNames = [];
cy.get(staking.validatorNames)
.each(($validatorName) => {
validatorNames.push($validatorName.text());
})
.then(() => {return validatorNames.sort()})
Cypress.Commands.add('stakingPage_getValidatorNamesSorted', function () {
let validatorNames = [];
cy.get(staking.validatorNames)
.each(($validatorName) => {
validatorNames.push($validatorName.text());
})
.then(() => {
return validatorNames.sort();
});
});

View File

@ -1,47 +1,53 @@
import wallet from '../locators/wallet.locators';
Cypress.Commands.add("walletVega_connect", function () {
Cypress.Commands.add('walletVega_connect', function () {
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
const walletTruncatedKey = Cypress.env('TRUNCATED_VEGA_PUBLIC_KEY');
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
const walletTruncatedKey = Cypress.env('TRUNCATED_VEGA_PUBLIC_KEY');
cy.get(wallet.vegawallet).within(() => {
cy.get('button')
.contains('Connect Vega wallet to use associated $VEGA')
.should('be.enabled')
.click();
});
cy.get(wallet.vegawallet).within(() => {
cy.get('button')
.contains('Connect Vega wallet to use associated $VEGA')
.should('be.enabled').click();
})
cy.get('button').contains('rest provider').click();
cy.get('button').contains('rest provider').click();
cy.get(wallet.connectRestForm).within(() => {
cy.get(wallet.name).click().type(walletName);
cy.get(wallet.passphrase).click().type(walletPassphrase);
cy.get('button').contains('Connect').click();
});
cy.get(wallet.connectRestForm).within(() => {
cy.get(wallet.name).click().type(walletName);
cy.get(wallet.passphrase).click().type(walletPassphrase);
cy.get('button').contains('Connect').click();
})
cy.get(wallet.vegawallet).within(() => {
cy.contains(walletTruncatedKey).should('be.visible');
cy.contains('Assets', { timeout: 20000 }).should('be.visible');
});
});
cy.get(wallet.vegawallet).within(() => {
cy.contains(walletTruncatedKey).should('be.visible');
cy.contains('Assets', {timeout: 20000}).should('be.visible');
})
})
Cypress.Commands.add('walletVega_getUnstakedAmount', function () {
cy.get(wallet.vegawallet).contains('Unstaked').siblings().invoke('text');
});
Cypress.Commands.add("walletVega_getUnstakedAmount", function() {
cy.get(wallet.vegawallet).contains('Unstaked').siblings().invoke('text')
})
Cypress.Commands.add("walletVega_getNextEpochStakeForSpecifiedValidator", function(validatorName) {
Cypress.Commands.add(
'walletVega_getNextEpochStakeForSpecifiedValidator',
function (validatorName) {
// need to check if validator is present first
let fieldPresent = false;
cy.get(wallet.vegawallet)
.within(($wallet) => {
if ($wallet.text().includes(`${validatorName} (Next epoch)`)) fieldPresent = true
})
.then(() => {
.within(($wallet) => {
if ($wallet.text().includes(`${validatorName} (Next epoch)`))
fieldPresent = true;
})
.then(() => {
if (fieldPresent == true) {
cy.contains(`${validatorName} (Next epoch)`)
.siblings()
.invoke('text')}
else {return "0.000000000000000000"}
})
})
cy.contains(`${validatorName} (Next epoch)`)
.siblings()
.invoke('text');
} else {
return '0.000000000000000000';
}
});
}
);