test(token test fixes): fix failing smoke tests (#2288)

* chore: fix staking view tests

* fix: staking flow test

* chore: rename variable
This commit is contained in:
Joe Tsang 2022-11-30 17:53:38 +00:00 committed by GitHub
parent 5d3a3a6f11
commit afd42f8a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 60 deletions

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" />
const stakeValidatorListTotalStake = '[col-id="totalStakeThisEpoch"]';
const stakeValidatorListTotalShare = '[col-id="share"]';
const stakeValidatorListTotalStake = '[col-id="stake"] > div > span';
const stakeValidatorListTotalShare = '[col-id="stakeShare"] > div > span';
const stakeValidatorListValidatorStake = '[col-id="validatorStake"]';
const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]';
const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]';

View File

@ -50,79 +50,50 @@ context('Staking Page - verify elements on page', function () {
function () {
// 2001-STKE-050
it('Should be able to see validator names', function () {
cy.get('[col-id="validator"]')
cy.get('[col-id="validator"] > div > span')
.should('have.length.at.least', 1)
.each(($name) => {
cy.wrap($name).should('not.be.empty');
});
});
it('Should be able to see validator status', function () {
cy.get('[col-id="status"]')
it('Should be able to see validator stake', function () {
cy.get('[col-id="stake"] > div > span')
.should('have.length.at.least', 1)
.each(($status) => {
cy.wrap($status).should('not.be.empty');
.each(($stake) => {
cy.wrap($stake).should('not.be.empty');
});
});
it('Should be able to see total stake for this epoch', function () {
cy.get('[col-id="totalStakeThisEpoch"]')
it('Should be able to see validator normalised voting power', function () {
cy.get('[col-id="normalisedVotingPower"] > div > span')
.should('have.length.at.least', 1)
.each(($totalStaked) => {
cy.wrap($totalStaked).should('not.be.empty');
.each(($vPower) => {
cy.wrap($vPower).should('not.be.empty');
});
});
it('Should be able to see validator staked for this epoch', function () {
cy.get('[col-id="validatorStake"]')
it('Should be able to see validator normalised voting power', function () {
cy.get('[col-id="normalisedVotingPower"] > div > span')
.should('have.length.at.least', 1)
.each(($validatorStake) => {
cy.wrap($validatorStake).should('not.be.empty');
.each(($vPower) => {
cy.wrap($vPower).should('not.be.empty');
});
});
it('Should be able to see validator staked for next epoch', function () {
cy.get('[col-id="pendingStake"]')
it('Should be able to see validator total penalties', function () {
cy.get('[col-id="totalPenalties"] > div > span')
.should('have.length.at.least', 1)
.each(($penalties) => {
cy.wrap($penalties).should('contain.text', '0%');
});
});
it('Should be able to see validator pending stake', function () {
cy.get('[col-id="pendingStake"] > div > span')
.should('have.length.at.least', 1)
.each(($pendingStake) => {
cy.wrap($pendingStake).should('not.be.empty');
});
});
// 2001-STKE-021
it('Should be able to see validator ranking score', function () {
cy.get('.ag-body-horizontal-scroll-viewport').scrollTo('right');
cy.get('[col-id="rankingScore"]')
.should('have.length.at.least', 1)
.each(($rankingScore) => {
cy.wrap($rankingScore).should('not.be.empty');
});
});
// 2001-STKE-022
it('Should be able to see validator stake score', function () {
cy.get('[col-id="stakeScore"]')
.should('have.length.at.least', 1)
.each(($stakeScore) => {
cy.wrap($stakeScore).should('not.be.empty');
});
});
// 2001-STKE-023
it('Should be able to see validator performance score', function () {
cy.get('[col-id="performanceScore"]')
.should('have.length.at.least', 1)
.each(($performanceScore) => {
cy.wrap($performanceScore).should('not.be.empty');
});
});
// 2001-STKE-024
it('Should be able to see validator voting power score', function () {
cy.get('[col-id="votingPower"]')
.should('have.length.at.least', 1)
.each(($votingPower) => {
cy.wrap($votingPower).should('not.be.empty');
cy.wrap($pendingStake).should('contain.text', '0.00');
});
});

View File

@ -12,8 +12,8 @@ const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]';
const associateContractRadioButton = '[data-testid="associate-radio-contract"]';
const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]';
const stakeValidatorListPendingStake = '[col-id="pendingStake"]';
const stakeValidatorListTotalStake = '[col-id="totalStakeThisEpoch"]';
const stakeValidatorListTotalShare = '[col-id="share"]';
const stakeValidatorListTotalStake = '[col-id="stake"] > div > span';
const stakeValidatorListTotalShare = '[col-id="stakeShare"] > div > span';
const stakeValidatorListName = '[col-id="validator"]';
const vegaKeySelector = '#vega-key-selector';
@ -150,7 +150,6 @@ Cypress.Commands.add(
(validatorNumber, validatorName = null) => {
cy.wait_for_spinner();
cy.contains('Loading...', epochTimeout).should('not.exist');
cy.contains('Total stake this epoch').should('be.visible');
cy.wait_for_beginning_of_epoch();
// below is to ensure validator list is shown
cy.get(stakeValidatorListName, { timeout: 10000 }).should('exist');
@ -179,10 +178,8 @@ Cypress.Commands.add(
) => {
cy.wait_for_spinner();
cy.contains('Loading...', epochTimeout).should('not.exist');
cy.contains('Total stake this epoch').should('be.visible');
cy.wait_for_beginning_of_epoch();
cy.get(`[row-id="${positionOnList}"]`).within(() => {
cy.get(stakeValidatorListName).should('have.text', expectedValidatorName);
cy.get(stakeValidatorListTotalStake, epochTimeout).should(
'have.text',
expectedTotalStake