|
| 1 | +<pre class='metadata'> |
| 2 | +Group: WHATWG |
| 3 | +Date: 2022-03-21 |
| 4 | +H1: Test Utils |
| 5 | +Shortname: testutils |
| 6 | +Text Macro: TWITTER testutils |
| 7 | +Text Macro: LATESTRD 2022-03 |
| 8 | +Abstract: This document defines APIs that provide additional testing functionality in browsers |
| 9 | +</pre> |
| 10 | + |
| 11 | +Introduction {#intro} |
| 12 | +===================== |
| 13 | + |
| 14 | +Testing browsers often requires use of specialised API surface that is |
| 15 | +not suitable for exposing to web authors, for example because it could |
| 16 | +undermine platform invariants, or allow behavior that could put users |
| 17 | +at risk. This can make writing cross-browser tests difficult because |
| 18 | +each implementation of the web platform will have its own approach to |
| 19 | +defining such test APIs. The [[!WEBDRIVER|WebDriver]] standard |
| 20 | +provides some of these APIs, with a focus on automated testing of web |
| 21 | +applications. However for testing of browser implementations |
| 22 | +themselves, there are some additional APIs that don't fit into the |
| 23 | +WebDriver framework, but are nevertheless important to testing. |
| 24 | + |
| 25 | +This specification defines additional in-browser APIs for use in |
| 26 | +tests, but which are not suitable to enable for end users. The primary |
| 27 | +client of these APIs is the web-platform-tests |
| 28 | +testsuite. |
| 29 | + |
| 30 | +Infrastructure {#infrastructure} |
| 31 | +================================ |
| 32 | + |
| 33 | +<p>This specification depends on the Infra Standard. [[!INFRA]] |
| 34 | + |
| 35 | +<p>This specification uses terminology from the Web IDL standard. [[!WEBIDL]] |
| 36 | + |
| 37 | +Availability {#availability} |
| 38 | +============================ |
| 39 | + |
| 40 | +The interfaces defined in this specification must not be enabled in |
| 41 | +the default shipping configuration of user agents. They must only be |
| 42 | +enabled in testing configurations for example with special build |
| 43 | +flags, or when a specific non-default preference is set. |
| 44 | + |
| 45 | +The TestUtils Namespace {#the-testutils-namespace} |
| 46 | +============================================ |
| 47 | + |
| 48 | +<xmp class=idl> |
| 49 | +[Exposed=(Window,Worker)] |
| 50 | +namespace TestUtils { |
| 51 | + [NewObject] Promise<undefined> gc(); |
| 52 | +}; |
| 53 | +</xmp> |
| 54 | + |
| 55 | +The {{TestUtils/gc()}} method must run these steps: |
| 56 | + |
| 57 | + 1. Let |p| be a new promise. |
| 58 | + |
| 59 | + 2. Run the following [=in parallel=]: |
| 60 | + |
| 61 | + 2.1 Run <a>implementation-defined</a> steps to perform a garbage collection |
| 62 | + covering at least the <a spec=html>entry Realm</a>. |
| 63 | + |
| 64 | + 2.2 Resolve |p|. |
| 65 | + |
| 66 | + |
| 67 | +<h2 class=no-num id=acknowledgements>Acknowledgments</h2> |
| 68 | + |
| 69 | +Thanks to the following people who have contributed to the |
| 70 | +Test Utils standard: |
| 71 | + |
| 72 | +Kagami Sascha Rosylight |
| 73 | + |
| 74 | +You are awesome! |
| 75 | + |
| 76 | +This standard is written by <a href=https://hoppipolla.co.uk>James Graham</a> |
| 77 | +(<a href=https://www.mozilla.org/>Mozilla</a>, |
| 78 | + |
0 commit comments