-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture + Display all logs for everything that happens in Cypress #448
Comments
@bahmutov what do you think? |
Perfecto! 😍 |
@brian-mann excellent. Really looking forward to getting this. We're spending lots of time trying to debug why our compiled JS is not working when served static via Cypress. We cannot replicate anywhere else, so one peek at the logs would like solve everything! |
Hi guys! Amazing feature! Any news about that? Thanks |
AMAZING! |
@brian-mann I've been banging my head against a wall trying to upgrade to cypress 0.20.1. It's been days - things work fine in the GUI but fail from the console. And not being able to log anything is infuriating. After super old school commenting out code one line at a time until it passes again to isolate the line, I've found that it is |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Also at this very moment you could do this trick here: #300 (comment) That will get all console.log's to show up in the command log, which will stringify and print their arguments. You could then watch the video / screenshot to see what the information is. That's what I would do today when running in CI. Of course locally just show the browser and iterate on it there. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This would be a really nice addition. Right now my tests are failing on the CI and it looks like it has something to do with cookies but because Cypress is basically a black box right now on CI I have no way of figuring out what's going on. Hope this feature will arrive soon, keep up the good work 👏🏼 |
Just want to throw my 2 cents in, I'm also having an issue with (what I can only imagine is cookie-related) the CI build vs local So far I'm loving Cypress though, you folks are doing amazing work and I'm more than willing to fork over our company credit card for a paid plan in the future! |
A lot of work happened over the last little while to enable us to finally work on something like this. It's not a lot more practical to implement something like this due to various under-the-hood improvements to the App and Cloud platforms over the last year or two. I hope we can share some updates and progress soon. In the meantime, some debugging-in-CI techniques I've found useful:
The way I've done this historically is by using You can pass Screenshot docs: https://docs.cypress.io/api/commands/screenshot#Arguments |
I am looking for this as well, and none of the workarounds are usable for me. The only actual workaround for this is to stick a hidden div somewhere in the DOM that mirrors everything that is being output to the console. My apps communicate internal states and variables for tests, and these are not always accessible from the DOM itself. I would like to assert based on these console.log messages. |
@brian-mann @bahmutov @lmiller1990 Any official work being done on this feature? I will try the plugins mentioned here. I would also love to keep in step with future improvement. I think this is an immensely valuable feature. |
@M4RcB4 Yes, there is. I don't have an exact date, but it's an active and high priority project. Please stay tuned - more info will come as soon as it is ready for testing! The goal is to capture all the things - console, network etc. As a long time user, I am quite excited - debugging with videos is good, but this will be better. |
Hey, is the intention for the logs to be only available via cypress dashboard, or would they also be printed to the terminal/saved to a local .txt as well? |
The project that @lmiller1990 mentioned will be only available in the cypress dashboard. |
So, still no way to make assertions against console output. |
@Opalexiss you can definitely make assertions against the |
Closed by #27040 |
@chrisbreiding nice, thanks! Although, the PR description on that #27040 PR is a bit unclear - which PR in v13.0.0 actually addresses this issue #448? I couldn't figure that out from either the PR description or the v13.0.0 changelog |
@karlhorky I can understand how it might be a bit confusing. #27040 was a PR for a long-running branch that collected a number of PRs for the v13 release. That includes several PRs that address this issue. For the most part, however, those changes are not user-facing, so they're not called out in the v13 PR or the changelog. Most of the work for this is under-the-hood (capturing all the things!). While the changelog published with this repo doesn't mention it, the changelog that will be published to the docs highlights the functionality this will enable for Cypress Cloud. |
Released in Cypress 13.0.0 as Test Replay. Please read our Blog for more details. |
Nice, thanks for the additional background, looks exciting! |
@jennifer-shehane I am not sure Test Replay was the actual requested feature. Personally, I want to be able to dump console.log, network tabs to a file, so we I can read it to understand what went wrong. Best, |
@jennifer-shehane what's the story for replay around non-cloud CI/CD setups? I'm a bit worried this is a dark pattern change designed to remove useful functionality from that set of users, especially when viewed as coupled with the removal of |
@comp615 Was something removed? I don't work at Cypress, but I still use it a lot -- my understanding is the Test Replay is for Cloud users. You can still record videos to your local machine, review them after a failure, as part of the OSS offering. |
Problem
Many of our users express the desire to see
console.log
statements when running headlessly. Typically you'd be able to see these when you're working in Dev Tools (in headed GUI mode).We can pretty easily display
console.log
statements by mixing them intostdout
when running headlessly, but we don't think this is really a "true" solution. It's kind of a hack and it still doesn't really tell you "everything" that's happening. For instance, when aconsole.log
happens, how would you know when it happened in relation to everything else that's going on in a test?So, we think to truly solve this problem, we need a comprehensive way of displaying not just
console.log
statements but also capturing:By providing all of this, the entire picture of what happened during a test is revealed and now you actually have even more information at your disposal than even what the GUI headed version provides you.
Solution
The logs will be available in the Cypress Cloud.
Once we capture and parse these logs, it will unlock an enormous amount of power in Cypress. We'll also be able to analyze the logs and deliver things like:
The logs could also be interactive - for instance they should "sync" up to the video and enable you to playback everything that actually happened in a Cypress test.
Here is an example comp of what we're going for.
We're still working on communicating the
start
andend
of logs, and also communicating that a log event acts as "a stream" but that events are connected to other events.For instance when a HTTP request starts - that's a 'start' event. When the response comes back, thats a separate 'end' event. However these are connected and you likely need to be able to view the data for both events from either the
start
orend
event.Another example:
A command starts. It retries 65x times. It eventually finishes. The duration of the retry events, the reason its retrying, and the eventual delta between a
start
and anend
needs to be communicated intelligently.These log files end up being a massive amount of data, but we already have the infrastructure in place to capture, parse and deliver them. At this point we're just iterating on a UI that's intuitive and doesn't overwhelm the user.
We're going to be providing a new
Logs
tab, but also for individual test failures, we'll just be providing the logs for that one independent test.Feedback
...is welcome ;-)
The text was updated successfully, but these errors were encountered: