Test evidence: The browser harness, Node runner, colour maths, spelling grammar, axe and the drive helpers open
On branch fiesta-1
Test evidence for Task 3 of the Fiesta packaging, copied from the implementer's report so it sits on the branch.
Commits
- 3079cd5 The browser harness, Node runner, colour maths, spelling grammar, axe and the drive helpers
- Fix round 1: b4f0664 Move classSpelling into check, and drop the keep entry staticcheck does not need; 6a5cd06 Scan returns axe's incomplete rules, loads the engine once, and has a test; 6777d08 Pin the harness's prompt failure on a browser that cannot start
GREEN: the ported tests, first run
All ported tests are preservation tests and passed on first run.
$ FIESTA_TEST_REQUIRE_NODE=1 go test ./internal/... ./check/ -count=1
ok amadan.net/rastrillo/fiesta/internal/axe 0.002s
ok amadan.net/rastrillo/fiesta/internal/markup 0.002s
ok amadan.net/rastrillo/fiesta/internal/nodetest 0.248s
ok amadan.net/rastrillo/fiesta/check 0.021s
$ make browser.internal.harness browser.check
ok amadan.net/rastrillo/fiesta/internal/harness 7.755s
ok amadan.net/rastrillo/fiesta/check 0.677s
$ go test -tags browser -v ./check/ -count=1
--- PASS: TestTheDepthFixtureServesItsStylesheets (0.65s)Negative control: a browser that cannot start
First attempt, with the SEED shape of New: FIESTA_CHROME=/nonexistent go test -tags browser -run TestScreenPassesACleanPage ./internal/harness/ printed nothing and the harness.test process sat alive until killed. Cause, in chromedp v0.14.2: cmd.Start() fails before the goroutine that closes c.allocated, so chromedp.Cancel blocks forever. The test would have failed only at go test's ten-minute alarm.
Fix: New cancels its contexts and t.Fatalfs when the boot fails, and registers the chromedp.Cancel cleanup only once the browser has started.
$ FIESTA_CHROME=/nonexistent go test -tags browser -run TestScreenPassesACleanPage ./internal/harness/ -count=1
--- FAIL: TestScreenPassesACleanPage (0.00s)
junk_test.go:75: harness: browser boot: fork/exec /nonexistent: no such file or directory
FAIL amadan.net/rastrillo/fiesta/internal/harness 0.003s
$ go test -tags browser ./internal/harness/ -count=1
ok amadan.net/rastrillo/fiesta/internal/harness 6.641saxe.Run was checked by hand with a scratch test (never committed): a page with an <img> with no alt gave one violation, image-alt [critical] Images must have alternative text [#bad]; scoped to a lone button, ErrNothingScanned.
make ci on the commit: gofmt, no-rastrillo, root, staticcheck, govulncheck, gitleaks, browser.internal.harness (7.556s), browser.check (0.710s). Exit 0.
Fix round 1 (b4f0664, 6a5cd06, 6777d08)
All three new tests green on first run:
--- PASS: TestAxeScanFindsFloorsAndSorts (0.86s) axe_browser_test.go:48: needs review, axe could not decide: [color-contrast]
--- PASS: TestTheDepthFixtureServesItsStylesheets (0.73s)
--- PASS: TestAFailedBootFailsPromptly (0.01s)Mutations, each applied to a backed-up file, run, and restored:
##### axe: violations dropped (runJS: violations: [].map(...))
axe_browser_test.go:63: the planted html-has-lang violation was not reported; got []
axe_browser_test.go:63: the planted image-alt violation was not reported; got []
axe_browser_test.go:63: the planted label violation was not reported; got []
axe_browser_test.go:67: 0 violation(s) reported; an order of fewer than two proves nothing
--- FAIL: TestAxeScanFindsFloorsAndSorts (0.76s)
##### axe: const floor = 0
axe_browser_test.go:88: a selector matching nothing gave <nil>, want ErrNothingScanned
axe_browser_test.go:91: a lone button gave <nil>, want ErrNothingScanned (under the five-rule floor)
--- FAIL: TestAxeScanFindsFloorsAndSorts (0.79s)
##### axe: sort comparator reversed (< to >)
axe_browser_test.go:70: violations are not sorted by id: [label image-alt html-has-lang]
--- FAIL: TestAxeScanFindsFloorsAndSorts (0.81s)
##### fixture: theme route reads fiesta.ThemeCSS("no-such-theme")
rig_browser_test.go:622: GET /theme.css answered 500, want 200
rig_browser_test.go:633: --rst-radius is empty on the page; the theme did not apply
--- FAIL: TestTheDepthFixtureServesItsStylesheets (0.74s)
##### harness: SEED shape of New (Cancel cleanup registered before the boot, no cancel on failure)
boot_test.go:42: the failed boot took 30.037263531s to fail, over the 30s budget: the hang is back
boot_test.go:46: the failure does not say "harness: browser boot:"; the boot did not fail as itself
boot_test.go:50: the subprocess hit go test's alarm instead of failing
--- FAIL: TestAFailedBootFailsPromptly (30.04s)Removing the sort would not have turned the test red (axe already returns these rules in id order); reversing the comparator does, and that is the mutation recorded.
make ci on 6777d08: gofmt, no-rastrillo, root, staticcheck, govulncheck, gitleaks, browser.internal.harness 6.632s, browser.check 1.546s. Exit 0.