Skip to main content

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', async () => {
const mock = await browser.mock('https://www.google-analytics.com/**')
mock.abort('Failed')
})

Welcome! How can I help?

WebdriverIO AI Copilot