@visual-regression-tracker/agent-cypress 5.1.0 → 5.4.0

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.
@@ -14,7 +14,7 @@ jobs:
14
14
  fetch-depth: 0
15
15
 
16
16
  - name: Setup Node.js environment
17
- uses: actions/setup-node@v1.4.4
17
+ uses: actions/setup-node@v2
18
18
 
19
19
  - name: Install dependencies
20
20
  run: npm ci
package/README.md CHANGED
@@ -132,9 +132,11 @@ cy.vrtTrack("Whole page with additional options", {
132
132
  viewport: "1920x1080",
133
133
  os: "MacOS",
134
134
  device: "Cloud agent",
135
+ customTags: "Cloud, DarkTheme, Auth",
135
136
  diffTollerancePercent: 1,
136
137
  ignoreAreas: [{ x: 1, y: 2, width: 100, height: 200 }],
137
138
  retryLimit: 2,
139
+ keepScreenshot: false, // Keep screenshot local copy, false by default
138
140
  });
139
141
  ```
140
142
 
package/dist/index.d.ts CHANGED
@@ -12,14 +12,18 @@ declare namespace Cypress {
12
12
  * cy.get("#id").vrtTrack("name", {
13
13
  * os: "MacOS",
14
14
  * device: "Cloud agent",
15
+ * customTags: "Cloud, DarkTheme, Auth",
15
16
  * diffTollerancePercent: 1.23,
16
17
  * ignoreAreas: [
17
18
  * {x: 1, y: 2, width: 100, height: 200}
18
19
  * ],
19
- * retryLimit: 5
20
+ * retryLimit: 5,
21
+ * keepScreenshot: false,
20
22
  * })
21
23
  */
22
- vrtTrack(name: string, options?: Partial<Loggable & Timeoutable & ScreenshotOptions & TrackOptions>): Chainable<null>;
24
+ vrtTrack(name: string, options?: Partial<Loggable & Timeoutable & ScreenshotOptions & TrackOptions & {
25
+ keepScreenshot?: boolean;
26
+ }>): Chainable<null>;
23
27
  vrtTrackBuffer(name: string, imageBuffer: Buffer, options?: Partial<Loggable & Timeoutable & ScreenshotOptions & TrackOptions>): Chainable<null>;
24
28
  vrtTrackBase64(name: string, imageBase64: string, options?: Partial<Loggable & Timeoutable & ScreenshotOptions & TrackOptions>): Chainable<null>;
25
29
  vrtStart(): null;
@@ -35,6 +39,7 @@ declare namespace Cypress {
35
39
  viewport?: string;
36
40
  os?: string;
37
41
  device?: string;
42
+ customTags?: string;
38
43
  diffTollerancePercent?: number;
39
44
  ignoreAreas?: IgnoreArea[];
40
45
  retryLimit?: number;
package/dist/plugin.js CHANGED
@@ -106,7 +106,9 @@ function addVisualRegressionTrackerPlugin(on, config) {
106
106
  return [4 /*yield*/, vrt["submitTestRunMultipart"](data)];
107
107
  case 1:
108
108
  result = _a.sent();
109
- (0, fs_1.unlinkSync)(props.imagePath);
109
+ if (!props.keepScreenshot) {
110
+ (0, fs_1.unlinkSync)(props.imagePath);
111
+ }
110
112
  return [2 /*return*/, result];
111
113
  }
112
114
  });
package/dist/utils.d.ts CHANGED
@@ -13,10 +13,12 @@ export declare const toTestRunDto: ({ name, pixelRatio, options, }: {
13
13
  viewport: any;
14
14
  os: any;
15
15
  device: any;
16
+ customTags: any;
16
17
  diffTollerancePercent: any;
17
18
  ignoreAreas: any;
19
+ keepScreenshot: any;
18
20
  };
19
- export declare const trackWithRetry: (trackFn: () => Cypress.Chainable<TestRunResponse>, shouldStopFn: (result: TestRunResponse) => boolean, onStopFn: (result: TestRunResponse) => Cypress.Chainable<unknown>, retryLimit?: number) => Cypress.Chainable<unknown>;
21
+ export declare const trackWithRetry: (trackFn: () => Cypress.Chainable<TestRunResponse>, shouldStopFn: (result: TestRunResponse) => boolean, onStopFn: (result: TestRunResponse) => Cypress.Chainable<unknown>, retryLimit?: number) => unknown;
20
22
  export declare const checkResult: (result: TestRunResponse) => Cypress.Chainable<unknown>;
21
23
  export declare const shouldStopRetry: (result: TestRunResponse) => boolean;
22
24
  export declare const trackImage: (subject: any, name: string, options: any) => Cypress.Chainable<TestRunResponse>;
package/dist/utils.js CHANGED
@@ -34,11 +34,13 @@ var toTestRunDto = function (_a) {
34
34
  return ({
35
35
  name: name,
36
36
  browser: Cypress.browser.name,
37
- viewport: (_b = options === null || options === void 0 ? void 0 : options.viewport) !== null && _b !== void 0 ? _b : Cypress.config("viewportWidth") * pixelRatio + "x" + Cypress.config("viewportHeight") * pixelRatio,
37
+ viewport: (_b = options === null || options === void 0 ? void 0 : options.viewport) !== null && _b !== void 0 ? _b : "".concat(Cypress.config("viewportWidth") * pixelRatio, "x").concat(Cypress.config("viewportHeight") * pixelRatio),
38
38
  os: options === null || options === void 0 ? void 0 : options.os,
39
39
  device: options === null || options === void 0 ? void 0 : options.device,
40
+ customTags: options === null || options === void 0 ? void 0 : options.customTags,
40
41
  diffTollerancePercent: options === null || options === void 0 ? void 0 : options.diffTollerancePercent,
41
42
  ignoreAreas: options === null || options === void 0 ? void 0 : options.ignoreAreas,
43
+ keepScreenshot: options === null || options === void 0 ? void 0 : options.keepScreenshot,
42
44
  });
43
45
  };
44
46
  exports.toTestRunDto = toTestRunDto;
@@ -49,7 +51,7 @@ var trackWithRetry = function (trackFn, shouldStopFn, onStopFn, retryLimit) {
49
51
  onStopFn(result);
50
52
  return;
51
53
  }
52
- (0, exports.log)("Diff found... Remaining retry attempts **" + retryLimit + "**");
54
+ (0, exports.log)("Diff found... Remaining retry attempts **".concat(retryLimit, "**"));
53
55
  return (0, exports.trackWithRetry)(trackFn, shouldStopFn, onStopFn, retryLimit - 1);
54
56
  });
55
57
  };
@@ -72,19 +74,19 @@ var trackImage = function (subject, name, options) {
72
74
  pixelRatio = props.pixelRatio;
73
75
  return options === null || options === void 0 ? void 0 : options.onAfterScreenshot;
74
76
  } }))
75
- .then(function () { return (0, exports.log)("tracking " + name); })
77
+ .then(function () { return (0, exports.log)("tracking ".concat(name)); })
76
78
  .then(function () {
77
79
  return cy.task("VRT_TRACK_IMAGE_MULTIPART", __assign(__assign({}, (0, exports.toTestRunDto)({ name: name, pixelRatio: pixelRatio, options: options })), { imagePath: imagePath }), { log: false });
78
80
  });
79
81
  };
80
82
  exports.trackImage = trackImage;
81
83
  var trackBuffer = function (name, imageBuffer, options) {
82
- (0, exports.log)("tracking " + name);
84
+ (0, exports.log)("tracking ".concat(name));
83
85
  return cy.task("VRT_TRACK_BUFFER_MULTIPART", __assign(__assign({}, (0, exports.toTestRunDto)({ name: name, options: options })), { imageBuffer: imageBuffer }), { log: false });
84
86
  };
85
87
  exports.trackBuffer = trackBuffer;
86
88
  var trackBase64 = function (name, imageBase64, options) {
87
- (0, exports.log)("tracking " + name);
89
+ (0, exports.log)("tracking ".concat(name));
88
90
  return cy.task("VRT_TRACK_IMAGE_BASE64", __assign(__assign({}, (0, exports.toTestRunDto)({ name: name, options: options })), { imageBase64: imageBase64 }), { log: false });
89
91
  };
90
92
  exports.trackBase64 = trackBase64;
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@visual-regression-tracker/agent-cypress",
3
- "version": "5.1.0",
3
+ "version": "5.4.0",
4
4
  "description": "Visual Regression Tracker integration plugin",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
5
7
  "scripts": {
6
8
  "test": "cypress run --spec 'cypress/integration/regression.spec.ts'",
7
9
  "build": "tsc",
@@ -23,16 +25,16 @@
23
25
  },
24
26
  "homepage": "https://github.com/Visual-Regression-Tracker/agent-cypress#readme",
25
27
  "dependencies": {
26
- "@visual-regression-tracker/sdk-js": "5.1.1"
28
+ "@visual-regression-tracker/sdk-js": "5.3.0"
27
29
  },
28
30
  "devDependencies": {
29
- "@types/jest": "^26.0.24",
30
- "@types/node": "^16.7.7",
31
- "cypress": "^8.3.1",
32
- "jest": "^26.6.3",
33
- "semantic-release": "^17.4.7",
34
- "ts-jest": "^26.5.6",
35
- "typescript": "^4.4.2"
31
+ "@types/jest": "^27.4.1",
32
+ "@types/node": "^17.0.23",
33
+ "cypress": "^9.5.2",
34
+ "jest": "^27.5.1",
35
+ "semantic-release": "^19.0.2",
36
+ "ts-jest": "^27.1.4",
37
+ "typescript": "^4.6.3"
36
38
  },
37
39
  "publishConfig": {
38
40
  "access": "public"