Mock the response of request made on a particular URL.

Usage

.mockNetworkResponse(urlToIntercept, {status, headers, body}, [callback])

Parameters

Name Type description
urlToIntercept string

URL to intercept and mock the response from

response object

Response to return

callback
Optional
function

Optional callback function to be called when the command finishes.

Example

 this.demoTest = function (browser) {
   browser
     .mockNetworkResponse('https://www.google.com/', {
       status: 200,
       headers: {
         'Content-Type': 'UTF-8'
       },
       body: 'Hello there!'
     })
     .navigateTo('https://www.google.com/');
 };