@@ -30,10 +30,9 @@ public abstract class Screenshot<T extends Screenshot<T>> {
3030 private String title ;
3131
3232 /**
33- * Make screenshot of the viewport only
34- * <p>
33+ * Make screenshot of the viewport only.
3534 * To be used when screenshotting the page
36- * and don't need to scroll while making screenshots (FF, IE)
35+ * and don't need to scroll while making screenshots (FF, IE).
3736 *
3837 * @param driver WebDriver instance
3938 * @return PageScreenshot instance
@@ -48,7 +47,7 @@ public static PageScreenshot page(WebDriver driver) {
4847 /**
4948 * To be used when screenshotting the page
5049 * and need to scroll while making screenshots, either vertically or
51- * horizontally or both directions (Chrome)
50+ * horizontally or both directions (Chrome).
5251 *
5352 * @param driver WebDriver instance
5453 * @param scroll ScrollStrategy How you need to scroll
@@ -71,7 +70,7 @@ public static PageScreenshot page(WebDriver driver, ScrollStrategy scroll) {
7170 }
7271
7372 /**
74- * To be used when need to screenshot particular element
73+ * To be used when need to screenshot particular element.
7574 *
7675 * @param driver WebDriver instance
7776 * @param element WebElement instance to be screenshotted
@@ -90,7 +89,7 @@ public static ElementScreenshot element(WebDriver driver, WebElement element) {
9089
9190 /**
9291 * @param name file name of the resulted image
93- * by default will be timestamp in format: 'yyyy_MM_dd_HH_mm_ss_SSS'
92+ * by default will be timestamp in format: 'yyyy_MM_dd_HH_mm_ss_SSS'.
9493 * @return instance of type Screenshot
9594 */
9695 public T withName (String name ) {
@@ -102,7 +101,7 @@ public T withName(String name) {
102101
103102 /**
104103 * @param title title of the resulted image.
105- * Won't be assigned by default
104+ * Won't be assigned by default.
106105 * @return instance of type Screenshot
107106 */
108107 public T withTitle (String title ) {
@@ -111,7 +110,7 @@ public T withTitle(String title) {
111110 }
112111
113112 /**
114- * Apply gray-and-white filter to the image
113+ * Apply gray-and-white filter to the image.
115114 *
116115 * @return instance of type Screenshot
117116 */
@@ -121,7 +120,7 @@ public T monochrome() {
121120 }
122121
123122 /**
124- * @return
123+ * @return BufferedImage - current image being processed.
125124 */
126125 public BufferedImage getImage () {
127126 return image ;
@@ -133,7 +132,7 @@ protected void setImage(BufferedImage image) {
133132
134133 /**
135134 * Final method to be called in the chain.
136- * Actually saves processed image.
135+ * Actually saves processed image to the default location: ./screenshots
137136 */
138137 public void save () {
139138 File screenshotFile = new File (location .toString (), fileName );
@@ -145,7 +144,7 @@ public void save() {
145144
146145 /**
147146 * Final method to be called in the chain.
148- * Actually saves processed image.
147+ * Actually saves processed image to the specified path .
149148 */
150149 public void save (String location ) {
151150 File screenshotFile = new File (location , fileName );
@@ -157,7 +156,7 @@ public void save(String location) {
157156
158157 /**
159158 * Final method to be called in the chain.
160- * Actually saves processed image.
159+ * Actually saves processed image to the specified path .
161160 */
162161 public void save (Path location ) {
163162 File screenshotFile = new File (location .toString (), fileName );
@@ -182,8 +181,9 @@ public boolean equals(Object o, double deviation) {
182181 }
183182
184183 /**
185- * @param o
186- * @return
184+ * @param o Object to compare with
185+ * @return true if the the provided object is of type Screenshot
186+ * and images are strictly equal.
187187 */
188188 @ Override
189189 public boolean equals (Object o ) {
@@ -196,22 +196,23 @@ public boolean equals(Object o) {
196196 }
197197
198198 /**
199- * @param image
200- * @return
199+ * @param image BufferedImage to compare with.
200+ * @return true if the the provided image and current image are strictly equal.
201201 */
202202 public boolean equals (BufferedImage image ) {
203203 if (this .getImage () == image ) return true ;
204204 return getImage () != null ? ImageProcessor .imagesAreEquals (getImage (), image , 0 ) : image == null ;
205205 }
206206
207207 /**
208- * @param image
209- * @param deviation
210- * @return
208+ * @param image BufferedImage to compare with.
209+ * @param deviation allowed deviation while comparing.
210+ * @return true if the the percentage of differences
211+ * between current image and provided one is less than or equal to <b>deviation</b>
211212 */
212213 public boolean equals (BufferedImage image , double deviation ) {
213214 if (this .getImage () == image ) return true ;
214- return getImage () != null ? ImageProcessor .imagesAreEquals (getImage (), image , 0 ) : image == null ;
215+ return getImage () != null ? ImageProcessor .imagesAreEquals (getImage (), image , deviation ) : image == null ;
215216 }
216217
217218 /**
0 commit comments