I'm trying to compare if the value changed correctly after doing certain things in the app. First I'm trying to assign the value using cypress aliases, but it does not find the value at all. I tried using let and const and same problem exists.
So here is the code which gives error:
cy.get('[data-cy=AmountAll]', { timeout: 15000 }).invoke('text').then((text) => {
text.replace(/\D/g,'').as("myAlias")
})
I want to reuse this txt variable so that I can compare it later:
cy.get('[data-cy=AmountAll]', { timeout: 15000 }).invoke('text').then((text) => {
expect(@myAlias).to.be.gte(text.replace(/\D/g,''));
})
So its basically checking if the value changed after doing some set of procedures and is smaller than before. But I cant find correct way to hold this value in a variable