clear
Resets all information stored in the mock.calls
array.
Usage
mock.clear()
Example
- Asynchronous Mode
- Synchronous Mode
clear.js
it('should clear mock', async () => {
const mock = await browser.mock('https://google.com/')
await browser.url('https://google.com')
console.log(mock.calls.length) // returns 1
mock.clear()
console.log(mock.calls.length) // returns 0
})
clear.js
it('should clear mock', () => {
const mock = browser.mock('https://google.com/')
browser.url('https://google.com')
console.log(mock.calls.length) // returns 1
mock.clear()
console.log(mock.calls.length) // returns 0
})
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.