comparadise-utils 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,9 +7,9 @@ declare function getTestFolderPathFromScripts(rawName?: string): {
|
|
|
7
7
|
name: string;
|
|
8
8
|
screenshotsFolder: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
declare function verifyImages(): void;
|
|
11
|
+
type MatchScreenshotArgs = {
|
|
11
12
|
rawName?: string;
|
|
12
13
|
options?: Partial<Cypress.ScreenshotOptions>;
|
|
13
|
-
}
|
|
14
|
-
declare function verifyImages(): void;
|
|
14
|
+
};
|
|
15
15
|
declare function matchScreenshot(subject: Cypress.JQueryWithSelector | Window | Document | void, args?: MatchScreenshotArgs): void;
|
package/dist/match-screenshot.js
CHANGED
|
@@ -58,16 +58,16 @@ function matchScreenshot(subject, args) {
|
|
|
58
58
|
cy.task('createNewScreenshot', screenshotsFolder).then(() => {
|
|
59
59
|
cy.task('log', `✅ A new base image was created for ${name}. Create this as a new base image via Comparadise!`);
|
|
60
60
|
});
|
|
61
|
-
return;
|
|
61
|
+
return null;
|
|
62
62
|
}
|
|
63
63
|
cy.task('compareScreenshots', screenshotsFolder).then(diffPixels => {
|
|
64
64
|
if (diffPixels === 0) {
|
|
65
65
|
cy.log(`✅ Actual image of ${name} was the same as base`);
|
|
66
|
-
return null;
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
else {
|
|
68
|
+
cy.task('log', `❌ Actual image of ${name} differed by ${diffPixels} pixels.`);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
71
|
});
|
|
72
72
|
return null;
|
|
73
73
|
});
|
package/dist/screenshots.js
CHANGED
|
@@ -65,7 +65,7 @@ function compareScreenshots(screenshotFolder) {
|
|
|
65
65
|
// Create diff.png next to base and new for review
|
|
66
66
|
fs.writeFile((0, files_1.createImageFileName)(screenshotFolder, 'diff'), pngjs_1.PNG.sync.write(diff), err => {
|
|
67
67
|
if (err) {
|
|
68
|
-
console.error('❌Diff exists but unable to create diff.png', err);
|
|
68
|
+
console.error('❌ Diff exists but unable to create diff.png', err);
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
}
|
|
@@ -73,7 +73,7 @@ function compareScreenshots(screenshotFolder) {
|
|
|
73
73
|
// Delete created new.png. Not needed if there's no diff
|
|
74
74
|
fs.unlink(actualPath, err => {
|
|
75
75
|
if (err) {
|
|
76
|
-
console.error('❌No diff but unable to
|
|
76
|
+
console.error('❌ No diff but unable to delete actualPath}', err);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
}
|
|
@@ -87,7 +87,7 @@ exports.compareScreenshots = compareScreenshots;
|
|
|
87
87
|
*/
|
|
88
88
|
function onAfterScreenshot(details) {
|
|
89
89
|
console.log('🧸 Screenshot was saved to:', details.path);
|
|
90
|
-
if (!details.path.match('
|
|
90
|
+
if (!details.path.match('visual')) {
|
|
91
91
|
return Promise.resolve({});
|
|
92
92
|
}
|
|
93
93
|
const getNewPath = (path) => {
|
|
@@ -102,7 +102,6 @@ function onAfterScreenshot(details) {
|
|
|
102
102
|
const newPathDir = newPath.substring(0, newPath.lastIndexOf('/'));
|
|
103
103
|
try {
|
|
104
104
|
fs.mkdirSync(newPathDir, { recursive: true });
|
|
105
|
-
console.log('🧸 No screenshot folder found in the package. Created new screenshot folder:', newPathDir);
|
|
106
105
|
}
|
|
107
106
|
catch (err) {
|
|
108
107
|
console.error('❌ Error creating new screenshot folder:', newPathDir, err);
|
package/package.json
CHANGED