-
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
Nightwatch commands in waitUntil
callback return NightwatchAPI
instead of a Promise
.
#4158
Comments
I am looking into this issue |
@garg3133 Can I get the full script so I can test it locally? |
You can use this example test to reproduce this: describe('ecosia demo', function() {
before(() => {
browser
.navigateTo('https://ecosia.org/');
});
it('waitUntil callback demo', function() {
browser
.waitUntil(async function() {
const title = await browser.getTitle();
console.log(title); // <-- returns NightwatchAPI
return true;
})
.perform(async function() {
const title = await browser.getTitle();
console.log(title); // <-- returns correct result (title)
});
});
}); |
@garg3133 I was able to reproduce the problem. Thanks. |
Here is an update: I have regressed to previous versions of Nightwatchjs, all the way back to 3.1.0, and I get the same error. It appears |
Yeah, it didn't for this particular case. But if you change the line |
Exactly, I just observed that. |
As a contrast, in the |
I am woking on this issue and was able to reproduce it. |
Another issue I've found with
waitUntil
is that if we pass an async callback towaitUntil
command, Nightwatch commands inside the callback still just returnNightwatchAPI
and no promise which can be awaited to get the result. While inperform
command, it works fine and Nightwatch commands return a promise insideasync
callback passed toperfom
command.All this is when we do not use
async
in the test case function.Edit: This problem goes away if we set
always_async_commands
top-level setting totrue
in the Nightwatch config file.To reproduce:
This issue can be reproduced by running the following example test:
Previous conversation regarding this:
Issue created from #3511 (comment)
The text was updated successfully, but these errors were encountered: