-
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
When using Cucumber as a runner a NightwatchAssertError thrown in Page Objects exits node process abruptly #3596
Comments
@memihai Check this issue, I think there might be an overlap, as it's the same kind of error. |
@asos-saveriocutrupi I hit that error too but that one hangs the process indefinitely. I never logged it as I didn't know how to reproduce it. There are 2 differences between that and the current issue:
But thanks for pointing that issue out! Good to know about it as I can now avoid it 👍 . |
I played around with this today and realised that if I define the command like this
So it returns a promise then I use it like so in the step definition:
}); Then the tests behave as expected. After the first test failed the second one is run and the result is 2 out of 2 failures. |
There is a simpler test case for this issue in https://discord.com/channels/618399631038218240/1072553726193184788/threads/1083290462011523142 describe('Ecosia', function() {
// test() and specify() is also available
it('demo test', function(browser) {
browser
.url('https://www.ecosia.org/%27)
.setValue('input[type=search]', 'nightwatch')
.click('button[type=submit]')
// .assert.containsText('.mainline-results', 'Nightwatch.js')
browser.waitForElementNotPresent('#dialog', 50000)
.end();
});
}); Updating priority. Hopefully we can get to this soon! |
I can also reproduce this issue and it is one of the blockers for upgrading to v2. |
The problem described here is still an issue in Nightwatch 3.0.1, I just tested it today. |
@gravityvi, @AutomatedTester Do you have any updates on this? |
@memihai I don't think it's a bug while using cucumber the nightwatch commands should return a promise or a value in the example shown above the page command isn't returning a promise. To fix the test just return the result from customWait. Let me know if I missed something here. Actual Example:
Fixed command:
|
@gravityvi yes your solution works for that example but what if I want to click the element after waiting for it to be visible
This will fail the same way I had pointed out in the issue. Another thing I tried is to return the result from the command which should be a promise
and then chain the wait and click:
This will fail the same way I had pointed out in the issue. I would expect both scenariops to work or at least the last one. Am I wrong in my assumptions? |
Description of the bug/issue
When the runner is Cucumber if an assertion fails in a Page Object the process exists abruptly with no stack trace.
Steps to reproduce
Actual:
Node process exists with exit code 0 after the NightwatchAssertError is thrown.
Expected:
Test is failed and next test is run.
Sample test
Command to run
Verbose Output
Nightwatch Configuration
Nightwatch.js Version
2.6.11
Node Version
17.8.0
Browser
Chrome 109.0.5414.119
Operating System
No response
Additional Information
This reproduces with custom commands and expect statemetns like
this.expect.element('@randomslector').to.be.visible;
The text was updated successfully, but these errors were encountered: