DevExpress / DevExpress/testcafe

[docs] Improve the "Intercept HTTP Requests" guide and related articles

Open
#6,339 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

AREA: docs TYPE: enhancement
Dominant language
JavaScript
Stars
9.9k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

  • Rewrite the intro part and describe in more detail the purpose of Request Hooks, specify in which cases a certain Request Hook can be useful (e.g. "RequestLogger stores all sent HTTP requests and received responses just like the "Network" tab in a browser's DevTools" or "use RequestMock to mock analytics calls").

  • Return the "Mocking cross-domain requests" section, which seems to be lost in the latest documentation update:

https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/mocking-http-requests.html#mocking-cross-domain-requests

  • Move the "Select Requests to be Handled by the Hook" info to the root of the "Intercept HTTP Requests" guide:

https://testcafe.io/documentation/402763/reference/test-api/requestmock/onrequestto#select-requests-to-be-handled-by-the-hook

  • Expand the "Select Requests to be Handled by the Hook" section with real-world examples. Look at these questions:

https://stackoverflow.com/questions/59454749/testcafe-multiple-requests-to-endpoint-synchronously-not-working
https://stackoverflow.com/questions/62219146/change-testcafe-requestmock-api-response-based-on-request-body
https://stackoverflow.com/questions/65906496/testcafe-mock-backend-data-being-overridden
https://stackoverflow.com/questions/65717087/how-to-mock-the-same-request-of-different-origins-urls-for-testcafe
https://stackoverflow.com/questions/59083652/can-we-have-more-than-one-key-value-for-method-in-requestlogger-for-testcafe

  • RequestMock - Add an example to illustrate how to deal with dynamic URL parameters based on these questions:

https://stackoverflow.com/questions/57002221/mock-api-to-give-response-based-on-request-urls-dynamic-part
https://stackoverflow.com/questions/59754362/regular-expression-for-matching-dynamic-part-in-url-while-mocking-api-is-not-wor
https://stackoverflow.com/questions/62382355/how-to-pass-query-params-of-a-request-url-while-mocking-with-request-hooks-in-te
https://stackoverflow.com/questions/62968747/create-requestmock-with-dynamic-url-params-testcafe

  • RequestLogger - Describe how to wait for a response based on these questions:

https://stackoverflow.com/questions/58934222/requestlogger-waiting-for-requests0-response
https://stackoverflow.com/questions/62798820/testcafe-requestlogger-how-to-wait-for-all-responses-to-return-before-doing-an
https://stackoverflow.com/questions/63702464/testcafe-typeerror-cannot-read-property-response-of-undefined
https://stackoverflow.com/questions/54677238/testcafe-requestlogger-not-intercepting-api-calls

  • Add a note that RequestLogger doesn't support the async function for the predicate parameter of the contains function based on this question:

https://stackoverflow.com/questions/56933029/testcafe-checking-api-response-always-passes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “Intercept HTTP Requests” guide and its related RequestMock and RequestLogger articles, using the linked legacy documentation and Stack Overflow questions as reference. Update the introduction, hook-use explanations, cross-domain and request-selection sections, and the requested examples and notes; done means the guide and related articles cover every listed topic with working, clear examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.