comparadise-utils 0.0.15 → 0.0.16
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.
- package/dist/index.js +0 -1
- package/dist/match-screenshot.js +1 -4
- package/dist/screenshots.d.ts +0 -1
- package/dist/screenshots.js +1 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ function setupVisualTests(on, config) {
|
|
|
7
7
|
on('task', {
|
|
8
8
|
baseExists: screenshots_1.baseExists,
|
|
9
9
|
compareScreenshots: screenshots_1.compareScreenshots,
|
|
10
|
-
createNewScreenshot: screenshots_1.createNewScreenshot,
|
|
11
10
|
log: (message) => {
|
|
12
11
|
console.log(message);
|
|
13
12
|
return null;
|
package/dist/match-screenshot.js
CHANGED
|
@@ -50,14 +50,11 @@ function matchScreenshot(subject, args) {
|
|
|
50
50
|
verifyImages();
|
|
51
51
|
const { name, screenshotsFolder } = getTestFolderPathFromScripts(rawName);
|
|
52
52
|
cy.task('baseExists', screenshotsFolder).then(hasBase => {
|
|
53
|
-
const type = 'new';
|
|
54
53
|
const target = subject ? cy.wrap(subject) : cy;
|
|
55
54
|
// For easy slicing of path ignoring the root screenshot folder
|
|
56
|
-
target.screenshot(`${PREFIX_DIFFERENTIATOR}${screenshotsFolder}
|
|
55
|
+
target.screenshot(`${PREFIX_DIFFERENTIATOR}${screenshotsFolder}/new`, options);
|
|
57
56
|
if (!hasBase) {
|
|
58
|
-
// cy.task('createNewScreenshot', screenshotsFolder).then(() => {
|
|
59
57
|
cy.task('log', `✅ A new base image was created for ${name}. Create this as a new base image via Comparadise!`);
|
|
60
|
-
// });
|
|
61
58
|
return null;
|
|
62
59
|
}
|
|
63
60
|
cy.task('compareScreenshots', screenshotsFolder).then(diffPixels => {
|
package/dist/screenshots.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* @returns true if path/base.png exists, false if not.
|
|
6
6
|
*/
|
|
7
7
|
export declare function baseExists(path: string): boolean;
|
|
8
|
-
export declare function createNewScreenshot(screenshotFolder: string): null;
|
|
9
8
|
/**
|
|
10
9
|
* Runs a visual regression test.
|
|
11
10
|
* @param screenshotFolder - Full screenshots folder where the base/new/diff
|
package/dist/screenshots.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.onAfterScreenshot = exports.compareScreenshots = exports.
|
|
26
|
+
exports.onAfterScreenshot = exports.compareScreenshots = exports.baseExists = void 0;
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const pngjs_1 = require("pngjs");
|
|
29
29
|
const images_1 = require("./images");
|
|
@@ -42,16 +42,6 @@ function baseExists(path) {
|
|
|
42
42
|
return exists;
|
|
43
43
|
}
|
|
44
44
|
exports.baseExists = baseExists;
|
|
45
|
-
function createNewScreenshot(screenshotFolder) {
|
|
46
|
-
const newImage = pngjs_1.PNG.sync.read(fs.readFileSync((0, files_1.createImageFileName)(screenshotFolder, 'new')));
|
|
47
|
-
fs.writeFile((0, files_1.createImageFileName)(screenshotFolder, 'new'), pngjs_1.PNG.sync.write(newImage), err => {
|
|
48
|
-
if (err) {
|
|
49
|
-
console.error('❌Unable to create new.png', err);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
exports.createNewScreenshot = createNewScreenshot;
|
|
55
45
|
/**
|
|
56
46
|
* Runs a visual regression test.
|
|
57
47
|
* @param screenshotFolder - Full screenshots folder where the base/new/diff
|
package/package.json
CHANGED