Repository navigation
feat: include the recorded request in grabRecordedNetworkTraffics - #5801
Draft
landon-medme wants to merge 4 commits into
Draft
landon-medme wants to merge 4 commits into
landon-medme wants to merge 4 commits into
Conversation
Every helper that records traffic (Playwright, Puppeteer, CDPBrowser) already stores requestHeaders on each recorded request, but grabRecordedNetworkTraffics dropped them, so tests had to reach into helper internals to assert on a request header.
Expose url, method, headers and postData as a request object alongside response, instead of only the headers.
…r in the docs example
…per returns the same type
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation/Description of the PR
grabRecordedNetworkTrafficsreturned onlyurlandresponse, so a test could not assert on what was sent: a request header (e.g. a correlation id), the method or the body. Every traffic-recording helper already stores this on each recorded request; it was dropped when building the result, so tests had to reach intothis.helpers.Playwright.requeststo get it.Each entry now also has a
requestobject alongsideresponse:request.postDatais JSON-parsed when it is a JSON string. Playwright and Puppeteer record the raw string (theirtypeof === 'object'guard never matches a string) while CDPBrowser records parsed JSON, so without this the type would differ by helper. Non-JSON bodies are returned unchanged.Additive only: existing
urlandresponsefields are untouched.Applicable helpers:
Applicable plugins:
CDPBrowser also uses the shared
grabRecordedNetworkTrafficsand is covered by the same change.Type of change
Checklist:
npm run docs)npm run lint)npm test)Testing
Ran the traffic tests in
test/helper/Playwright_test.jslocally:should grab the request of recorded traffics,should grab JSON post data of recorded traffics as an object) pass, and fail on4.xwithout this change.should see recording trafficsfails both with and without this change: codecept.io no longer servesimg/companies/BC_LogoScreen_C.jpg.Only the
docs/webapipartial was edited;docs/helpers/is left for the docs autogeneration.