Skip to content

Commit 7bfcda3

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 7bfcda3

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

script/compare-screenshots.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,24 @@ 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.args
247+
.map((e, i) => i != 1 ? e : e.replace(/.*[/\\]/, ''))
248+
.join(' ')
249+
}' -->`);
250+
console.log(`<table>`);
251+
console.log(`<tr><th>Before</th><th>After</th></tr>`);
252+
console.log(`<tr>`);
253+
console.log(`<td>`);
254+
console.log(path.resolve('.before.png'));
255+
console.log(`</td>`);
256+
console.log(`<td>`);
257+
console.log(path.resolve('.after.png'));
258+
console.log(`</td>`);
259+
console.log(`</tr>`);
260+
console.log(`</table>`);
243261
} finally {
244262
await browser.close();
245263
}

0 commit comments

Comments
 (0)