@@ -147,6 +147,28 @@ class ResembleHelper extends Helper {
147
147
}
148
148
}
149
149
150
+ /**
151
+ * This method attaches context, and images to Mochawesome reporter when the mismatch exceeds tolerance.
152
+ * @param baseImage
153
+ * @param misMatch
154
+ * @param tolerance
155
+ * @returns {Promise<void> }
156
+ */
157
+
158
+ async _addMochaContext ( baseImage , misMatch , tolerance ) {
159
+ const mocha = this . helpers [ 'Mochawesome' ] ;
160
+ const diffImage = "Diff_" + baseImage . split ( "." ) [ 0 ] + ".png" ;
161
+
162
+ if ( mocha !== undefined && misMatch >= tolerance ) {
163
+ await mocha . addMochawesomeContext ( "Base Image" ) ;
164
+ await mocha . addMochawesomeContext ( this . baseFolder + baseImage ) ;
165
+ await mocha . addMochawesomeContext ( "ScreenShot Image" ) ;
166
+ await mocha . addMochawesomeContext ( this . screenshotFolder + baseImage ) ;
167
+ await mocha . addMochawesomeContext ( "Diff Image" ) ;
168
+ await mocha . addMochawesomeContext ( this . diffFolder + diffImage ) ;
169
+ }
170
+ }
171
+
150
172
/**
151
173
* This method uploads the diff and screenshot images into the bucket with diff image under bucketName/diff/diffImage and the screenshot image as
152
174
* bucketName/output/ssImage
@@ -292,6 +314,8 @@ class ResembleHelper extends Helper {
292
314
293
315
this . _addAttachment ( baseImage , misMatch , options . tolerance ) ;
294
316
317
+ this . _addMochaContext ( baseImage , misMatch , options . tolerance ) ;
318
+
295
319
if ( awsC !== undefined ) {
296
320
await this . _upload ( awsC . accessKeyId , awsC . secretAccessKey , awsC . region , awsC . bucketName , baseImage , options . prepareBaseImage )
297
321
}
0 commit comments