abort(中止)
以下のエラーコードのいずれかでリクエストを中止します:
Failed
, Aborted
, TimedOut
, AccessDenied
, ConnectionClosed
,
ConnectionReset
, ConnectionRefused
, ConnectionAborted
,
ConnectionFailed
, NameNotResolved
, InternetDisconnected
,
AddressUnreachable
, BlockedByClient
, BlockedByResponse
.
使用方法
mock.abort(errorCode)
パラメータ
名前 | タイプ | 詳細 |
---|---|---|
errorCode | ErrorCode | レスポンスのエラーコード。次のいずれかを指定できます:Failed , Aborted , TimedOut , AccessDenied , ConnectionClosed , ConnectionReset , ConnectionRefused , ConnectionAborted , ConnectionFailed , NameNotResolved , InternetDisconnected , AddressUnreachable , BlockedByClient , BlockedByResponse |
例
abort.js
it('should block Google Analytics from page', async () => {
const mock = await browser.mock('https://www.google-analytics.com/**')
mock.abort('Failed')
})