@argos-ci/cypress 2.0.5 → 2.1.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.
package/dist/support.d.ts CHANGED
@@ -8,6 +8,12 @@ type ArgosScreenshotOptions = Partial<Cypress.Loggable & Cypress.Timeoutable & C
8
8
  * Custom CSS evaluated during the screenshot process.
9
9
  */
10
10
  argosCSS?: string;
11
+ /**
12
+ * Sensitivity threshold between 0 and 1.
13
+ * The higher the threshold, the less sensitive the diff will be.
14
+ * @default 0.5
15
+ */
16
+ threshold?: number;
11
17
  };
12
18
  declare global {
13
19
  namespace Cypress {
@@ -15,12 +21,20 @@ declare global {
15
21
  /**
16
22
  * Stabilize the UI and takes a screenshot of the application under test.
17
23
  *
18
- * @see https://on.cypress.io/screenshot
24
+ * @see https://argos-ci.com/docs/cypress#api-overview
19
25
  * @example
20
26
  * cy.argosScreenshot("my-screenshot")
21
27
  * cy.get(".post").argosScreenshot()
22
28
  */
23
- argosScreenshot: (name: string, options?: ArgosScreenshotOptions) => Chainable<null>;
29
+ argosScreenshot: (
30
+ /**
31
+ * Name of the screenshot. Must be unique.
32
+ */
33
+ name: string,
34
+ /**
35
+ * Options for the screenshot.
36
+ */
37
+ options?: ArgosScreenshotOptions) => Chainable<null>;
24
38
  }
25
39
  }
26
40
  }
package/dist/support.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'cypress-wait-until';
2
2
  import { resolveViewport, getGlobalScript } from '@argos-ci/browser';
3
- import { getScreenshotName, getMetadataPath } from '@argos-ci/util/browser';
3
+ import { getScreenshotName, validateThreshold, getMetadataPath } from '@argos-ci/util/browser';
4
4
 
5
- var version = "2.0.4";
5
+ var version = "2.0.5";
6
6
 
7
7
  function injectArgos() {
8
8
  cy.window({
@@ -96,6 +96,11 @@ Cypress.Commands.add("argosScreenshot", {
96
96
  version
97
97
  }
98
98
  };
99
+ metadata.transient = {};
100
+ if (options.threshold !== undefined) {
101
+ validateThreshold(options.threshold);
102
+ metadata.transient.threshold = options.threshold;
103
+ }
99
104
  cy.writeFile(getMetadataPath(ref.props.path), JSON.stringify(metadata));
100
105
  });
101
106
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/cypress",
3
3
  "description": "Visual testing solution to avoid visual regression. Cypress commands and utilities for Argos visual testing.",
4
- "version": "2.0.5",
4
+ "version": "2.1.0",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@argos-ci/browser": "2.1.2",
46
- "@argos-ci/core": "2.3.0",
47
- "@argos-ci/util": "2.0.0",
46
+ "@argos-ci/core": "2.4.0",
47
+ "@argos-ci/util": "2.1.0",
48
48
  "cypress-wait-until": "^3.0.1"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "cypress": "^12.0.0 || ^13.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@argos-ci/cli": "2.2.0",
54
+ "@argos-ci/cli": "2.3.0",
55
55
  "@argos-ci/cypress": "workspace:.",
56
56
  "@types/node": "^18.0.0",
57
57
  "cypress": "^13.7.2",
@@ -64,5 +64,5 @@
64
64
  "test": "pnpm exec cypress run",
65
65
  "e2e": "UPLOAD_TO_ARGOS=true pnpm run test"
66
66
  },
67
- "gitHead": "0c328bfcd6475ad625c0335cab11e912e856173c"
67
+ "gitHead": "aca82cf842a6d8310611a8594c581794df85cbd8"
68
68
  }