Closed jradom closed 3 years ago
Hi @jradom!
I see you have both free and paid plugins enabled at the same time. That's the problem. Please disable the free version here:
and restart IDE.
As for the logging issue: this is the Cypress behavior; see here for instance: https://github.com/cypress-io/cypress/issues/186 You can easily get log printed to sdout by adding such a command:
on('task', {
log (message) {
console.log(message)
return null
}
})
into your plugins/commands.js file
And use it as following:
I did what you've suggested but cy.visit('/'); is still not stopped/skipped on during debugging.
Please, advise
Thanks
Jeff
Could you please try debug with some delay before the breakpoint. For example you can add such a before hook:
beforeEach(() => {
cy.wait(2000)
})
And check if the first breakpoint stops the execution in this case.
So, my code looks like now
But Cypress doesn't move to URL opening Any suggestions?
FYI, I was born and raised in Leningrad
Thanks
Jeff
FYI, I was born and raised in Leningrad
Oh, that's a really cool coincidence! :)
Could you attach a copy of your project? I'm unable to reproduce the problem on my sample one.
here you are ...
Unfortunately, I cannot reproduce the problem on your project either.
I will ask you if any idea how to troubleshot this comes to my mind...
Well, the code stops at a breakpoint and you can proceed fitter steps but Cypress in the browser don’t even go to the URL on a visit command. It stays with hourglass shown and stays there on each further step
Sent from my iPhone
On Oct 12, 2020, at 11:53 PM, Mikhail Bolotov notifications@github.com wrote:
Unfortunately, I cannot reproduce the problem on your project either.
I will ask you if any idea how to troubleshot this comes to my mind...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Watch this. The cursor is on the last statement
but Cypress in the browser doesn't even get to URL based on the visit command Actually, it stopped at Beforeeach wait statement
But without Beforeeach
I see this
Yes, this is an expected behavior.
Cypress commands are asynchronous, so the runner just saves them in a queue when the code is 'executed'. And they will really get executed later.
So when your breakpoint is hit, the runner is just collecting the commands.
If you want to stop when the command is actually get executed, you can set a breakpoint in a then
block, for example:
Well, but in this case what is the point of using your plugin with breakpoint which moves but the execution of a Cypress code doesn't move together? I'm lost on the purpose of your tool breakpoints. Please, clarify
Thanks
Jeff
The whole point with having a breakpoint is to see where are you in UI but I don't see how that can be achieved
The commands are executed in the same order as they are written. So you can insert a
cy.wrap(null).then(() => {
// set any statement here and put a breakpoint on it
} )
block where you want to get the execution paused.
Beside that, a real Cypress test often has many synchronous blocks like then
and should
where you can put a breakpoint directly.
Well, it's still not clear to me how I can use your breakpoint and making some changes to the above code and see UI movements in a Cypress browser. I'm coming from many hears of using Selenium but I had the impression that Cypress wraps asynchronous events and makes code synchronous the way I had used it above. Is it not a case?
BTW, in your screenshot above, it passed visit command but still UPS page is not shown in the runner. Is it a way to do it at all?
I just cut off the app window in the screenshot, it was actually here (but note that in my example it's not UPS page but the Cypress sample one) As for the usage of breakpoints and sync/async stuff: there is no way to debug async commands in a synchronous way. You cannot say the debugger to 'Step Over' from one command to the other and expect it get executed in the same time (and so to see the UI movements). The debugger does not know when the command will actually be executed. Cypress hides this machinery somewhere in the deep and does not provide any API to hook up by the debugger. The only way to catch the moment when commands are really executed is to go into a synchronous block and put a breakpoint here (or use 'Run to Line' command for example). I'm not sure if I answered all of your questions. Please don't hesitate to ask me more.
Have you ever used Selenium or any other similar tool?
yes, a little bit
BTW, could it be more easy for you to talk in a slack channel? I have one dedicated for the plugin: https://join.slack.com/t/intellij-cypress/shared_invite/zt-g5lcy9xc-F3qy_g8O~qbZvKjD2m0EjQ
Let's say I have a page like this So, using Selenium for example with a breakpoint I can easily see all the steps of filling fields, etc. So, I understood that I can't do it using Cypress even with the help of your tool brreakpoints
I've tried this but got a runtime error it('should see ups page', () => { cy.visit('/').then( () => { cy.task('log', 'YYYYYYYYYYYYYYYYYYYYY=============> ' + 'URL visit'); }) cy.task('log', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=============> ' + 'Step1'); cy.get('#canada').click(); let a:number = 5; cy.task('log', 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=============> ' + 'Step2'); });
So, using Selenium for example with a breakpoint I can easily see all the steps of filling fields, etc. So, I understood that I can't do it using Cypress even with the help of your tool brreakpoints
You can do this if you set an additional sync block after each of the command (and set a breakpoint into each or use 'Run to cursor' debugger command)
I've tried this but got a runtime error
what's error?
Hi Jeff! I've added a note on debugging Cypress commands in the readme page. Do you have any other problems now? I will close the issue otherwise.
Hi Mikhail,
I still want to understand a purpose of debugging with breakpoints if I can’t see command moving forward in a Cypress runner window. Please, clarify
Thanks
Jeff
Sent from my iPhone
On Oct 20, 2020, at 6:56 AM, Mikhail Bolotov notifications@github.com wrote:
Hi Jeff! I've added a note on debugging Cypress commands in the readme page. Do you have any other problems now? I will close the issue otherwise.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Debugger can helpfull for debugging any synchronous code. A real large Cypress test project usually contains a lot of complex synchronous code where breakpoints can be used. Does this answer your question?
Can you provide a simple example please?
Sent from my iPhone
On Oct 20, 2020, at 8:34 AM, Mikhail Bolotov notifications@github.com wrote:
Debugger can helpfull for debugging any synchronous code. A real large Cypress test project usually contains a lot of complex synchronous code where breakpoints can be used. Does this answer your question?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I mean the pure Cypress commands cannot be debugged (as they are asynchronous), but you may easily make a synchronous block whenever you want.
Something like this (a quote from issue #24):
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")
})
You can put a breakpoint at the lines with console output and got them working as expected.
You can also check for Cypress official docs about debugging: https://docs.cypress.io/guides/guides/debugging.html#Using-debugger They are talking about 'debugger' statement, but you can apply it to the breakpoints as well.
Hi Mikhail,
I've for some reason in several projects started to see this when using your plugin but command npx works fine It'll be great if can suggest something
Thanks
Jeff
Hi Jeff,
Could you provide more information on that? Based on this screenshot I cannot say what's going on. Do you start seeing this when upgraded to 1.6.2, right? Could you at least unfold the stacktrace element on the error message which you provided.
here you are ...
Message: Error writing to: <span
class="ansi-blue-fg">/cypress.json
Error: EROFS: read-only file system, open '/cypress.json'
Stack trace:
Error: Error writing to: [34m`/cypress.json` [39m
[33m`Error: EROFS: read-only file system, open '/cypress.json'` [39m
at Object.get
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:968:15)
at Object._err
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/util/settings.js:65:22)
at Object._logWriteErr
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/util/settings.js:77:17)
at
/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/util/settings.js:84:19
at tryCatcher
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate]
(/Users/radomj/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
On Mon, Nov 9, 2020 at 11:01 PM Mikhail Bolotov notifications@github.com wrote:
Hi Jeff,
Could you provide more information on that? Based on this screenshot I cannot say what's going on. Do you start seeing this when upgraded to 1.6.2, right? Could you at least unfold the stacktrace element on the error message which you provided.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-724506182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPPX7BDG4XMAFIVAWDDSPDQNZANCNFSM4SMLGTCA .
I still can't figure out what's going on there. Do you start getting this after upgrade the plugin or not?
Hi Mikhail,
Here is how you can replicate the issue: Download locally this project https://github.com/marcdacz/compare-pdf-cypress-js Add it to IntelliJ Ultimate Create a configuration like this [image: image.png] After the above project opening IntelliJ suggest to install Node and I did (it does the latest one node --version v12.13.1) Run it from IntelliJ and you'll see this [image: image.png] BTW, I run "npx cypress open" the code runs OK. Oh, some simple Cypress projects work fine. Strange It'll be great if you'll find a way to fix it. I have a demo to deliver early morning Friday PST
Cheers
Jeff
On Tue, Nov 10, 2020 at 5:49 AM Mikhail Bolotov notifications@github.com wrote:
I still can't figure out what's going on there. Do you start getting this after upgrade the plugin or not?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-724713080, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPIFC6D2I73TXNVDY7LSPFAFZANCNFSM4SMLGTCA .
other interesting observations. Some very simple Cypress projects are running fine using your plugin and my Cypress version is [image: image.png]
On Tue, Nov 10, 2020 at 5:49 AM Mikhail Bolotov notifications@github.com wrote:
I still can't figure out what's going on there. Do you start getting this after upgrade the plugin or not?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-724713080, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPIFC6D2I73TXNVDY7LSPFAFZANCNFSM4SMLGTCA .
I cannot see the images you provided. It looks like this:
Could you resend them?
Here you are again... Please, let me if that worked this time [image: image.png]
[image: image.png] [image: image.png] [image: image.png]
Thanks
Jeff
On Wed, Nov 11, 2020 at 1:55 AM Mikhail Bolotov notifications@github.com wrote:
I cannot see the images you provided. It looks like this: [image: image] https://user-images.githubusercontent.com/19785715/98797025-192d9000-241d-11eb-84dd-f8c1b1ccd18d.png
Could you resend them?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-725324937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPPI4IDUMJDW7QVVSXLSPJNRFANCNFSM4SMLGTCA .
unfortunately, it did not Do you check the outlook as it shown at the 'Preview' tab? Does it show your images there? Here is a recursive example :)
and now?
On Wed, Nov 11, 2020 at 7:51 AM Mikhail Bolotov notifications@github.com wrote:
unfortunately, it did not Do you check the outlook as it shown at the 'Preview' tab? Does it show your images there? Here is a recursive example :) [image: image] https://user-images.githubusercontent.com/19785715/98833292-e7352180-244e-11eb-8580-ed738ba81780.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-725501088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPP7IKDRM3L4PRBPNNTSPKXJVANCNFSM4SMLGTCA .
did zip file work? Please, let me know
On Wed, Nov 11, 2020 at 7:51 AM Mikhail Bolotov notifications@github.com wrote:
unfortunately, it did not Do you check the outlook as it shown at the 'Preview' tab? Does it show your images there? Here is a recursive example :) [image: image] https://user-images.githubusercontent.com/19785715/98833292-e7352180-244e-11eb-8580-ed738ba81780.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-725501088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPP7IKDRM3L4PRBPNNTSPKXJVANCNFSM4SMLGTCA .
no, I see nothing
this is really weird. Can you just give me an email where I can send screenshots? BTW, have you tried to download a Cypress project from my email, set it up and run it?
On Wed, Nov 11, 2020 at 11:39 AM Mikhail Bolotov notifications@github.com wrote:
no, I see nothing
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-725621659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPJNZ725HEYGE2HIFO3SPLSADANCNFSM4SMLGTCA .
my email:
Yes, I tried the project and run it successfully
Okay, I've looked at screenshots. You can try to define the Cypress project directory as the warning suggests
Great. It did work now but the error message was kinda unrelated and confusing. I suggests if possible to change it because any new user can have the same issue
Cheers (Spasio)
Jeff
On Thu, Nov 12, 2020 at 1:33 AM Mikhail Bolotov notifications@github.com wrote:
Okay, I've looked at screenshots. You can try to define the Cypress project directory as the warning suggests [image: image] https://user-images.githubusercontent.com/19785715/98922111-21e89980-24e3-11eb-90e7-88461177bb2e.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbolotov/intellij-cypress/issues/23#issuecomment-725959652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZGPLXCTV5Y27VM3J7OFLSPOTVFANCNFSM4SMLGTCA .
Hello Mikhail,
I'm pretty new to Cypress and try executing the below code
describe('I am on UPS page', () => { it('should see ups page', () => { cy.visit('/'); cy.visit('https://www.ups.com/us/en/Home.page'); let a:number = 5; console.log('AAAAAAAAAAAAA===================================> '); }); })
I put a breakpoint here, it didn't even stop on. a first cy.visist
I also can't find result from console.log('AAAAAAAAAAAAA===================================> '); Oh, I use Typescript I thought that results will show in the IntelliJ Debug window but it's not there
Idid imstall/unstal again and got this
Please help
Thanks
Jeff