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

Should not truncate full url during cy.request() in stdout #3145

Closed
cmcnicholas opened this issue Jan 16, 2019 · 5 comments · Fixed by #5150
Closed

Should not truncate full url during cy.request() in stdout #3145

cmcnicholas opened this issue Jan 16, 2019 · 5 comments · Fixed by #5150
Labels
good first issue Good for newcomers pkg/driver This is due to an issue in the packages/driver directory type: user experience Improvements needed for UX

Comments

@cmcnicholas
Copy link

Is this a Feature or Bug?

I believe this to be a bug with Cypress dashboard where truncation of the output makes debugging issues via the dashboard or CI very difficult for developers. It is useful for instance to see body and url parameters when using something like cy.request however the output on failure is formatted in a way which inhibits the ability to debug issues.

Current behavior:

the output in the cypress dashboard for a 404 (any sufficiently large output will do) looks like

 1) toolbar layer style "before all" hook for "should edit style name":
     CypressError: cy.request() failed on:

http://xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy/api/customer?token=uy9aG2yVRlyPAcW_xvTZEXlTvRm6O4u_

The response we received from your web server was:

  > 404: Not Found

This was considered a failure because the status code was not '2xx' or '3xx'.

If you do not want status codes to cause failures pass the option: 'failOnStatusCode: false'

-----------------------------------------------------------

The request we sent was:

Method: POST
URL: http://xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy/api/customer?token=uy9aG2yVRlyPAcW_xvTZEXlTvRm6...
Headers: {
  "user-agent": "E2E",
  "accept": "*/*",
  "accept-encoding": "gzip, deflate",
  "content-type": "application/json",
  "content-length": 74
}
Body: {"clusterId":"Dev-Alpha-Cluster","name":"Fin Fang Foom e2e20190116163428","OtherStuff":"ThisIsSomeDa...

see that the body and url are being truncated in this final block of the log. For small payloads it's fine, but when payloads become larger (or other cy methods that produce longer lines) the truncation makes the output almost useless. This is more of a problem when the errors are only produced on the CI server.

Desired behavior:

I would like some control over the output here, several options:

  • Download the raw output (unmodified)
  • Wrap long lines preserving the entire line
  • Have an option to open raw in the browser

Steps to reproduce: (app code and test code)

Simply perform a cy.request with a sufficiently large url or body e.g.

cy.request({
  method: 'POST',
  url: 'http://myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url',
})

Versions

Cypress: 3.1.3

I don't believe the browser to be an issue in this specific issue.

@jennifer-shehane
Copy link
Member

Hi @cmcnicholas, I want to be sure about where you are seeing this data. When you review this output, you are on the Cypress Dashboard webpage? So, visiting a url like: https://dashboard.cypress.io/#/projects/123abc/runs/678/specs yes?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jan 18, 2019
@cmcnicholas
Copy link
Author

Hi @cmcnicholas, I want to be sure about where you are seeing this data. When you review this output, you are on the Cypress Dashboard webpage? So, visiting a url like: https://dashboard.cypress.io/#/projects/123abc/runs/678/specs yes?

Yes that is correct @jennifer-shehane

@jennifer-shehane jennifer-shehane added stage: ready for work The issue is reproducible and in scope good first issue Good for newcomers type: user experience Improvements needed for UX pkg/driver This is due to an issue in the packages/driver directory and removed stage: needs information Not enough info to reproduce the issue external: dashboard labels Jan 18, 2019
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jan 18, 2019

Thanks for the reply. The truncating appears to be happening within the CLI, so the full url is never being fully printed in the output that is later printed in the Dashboard.

Doing cypress run locally prints:

  1)  Long request:
     CypressError: cy.request() failed trying to load:

http://myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url/

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: getaddrinfo ENOTFOUND myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url:80

-----------------------------------------------------------

The request we sent was:

Method: POST
URL: http://myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreal...

-----------------------------------------------------------

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer

The stack trace for this error is:

RequestError: Error: getaddrinfo ENOTFOUND myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url:80
    at new RequestError.............//more content printed here

The code for this url to print in the error message is

So, I would recommend removing this truncation, if we have to set a limit, it seems that the standard recommended cutoff for urls is 2000 characters.

@jennifer-shehane jennifer-shehane added difficulty: 1️⃣ and removed stage: ready for work The issue is reproducible and in scope labels Jan 18, 2019
@jennifer-shehane jennifer-shehane changed the title Cypress Dashboard Truncates Output Should not truncate full url during cy.request() in stdout Feb 11, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 29, 2019

The code for this is done in cypress-io/cypress#5150, 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 Oct 23, 2019

Released in 3.5.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers pkg/driver This is due to an issue in the packages/driver directory type: user experience Improvements needed for UX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants