PageSourceSearch

https://testplane.io/assets/js/ce100de1.992ce528.js

js testplane.io collected 2026-10-03 20:21:40 UTC 3,941 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunktestplane_docs=self.webpackChunktestplane_docs||[]).push([["4171"],{2791(e,r,l){l.r(r),l.d(r,{metadata:()=>n,default:()=>m,frontMatter:()=>c,contentTitle:()=>t,toc:()=>i,assets:()=>a});var n=JSON.parse('{"id":"commands/browser/mockClearAll","title":"mockClearAll","description":"Overview {/ #overview /}","source":"@site/versioned_docs/version-v8/commands/browser/mockClearAll.mdx","sourceDirName":"commands/browser","slug":"/commands/browser/mockClearAll","permalink":"/docs/v8/commands/browser/mockClearAll","draft":false,"unlisted":false,"editUrl":"https://github.com/gemini-testing/testplane-docs/tree/master/versioned_docs/version-v8/commands/browser/mockClearAll.mdx","tags":[],"version":"v8","frontMatter":{},"sidebar":"mainSidebar","previous":{"title":"mock","permalink":"/docs/v8/commands/browser/mock"},"next":{"title":"mockRestoreAll","permalink":"/docs/v8/commands/browser/mockRestoreAll"}}'),s=l(74848),o=l(28453);let c={},t="mockClearAll",a={},i=[{value:"Overview",id:"overview",level:2},{value:"Usage",id:"usage",level:2},{value:"Usage Examples",id:"examples",level:2},{value:"Related Commands",id:"related",level:2},{value:"References",id:"references",level:2}];function d(e){let r={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.header,{children:(0,s.jsx)(r.h1,{id:"mockclearall",children:"mockClearAll"})}),"\n",(0,s.jsx)(r.h2,{id:"overview",children:"Overview"}),"\n",(0,s.jsxs)(r.p,{children:["Use the ",(0,s.jsx)(r.code,{children:"mockClearAll"})," command to reset all stored information in registered mocks. Mocks are registered using the ",(0,s.jsx)(r.a,{href:"../mock",children:"mock"})," command."]}),"\n",(0,s.jsx)(r.h2,{id:"usage",children:"Usage"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-typescript",children:"await browser.mockClearAll();\n"})}),"\n",(0,s.jsx)(r.h2,{id:"examples",children:"Usage Examples"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-typescript",children:'it("should clear all mocks", async ({ browser }) => {\n    const docMock = await browser.mock("**", {\n        headers: { "Content-Type": "text/html" },\n    });\n    const jsMock = await browser.mock("**", {\n        headers: { "Content-Type": "application/javascript" },\n    });\n\n    await browser.url("http://guinea-pig.webdriver.io/");\n    console.log(docMock.calls.length, jsMock.calls.length); // returns "1 4"\n\n    await browser.url("http://guinea-pig.webdriver.io/");\n    console.log(docMock.calls.length, jsMock.calls.length); // returns "2 4" (JavaScript comes from cache)\n\n    await browser.mockClearAll();\n    console.log(docMock.calls.length, jsMock.calls.length); // returns "0 0"\n});\n'})}),"\n",(0,s.jsx)(r.h2,{id:"related",children:"Related Commands"}),"\n",(0,s.jsxs)(r.ul,{children:["\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"../mock",children:"mock"})}),"\n",(0,s.jsx)(r.li,{children:(0,s.jsx)(r.a,{href:"../mockRestoreAll",children:"mockRestoreAll"})}),"\n"]}),"\n",(0,s.jsx)(r.h2,{id:"references",children:"References"}),"\n",(0,s.jsxs)(r.p,{children:["We'd like to give credit to the original WebdriverIO docs ",(0,s.jsx)(r.a,{href:"https://webdriver.io/docs/api/browser/mockClearAll",children:"article"}),", from which we drew some information while writing our version."]})]})}function m(e={}){let{wrapper:r}={...(0,o.R)(),...e.components};return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},28453(e,r,l){l.d(r,{R:()=>c,x:()=>t});var n=l(96540);let s={},o=n.createContext(s);function c(e){let r=n.useContext(o);return n.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function t(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),n.createElement(o.Provider,{value:r},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.