webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
31 lines (28 loc) • 1.2 kB
TypeScript
/**
* Restores all mock information and behavior stored in all registered
* mocks of the session. On a browsing context, it restores only the mocks made
* for that tab or window. Inside a parallel test, it restores only the mocks
* that the test created, also on tabs it opened.
*
* All mocks are restored, also when one fails. The error is thrown afterwards: an
* `AggregateError` when several mocks fail.
*
* <example>
:mockRestoreAll.js
it('should restore all mocks', async () => {
const googleMock = await browser.mock('https://google.com/')
googleMock.respond('https://webdriver.io')
const wdioMock = await browser.mock('https://webdriver.io')
wdioMock.respond('http://json.org')
await browser.url('https://google.com/')
console.log(await browser.getTitle()) // JSON
await browser.mockRestoreAll()
await browser.url('https://google.com/')
console.log(await browser.getTitle()) // Google
})
* </example>
*
* @alias browser.mockRestoreAll
*/
export declare function mockRestoreAll(this: WebdriverIO.Browser | WebdriverIO.BrowsingContext): Promise<void>;
//# sourceMappingURL=mockRestoreAll.d.ts.map