tree: d5f14250df59e9472e6d93bfc002636492978d77 [path history] [tgz]
  1. .github/
  2. .well-known/
  3. 2dcontext/
  4. accelerometer/
  5. acid/
  6. ambient-light/
  7. animation-worklet/
  8. apng/
  9. appmanifest/
  10. audio-output/
  11. background-fetch/
  12. BackgroundSync/
  13. battery-status/
  14. beacon/
  15. bluetooth/
  16. clear-site-data/
  17. client-hints/
  18. clipboard-apis/
  19. common/
  20. compat/
  21. console/
  22. contacts/
  23. content-security-policy/
  24. cookie-store/
  25. cookies/
  26. cors/
  27. credential-management/
  28. css/
  29. custom-elements/
  30. device-memory/
  31. dom/
  32. domparsing/
  33. domxpath/
  34. editing/
  35. element-timing/
  36. encoding/
  37. encrypted-media/
  38. entries-api/
  39. event-timing/
  40. eventsource/
  41. feature-policy/
  42. fetch/
  43. FileAPI/
  44. fonts/
  45. forced-colors-mode/
  46. fullscreen/
  47. gamepad/
  48. generic-sensor/
  49. geolocation-API/
  50. geolocation-sensor/
  51. graphics-aam/
  52. gyroscope/
  53. hr-time/
  54. html/
  55. html-media-capture/
  56. idle-detection/
  57. imagebitmap-renderingcontext/
  58. images/
  59. import-maps/
  60. IndexedDB/
  61. inert/
  62. infrastructure/
  63. innerText/
  64. input-device-capabilities/
  65. input-events/
  66. interfaces/
  67. intersection-observer/
  68. keyboard-lock/
  69. keyboard-map/
  70. kv-storage/
  71. largest-contentful-paint/
  72. layout-instability/
  73. lifecycle/
  74. loading/
  75. longtask-timing/
  76. magnetometer/
  77. mathml/
  78. media/
  79. media-capabilities/
  80. media-playback-quality/
  81. media-source/
  82. mediacapture-depth/
  83. mediacapture-fromelement/
  84. mediacapture-image/
  85. mediacapture-record/
  86. mediacapture-streams/
  87. mediasession/
  88. mimesniff/
  89. mixed-content/
  90. mst-content-hint/
  91. native-file-system/
  92. navigation-timing/
  93. netinfo/
  94. network-error-logging/
  95. notifications/
  96. offscreen-canvas/
  97. orientation-event/
  98. orientation-sensor/
  99. origin-policy/
  100. page-visibility/
  101. paint-timing/
  102. payment-handler/
  103. payment-method-basic-card/
  104. payment-method-id/
  105. payment-request/
  106. performance-timeline/
  107. permissions/
  108. picture-in-picture/
  109. pointerevents/
  110. pointerlock/
  111. portals/
  112. preload/
  113. presentation-api/
  114. printing/
  115. priority-hints/
  116. push-api/
  117. quirks/
  118. referrer-policy/
  119. remote-playback/
  120. reporting/
  121. requestidlecallback/
  122. resize-observer/
  123. resource-timing/
  124. resources/
  125. screen-capture/
  126. screen-orientation/
  127. screen_enumeration/
  128. scroll-animations/
  129. scroll-to-text-fragment/
  130. secure-contexts/
  131. selection/
  132. serial/
  133. server-timing/
  134. service-workers/
  135. shadow-dom/
  136. shape-detection/
  137. signed-exchange/
  138. sms/
  139. speech-api/
  140. std-toast/
  141. storage/
  142. streams/
  143. subresource-integrity/
  144. svg/
  145. timing-entrytypes-registry/
  146. tools/
  147. touch-events/
  148. trusted-types/
  149. uievents/
  150. upgrade-insecure-requests/
  151. url/
  152. user-timing/
  153. vibration/
  154. visual-viewport/
  155. wake-lock/
  156. wasm/
  157. web-animations/
  158. web-locks/
  159. web-nfc/
  160. web-share/
  161. webaudio/
  162. webauthn/
  163. WebCryptoAPI/
  164. webdriver/
  165. webgpu/
  166. WebIDL/
  167. webmessaging/
  168. webmidi/
  169. webrtc/
  170. webrtc-identity/
  171. webrtc-quic/
  172. webrtc-stats/
  173. webrtc-svc/
  174. websockets/
  175. webstorage/
  176. webusb/
  177. webvr/
  178. webvtt/
  179. webxr/
  180. workers/
  181. worklets/
  182. x-frame-options/
  183. xhr/
  184. xslt/
  185. .gitignore
  186. CONTRIBUTING.md
  187. LICENSE.md
  188. lint.whitelist
  189. README.md
  190. testharness_runner.html
  191. update-built-tests.sh
  192. wpt
  193. wpt.py
