Skip to content
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

Do not truncate Command Log message in default commands #6145

Closed
gabbersepp opened this issue Jan 12, 2020 · 7 comments · Fixed by #6163
Closed

Do not truncate Command Log message in default commands #6145

gabbersepp opened this issue Jan 12, 2020 · 7 comments · Fixed by #6163
Labels
pkg/reporter This is due to an issue in the packages/reporter directory type: user experience Improvements needed for UX

Comments

@gabbersepp
Copy link
Contributor

Current behavior:

Logs from cy.log are now truncated at 50 lines: #5625
But logs from cy.get not.

Desired behavior:

I wanted to know if we can add a global option in cypress.config that tells cypress to apply the same truncate logic as it does on manual cy.log calls?

Test code to reproduce

use cy.get with a very large selector and let it fail. You are not able to determine the failure from the screenshot:

describe("3.8.2", () => {
    it("truncate", () => {
        cy.visit("https://cypress.io")
            .get("#page-content > div:nth-child(2) > div > main > section.index-hero.Hero__StyledHero-sc-15j8hrl-2.kegIwW.gatsby-image-wrapper > div > h1 > div")
            .should("not.be.visible")
    })
})

image

Versions

3.8.2

@jennifer-shehane
Copy link
Member

We would likely just extend the same stylings for other commands as cy.log().

Making this configurable is problematic because setting the truncation too large will cause the browser to lock up in some circumstances currently.

Can you explain the use case for needing this configurable as opposed to always showing up to 50 lines?

@jennifer-shehane jennifer-shehane added type: user experience Improvements needed for UX stage: awaiting response Potential fix was proposed; awaiting response labels Jan 13, 2020
@jennifer-shehane jennifer-shehane changed the title Do not truncate cy logs in default commands Do not truncate Command Log message in default commands Jan 13, 2020
@gabbersepp
Copy link
Contributor Author

We would likely just extend the same stylings for other commands as cy.log().

Making this configurable is problematic because setting the truncation too large will cause the browser to lock up in some circumstances currently.

Can you explain the use case for needing this configurable as opposed to always showing up to 50 lines?

Please have a look at the screenshot above. You see that the locator is not fully visible. For us this is problematic because we have a complex application with deeply nested elements and thus the locator are very long.

For example:

  • i create an object that has an id 123456
  • i create an object that has an id 345567
  • i want to display object 123456 in a subview within the AUT
  • I test if the object is in the subview
  • the test fails
    • and is showing only a partial selector
    • the subview shows an object

Now I see that an object was displayed but the test fails. As i do not see the full selector, I do not know which object was used within the cy.get. So I have to assume that it might have been failed because of the wrong object beeing loaded. This now forces me to analyze where the data is loaded wrongly. This costs time and it is not guaranteed that I can fix the bug because I never know if this was the real error.

Now you might argue that our selectors are too long. But The structure of the application does not allow to reduce the length and keep readability at all places.

But I understand that this is something you probably don't want to implement. Do you think that this can be done by using a cypress plugin? Then I can create one that fits exactly our usecase.

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jan 13, 2020

@gabbersepp Yes, I understand the need to show more of the info in the error, up to 50 lines like the cy.log(). We can do this.

I was asking why you believed this needed to be configurable and not just show 50 lines max always for every default command?

I would suggest extending the css styles from this PR to apply to other commands in the Command Log. #5630

@gabbersepp
Copy link
Contributor Author

@jennifer-shehane sorry. Now I understand what you mean. I do not know if this behaviour is necessary for all user and for all commands. So adding a true/false flag to the config would avoid applying this breaking feature to all user

@jennifer-shehane jennifer-shehane added stage: ready for work The issue is reproducible and in scope pkg/reporter This is due to an issue in the packages/reporter directory and removed stage: awaiting response Potential fix was proposed; awaiting response labels Jan 13, 2020
@jennifer-shehane
Copy link
Member

@gabbersepp I wouldn't consider this a breaking change. Should be good to extend the truncation to 50 lines.

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope labels Jan 14, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jan 15, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 15, 2020

The code for this is done in cypress-io/cypress#6163, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 24, 2020

Released in 3.8.3.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v3.8.3, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/reporter This is due to an issue in the packages/reporter directory type: user experience Improvements needed for UX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants