@@ -23,6 +23,16 @@ interface Config {
23
23
prepareBaseImage : string ;
24
24
}
25
25
26
+ interface Options {
27
+ tolerance ?: any ;
28
+ ignoredBox ?: any ;
29
+ boundingBox ?: any ;
30
+ needsSameDimension ?: boolean ;
31
+ outputSettings ?: any ;
32
+ prepareBaseImage ?: boolean ;
33
+ compareWithImage ?: any
34
+ }
35
+
26
36
interface Endpoint {
27
37
/**
28
38
* The host portion of the endpoint including the port, e.g., example.com:80.
@@ -97,7 +107,7 @@ class ResembleHelper extends Helper {
97
107
* @param options
98
108
* @returns {Promise<resolve | reject> }
99
109
*/
100
- async _compareImages ( image : any , options : any ) {
110
+ async _compareImages ( image : any , options : Options ) {
101
111
const baseImage = this . _getBaseImagePath ( image , options ) ;
102
112
const actualImage = this . _getActualImagePath ( image ) ;
103
113
const diffImage = this . _getDiffImagePath ( image ) ;
@@ -170,7 +180,7 @@ class ResembleHelper extends Helper {
170
180
* @param options
171
181
* @returns {Promise<*> }
172
182
*/
173
- async _fetchMisMatchPercentage ( image : any , options : any ) {
183
+ async _fetchMisMatchPercentage ( image : any , options : Options ) {
174
184
const result = this . _compareImages ( image , options ) ;
175
185
const data : any = await Promise . resolve ( result ) ;
176
186
return data . misMatchPercentage ;
@@ -219,7 +229,7 @@ class ResembleHelper extends Helper {
219
229
* @returns {Promise<void> }
220
230
*/
221
231
222
- async _addAttachment ( baseImage : any , misMatch : any , options : any ) {
232
+ async _addAttachment ( baseImage : any , misMatch : any , options : Options ) {
223
233
const allure : any = require ( 'codeceptjs' ) . container . plugins ( "allure" ) ;
224
234
225
235
if ( allure !== undefined && misMatch >= options . tolerance ) {
@@ -381,7 +391,7 @@ class ResembleHelper extends Helper {
381
391
* @param {any } [options] Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
382
392
* @returns {Promise<void> }
383
393
*/
384
- async seeVisualDiff ( baseImage : any , options : any ) {
394
+ async seeVisualDiff ( baseImage : any , options : Options ) {
385
395
await this . _assertVisualDiff ( undefined , baseImage , options ) ;
386
396
}
387
397
@@ -393,7 +403,7 @@ class ResembleHelper extends Helper {
393
403
* @param {any } [options] Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
394
404
* @returns {Promise<void> }
395
405
*/
396
- async seeVisualDiffForElement ( selector : any , baseImage : any , options : any ) {
406
+ async seeVisualDiffForElement ( selector : any , baseImage : any , options : Options ) {
397
407
await this . _assertVisualDiff ( selector , baseImage , options ) ;
398
408
}
399
409
@@ -581,7 +591,7 @@ class ResembleHelper extends Helper {
581
591
* @param options Helper options
582
592
* @returns {string }
583
593
*/
584
- _getBaseImageName ( image : any , options : { compareWithImage : any } ) {
594
+ _getBaseImageName ( image : any , options : { compareWithImage ? : any } ) {
585
595
return options . compareWithImage ? options . compareWithImage : image ;
586
596
}
587
597
@@ -591,7 +601,7 @@ class ResembleHelper extends Helper {
591
601
* @param options Helper options
592
602
* @returns {string }
593
603
*/
594
- _getBaseImagePath ( image : string , options : any ) {
604
+ _getBaseImagePath ( image : string , options : Options ) {
595
605
return this . baseFolder + this . _getBaseImageName ( image , options ) ;
596
606
}
597
607
@@ -619,7 +629,7 @@ class ResembleHelper extends Helper {
619
629
* @param options Helper options
620
630
* @returns {boolean }
621
631
*/
622
- _getPrepareBaseImage ( options : any ) {
632
+ _getPrepareBaseImage ( options : Options ) {
623
633
if ( "undefined" !== typeof options . prepareBaseImage ) {
624
634
// Cast to bool with `!!` for backwards compatibility
625
635
return ! ! options . prepareBaseImage ;
0 commit comments