blink/web_tests/external/wpt/README.md

The web-platform-tests Project

The web-platform-tests Project is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • web-platform-tests.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the IRC chat room named #testing on irc.w3.org; includes participants located around the world, but busiest during the European working day; all discussion is archived here
  • Mailing list: a public and low-traffic discussion list

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

The tests are designed to be run from your local computer. The test environment requires Python 2.7+ (but not Python 3.x).

On Windows, be sure to add the Python directory (c:\python2x, by default) to your %Path% Environment Variable, and read the Windows Notes section below.

To get the tests running, you need to set up the test domains in your hosts file.

The necessary content can be generated with ./wpt make-hosts-file; on Windows, you will need to precede the prior command with python or the path to the Python binary (python wpt make-hosts-file).

For example, on most UNIX-like systems, you can setup the hosts file with:

./wpt make-hosts-file | sudo tee -a /etc/hosts

And on Windows (this must be run in a PowerShell session with Administrator privileges):

python wpt make-hosts-file | Out-File $env:systemroot\System32\drivers\etc\hosts -Encoding ascii -Append

If you are behind a proxy, you also need to make sure the domains above are excluded from your proxy lookups.

Running Tests Manually

The test server can be started using

./wpt serve

On Windows: You will need to precede the prior command with python or the path to the python binary.

python wpt serve

This will start HTTP servers on two ports and a websockets server on one port. By default the web servers start on ports 8000 and 8443 and the other ports are randomly-chosen free ports. Tests must be loaded from the first HTTP server in the output. To change the ports, create a config.json file in the wpt root directory, and add port definitions of your choice e.g.:

{
  "ports": {
    "http": [1234, "auto"],
    "https":[5678]
  }
}

After your hosts file is configured, the servers will be locally accessible at:

http://web-platform.test:8000/
https://web-platform.test:8443/ *

To use the web-based runner point your browser to:

http://web-platform.test:8000/tools/runner/index.html
https://web-platform.test:8443/tools/runner/index.html *

*See Trusting Root CA

Running Tests Automatically

Tests can be run automatically in a browser using the run command of the wpt script in the root of the checkout. This requires the hosts file setup documented above, but you must not have the test server already running when calling wpt run. The basic command line syntax is:

./wpt run product [tests]

On Windows: You will need to precede the prior command with python or the path to the python binary.

python wpt run product [tests]

where product is currently firefox or chrome and [tests] is a list of paths to tests. This will attempt to automatically locate a browser instance and install required dependencies. The command is very configurable; for example to specify a particular binary use wpt run --binary=path product. The full range of options can be see with wpt run --help and wpt run --wptrunner-help.

Not all dependencies can be automatically installed; in particular the certutil tool required to run https tests with Firefox must be installed using a system package manager or similar.

On Debian/Ubuntu certutil may be installed using:

sudo apt install libnss3-tools

And on macOS with homebrew using:

brew install nss

On other platforms, download the firefox archive and common.tests.tar.gz archive for your platform from Mozilla CI.

Then extract certutil[.exe] from the tests.tar.gz package and libnss3[.so|.dll|.dynlib] and put the former on your path and the latter on your library path.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to http://w3c-test.org/.

Pull requests are automatically mirrored except those that modify sensitive resources (such as .py). The latter require someone with merge access to comment with “LGTM” or “w3c-test:mirror” to indicate the pull request has been checked.

Branches

In the vast majority of cases the only upstream branch that you should need to care about is master. If you see other branches in the repository, you can generally safely ignore them.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome (and even encouraged) to contribute to test development, so long as you fulfill the contribution requirements detailed in the [Contributing Guidelines][contributing]. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run the lint script described below.
  • Commit locally and push that to your repo.
  • Send in a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!

Lint tool

We have a lint tool for catching common mistakes in test files. You can run it manually by starting the lint executable from the root of your local web-platform-tests working directory like this:

./wpt lint

The lint tool is also run automatically for every submitted pull request, and reviewers will not merge branches with tests that have lint errors, so you must fix any errors the lint tool reports.

In the unusual case of error reports for things essential to a certain test or that for other exceptional reasons shouldn't prevent a merge of a test, update and commit the lint.whitelist file in the web-platform-tests root directory to suppress the error reports.

For more details, see the lint-tool documentation.