Expose HttpRequest and cdp modules as utils. #4238
Merged
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.
This PR exposes a few internal modules like
HttpRequest
andcdp
asutils
so that these modules can be imported and used directly inside test suites.HttpRequest
module is useful for modifying the settings of HTTP requests as and when required. For example, we can modify the HTTP timeout and retry attempts for a particular command by calling theupdateGlobalSettings
static method just before that command:Note: The above command would change the
HttpRequest
settings globally for the entirety of the test run. It should ideally be reset back to the original settings once the requirement is over.Note 2: The initial values of
timeout
andretry_attempts
can be set using thetimeout_options
property ofwebdriver
config innightwatch.conf.js
.cdp
module is useful when working with CDP commands in Nightwatch -- there could be situations when users want to reset the CDP connection or reset the network mocks. They would also need this module when implementing their own custom CDP commands.