blob: feec3e98f83a6a535a2a06c60aab44f4489d5b8f [file] [log] [blame] [view]
Weizhong Xiabe863d722023-11-01 22:36:151# Running Web Platform Tests with run_wpt_tests.py
2
3`run_web_tests.py` runs web tests with content shell through [protocol mode]. See
4[web_tests.md](./web_tests.md) for details. `run_wpt_tests.py` instead can run web
5platform tests with Chrome, Chrome Android and WebView. This document explains how
6to use `run_wpt_tests.py` in these scenarios.
7
8[TOC]
9
10## Difference and Similarity with run_web_tests.py
11
12`run_wpt_tests.py` can run with different browsers. To specify which browser to
13run tests with, you should use `--product` or `-p`. Supported parameters are `chrome`,
14`chrome_android` (or `clank`), and `android_webview` (or `webview`). The default
15value is `chrome` if not specified.
16
17The CLI is mostly kept the same between run_web_tests.py and run_wpt_tests.py. To
18see a complete list of arguments supported in run_wpt_tests.py, run:
19
20```bash
21third_party/blink/tools/run_wpt_tests.py --help
22```
23
24## Running Web Platform Tests with Chrome
25
26### Supported Platforms
27
28* Linux
29
30It is possible to run tests for Chrome on other platforms, but test expectations
31and baselines are only actively maintained for Linux due to resource constraint.
32
33### Initial Setup
34
35Before you can run the web platform tests, you need to build the `chrome_wpt_tests`
36target to get `chrome`, `chromedriver` and all of the other needed binaries.
37
38```bash
39autoninja -C out/Default chrome_wpt_tests
40```
41
42### Running the Tests
43
44Once you have `chrome` and `chromedriver` built, running tests is very much similar
45to how you run tests with `run_web_tests.py`. For example, to run tests in `external/wpt/html/dom`,
46you should run:
47
48```bash
49third_party/blink/tools/run_wpt_tests.py --release -p chrome third_party/blink/web_tests/external/wpt/html/dom
50```
51
52Note: consider using `-v` to get browser logs. It can be provided multiple times to
53increase verbosity.
54
55### Test expectations and Baselines
56
57The
58[TestExpectations](../../third_party/blink/web_tests/TestExpectations) file (and related
59files) contains the list of all known web test failures. A special tag `Chrome` is
60introduced to specify chrome specific failures. See the
61[Web Test Expectations documentation](./web_test_expectations.md) for more
62on this.
63
64Chrome specific baselines reside at `third_party/blink/web_tests/platform/linux-chrome`, and
65falls back to `third_party/blink/web_tests/platform/linux`. To update baselines for chrome,
66you should trigger `linux-wpt-fyi-rel` and run [rebaseline tool](./web_test_expectations.md#How-to-rebaseline) after the results are ready.
67
68## Running Web Platform Tests with Chrome Android
69
70To be updated.
71
72## Running Web Platform Tests with WebView
73
74To be updated.
75
76## Debugging Support
77
78### Headful Mode
79
80Passing the `--no-headless` flag to `run_wpt_tests.py` will pause execution
81after running each test headfully.
82You can interact with the paused test page afterwards, including with DevTools:
83
84![Testharness paused](images/web-tests/wptrunner-paused.jpg)
85
86Closing the tab or window will unpause the testharness and run the next test.
87
88### Text-Based Debuggers
89
90To interactively debug WPTs, prefix the `run_wpt_tests.py` command with
91[`debug_renderer`][debug renderer] to attach a debugger to a desired renderer.
92
93For other use cases, see [these debugging tips].
94
95[these debugging tips]: /docs/linux/debugging.md
96
97## Known Issues
98
99Please [file bugs and feature requests](https://crbug.com/new) against
100[`Blink>Infra` with the `wptrunner`
101label](https://bugs.chromium.org/p/chromium/issues/list?q=component%3ABlink%3EInfra%20label%3Awptrunner&can=2).
102
103[protocol mode]: /content/web_test/browser/test_info_extractor.h
104[debug renderer]: /third_party/blink/tools/debug_renderer