How can i write correctly this code, in such a way that it is a valid if syntax, and if it is not respected, should I have someone else with it?
Basically I want to search for a text in a popup window. If it does not exist, enter the code in else statement.
cy.get(".ibxudA").find('.WildnessText-kRKTej').should('have.text',"Wildness")
You can yield the subject returned by find and evaluate the text using JQuery commands.
cy.get('.ibxudA').find('.WildnessText-kRKTejj').then(($el) => {
if ($el.text() !== "Wildness") {
// code to execute if it does not have the text
} else {
// code to execute if it does have the text
}
});