Skip to content

Commit

Permalink
docs: stopAsError
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Feb 11, 2024
1 parent e4d14b4 commit b5a8704
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/documentation/sitespeed.io/scripting/Measure.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
await commands.measure.start();
await commands.click.byLinkTextAndWait('Documentation');
// Remember to stop the measurements if you do not provide a URL
await commands.measure.stop();</code></pre></div></div><h3 class="name has-anchor" id="stop"><span class="type-signature">(async) </span>stop<span class="signature">(testedStartUrl)</span><span class="type-signature"> &rarr; {Promise}</span></h3><div class="description">Stops the measurement process, collects metrics, and handles any post-measurement tasks. It finalizes the URL being tested, manages any URL-specific metadata, stops any ongoing video recordings, and initiates the data collection process.</div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>testedStartUrl</code></td><td class="type"><span class="param-type">string</span></td><td class="description last">The URL that was initially tested. If not provided, it will be obtained from the browser.</td></tr></tbody></table></div><div class="method-member-container mt-20"><strong>Throws:</strong><dl><dt><div class="param-desc">Throws an error if there are issues in stopping the measurement or collecting data.</div></dt><dd></dd><dt><dl><dt>Type</dt><dd><span class="param-type">Error</span></dd></dl></dt><dd></dd></dl></div><div class="method-member-container mt-20"><strong>Returns:</strong><div class="param-desc">A promise that resolves with the collected metrics data.</div><dl class="param-type"><dt>Type:&nbsp;</dt><dd><span class="param-type">Promise</span></dd></dl></div></article></section><footer class="footer" id="PeOAagUepe"><div class="wrapper">© <a href="https://www.sitespeed.io">sitespeed.io</a> 2024</div></footer></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">sitespeed.io scripting</a><div class="mobile-nav-links"><div class="navbar-item"><a id="" href="." target="">Start</a></div><div class="navbar-item"><a id="" href="https://www.sitespeed.io/documentation/sitespeed.io/" target="">Back to documentation</a></div></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-tutorials"><div>Tutorials</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="tutorial-01-Introduction.html">Introduction</a></div><div class="sidebar-section-children"><a href="tutorial-02-Running-Scripts.html">Running and managing scripts</a></div><div class="sidebar-section-children"><a href="tutorial-03-Measurement-Commands.html">Measure</a></div><div class="sidebar-section-children"><a href="tutorial-04-Interact-with-the-page.html">Interact with the page</a></div><div class="sidebar-section-children"><a href="tutorial-05-Interact-Browser.html">Interact with the browser</a></div><div class="sidebar-section-children"><a href="tutorial-06-Error-handling.html">Error handling</a></div><div class="sidebar-section-children"><a href="tutorial-07-Debugging-Scripts.html">Debugging scripts</a></div><div class="sidebar-section-children"><a href="tutorial-08-Setting-Up-IntelliSense.html">Code completion and IntelliSense</a></div><div class="sidebar-section-children"><a href="tutorial-09-Examples.html">Examples</a></div><div class="sidebar-section-children"><a href="tutorial-10-Selenium.html">Running Selenium code</a></div><div class="sidebar-section-children"><a href="tutorial-11-Chrome-Devtools-Protocol.html">Chrome Devtools Protocol (CDP)</a></div><div class="sidebar-section-children"><a href="tutorial-12-Android.html">Android devices</a></div><div class="sidebar-section-children"><a href="tutorial-13-Tips-and-tricks.html">Tips and tricks</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="Actions.html">Actions</a></div><div class="sidebar-section-children"><a href="AddText.html">AddText</a></div><div class="sidebar-section-children"><a href="AndroidCommand.html">AndroidCommand</a></div><div class="sidebar-section-children"><a href="Cache.html">Cache</a></div><div class="sidebar-section-children"><a href="ChromeDevelopmentToolsProtocol.html">ChromeDevelopmentToolsProtocol</a></div><div class="sidebar-section-children"><a href="ChromeTrace.html">ChromeTrace</a></div><div class="sidebar-section-children"><a href="Click.html">Click</a></div><div class="sidebar-section-children"><a href="ClickAndHold.html">ClickAndHold</a></div><div class="sidebar-section-children"><a href="Commands.html">Commands</a></div><div class="sidebar-section-children"><a href="ContextClick.html">ContextClick</a></div><div class="sidebar-section-children"><a href="Debug.html">Debug</a></div><div class="sidebar-section-children"><a href="DoubleClick.html">DoubleClick</a></div><div class="sidebar-section-children"><a href="Element.html">Element</a></div><div class="sidebar-section-children"><a href="GeckoProfiler.html">GeckoProfiler</a></div><div class="sidebar-section-children"><a href="JavaScript.html">JavaScript</a></div><div class="sidebar-section-children"><a href="Measure.html">Measure</a></div><div class="sidebar-section-children"><a href="Meta.html">Meta</a></div><div class="sidebar-section-children"><a href="MouseMove.html">MouseMove</a></div><div class="sidebar-section-children"><a href="Navigation.html">Navigation</a></div><div class="sidebar-section-children"><a href="Screenshot.html">Screenshot</a></div><div class="sidebar-section-children"><a href="Scroll.html">Scroll</a></div><div class="sidebar-section-children"><a href="Select.html">Select</a></div><div class="sidebar-section-children"><a href="Set.html">Set</a></div><div class="sidebar-section-children"><a href="SingleClick.html">SingleClick</a></div><div class="sidebar-section-children"><a href="StopWatch.html">StopWatch</a></div><div class="sidebar-section-children"><a href="Switch.html">Switch</a></div><div class="sidebar-section-children"><a href="Wait.html">Wait</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
await commands.measure.stop();</code></pre></div></div><h3 class="name has-anchor" id="stop"><span class="type-signature">(async) </span>stop<span class="signature">(testedStartUrl)</span><span class="type-signature"> &rarr; {Promise}</span></h3><div class="description">Stops the measurement process, collects metrics, and handles any post-measurement tasks. It finalizes the URL being tested, manages any URL-specific metadata, stops any ongoing video recordings, and initiates the data collection process.</div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>testedStartUrl</code></td><td class="type"><span class="param-type">string</span></td><td class="description last">The URL that was initially tested. If not provided, it will be obtained from the browser.</td></tr></tbody></table></div><div class="method-member-container mt-20"><strong>Throws:</strong><dl><dt><div class="param-desc">Throws an error if there are issues in stopping the measurement or collecting data.</div></dt><dd></dd><dt><dl><dt>Type</dt><dd><span class="param-type">Error</span></dd></dl></dt><dd></dd></dl></div><div class="method-member-container mt-20"><strong>Returns:</strong><div class="param-desc">A promise that resolves with the collected metrics data.</div><dl class="param-type"><dt>Type:&nbsp;</dt><dd><span class="param-type">Promise</span></dd></dl></div><h3 class="name has-anchor" id="stopAsError"><span class="type-signature">(async) </span>stopAsError<span class="signature">(errorMessage, optionalURL)</span><span class="type-signature"> &rarr; {Promise}</span></h3><div class="description">Stop the current measurement and mark it as a failure. This stop function will not measure anything on a page. This is useful if you need to stop a measurement in a (try) catch and you know something has failed.</div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>errorMessage</code></td><td class="type"><span class="param-type">string</span></td><td class="description last">The message about the error. This will end up on the HTML report for sitespeed.io so give it a good message so you know what's gone wrong.</td></tr><tr><td class="name"><code>optionalURL</code></td><td class="type"><span class="param-type">string</span></td><td class="description last">The URL of the page that you wanted to test. If you don't know the URL (you clicked on a link etc) skip it.</td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-since bold">Since</dt><dd class="tag-since"><ul><li>21.2.0</li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><div class="param-desc">A promise that resolves when the stop process has completed.</div><dl class="param-type"><dt>Type:&nbsp;</dt><dd><span class="param-type">Promise</span></dd></dl></div></article></section><footer class="footer" id="PeOAagUepe"><div class="wrapper">© <a href="https://www.sitespeed.io">sitespeed.io</a> 2024</div></footer></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">sitespeed.io scripting</a><div class="mobile-nav-links"><div class="navbar-item"><a id="" href="." target="">Start</a></div><div class="navbar-item"><a id="" href="https://www.sitespeed.io/documentation/sitespeed.io/" target="">Back to documentation</a></div></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-tutorials"><div>Tutorials</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="tutorial-01-Introduction.html">Introduction</a></div><div class="sidebar-section-children"><a href="tutorial-02-Running-Scripts.html">Running and managing scripts</a></div><div class="sidebar-section-children"><a href="tutorial-03-Measurement-Commands.html">Measure</a></div><div class="sidebar-section-children"><a href="tutorial-04-Interact-with-the-page.html">Interact with the page</a></div><div class="sidebar-section-children"><a href="tutorial-05-Interact-Browser.html">Interact with the browser</a></div><div class="sidebar-section-children"><a href="tutorial-06-Error-handling.html">Error handling</a></div><div class="sidebar-section-children"><a href="tutorial-07-Debugging-Scripts.html">Debugging scripts</a></div><div class="sidebar-section-children"><a href="tutorial-08-Setting-Up-IntelliSense.html">Code completion and IntelliSense</a></div><div class="sidebar-section-children"><a href="tutorial-09-Examples.html">Examples</a></div><div class="sidebar-section-children"><a href="tutorial-10-Selenium.html">Running Selenium code</a></div><div class="sidebar-section-children"><a href="tutorial-11-Chrome-Devtools-Protocol.html">Chrome Devtools Protocol (CDP)</a></div><div class="sidebar-section-children"><a href="tutorial-12-Android.html">Android devices</a></div><div class="sidebar-section-children"><a href="tutorial-13-Tips-and-tricks.html">Tips and tricks</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="Actions.html">Actions</a></div><div class="sidebar-section-children"><a href="AddText.html">AddText</a></div><div class="sidebar-section-children"><a href="AndroidCommand.html">AndroidCommand</a></div><div class="sidebar-section-children"><a href="Cache.html">Cache</a></div><div class="sidebar-section-children"><a href="ChromeDevelopmentToolsProtocol.html">ChromeDevelopmentToolsProtocol</a></div><div class="sidebar-section-children"><a href="ChromeTrace.html">ChromeTrace</a></div><div class="sidebar-section-children"><a href="Click.html">Click</a></div><div class="sidebar-section-children"><a href="ClickAndHold.html">ClickAndHold</a></div><div class="sidebar-section-children"><a href="Commands.html">Commands</a></div><div class="sidebar-section-children"><a href="ContextClick.html">ContextClick</a></div><div class="sidebar-section-children"><a href="Debug.html">Debug</a></div><div class="sidebar-section-children"><a href="DoubleClick.html">DoubleClick</a></div><div class="sidebar-section-children"><a href="Element.html">Element</a></div><div class="sidebar-section-children"><a href="GeckoProfiler.html">GeckoProfiler</a></div><div class="sidebar-section-children"><a href="JavaScript.html">JavaScript</a></div><div class="sidebar-section-children"><a href="Measure.html">Measure</a></div><div class="sidebar-section-children"><a href="Meta.html">Meta</a></div><div class="sidebar-section-children"><a href="MouseMove.html">MouseMove</a></div><div class="sidebar-section-children"><a href="Navigation.html">Navigation</a></div><div class="sidebar-section-children"><a href="Screenshot.html">Screenshot</a></div><div class="sidebar-section-children"><a href="Scroll.html">Scroll</a></div><div class="sidebar-section-children"><a href="Select.html">Select</a></div><div class="sidebar-section-children"><a href="Set.html">Set</a></div><div class="sidebar-section-children"><a href="SingleClick.html">SingleClick</a></div><div class="sidebar-section-children"><a href="StopWatch.html">StopWatch</a></div><div class="sidebar-section-children"><a href="Switch.html">Switch</a></div><div class="sidebar-section-children"><a href="Wait.html">Wait</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
Loading

0 comments on commit b5a8704

Please sign in to comment.