I figured out, that I can use browser.pause();
to stop the execution of the browser and inspect its current variables, but how do I inspect the variables of my WebdriverIO test source?
Of course I could call console.log()
if I would like to know a value. But for every try I would have to restart the complete test suite, or I would need to comment every other test.
Instead, I would ideally like to stop the execution in one line and inspect all available variables.
Does somebody has a solution for that, or an other idea?
This is not the matter of webdriver-io, but the IDE you are using. What you are looking for is a
remote debugging
feature of an IDE. I've been doing that with Webstorm successfully.Have a look at this video on how to run setup test runner in Webstorm.
For people coming here in hopes of an easier debug process of their WebdriverIO test cases, take a look at the .debug() command.
It doesn't do exactly what @Sandro was looking for, but it offers an alternative to changing your text-editor for a fancy, lumbering IDE:
browser.debug()
after the line you want your "breakpoint");browser
object in the state in which it is found, alongside all the other API commands.Drawbacks:
!Note: If you are using the WDIO testrunner, make sure you increase the
timeout
property of your test framework your are using (e.g. Mocha, Cucumber, or Jasmine) in order to prevent the continuation due to a test timeout.