Waiting for text to appear in the text box of my application has been a challenge. The loading time ranges from 1 to 5 seconds, sometimes even longer, and some text boxes may not have any text at all. This poses an issue with using cypress-wait-until as it simply waits for text to appear and fails the test after 60 seconds if it doesn't load. Below is my current code snippet:
cy.get(elementSelector)
.if()
.find(this.helpTextArea)
.then(($helptextBox) => {
let helptext = $helptextBox.text();
helptext = helptext.trim() ? helptext : null;
if (additionalHelptext) {
questionModel.additionalHelptext = helptext;
} else {
questionModel.helptext = helptext;
}
});
I believe that implementing a soft assertion would be the most efficient solution, one that does not fail the test on textboxes with no text. However, to my knowledge, Cypress does not support such soft assertions.
Attempts made so far include: cypress-wait-until (fails when text is not found), cy.wait() (increases test execution time and lacks reliability).