Skip to content

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

Open
aubincc wants to merge 21 commits into
bahmutov:masterfrom
aubincc:master
Open

Hide options that do not belong to Cypress.RequestOptions from "Request:" in the HTML#197
aubincc wants to merge 21 commits into
bahmutov:masterfrom
aubincc:master

Conversation

@aubincc

@aubincc aubincc commented Mar 23, 2023

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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

@aubincc

aubincc commented Mar 23, 2023

Copy link
Copy Markdown
Author

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
Copy Markdown
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

aubincc commented Mar 23, 2023

Copy link
Copy Markdown
Author

I think of a question:

showLoggables/API_SHOW_LOGGABLES & showFailables/API_SHOW_FAILABLES ?

@LeJeanbono

Copy link
Copy Markdown
Collaborator

API_SHOW_CYPRESS_SPECIFIC_REQUEST_OPTION for both ?

@aubincc

aubincc commented Mar 23, 2023

Copy link
Copy Markdown
Author

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

@aubincc

aubincc commented Mar 24, 2023

Copy link
Copy Markdown
Author

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

aubincc commented Mar 24, 2023

Copy link
Copy Markdown
Author

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
Copy Markdown
Collaborator

Are you done @aubincc ?

@aubincc

aubincc commented Apr 28, 2023

Copy link
Copy Markdown
Author

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

aubincc commented Jun 19, 2023

Copy link
Copy Markdown
Author

@LeJeanbono what must I do now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants