Skip to content

Commit 61735c2

Browse files
committed
Updated description and modified ImageCompare test
1 parent db1a3f6 commit 61735c2

5 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/framework/playwright/actions/UIElementActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export default class UIElementActions {
334334
* If differences are detected, a diff image highlighting the changes is generated and stored in ./test-results/image/diffs.
335335
* @param fileName name of the file in baseline folder to compare
336336
* @param maskSelectors selectors to mask on the screenshot
337-
* @param misMatchTolerance tolerance level for image comparison (range 0 to 1), default is 0.00
337+
* @param misMatchTolerance tolerance level for image comparison in percentage, default is 0.00
338338
*/
339339
public async compareAndValidateElementScreenshot(fileName: string, maskSelectors: string[] = [], misMatchTolerance = 0.00) {
340340
const actualImageName = fileName.replace('.png', `_${new Date().getDate()}.png`);

src/framework/utils/ImageComparator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class ImageComparator {
1111
* @param baselineImageName baseline image name
1212
* @param actualImageDir Path to the actual image directory
1313
* @param actualImageName actual image name
14-
* @param misMatchTolerance tolerance level for image comparison (range 0 to 1), default is 0.00
14+
* @param misMatchTolerance tolerance level for image comparison in percentage (0.00 for exact match, 0.25 for 0.25% mismatch allowed etc., default is 0.00)
1515
* @returns
1616
*/
1717
public static async compareImages(baselineImagedDir: string, baselineImageName: string, actualImageDir: string, actualImageName: string, misMatchTolerance = 0.00): Promise<{ isSame: boolean; misMatchPercentage: number }> {
-435 KB
Binary file not shown.
-427 KB
Binary file not shown.

src/tests/ImageCompareTest.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import UIActions from "@uiActions/UIActions";
66
Allure.attachDetails(`Capture the Screenshot and compare with the baseline image`, null);
77
const ui = new UIActions(page);
88
// All the baseline images are captured and stored in src/resources/baselineImages from below URL
9-
// await pw.goto("https://demo.applitools.com/", "Applitools Demo");
9+
await ui.goto("https://demo.applitools.com/", "Applitools Demo");
10+
await ui.element('.auth-wrapper', "Login Section").compareAndValidateElementScreenshot("Login_Section.png");
11+
await ui.element('.auth-wrapper', "Login Section masked").compareAndValidateElementScreenshot("Login_Section_masked.png", [".logo-w", ".buttons-w"]);
1012
// All the tests are run against the below URL
1113
await ui.goto("https://demo.applitools.com/index_v2.html", "Applitools Demo v2");
1214
// We are masking the dynamic elements before capturing the screenshot. So that the comparison will be done excluding those elements

0 commit comments

Comments
 (0)