Skip to content

Commit ec0fe0b

Browse files
committed
README: describe how to run the tests
I had already provided links, a long time ago, but failed to jot down notes that were so far stuck in my brain but would most likely benefit new contributors a lot. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 775de01 commit ec0fe0b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,32 @@ $ npx -y pagefind --site public --serve
9595

9696
Note that running Pagefind will make the process about 7 times slower, and the site will not be re-rendered and live-reloaded in the browser when you change files in `content/` (unlike with `hugo serve -w`).
9797

98+
## Running the test suite
99+
100+
Believe it or not, https://git-scm.com/ has its own test suite. It uses [Playwright](https://playwright.dev/) to perform a couple of tests that verify that the site "looks right". These tests live in `tests/` and are configured via `playwright.config.js`.
101+
102+
To run these tests in your local setup, you need a working node.js installation. After that, you need to install Playwright:
103+
104+
```console
105+
$ npm install @playwright/test
106+
```
107+
108+
Since Playwright uses headless versions of popular web browsers, you most likely need to install at least one of them, e.g. via:
109+
110+
```console
111+
$ npx playwright install firefox
112+
```
113+
114+
Supported browsers include `firefox`, `chromium`, `webkit`, `chrome`. You can also simply download all of 'em using `npx playwright install` but please first note that they all weigh >100MB, so you might want to refrain from doing that. Side note: In GitHub Actions' hosted runners, Chrome comes pre-installed, and you might be able to use your own Chrome installation, too, if you have one.
115+
116+
By default, the Playwright tests target https://git-scm.com/, which is unlikely what you want: You probably want to run the tests to validate your local changes. To do so, the configuration has a special provision to start a tiny local web server to serve the files written to `public/` by Hugo and Pagefind:
117+
118+
```console
119+
$ PLAYWRIGHT_TEST_URL='http://localhost:5000/' npx playwright test --project=firefox
120+
```
121+
122+
For more fine-grained testing, you can pass `-g <regex>` to run only the matching test cases.
123+
98124
## Update manual pages
99125

100126
First, install the Ruby prerequisites:

0 commit comments

Comments
 (0)