abort

Abort the request with one of the following error codes: Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse.

Usage#
mock.abort(errorCode)
Parameters#
NameTypeDetails
errorCodeErrorCodeerror code of the response, can be one of: Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse
Example#
abort.js
it('should block Google Analytics from page', () => {
const mock = browser.mock('https://www.google-analytics.com/**')
mock.abort('Failed')
})