You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, whenever I try to use any cypress command after promisifying a command in a single it block, I am getting error as below.
Code:
it('cy after promisify in single it block',async()=>{constfoo=awaitpromisify(cy.wrap('foo'));// this is promisifiedcy.log('any cy code here');// this does not run after the promisifyexpect(foo).to.equal('foo');});
Error i get:
Cypress Warning: Cypress detected that you returned a promise in a test, but also invoked one or more cy commands inside of that promise.
The test title was:
> Test spec file cy after promisify in single it block
While this works in practice, it's often indicative of an anti-pattern. You almost never need to return both a promise and also invoke cy commands.
Cy commands themselves are already promise like, and you can likely avoid the use of the separate Promise.
More info: promisify in separate it blocks works fine, i.e. promisify should be the last command in the it block. I have also tried with the cucumber framework. There also, if promisify is in separate step definitions, all is fine, but in the same step definition, again, I can not use any cy command after I use promisify, with the same error.
Cypress: v11.1.0
Node: v14.17.3
Any suggestion and resolution is appreciated
The text was updated successfully, but these errors were encountered:
mysticdevx
changed the title
multiple promisify commands fail in a single test
cypress commands after the promisify are failing
Nov 28, 2022
Hi, whenever I try to use any cypress command after promisifying a command in a single
it
block, I am getting error as below.Code:
Error i get:
More info:
promisify
in separateit
blocks works fine, i.e. promisify should be the last command in the it block. I have also tried with the cucumber framework. There also, ifpromisify
is in separate step definitions, all is fine, but in the same step definition, again, I can not use anycy
command after I use promisify, with the same error.Cypress: v11.1.0
Node: v14.17.3
Any suggestion and resolution is appreciated
The text was updated successfully, but these errors were encountered: