Pausing test to debug nightwatch via command line

4,031 views
Skip to first unread message

Aaron Briel

unread,
Sep 22, 2014, 12:38:24 PM9/22/14
to nightw...@googlegroups.com
I am new to nightwatch and node.js, and I was curious what approach people take with respect to debugging.  Specifically, I would like to be able to pause a test at specific points and then be able to execute commands via the command line to test variable values or page-object function calls with the browser open.  Thanks! 

Dave Cadwallader

unread,
Sep 23, 2014, 1:26:43 AM9/23/14
to nightw...@googlegroups.com
I usually just insert a pause()  (with no args) which pauses the browser indefinitely.  Then you can open up the browser console and do what you want.

Andrei Rusu

unread,
Sep 23, 2014, 2:38:58 AM9/23/14
to nightw...@googlegroups.com
You can also have a look at this guide for debugging from WebStorm IDE:
https://github.com/beatfactor/nightwatch/wiki/Debugging-Nightwatch-tests-in-WebStorm.
> --
> You received this message because you are subscribed to the Google Groups
> "NightwatchJs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nightwatchjs...@googlegroups.com.
> To post to this group, send email to nightw...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nightwatchjs/49263c4a-0e28-4dc9-a761-5439eba02801%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Aaron Briel

unread,
Sep 23, 2014, 10:07:23 AM9/23/14
to nightw...@googlegroups.com
I have indeed configured my WS instance in that manner. I suppose I just need to tinker more with how to actually execute existing functions in the debug window.  It's a bit different than python, which simply requires a pdb.trace(), allowing one to execute any method available at the trace point..  Thanks though!!

Yegor Ius

unread,
Jun 21, 2016, 11:15:59 AM6/21/16
to NightwatchJs
I am only able to run NW tests via the approach described in the wiki. Execution does not stop at breakpoints...

Vincent Jo

unread,
Aug 3, 2016, 8:06:58 PM8/3/16
to NightwatchJs
Same here. It doesn't stop on breakpoints, but it just runs them. 

Rahul Kavalapara

unread,
Aug 5, 2016, 3:42:06 AM8/5/16
to NightwatchJs
I personally don't use Web storm. I use both VS Code & Visual studio. I can hit breakpoints with no issues. I also get Intellisense support. :) 

Kuba Mucha

unread,
Aug 8, 2016, 6:42:36 AM8/8/16
to NightwatchJs

Sandeep Thukral

unread,
Mar 9, 2017, 4:54:38 AM3/9/17
to NightwatchJs
Rahul,

How can I get intellisense in VS Code for nightwatchJS?

sreenivas parimi

unread,
Jun 27, 2018, 2:35:02 PM6/27/18
to NightwatchJs
how to hit breakpoints in vscode

Paras Mathur

unread,
Jun 28, 2018, 8:19:07 AM6/28/18
to nightw...@googlegroups.com
So far I have used pause(500000) to halt the script and look for the root cause of trouble

On 28 June 2018 at 00:05, sreenivas parimi <sreeniva...@gmail.com> wrote:
how to hit breakpoints in vscode

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

raj shd

unread,
Jun 29, 2018, 5:24:58 AM6/29/18
to nightw...@googlegroups.com
you need to add this to .vscode/launch.json

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "NightWatch",
"program": "${workspaceRoot}/node_modules/nightwatch/bin/runner.js",
"args": [
"--env",
"chrome",
"Tests/playground.js"
]
}
]
}


Reply all
Reply to author
Forward
0 new messages