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

dumb question about pro license #24

Open mgkimsal opened 3 years ago

mgkimsal commented 3 years ago

I have the 'pro' plugin.

It just says "no license" in the plugin screen.

I have a license key.

I see 0 instructions on where and how I enter a license key.

I don't understand what this 'cypress-intellij-reporter' thing is supposed to do. The only thing I know is that after I installed it (and the 'pro' plugin) phpstorm took away the 'run' option on my js tests.

Apologies if this is a bit terse. I'm interested in using this, and have paid for pro, but I guess I expected there to be some instructions on what to do with the license key so that... it worked.

EDIT : I sort of answered my own question... You have to completely restart your IDE and it will then ask for a key. The plugin system gave no indication of that, and normally will say "requires restart". :/

mbolotov commented 3 years ago

Hi @mgkimsal, Thanks for the report! I'll try add more instructions on how to deal with licence. You also mentioned 'cypress-intellij-reporter'. The readme says you need to install this package into your project:

npm i cypress-intellij-reporter -D

As for the missing 'run' option - do you still have the problem after restart?

mgkimsal commented 3 years ago

seems to be there after restart.

I saw the npm stuff, and all I could tell is that after I installed it, my 'run test' options went away. restarting seems to have helped.

FWIW, I may go for a full year, but... the 'debug' stuff doesn't work for me. The debug line is paused at during initialization, not when the browser actually gets to that point in the code. Some error about TTY in the phpstorm console window. there was another issue about this that ... pointed to "set up a nodejs configuration environment" then said something like "it's so simple/easy" but... I have no idea what values I'm supposed to put in there ("point to the program that launches this" is what I think is in the environment setup screen in phpstorm, which is 100% unhelpful to me unfortunately).

Thank you for the response.

mbolotov commented 3 years ago

I guess you try to step over Cypress commands via debugger and expect it to be executed step by step, right? It won't work this way. Cypress commands are asynchronous. When you are stepping over a command, it's just placed into a queue and not executed in fact. If you need to pause the execution after a command got really executed, you have to add a breakpoint into any synchronous block, e.g. in a then(...) one.

As for the error in console window - could you please add a screenshot?

mgkimsal commented 3 years ago

it was same issue as this one

https://github.com/mbolotov/intellij-cypress/issues/11

there just didn't seem to be enough information there for me to get things to work.

re: async.

If I have a test like

it('go to schedule and click a data', () => {
    cy.loginAs(admin);
    cy.visit('/schedule#/schedule/new');
    cy.get("#sampleid").click();
....... 

I was (wrongly?) assuming I could put a breakpoint on "cy.get("#sampleid").click();" and then, when the browser had opened the schedule page, I would be at a breakpoint before it looked for 'sampled' to click it.

If that's not possible, perhaps I don't understand what step debugging would be?

in the case above, when cypress is starting up, the breakpoint happens on the 'click' line - the cypress browser isn't even opened yet - then it finishes stuff in 'before', then it goes to the 'login as admin' step, and so on, but doesn't breakpoint on the 'click' line.

Perhaps I had a wrong understanding of what was possible here.

Again, this is probably sounding rude, and I'm not meaning it to. Thank you for your efforts - always good to see more plugins for JB ecosystem :)

mbolotov commented 3 years ago

yes, there are two equal issues in a few days. And those are the first ones in the past six month since the plugin launch :)

let me just quote the official docs from the Cypress team:

It is very important to understand that Cypress commands don’t do anything at the moment they are invoked, but rather enqueue themselves to be run later

So breakpoints work exactly as they supposed to do in terms of how the browser executes the code. There is no place in your code that will be executed when the commands really do their job. That's why you can't stop the execution 'just after the click'.

Having said that, every of the cypress command allows add a synchronous block by adding a then callback:

it('go to schedule and click a data', () => {
  cy.loginAs(admin);
  cy.visit('/schedule#/schedule/new').then(() => {
       console.log("you can set a breakpoint at this line and get the execution paused after the 'visit' command get actually executed (so when the test open your page)" 
  })
  cy.get("#sampleid").click().then(() => {
       console.log("at this time, your test has finished clicking")
})

Is this explanation clear enough? I think I'll add a special wiki page to describe the behavior of breakpoints in conjunction of Cypress commands.

mgkimsal commented 3 years ago

Thank you for that extra explanation. That does help. I am not a cypress expert, and went to your plugin to help me debug some things. Thank you again.