test(e2e): write screenshots to a temp dir unless --shots is passed
The PNGs contain the live times of the deliveries each run fires, so a plain 'timeout 400 python3 tests/e2e.py' left six tracked files dirty - and the history audit refuses a dirty tree, so the very act of running the e2e suite could make 'audit' report a violation against an unrelated commit. 'make e2e' still refreshes docs/ (the committed README images) via --shots.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-14 08:00:46
Commitf9cc9390
Parents9ecc07ab
Changed files
Makefile+2−2■■■■
tests/e2e.py+12−0■■■■■
2 files+14−2
Diff
Makefile+2−2■■■■
index b1aa2e3..645666a 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
2222 # make fortify -D_FORTIFY_SOURCE=2 -> ./plugin_webhook-fortify
2323 # make ui regenerate src/ui_html.h from src/ui.html
2424 # make test build + run tests/run.sh
25-# make e2e build + run tests/e2e.py (Playwright)
25+# make e2e build + run tests/e2e.py --shots (Playwright, refreshes docs/)
2626 # make clean
2727
2828 CC ?= cc
@@ -89,7 +89,7 @@ test: native
8989 @bash tests/run.sh
9090
9191 e2e: native
92- @python3 tests/e2e.py
92+ @python3 tests/e2e.py --shots
9393
9494 clean:
9595 rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).arm64 $(BIN)-asan $(BIN)-fortify
tests/e2e.py+12−0■■■■■
index 69b4507..068c4db 100755
--- a/tests/e2e.py
+++ b/tests/e2e.py
@@ -19,7 +19,14 @@ themes and asserts:
1919 Skips cleanly (exit 0) when Playwright is missing, so the offline suite stays
2020 dependency-free.
2121
22+Screenshots are written to a temp directory by default and only refreshed in
23+docs/ when --shots is passed (`make e2e`). The PNGs carry the live times of the
24+deliveries the run fires, so regenerating them on every gate run would leave two
25+tracked files dirty and make a history audit that refuses a dirty tree report a
26+violation against an unrelated commit.
27+
2228 python3 tests/e2e.py # run if Playwright is available
29+ python3 tests/e2e.py --shots # also refresh docs/ui-*.png (commit them)
2330 python3 tests/e2e.py --strict # exit 2 when Playwright is missing
2431 """
2532
@@ -176,6 +183,8 @@ def record_count():
176183 def main():
177184 ap = argparse.ArgumentParser()
178185 ap.add_argument("--strict", action="store_true")
186+ ap.add_argument("--shots", action="store_true",
187+ help="refresh docs/ui-*.png (they are committed artefacts)")
179188 args = ap.parse_args()
180189
181190 try:
@@ -188,6 +197,9 @@ def main():
188197 bad("plugin_webhook binary is missing (run make first)")
189198 return 1
190199
200+ global DOCS
201+ if not args.shots:
202+ DOCS = tempfile.mkdtemp(prefix="webhook-shots-")
191203 os.makedirs(DOCS, exist_ok=True)
192204 start_recorder()
193205 seed()
194206
Makefile+2−2■■■■
index b1aa2e3..645666a 100644index b1aa2e3..645666a 100644
--- a/Makefile--- a/Makefile
+++ b/Makefile+++ b/Makefile
@@ -22,7 +22,7 @@@@ -22,7 +22,7 @@
22 # make fortify -D_FORTIFY_SOURCE=2 -> ./plugin_webhook-fortify22 # make fortify -D_FORTIFY_SOURCE=2 -> ./plugin_webhook-fortify
23 # make ui regenerate src/ui_html.h from src/ui.html23 # make ui regenerate src/ui_html.h from src/ui.html
24 # make test build + run tests/run.sh24 # make test build + run tests/run.sh
25-# make e2e build + run tests/e2e.py (Playwright)25+# make e2e build + run tests/e2e.py --shots (Playwright, refreshes docs/)
26 # make clean26 # make clean
27 27
28 CC ?= cc28 CC ?= cc
@@ -89,7 +89,7 @@ test: native@@ -89,7 +89,7 @@ test: native
89 @bash tests/run.sh89 @bash tests/run.sh
90 90
91 e2e: native91 e2e: native
92- @python3 tests/e2e.py92+ @python3 tests/e2e.py --shots
93 93
94 clean:94 clean:
95 rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).arm64 $(BIN)-asan $(BIN)-fortify95 rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).arm64 $(BIN)-asan $(BIN)-fortify
tests/e2e.py+12−0■■■■■
index 69b4507..068c4db 100755index 69b4507..068c4db 100755
--- a/tests/e2e.py--- a/tests/e2e.py
+++ b/tests/e2e.py+++ b/tests/e2e.py
@@ -19,7 +19,14 @@ themes and asserts:@@ -19,7 +19,14 @@ themes and asserts:
19 Skips cleanly (exit 0) when Playwright is missing, so the offline suite stays19 Skips cleanly (exit 0) when Playwright is missing, so the offline suite stays
20 dependency-free.20 dependency-free.
21 21
22+Screenshots are written to a temp directory by default and only refreshed in
23+docs/ when --shots is passed (`make e2e`). The PNGs carry the live times of the
24+deliveries the run fires, so regenerating them on every gate run would leave two
25+tracked files dirty and make a history audit that refuses a dirty tree report a
26+violation against an unrelated commit.
27+
22 python3 tests/e2e.py # run if Playwright is available28 python3 tests/e2e.py # run if Playwright is available
29+ python3 tests/e2e.py --shots # also refresh docs/ui-*.png (commit them)
23 python3 tests/e2e.py --strict # exit 2 when Playwright is missing30 python3 tests/e2e.py --strict # exit 2 when Playwright is missing
24 """31 """
25 32
@@ -176,6 +183,8 @@ def record_count():@@ -176,6 +183,8 @@ def record_count():
176 def main():183 def main():
177 ap = argparse.ArgumentParser()184 ap = argparse.ArgumentParser()
178 ap.add_argument("--strict", action="store_true")185 ap.add_argument("--strict", action="store_true")
186+ ap.add_argument("--shots", action="store_true",
187+ help="refresh docs/ui-*.png (they are committed artefacts)")
179 args = ap.parse_args()188 args = ap.parse_args()
180 189
181 try:190 try:
@@ -188,6 +197,9 @@ def main():@@ -188,6 +197,9 @@ def main():
188 bad("plugin_webhook binary is missing (run make first)")197 bad("plugin_webhook binary is missing (run make first)")
189 return 1198 return 1
190 199
200+ global DOCS
201+ if not args.shots:
202+ DOCS = tempfile.mkdtemp(prefix="webhook-shots-")
191 os.makedirs(DOCS, exist_ok=True)203 os.makedirs(DOCS, exist_ok=True)
192 start_recorder()204 start_recorder()
193 seed()205 seed()
194206