-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Class-Style commands returning a promise reject does not stop execution #3741
Comments
This could be a duplicate of #2510 |
Hi @AutomatedTester I am not sure. Existing API commands do stop the tests from continuing, but when you create a custom command that follows the documentation it does not. |
@swrdfish , is there any timeline as to when this will be fixed as we cannot migrate from version 1.* until this is resolved |
@humphreyn this is a complex bug, we are looking into it but cannot promise on a timeline yet. |
@humphreyn Is it happening with the default test format or is it only when using the Cucumber runner? |
@beatfactor , I will set up a test can get back to you as we currently only use the Cucumber runner. |
@beatfactor, using the NW runner doesn't stop execution. To the default NW project installed with "npm init nightwatch" I added the below as follows: //nightwatch/page-objects/google/search.js
//nightwatch/examples/with-page-objects/google.js
//nightwatch/custom-commands/myCustomCommand.js
//output after running:
FYI @humphreyn |
@humphreyn If you are migrating a framework you might also be interested in this issue. This one is my blocker and you might hit it. I am also migrating a ~2000 test framework from 1.*. While working on the migration I had also hit the issue you had logged here so thank you for logging it. |
Description of the bug/issue
When I call my custom command that returns a promise.reject
Then I expected the scenario.result.status to equal "FAILED" in the cucumber AfterStep
And I expect any following cucumber steps to be skipped
But instead the AfterStep scenario.result.status equals "PASSED"
And any following cucumber steps are executed
Steps to reproduce
Any custom command that returns a promise.reject causes this error
The attached script uses a custom command that always returns a promise reject
We have 1.x custom commands that wait for a condition and return a promise.reject if that condition is not met within the timeout period
Version 2.x does not seem to handle custom commands promise.rejects at all
Sample test
Command to run
Verbose Output
Nightwatch Configuration
Nightwatch.js Version
2.6.21
Node Version
16.18.0
Browser
chrome 113.0.5672.127
Operating System
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: