Skip to content

Commit 38d8bdd

Browse files
committed
Add reproducible runner visual evidence
1 parent 742ae7d commit 38d8bdd

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

docs/pr-evidence/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# PR #6 visual evidence
2+
3+
These captures show `/examples/values` at a 1200×900 desktop viewport, clipped to the `.playground` runner. The review point is the Run control: the PR changes its action color from `#FF4801` to the WCAG-AA `#C83800` while preserving the editor/output layout.
4+
5+
| Capture | Commit | SHA-256 |
6+
| --- | --- | --- |
7+
| [Before](pr-6-before-runner.png) | `b61edf1` (`origin/main`) | `be773336d14f1b819ade1a22f6308573b5e26148ec37b322f73ad1d2de232b34` |
8+
| [After](pr-6-after-runner.png) | `742ae7d` | `281db8bb44daa94af2d99b689b1177fb21427b0051679a3e1de3a56bc4831b04` |
9+
10+
Regenerate each page with its commit checked out, serve the rendered `/examples/values` HTML plus `public/` on a local HTTP server, then run:
11+
12+
```bash
13+
TARGET_URL=http://127.0.0.1:<port>/examples/values/ \
14+
CAPTURE_SELECTOR=.playground WIDTH=1200 HEIGHT=900 \
15+
OUTPUT=<output>.png node scripts/capture_browser_screenshot.mjs
16+
```
17+
18+
The captures use the repository's headless-Chrome script; it waits for the selected element and writes the selector's rendered bounding box.
60.3 KB
Loading
60.1 KB
Loading

scripts/capture_browser_screenshot.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const output = process.env.OUTPUT || (args.has('--inject-shiki') ? '/tmp/pythonb
1313
const url = `${target}${target.includes('?') ? '&' : '?'}screenshot_test=${Date.now()}`;
1414
const width = Number(process.env.WIDTH || 2040);
1515
const height = Number(process.env.HEIGHT || 626);
16+
const captureSelector = process.env.CAPTURE_SELECTOR || '.literate-program';
1617
const port = 9444 + Math.floor(Math.random() * 1000);
1718
const profile = await mkdtemp(path.join(tmpdir(), 'pythonbyexample-shot-chrome-'));
1819

@@ -85,7 +86,7 @@ try {
8586

8687
for (let i = 0; i < 100; i++) {
8788
const ready = await client.send('Runtime.evaluate', {
88-
expression: "document.readyState === 'complete' && !!document.querySelector('.literate-program')",
89+
expression: `document.readyState === 'complete' && !!document.querySelector(${JSON.stringify(captureSelector)})`,
8990
returnByValue: true,
9091
});
9192
if (ready.result.value) break;
@@ -119,7 +120,8 @@ try {
119120
const data = await client.send('Runtime.evaluate', {
120121
returnByValue: true,
121122
expression: `(() => {
122-
const program = document.querySelector('.literate-program');
123+
const program = document.querySelector(${JSON.stringify(captureSelector)});
124+
if (!program) throw new Error('capture selector did not match an element');
123125
const rect = program.getBoundingClientRect();
124126
const steps = [...document.querySelectorAll('.lesson-step')].map((step, index) => {
125127
const pre = step.querySelector('pre');

0 commit comments

Comments
 (0)