test/viewport/README.md rewritten sentence by sentence #197
+11
-11
@@ -7,15 +7,15 @@ in a real browser:
|
||||
make frontend-viewport-test
|
||||
```
|
||||
|
||||
It runs the unit tests, builds the page into `dist/`, and serves it from the
|
||||
same nginx image, with the same `configs/nginx.conf`, as the Docker image.
|
||||
Before the browser starts, it checks that `/`, and a path nginx answers with the
|
||||
page, are served with `Cache-Control: no-cache` and a `Content-Security-Policy`
|
||||
header. Then it starts a headless Chrome in a container and opens the page in it
|
||||
at each width. For each width it measures the layout inside the page and checks
|
||||
the measurements in Node. The checks decide pass or fail. Screenshots and a
|
||||
`results.json` land in `tmp/viewport/`, for a person to look at when a check
|
||||
fails.
|
||||
First it runs the unit tests. Then it builds the page into `dist/`. It serves
|
||||
`dist/` with the nginx image and the `configs/nginx.conf` that the Docker image
|
||||
ships. Before the browser starts, it fetches `/` and `/no-such-page`, which
|
||||
nginx answers with the page. Both must carry `Cache-Control: no-cache` and a
|
||||
`Content-Security-Policy` header. Then it starts a headless Chrome in a
|
||||
container and opens the page in it at each width. For each width it measures the
|
||||
layout inside the page and checks the measurements in Node. The checks decide
|
||||
pass or fail. Screenshots and a `results.json` land in `tmp/viewport/`, for a
|
||||
person to look at when a check fails.
|
||||
|
||||
The test is not part of `make check`: it needs Docker and takes minutes, and
|
||||
`make test` has to finish in under 60 seconds.
|
||||
@@ -51,7 +51,7 @@ Four more widths are fixed, each for a stated reason:
|
||||
|
||||
## The checks
|
||||
|
||||
Every check runs at every width, and none stops the others.
|
||||
A failed check does not stop the others.
|
||||
|
||||
- `app-rendered`: at least 10 WAN host rows exist, and at least 5 rows show a
|
||||
number as their latency. Without this, the other checks could pass against a
|
||||
@@ -99,7 +99,7 @@ So the rows show one-, two- and three-digit latencies and some unreachable rows,
|
||||
and the layout is tested against that spread. The request to
|
||||
`http://192.168.1.1` is answered, so the `Local Gateway` row appears.
|
||||
|
||||
On each page, the test sets the interval to 1 second and waits until at least 5
|
||||
At each width, the test sets the interval to 1 second and waits until at least 5
|
||||
rows show a latency before it measures. The page discards its first round, so
|
||||
this reaches a filled page without waiting out two rounds at 3 seconds.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user