Show an example of screen-diff-plugin usage for codeceptjs #1417
-
Hello, can u give an exmple of how https://github.com/allure-framework/allure2/blob/master/plugins/screen-diff-plugin/README.md |
Beta Was this translation helpful? Give feedback.
Answered by
baev
May 8, 2024
Replies: 1 comment
-
// Read the three files and encode to base64
const expected = fs.readFileSync("expected.png", "base64");
const actual = fs.readFileSync("actual.png", "base64");
const diff = fs.readFileSync("diff.png", "base64");
// Wrap into a JSON, encode as string
const content = JSON.stringify({
expected: `data:image/png;base64,${expected}`,
actual: `data:image/png;base64,${actual}`,
diff: `data:image/png;base64,${diff}`,
});
// Attach to the test report
allure.attachment("Screenshot diff", content, "application/vnd.allure.image.diff"); You can use any library to generate the diff image. It should work as long as you use any images in a format supported by modern browsers. More details can be found in the documentation. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
baev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use any library to generate the diff image. It should work as long as you use any images in a format supported by modern browsers.