-
Couldn't load subscription status.
- 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?
Changes from all commits
3cc7351
13e8850
c98ba8a
90647b1
045c910
36992be
5101f7a
5fc2218
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -233,9 +233,12 @@ class ResembleHelper extends Helper { | |||||||||||||||||||||||||||||||||||||||||||
| const allure: any = require("codeceptjs").container.plugins("allure"); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (allure !== undefined && misMatch >= options.tolerance) { | ||||||||||||||||||||||||||||||||||||||||||||
| allure.addAttachment("Base Image", fs.readFileSync(this._getBaseImagePath(baseImage, options)), "image/png"); | ||||||||||||||||||||||||||||||||||||||||||||
| allure.addAttachment("Screenshot Image", fs.readFileSync(this._getActualImagePath(baseImage)), "image/png"); | ||||||||||||||||||||||||||||||||||||||||||||
| allure.addAttachment("Diff Image", fs.readFileSync(this._getDiffImagePath(baseImage)), "image/png"); | ||||||||||||||||||||||||||||||||||||||||||||
| 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" }), | ||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+236
to
+241
|
||||||||||||||||||||||||||||||||||||||||||||
| 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" | |
| ); |
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.