-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Truncate cy.log() in Command Log to 50 lines instead of 1 #5630
Conversation
Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.
PR Review ChecklistIf any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'. User Experience
Functionality
Maintainability
Quality
Internal
|
@jennifer-shehane shouldn't there be some kind of upper maximum here? Seems slightly irresponsible to display all of the log message regardless of how long it is. With this PR, if you shrink the reporter, the text will wrap really far and make the command log pretty unusable at smaller sizes. Could we truncate the log message to a more reasonable point so we avoid that problem? |
@brian-mann As a cypress test code writer, I would like to have control of the log messages of my own tests. This change does not affect any other message types. Just my own written |
@pitgrap The restriction would be a very large one, like 2,000 characters. The purpose of restriction would be to prevent the reporter from printing a gigantic log, like if someone accidentally printed a large Object, that may lock up the browser during rendering. Something more than this amount of characters wouldn't even be visible in a single frame of the test runner for review. Users can open a new issue if they need this to be larger and handled in some other way. I'll update the PR for this. |
Do you have any updates? Can I do anything to get this PR merged? |
There were changes requested for this PR that were never implemented. Implement the changes and we can move forward.
Likely relevant to this work #5762 |
@jennifer-shehane Thanks for pointing that out. |
Rebased on develop branch, added the feedback and updated the screenshots. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see the line-clamp
style have any effect. As can be seen in the image below, the log is printing 50+ lines, not truncating at line 50.
If you are going to truncate, we also need some ellipsis to indicate that the log was truncated otherwise the users will have no way of knowing whether it is the end of the log or truncated.
I agree, and that's what should happen. See my screenshot in the description.
That's weird. I will retest it. |
- add line-height: 1.5 - set upper limit of 50 lines (~ 2000), works in all browsers except IE11
Ok, sorry. My new styles has been overwritten by another CSS rule with a "display: block". Now it should be finally fixed and working. |
Changes were made to address Chris original comment
User facing changelog
Messages from
cy.log()
are now truncated at 50 lines the Command Log instead of the 1 line.How has the user experience changed?
Before:

After:
Truncates the log to 50 lines and shows ellipsis to indicate truncation.
Clicking to log to console will log full
cy.log()
content.PR Tasks
none.