nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

Feature request: Promise-based client interface #638

Closed mbixby closed 8 years ago

mbixby commented 9 years ago

This would allow for interleaving synchronous and asynchronous code with nicer syntax. Promise.all could be used to parallelize commands. Adding breakpoints in between commands would work as expected, making live coding easier.

await client.url('http://www.google.com');
await client.waitForElementVisible('body', 1000);
const title = await client.title();
expect(title).to.contain('Google');

(similarly with yield or plain promises)

See https://github.com/theintern/leadfoot/blob/master/Command.js for more examples.

Is this realistic?

May be related to #121 (conditional test parts).

Matthew-Davey commented 9 years ago

Must agree with this. I've been poking around in Nightwatch a lot recently and it's just crying out to be implemented with promises!

mucsi96 commented 8 years ago

+1

volodya1805 commented 8 years ago

+1

gabzim commented 8 years ago

+1

aikeru commented 8 years ago

+1, please

deanrad commented 8 years ago

+1 though I fear this would be against the grain. Nightwatch does not appear interested in normal programming concepts— being limited to the fluent interface, while frustrating to real programmers who want to add breakpoints, control flow etc, is a boon to folks getting off the ground with less programming skill. I'd love to see a prototype @mbixby - I was just pondering whipping up an interface this morning whose promise resolves with an object of {client, result}, so promise steps could chain, but also get the results of an elements query, for example.

DutchKevv commented 8 years ago

+1

beatfactor commented 8 years ago

I'm afraid this is not on the agenda for the near future, but we'll keep it in mind for a more significant upgrade later down the path. For now I'm closing it since it's open for a long time.

dilipkumar2k6 commented 7 years ago

Missing Promise support is big setback for me as a developer. Can you please add Promise support? I would be happy to do PR if ready to accept.

pkantsedalov commented 7 years ago

Has anybody tried sequenced? Maybe it can be temporary solution for devs & automation QAs.

cheapsteak commented 7 years ago

This is supported by webdriver.io and nightmare Wish for reconsideration

mbixby commented 7 years ago

A while after starting this feature request I realized I can achieve this by switching to a blocking API for Selenium in Ruby. I can whip up pry debugger and develop and tweak my Selenium tests live (while stopped on a breakpoint inside the program) without needing to rerun the test case in context.

There are some JS libs for Selenium with blocking API (Testium) but the debugging experience seems to be inferior.

twiggy commented 7 years ago

+1

alexpanov commented 6 years ago

I can't believe that this hasn't been addressed in more than 2 years.

JonEustace commented 6 years ago

Agreed.

leegee commented 6 years ago

Lack of Promises is a real deal-breaker.

metareven commented 6 years ago

This is a huge issue for me as well. This was OK back in the day before native promises were a thing, but now this means that we cannot write "normal" javascript code for our integration tests

HareshVelusamy commented 4 years ago

+1