1. Introduction
Testing browsers often requires use of specialised API surface that is not suitable for exposing to web authors, for example because it could undermine platform invariants, or allow behavior that could put users at risk. This can make writing cross-browser tests difficult because each implementation of the web platform will have its own approach to defining such test APIs. The WebDriver standard provides some of these APIs, with a focus on automated testing of web applications. However for testing of browser implementations themselves, there are some additional APIs that don’t fit into the WebDriver framework, but are nevertheless important to testing.
This specification defines additional in-browser APIs for use in tests, but which are not suitable to enable for end users. The primary client of these APIs is the web-platform-tests testsuite.
2. Infrastructure
This specification depends on the Infra Standard. [INFRA]
This specification uses terminology from the Web IDL standard. [WEBIDL]
3. Availability
The interfaces defined in this specification must not be enabled in the default shipping configuration of user agents. They must only be enabled in testing configurations for example with special build flags, or when a specific non-default preference is set.
4. The TestUtils Namespace
[Exposed =(Window ,Worker )]namespace { [
TestUtils NewObject ]Promise <undefined >(); };
gc
The gc()
method must run these steps:
-
Let p be a new promise.
-
Run the following in parallel:
2.1 Run implementation-defined steps to perform a garbage collection covering at least the entry Realm.
2.2 Resolve p.
Acknowledgments
Thanks to the following people who have contributed to the Test Utils standard:
Kagami Sascha Rosylight
You are awesome!
This standard is written by James Graham (Mozilla, james@hoppipolla.co.uk).
Intellectual property rights
Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License. To the extent portions of it are incorporated into source code, such portions in the source code are licensed under the BSD 3-Clause License instead.
This is the Living Standard. Those interested in the patent-review version should view the Living Standard Review Draft.