1

Pls help me. I have a 2 variables and want to know which variable is greater with cypress. Like this:

if(rejectedCount > sortedCount){
    return true
} else return false

Are there any assertion for it.

This is my code

cy.get('.list-table-list-item').eq(0)

.find('.reject span')
.invoke('text')
.then(text => {
     const rejectedCount = text;
     cy.get('.sortingReject').click();
     cy.get('.list-table-list-item').eq(0)
         .find('.reject span')
         .invoke('text')
         .then(text => {
              const sortedCount = text;
             // There should be my assertion Like this
              cy.get(sortedCount).should('be.gt', rejectedCount);

           });
  });

But it not working right. Pls help me!

Narine Poghosyan
  • 853
  • 3
  • 16
  • 26

1 Answers1

3

You should use expect

expect(sortedCount).to.be.gt(rejectedCount)

https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Explicit-Subjects

kuceb
  • 16,573
  • 7
  • 42
  • 56