-
Notifications
You must be signed in to change notification settings - Fork 54
feat(allure): screen diff plugin support #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds Allure screen-diff plugin support by changing how screenshots are attached when a visual mismatch exceeds tolerance.
- Replace three image attachments with a single allure.addScreenDiff call.
- Switch from Buffer attachments to base64-encoded strings.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
allure.addScreenDiff( | ||
"Screen Diff", | ||
fs.readFileSync(this._getBaseImagePath(baseImage, options), { encoding: "base64" }), | ||
fs.readFileSync(this._getActualImagePath(baseImage), { encoding: "base64" }), | ||
fs.readFileSync(this._getDiffImagePath(baseImage), { encoding: "base64" }), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeceptJS's Allure plugin does not expose addScreenDiff in supported versions; calling this will throw at runtime. Use standard attachments with the names expected by the Allure screen-diff plugin (expected, actual, diff), or feature-detect and fall back to addAttachment.
allure.addScreenDiff( | |
"Screen Diff", | |
fs.readFileSync(this._getBaseImagePath(baseImage, options), { encoding: "base64" }), | |
fs.readFileSync(this._getActualImagePath(baseImage), { encoding: "base64" }), | |
fs.readFileSync(this._getDiffImagePath(baseImage), { encoding: "base64" }), | |
); | |
allure.addAttachment( | |
"expected", | |
fs.readFileSync(this._getBaseImagePath(baseImage, options)), | |
"image/png" | |
); | |
allure.addAttachment( | |
"actual", | |
fs.readFileSync(this._getActualImagePath(baseImage)), | |
"image/png" | |
); | |
allure.addAttachment( | |
"diff", | |
fs.readFileSync(this._getDiffImagePath(baseImage)), | |
"image/png" | |
); |
Copilot uses AI. Check for mistakes.
fs.readFileSync(this._getBaseImagePath(baseImage, options), { encoding: "base64" }), | ||
fs.readFileSync(this._getActualImagePath(baseImage), { encoding: "base64" }), | ||
fs.readFileSync(this._getDiffImagePath(baseImage), { encoding: "base64" }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading images as base64 strings increases memory/cpu and bloats attachments by ~33%. Prefer passing Buffers (omit the encoding option) to avoid unnecessary encoding and to keep report size smaller.
fs.readFileSync(this._getBaseImagePath(baseImage, options), { encoding: "base64" }), | |
fs.readFileSync(this._getActualImagePath(baseImage), { encoding: "base64" }), | |
fs.readFileSync(this._getDiffImagePath(baseImage), { encoding: "base64" }), | |
fs.readFileSync(this._getBaseImagePath(baseImage, options)), | |
fs.readFileSync(this._getActualImagePath(baseImage)), | |
fs.readFileSync(this._getDiffImagePath(baseImage)), |
Copilot uses AI. Check for mistakes.
This PR aims to add support to allure screen diff plugin.
resolves #70
resolves #58