Documentation: Explain how to import tests using the WPT.sh script

This commit is contained in:
sideshowbarker 2024-11-02 14:12:40 +09:00 committed by Andreas Kling
parent 6d9dab5a29
commit 21b705ee32
Notes: github-actions[bot] 2024-11-05 09:39:54 +00:00
3 changed files with 14 additions and 0 deletions

View file

@ -58,6 +58,8 @@ Note that this also applies to debug logging and other internal strings, as they
When possible, please include tests when fixing bugs or adding new features. When possible, please include tests when fixing bugs or adding new features.
If changes youre making have relevant [Web Platform Tests (WPT)](https://wpt.fyi/) tests — especially if the changes cause Ladybird to pass any WPT tests it hadnt yet been passing — you should consider [importing those tests into your Ladybird clone](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/Testing.md#importing-web-platform-tests), and then commit the imported tests along with your code changes.
## Code submission policy ## Code submission policy
Nobody is perfect, and sometimes we mess things up. That said, here are some good do's & don'ts to try and stick to: Nobody is perfect, and sometimes we mess things up. That said, here are some good do's & don'ts to try and stick to:

View file

@ -89,3 +89,4 @@ Make sure your code meets the requirements in the [full contribution guidelines]
* Make correctly formatted, atomic commits (building the project at every commit should succeed). * Make correctly formatted, atomic commits (building the project at every commit should succeed).
* Discuss and resolve any reviews you receive. * Discuss and resolve any reviews you receive.
* Fix CI failures by editing your commits. * Fix CI failures by editing your commits.
* Include tests ([use `Meta/import-wpt-test.py` to import WPT tests](Testing.md#importing-web-platform-tests))

View file

@ -110,6 +110,17 @@ git checkout my-css-change
./Meta/WPT.sh run --log results.log ./Meta/WPT.sh run --log results.log
``` ```
### Importing Web Platform Tests
You can import certain Web Platform Tests (WPT) tests into your Ladybird clone (if theyre tests of type that can be imported — and especially if any code changes youre making cause Ladybird to pass any WPT tests it hasnt yet been passing). Heres how:
```sh
./Meta/WPT.sh import html/dom/aria-attribute-reflection.html
```
That is, you give `./Meta/WPT.sh import` the path part of any `http://wpt.live/` URL for a WPT test you want to import. It will then download both that test and any of its JavaScript scripts, copy those to the `Tests/LibWeb/Text/input/wpt-import` directory, run the test, and then in the `Tests/LibWeb/Text/expected/wpt-import` directory, it will create a file with the expected results from the test.
## Writing tests ## Writing tests
Running `Tests/LibWeb/add_libweb_test.py your-new-test-name` will create a new test HTML file in Running `Tests/LibWeb/add_libweb_test.py your-new-test-name` will create a new test HTML file in