Skip to content

Commit 7a04f9c

Browse files
authored
Fixed optional param in JSDoc and generated TS definition (#99)
1 parent 3d9974d commit 7a04f9c

File tree

2 files changed

+154
-2
lines changed

2 files changed

+154
-2
lines changed

index.d.ts

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
export = ResembleHelper;
2+
/**
3+
* Resemble.js helper class for CodeceptJS, this allows screen comparison
4+
* @author Puneet Kala
5+
*/
6+
declare class ResembleHelper {
7+
constructor(config: any);
8+
baseFolder: any;
9+
diffFolder: any;
10+
screenshotFolder: string;
11+
prepareBaseImage: any;
12+
resolvePath(folderPath: any): any;
13+
/**
14+
* Compare Images
15+
*
16+
* @param image
17+
* @param options
18+
* @returns {Promise<resolve | reject>}
19+
*/
20+
_compareImages(image: any, options: any): Promise<any | any>;
21+
/**
22+
*
23+
* @param image
24+
* @param options
25+
* @returns {Promise<*>}
26+
*/
27+
_fetchMisMatchPercentage(image: any, options: any): Promise<any>;
28+
/**
29+
* Take screenshot of individual element.
30+
* @param selector selector of the element to be screenshotted
31+
* @param name name of the image
32+
* @returns {Promise<void>}
33+
*/
34+
screenshotElement(selector: any, name: any): Promise<void>;
35+
/**
36+
* This method attaches image attachments of the base, screenshot and diff to the allure reporter when the mismatch exceeds tolerance.
37+
* @param baseImage
38+
* @param misMatch
39+
* @param options
40+
* @returns {Promise<void>}
41+
*/
42+
_addAttachment(baseImage: any, misMatch: any, options: any): Promise<void>;
43+
/**
44+
* This method attaches context, and images to Mochawesome reporter when the mismatch exceeds tolerance.
45+
* @param baseImage
46+
* @param misMatch
47+
* @param options
48+
* @returns {Promise<void>}
49+
*/
50+
_addMochaContext(baseImage: any, misMatch: any, options: any): Promise<void>;
51+
/**
52+
* This method uploads the diff and screenshot images into the bucket with diff image under bucketName/diff/diffImage and the screenshot image as
53+
* bucketName/output/ssImage
54+
* @param accessKeyId
55+
* @param secretAccessKey
56+
* @param region
57+
* @param bucketName
58+
* @param baseImage
59+
* @param options
60+
* @returns {Promise<void>}
61+
*/
62+
_upload(accessKeyId: any, secretAccessKey: any, region: any, bucketName: any, baseImage: any, options: any): Promise<void>;
63+
/**
64+
* This method downloads base images from specified bucket into the base folder as mentioned in config file.
65+
* @param accessKeyId
66+
* @param secretAccessKey
67+
* @param region
68+
* @param bucketName
69+
* @param baseImage
70+
* @param options
71+
* @returns {Promise<void>}
72+
*/
73+
_download(accessKeyId: any, secretAccessKey: any, region: any, bucketName: any, baseImage: any, options: any): Promise<void>;
74+
/**
75+
* Check Visual Difference for Base and Screenshot Image
76+
* @param baseImage Name of the Base Image (Base Image path is taken from Configuration)
77+
* @param {any} [options] Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
78+
* @returns {Promise<void>}
79+
*/
80+
seeVisualDiff(baseImage: any, options?: any): Promise<void>;
81+
/**
82+
* See Visual Diff for an Element on a Page
83+
*
84+
* @param selector Selector which has to be compared expects these -> CSS|XPath|ID
85+
* @param baseImage Base Image for comparison
86+
* @param {any} [options] Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
87+
* @returns {Promise<void>}
88+
*/
89+
seeVisualDiffForElement(selector: any, baseImage: any, options?: any): Promise<void>;
90+
_assertVisualDiff(selector: any, baseImage: any, options: any): Promise<void>;
91+
/**
92+
* Function to prepare Base Images from Screenshots
93+
*
94+
* @param screenShotImage Name of the screenshot Image (Screenshot Image Path is taken from Configuration)
95+
* @param options
96+
*/
97+
_prepareBaseImage(screenShotImage: any, options: any): Promise<void>;
98+
/**
99+
* Function to create Directory
100+
* @param directory
101+
* @returns {Promise<void>}
102+
* @private
103+
*/
104+
private _createDir;
105+
/**
106+
* Function to fetch Bounding box for an element, fetched using selector
107+
*
108+
* @param selector CSS|XPath|ID selector
109+
* @returns {Promise<{boundingBox: {left: *, top: *, right: *, bottom: *}}>}
110+
*/
111+
_getBoundingBox(selector: any): Promise<{
112+
boundingBox: {
113+
left: any;
114+
top: any;
115+
right: any;
116+
bottom: any;
117+
};
118+
}>;
119+
_getHelper(): any;
120+
/**
121+
* Returns the final name of the expected base image, without a path
122+
* @param image Name of the base-image, without path
123+
* @param options Helper options
124+
* @returns {string}
125+
*/
126+
_getBaseImageName(image: any, options: any): string;
127+
/**
128+
* Returns the path to the expected base image
129+
* @param image Name of the base-image, without path
130+
* @param options Helper options
131+
* @returns {string}
132+
*/
133+
_getBaseImagePath(image: any, options: any): string;
134+
/**
135+
* Returns the path to the actual screenshot image
136+
* @param image Name of the image, without path
137+
* @returns {string}
138+
*/
139+
_getActualImagePath(image: any): string;
140+
/**
141+
* Returns the path to the image that displays differences between base and actual image.
142+
* @param image Name of the image, without path
143+
* @returns {string}
144+
*/
145+
_getDiffImagePath(image: any): string;
146+
/**
147+
* Returns the final `prepareBaseImage` flag after evaluating options and config values
148+
* @param options Helper options
149+
* @returns {boolean}
150+
*/
151+
_getPrepareBaseImage(options: any): boolean;
152+
}

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class ResembleHelper extends Helper {
286286
/**
287287
* Check Visual Difference for Base and Screenshot Image
288288
* @param baseImage Name of the Base Image (Base Image path is taken from Configuration)
289-
* @param options Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
289+
* @param {any} [options] Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
290290
* @returns {Promise<void>}
291291
*/
292292
async seeVisualDiff(baseImage, options) {
@@ -298,7 +298,7 @@ class ResembleHelper extends Helper {
298298
*
299299
* @param selector Selector which has to be compared expects these -> CSS|XPath|ID
300300
* @param baseImage Base Image for comparison
301-
* @param options Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
301+
* @param {any} [options] Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
302302
* @returns {Promise<void>}
303303
*/
304304
async seeVisualDiffForElement(selector, baseImage, options) {

0 commit comments

Comments
 (0)