Skip to main content

clear

Overview

Use the clear command to reset all information stored in the mock.calls array.

Usage

mock.clear();

Usage Examples

it("should clear mock", async ({ browser }) => {
const mock = await browser.mock("https://google.com/");
await browser.url("https://google.com");

console.log(mock.calls.length); // outputs: 1
mock.clear();
console.log(mock.calls.length); // outputs: 0
});

References

We'd like to give credit to the original WebdriverIO docs article, from which we drew some information while writing our version.