You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-32Lines changed: 29 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -28,55 +28,48 @@ Example:
28
28
}
29
29
```
30
30
To use the Helper, users must provide the three parameters:
31
+
31
32
`screenshotFolder` : This will always have the same value as `output` in Codecept configuration, this is the folder where webdriverIO
32
33
saves a screenshot when using `I.saveScreenshot` method
33
34
34
35
`baseFolder`: This is the folder for base images, which will be used with screenshot for comparison
35
36
36
37
`diffFolder`: This will the folder where resemble would try to store the difference image, which can be viewed later,
37
-
Please remember to create empty folder if you don't have one already
38
38
39
39
Usage, these are major functions that help in visual testing
40
40
41
-
First one is the `verifyMisMatchPercentage` which basically takes several parameters including tolerance and PrepareBase
41
+
First one is the `seeVisualDiff` which basically takes two parameters
42
+
1)`baseImage` Name of the base image, this will be the image used for comparison with the screenshot image,
43
+
it is mandatory to have the same image file names for base and screenshot image
44
+
2)`options` options can be passed which include `prepaseBaseImage` and `tolerance`
45
+
42
46
```js
43
47
/**
44
-
* Mis Match Percentage Verification
48
+
* Check Visual Difference for Base and Screenshot Image
45
49
* @parambaseImage Name of the Base Image (Base Image path is taken from Configuration)
46
-
* @paramscreenShotImage Name of the screenshot Image (Screenshot Image Path is taken from Configuration)
47
-
* @paramdiffImageName Name of the Diff Image which will be saved after comparison (Diff Image path is taken from Configuration)
48
-
* @paramtolerance Tolerance Percentage, default value 10
49
-
* @paramprepareBase True | False, depending on the requirement if the base images are missing
50
-
* @paramselector CSS|XPath|id, If provided locator will be used to fetch Bounding Box of the element and only that element is compared on two images
51
-
* @paramoptions Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
50
+
* @paramoptions Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
* @paramselector Selector which has to be compared, CSS|XPath|ID
63
+
* @parambaseImage Base Image for comparison
64
+
* @paramoptions Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
Users can make use of the boundingBox feature by providing a selector to `verifyMisMatchPercentage` function, it will internally
79
-
check if a locator is provided, fetch it's bounding-box and compare only that element on both the images.
69
+
> Note:
70
+
`seeVisualDiffForElement` only works when the page for baseImage is open in the browser, so that webdriver can fetch coordinates of the provided selector
71
+
72
+
80
73
81
74
Finally to use the helper in your test, you can write something like this:
82
75
@@ -85,17 +78,21 @@ Feature('to verify monitoried Remote Db instances');
85
78
86
79
Scenario('Open the System Overview Dashboard', async (I, adminPage, loginPage) => {
* Check Visual Difference for Base and Screenshot Image
78
84
* @param baseImage Name of the Base Image (Base Image path is taken from Configuration)
79
-
* @param screenShotImage Name of the screenshot Image (Screenshot Image Path is taken from Configuration)
80
-
* @param diffImageName Name of the Diff Image which will be saved after comparison (Diff Image path is taken from Configuration)
81
-
* @param tolerance Tolerance Percentage, default value 10
82
-
* @param prepareBase True | False, depending on the requirement if the base images are missing
83
-
* @param selector If set, passed selector will be used to fetch Bouding Box and compared on two images
84
-
* @param options Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
85
+
* @param options Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
* @param selector Selector which has to be compared expects these -> CSS|XPath|ID
109
+
* @param baseImage Base Image for comparison
110
+
* @param options Options ex {prepareBaseImage: true, tolerance: 5} along with Resemble JS Options, read more here: https://github.com/rsmbl/Resemble.js
0 commit comments