如何用柏树找到哪个变量更大

How to find which variable is greater with cypress

请帮助我。 我有 2 个变量,想知道哪个变量对柏树来说更大。 像这样:

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

有没有断言

这是我的代码

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);

           });
  });

但它不能正常工作。 请帮助我!

你应该使用expect

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

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