Debugging cucumber steps in WebStorm - debugging

I'm experimenting with Cucumber/WebdriverIO UI tests using Webstorm (NodeJs platform). At certain steps I would really love to stop it in debug mode, check the retrieved element and see what can I do with it.
But unfortunately the Debug button is disabled and I couldn't find anything specific in Webstorm documentation as well.
If I can achieve my original goal (stopping a step and experimenting with the elements) without using Webstorm's Debug mode, that's totally fine for me.

Debugging Cucumber specs is not currently supported, please vote for WEB-15146

I'm not sure how this would work with Cucumber but WebdriverIO now has a debug command you can use

Related

Breakpoint debugging in Appium

Is there a way on how to set breakpoints in appium or get a better debugging experience than looking through logs and printing console.log() all the time?
I would like to be able to stop the test run in any step and see what are the values - proceed to next step and so on. I saw that this might be possible using IDE but is there a better integration solution? Also saw that cloud device providers provide similar logging solutions like https://www.browserstack.com/docs/app-automate/appium/set-up-tests/debugging-options but this is only on the cloud devices and I would like to see it localy.
Maybe a dependency that would include what I am asking for?
My setup is appium, webdriver.io, mocha.
Thank you in advance!
First of all, debug with IDE and BrowserStack logs it's not the same. I don't know why you need it, but the best way to debug is to use the IDE
enter image description here
enter image description here
enter image description here
Also, you can create your custom logger util, which will store all the events to log file and print it
And the last one is https://appium.io/docs/en/commands/session/events/get-events/
self.driver.execute_script("mobile: deviceInfo")

Cypress 10 - How to run all tests in one go?

I used to use Cypress 9 on previous projects.
By default, when running cypress open or cypress open --browser chrome used to run all tests for all React components.
However I installed Cypress 10 for the first time on a project that didn't have e2e tests yet. I added test specs, but I don't see any option to run all tests altogether.
It seems I have to run the tests one by one, clicking on each of them.
Can anyone please suggest how do I run all the tests automatically?
It's been removed in Cypress v10, here are the change notes related
During cypress open, the ability to "Run all specs" and "Run filtered specs" has been removed. Please leave feedback around the removal of this feature here. Your feedback will help us make product decisions around the future of this feature.
The feedback page to register your displeasure is here
You can create a "barrel" spec to run multiple imported specs.
I can't vouch for it working the same as v9 "Run all tests", but can't see any reason why not.
// all.spec.cy.js
import './test1.spec.cy.js' // relative paths
import './test2.spec.cy.js'
...
As #Constance says, reinstated in v11.20.
But still a very handy technique if you want to run a pre-defined subset of your tests.
In Cypress version 11.2.0 the Run All button has been reinstated.
You need to set experimentalRunAllSpecs to true in cypress.config.js.
Please see Configuration - End-to-End Testing
If Cypress Test Runner is not a must, I suggest to utilize the CLI/Node Cmd approach
You can trigger all the test(s) by npx cypress run(Still the video recording & screenshot on failed steps would be saved in the respective folders) to run all or with any other cypress flags to filter out specific spec files, or browser etc.
As per the feedback discussion there is a workaround the same as #Fody's answer that will achieve the same result as v9. Also worth noting though is the section on Continuous Integration and the Update 1 that includes a fix for preventing this workaround creating issues with the cypress run command.
Are there any current workarounds?
Yes. If you are impacted by the omission of this feature, it is possible to achieve the same level of parity as 9.x with a workaround Gleb Bahmutov explains here: https://glebbahmutov.com/blog/run-all-specs-cypress-v10/
This will still inherit the same problems as the previous implementation (which is why it was removed) but it will work in certain cases where the previous implementation was not problematic for your use case
https://github.com/cypress-io/cypress/discussions/21628#discussion-4098510
It was removed because people used it wrong.
The Test Runner is for debugging single tests. But by running all tests, then performance will quickly become a problem and crash the entire suite.
Running all tests should only be performed from the CLI.
Sources
https://github.com/cypress-io/cypress/issues/681
https://github.com/cypress-io/cypress/discussions/21628

JavaScript Mocha test debugging in WebStorm

I've just started using Mocha (+Chai) in WebStorm IDE for my Node.js project.
And I found out that I can't find familiar console pane, where I can type in expressions.
Also I see no easy way to re-run failed unit-test code in plain node.js (without mocha, because I need header with imports and Chai and I need to remove "describe", "it"...), so I can fix the code.
WebStorm is quite popular, Mocha and TDD too, so my question is:
How do you do TDD in WebStorm? How do you solve this problem?
Maybe I'm missing some button in IDE which opens console
Or maybe there is a way to simply run this unit-test separately in Node.js
somehow.
Or maybe you just live with this as it is and just
copy-paste code to some 'test.js' manually?

Improving productivity in debugging IntelliJ Idea

I wanted to know is there any way in IDEA putting debuggers' breakpoint to previous row where debugger has just passed and re-run that scenario again. Because when debugging a loop, it's a bit tedious going to a UI doing desired action for handling that case again. I think such feature is available in Visual Studio. I've tried to google it but unfortunately I could not found anything about it.
I've submitted an issue on IDEA's bug tracker but its status changed to won't fix with this comment:
This functionality is not supported by the JVM. It's not possible to
implement it in IntelliJ IDEA without JVM support.
http://youtrack.jetbrains.com/issue/IDEA-84257?projectKey=IDEA

Is there a way to freeeze Selenium-RC execution on error?

My Google-fu is weak and so I turn to the hive mind...
I have a Selenium script I originally developed in the IDE, which I am now trying to adapt to run on IE8 via Selenium-RC. I'm trying to debug an error where an element is not being found.
The problem is that as soon as the error occurs, the script exits and RC closes the browser. This makes it a bit hard to poke around with Firebug, etc, to see what is going on under the covers.
In the IDE, I could simply set a breakpoint. Is there a way to freeze the state of RC and the browser when an error occurs?
Any other ideas?
Thanks!
Depending on how you're running your RC tests, you could set a breakpoint in your IDE and run the test in debug mode. For example I use Eclipse to run tests using Java. Another option is to put a long pause in your test, just make sure you remove it again afterwards..!
I am running selenium rc tests as part of my test suite, so I just fire up --pdb (in python) and script pauses when exception occurs - before tearDown that closes the browser is invoked.
I have also had a plugin where I took a screenshot when something went wrong.
If you are using JUnit and SeleniumTestCase, you can add an empty tear down method to your test code which should prevent the browser from shutting down by overriding the base SeleniumTestCase tear down method. I use this on failing tests which I need to examine the resulting browser state after a failure.
In these situations I comment out the selenium.close() and selenium.stop() commands in my code which stops the browser from closing.
IIRC screenshot is only supported for firefox, so that won't help in your case.

Resources