I have a Cypress test that was working fine. Its operation was stopped for a while and now we need to reactivate it, but it is not working anymore.
Here is the code
cy.get('[data-cy="content-wrapper"]').then(inputRow => {
if (inputRow.find('[data-cy="error-message-text"]').length) {
if (inputRow.find('[data-cy="MarketAvailableRuleFailure"]').length) {
cy.log('Outcome not available');
cy.then(() => this.skip()); // stop test
}
if (inputRow.find('[data-cy="MinValueRuleFailure"]').length) {
cy.log('Value is too small');
cy.then(() => this.skip()); // stop test
}
}
});
I’m getting this error message: “_this.skip is not a function”
error message
It seems that .skip is no longer working as it used to.
I tried to use cy.then(() => cy.state('test').skip())
, as described here:
text
Unfortunately cy.state
is deprecated.
Can someone help me with this?
Luiza Campos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
It’s just a typo, the screenshot does not agree with you code – there is an underscore in front of this
.
Also make sure the block that code is in uses function() {}
not () => {}
, otherwise this
is undefined.