Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hide options that do not belong to Cypress.RequestOptions from "Request:" in the HTML #197

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

aubincc
Copy link

@aubincc aubincc commented Mar 23, 2023

This does not make a big difference, but I have never found it useful to have this property shown in the HTML.

If you like I can turn it into an option.

@LeJeanbono
Copy link
Collaborator

Hi @aubincc !
Can you add a testing case please ?
Thanks for your contribution !

@aubincc
Copy link
Author

aubincc commented Mar 23, 2023

Hi @aubincc ! Can you add a testing case please ? Thanks for your contribution !

Sure, I'll see if I can have a look.
I might even try and make it an option. Do you think I should?

aubincc and others added 7 commits March 23, 2023 17:07
Tests for default behaviour and set behaviour: property is hidden
Tests for default behaviour and set behaviour: property is hidden
Create hides-failOnStatusCode.cy.ts
failOnStatusCode is now hidden in HTML of req body

Following bahmutov#197

Set Cypress env var API_SHOW_FAILONSTATUSCODE to true to reveal it.

Added tests along with it. 😉 at @LeJeanbono
@LeJeanbono
Copy link
Collaborator

Nice one !
By The Way, I'm thinking that we could elarge this one with more stuff than failOnStatusCode to hide, like:

interface Loggable {
    log: boolean
  }

interface Failable {
    failOnStatusCode: boolean
    retryOnStatusCodeFailure: boolean
    retryOnNetworkFailure: boolean
  }

To only show what's depend on pure request stuff :

interface RequestOptions {
    auth: object
    body: RequestBody
    encoding: Encodings
    followRedirect: boolean
    form: boolean
    gzip: boolean
    headers: object
    method: HttpMethod
    qs: object
    url: string
}

What's do you think ?

@aubincc
Copy link
Author

aubincc commented Mar 23, 2023

I think of a question:

showLoggables/API_SHOW_LOGGABLES & showFailables/API_SHOW_FAILABLES ?

@LeJeanbono
Copy link
Collaborator

API_SHOW_CYPRESS_SPECIFIC_REQUEST_OPTION for both ?

@aubincc
Copy link
Author

aubincc commented Mar 23, 2023

Alright, please be nice and patient now, today was my first go at TypeScript ever 🥵

@aubincc
Copy link
Author

aubincc commented Mar 24, 2023

I have done it and it is working but I'm running into a little bit of a nightmare when pushing.
Could be something to do with the husky pre-push, I don't know.

aubincc added 11 commits March 24, 2023 13:35
Update branch only-requestoptions
Replacing details for:
API_SHOW_FAILONSTATUSCODE
with:
API_SHOW_GENUINE_REQUEST_OPTIONS_ONLY
With Cypress env var API_SHOW_GENUINE_REQUEST_OPTIONS_ONLY

only genuineRequestOptions are kept in the displayed Request info
Added Cypress env var `API_SHOW_GENUINE_REQUEST_OPTIONS_ONLY`
Removed Cypress env var `API_SHOW_FAILONSTATUSCODE`

This new boolean variable, if set to true, will filter out all keys which are not genuinely sent to the API.
`log`, `failOnStatusCode`, `retryOnStatusCodeFailure`, `retryOnNetworkFailure` will be removed from sight.
All the others belonging to Cypress.RequestOptions will be kept.
@aubincc aubincc changed the title Hide failOnStatusCode from "Request:" in the HTML Hide options that do not belong to Cypress.RequestOptions from "Request:" in the HTML Mar 24, 2023
@aubincc
Copy link
Author

aubincc commented Mar 24, 2023

I'd like a review @LeJeanbono

My next goal would be to convert the qs object to a real querystring.
Baby steps 👶🏻

@LeJeanbono
Copy link
Collaborator

Are you done @aubincc ?

@aubincc
Copy link
Author

aubincc commented Apr 28, 2023

Are you done @aubincc ?

Done with the RequestOptions yes, would you care to verify my code?

About the querystring, I will see to that another time.

@aubincc
Copy link
Author

aubincc commented Jun 19, 2023

@LeJeanbono what must I do now?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants