mbolotov / intellij-cypress

IntelliJ-Cypress plugin: https://plugins.jetbrains.com/plugin/13819-intellij-cypress Pro version: https://plugins.jetbrains.com/plugin/13987-cypress-support-pro
MIT License
35 stars 5 forks source link

Unable to use with cucumber cypress #13

Closed deepziem closed 4 years ago

deepziem commented 4 years ago

image

image

image

image

  1. How to debug cucumber tests ?
  2. I try to do debug and it does not go into debug window. goes to run window in webstorm.
  3. how to put breakpoints ? its extremely vague in your documentation and videos .. seriously very very difficult to understand. We need at-least basic steps
  4. It does not stop at breakpoints ..
mbolotov commented 4 years ago

Hi @deepziem

You are right, the plugin does not support cucumber files. So one neither can set breakpoints nor even create a run configuration using a scenario gutter.

As for the questions 5,6,7 - are you asking about a cucumber case or a general (mocha) one?

mbolotov commented 4 years ago

I tried breakpoints on a sample cypress-cucumber project.

And I was able to setup a breakpoint on a JavaScript-code line and got debugger stopped on that breakpoint: image

deepziem commented 4 years ago

@mbolotov i am not generally able to set up debugger. I did not mean to debug cucumber lines but the cypress javascript only. Based on my settings shown in screenshot what am i doing wrong, when i run why is it not running?

I changed my package.json and cypress.json to match the example you gave me. Thing Is the actual setup is confusing , can you provide clear instructions somewhere

image

First:

When we trigger tests, should we trigger the script 
    "Debug_Tests"    : "cypress run --spec \"**/*.feature\" --headed --browser chrome"
OR
Should we trigger a feature file? and how  did you do that?

Second: Can you provide some screenshots of the settings you are using for this ?

mbolotov commented 4 years ago

The plugin does not use npm scripts at all. For starting a single feature file, I used the following run configuration: image

deepziem commented 4 years ago

Thanks .. I tried same .. but somehow something is wrong .. it does not bring up the debug window just the run window as below .. any idea why?

image

I am able to trigger the tests, that is not the issue.

Ie the run window will not stop at breakpoints. When i try to edit specifically the debug configuration [ not edit via the top menu bar .. try to edit from debug window], it still asks for the runner.

image

mbolotov commented 4 years ago

try to edit from debug window

I'm not sure I understand what do you mean. Could you show where do you do edit from debug window?

BTW, did you try to debug the sample project I mentioned? I think it will be good to know whether the problem lies in your specific project or not.

deepziem commented 4 years ago

image

I tried sample project and latest intellij , latest nodejs .. same issue . Breakpoint does not stop. This below window is by clicking the debug button.

image

This is when it runs ..

image

mbolotov commented 4 years ago

is it possible to record the video of how you run the debug? also, you could try to add a debugger statement into the code instead of a breakpoint to check if it's the breakpoint hit problem only

kumzme commented 4 years ago

Cypress_test.zip

kumzme commented 4 years ago

Ive added a recording .. same effect with .debug() or .debugger statement literally.

mbolotov commented 4 years ago

Okay, I got it: image The debugger session indeed can't be established in your case. You can try to disable automatic browser page selection here: image In this case, debugger will ask for the page to connect if there are many: image There are a few problems with this approach:

  1. You should know what page to select (or just iterate through all of them and find it out)
  2. The window is a pop-up and will disappear if you click on anything outside
  3. The execution is not paused while you are selecting. So you have to be fast to not miss you breakpoint (or add delays in the test code)

So you can try this and see if it will work this way. It could be the single page with the name other than 'about:blank' and it then should work with the checkbox deselected. If you find several pages and the correct page name is not 'about:blank' but has a static name, you can define it in the run settings.

kumzme commented 4 years ago

Wow That's nice .. I am able to debug now .

  1. But I promise you , It's kinda crazy. Sometimes using external mouse / Keyboard i Mac [ I use RAT Gaming mouse /Mech keyboard] its not easy to click. It doent respond or work like mac keyboards and other things when this popup comes by. Sometimes I am able to click and sometimes not

  2. I was thinking of recommending to capital one for my team .. Can you also kindly put in instructions for cucumber and also cypress similar way in readme.md and also

  3. Can you suggest a way to debug as a script like this pls ? I am sure there is a way .. by intercepting chrome in a debugger session .. "test": "cypress run --spec \"*/.feature\" --headed",

Ie make it generic pls. What we do is a custom script .. which will read a set of tags in sequential order .. Then we take the tags and pass to the above script as a parameter .. and Loop through all tags. This way we can achieve parellel and sequential combination according to various applications ..

  1. But we wont be able to debug that .. with this above your approach. It's the single most important thing in Cypress.. to be able to debug a npm script
mbolotov commented 4 years ago

It's nice to see you've eventually got it to work. How does the page url look like? Is it static?

As for debugging scripts, I will look into your request. I think it's doable.

deepziem commented 4 years ago

Buddy .. not sure how to answer you .. I really donno .. I barely managed to make it work.

Even now as I mentioned .. The window pops up once or twice [Debug wont work ] .. then it goes away .. then it debugs when we debug second or third run .. it does for 2 3 runs and the popup comes again [now debug wont work again] .. then next set of runs, it works again etc.

I tried to clear cache of IntelliJ and. restart .. popup comes .. and then the above cycle repeats for sure

mbolotov commented 4 years ago

yep, that's strange. could you please make a screenshot of the popup next time it appears?

deepziem commented 4 years ago

hmm oklemme try

kumzme commented 4 years ago

Hi, It's just as previous screenshots. Just that it will pop up now and then .. tried a few different macs. So kindly see if you can make this smooth. Cypress debugging is making my life hell.

Also npm script debugging pls.

mbolotov commented 4 years ago

Hi @kumzme So what options does popup offer? Are they the same each time?

It's just as previous screenshots

Unfortunately, I don't see any popup on your screenshots here. Could you please attach one more?

kumzme commented 4 years ago

Hi See below. Unfortunately, It works at best flaky .. Really waiting for a fix / update for npm script run. So what options does popup offer? Are they the same each time?

It is always almost same. One option in name of project and one generic

Screen Shot 2020-08-26 at 11 12 48 AM

mbolotov commented 4 years ago

Hi guys! I believe I've fixed the connection problem in version 1.6.1, please try it. Please also note that 1.6 version brings support for running Cucumber tests from IDE.

mbolotov commented 4 years ago

closing as fixed