test/viewport/README.md: rework against the review findings
check / check (push) Canceled after 0s

The opening paragraph has one short sentence per step, and the header
check names `/` and `/no-such-page`. The checks section no longer says
every check runs at every width: `tap-targets-44px` runs only at touch
widths, and each width gets one of the two row-layout checks. The wait
for 5 latency figures is described per width, as the test opens the page
once per width. For #197, part of
#189.

Model: fable-5-1
This commit is contained in:
clawbot
2026-10-26 04:07:04 +00:00
parent a468b14c1e
commit a2de3b2b94
+11 -11
View File
@@ -7,15 +7,15 @@ in a real browser:
make frontend-viewport-test make frontend-viewport-test
``` ```
It runs the unit tests, builds the page into `dist/`, and serves it from the First it runs the unit tests. Then it builds the page into `dist/`. It serves
same nginx image, with the same `configs/nginx.conf`, as the Docker image. `dist/` with the nginx image and the `configs/nginx.conf` that the Docker image
Before the browser starts, it checks that `/`, and a path nginx answers with the ships. Before the browser starts, it fetches `/` and `/no-such-page`, which
page, are served with `Cache-Control: no-cache` and a `Content-Security-Policy` nginx answers with the page. Both must carry `Cache-Control: no-cache` and a
header. Then it starts a headless Chrome in a container and opens the page in it `Content-Security-Policy` header. Then it starts a headless Chrome in a
at each width. For each width it measures the layout inside the page and checks container and opens the page in it at each width. For each width it measures the
the measurements in Node. The checks decide pass or fail. Screenshots and a layout inside the page and checks the measurements in Node. The checks decide
`results.json` land in `tmp/viewport/`, for a person to look at when a check pass or fail. Screenshots and a `results.json` land in `tmp/viewport/`, for a
fails. person to look at when a check fails.
The test is not part of `make check`: it needs Docker and takes minutes, and The test is not part of `make check`: it needs Docker and takes minutes, and
`make test` has to finish in under 60 seconds. `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 ## 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 - `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 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 and the layout is tested against that spread. The request to
`http://192.168.1.1` is answered, so the `Local Gateway` row appears. `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 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. this reaches a filled page without waiting out two rounds at 3 seconds.