Skip to content

Commit 9745e6a

Browse files
committed
compare-screenshots: output PR comment template
After taking screenshots, output an HTML table template that can be copied into a PR comment. The absolute paths serve as placeholders that can be selected and replaced by uploading the images. The paths are placed on their own lines so that users can easily triple-click to select the entire path, copy it, and then paste the uploaded image URL in its place. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent ccd9195 commit 9745e6a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

script/compare-screenshots.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,25 @@ async function main() {
240240
console.error(`\nScreenshots saved:`);
241241
console.error(' - .before.png');
242242
console.error(' - .after.png');
243+
244+
console.error(`\nPR comment template (copy paths, then replace by uploading images):\n`);
245+
console.log(`<!-- Generated by 'node ${
246+
process.argv
247+
.slice(1)
248+
.map((e, i) => i != 1 ? e : e.replace(/.*[/\\]/, ''))
249+
.join(' ')
250+
}' -->`);
251+
console.log(`<table>`);
252+
console.log(`<tr><th>Before</th><th>After</th></tr>`);
253+
console.log(`<tr>`);
254+
console.log(`<td>`);
255+
console.log(path.resolve('.before.png'));
256+
console.log(`</td>`);
257+
console.log(`<td>`);
258+
console.log(path.resolve('.after.png'));
259+
console.log(`</td>`);
260+
console.log(`</tr>`);
261+
console.log(`</table>`);
243262
} finally {
244263
await browser.close();
245264
}

0 commit comments

Comments
 (0)