You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`test`|[TestOptions](https://github.com/NimaSoroush/differencify#testoptions)|Validate your changes by testing against reference screenshots|
7
-
|`cleanup`|no argument|Closes all leftover browser instances|
5
+
|`launchBrowser`|no argument|Launches a browser instance with [GlobalOptions](https://github.com/NimaSoroush/differencify#globaloptions). The browser will be closed when the parent node.js process is closed|
6
+
|`init`|[TestOptions](https://github.com/NimaSoroush/differencify#testoptions)|Launches a browser instance if there is no instance already been launched or launches new browser window if `newWindow:true`|
7
+
|`cleanup`|no argument|Closes browser instance if it is not closed already|
8
8
9
9
### Steps Methods
10
10
@@ -14,27 +14,36 @@
14
14
|`wait`|`string`, `integer` or `func`|waiting time in millisecond `or` waiting for a selector `or` waiting until the function you supplied is evaluated as true|
15
15
|`execute`|`func` or `string`|execute an expression in the browser context|
16
16
|`freezeImage`|`string`|Selector name of a <img> tag containing animated image to be freezed before taking screenshot|
17
-
|`capture`|`string`|`undefiend`, `document` or selector name|
-`options` <[Object]> Options object which might have the following properties:
23
+
-`path` <[string]> The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the image won't be saved to the disk.
24
+
-`type` <[string]> Specify screenshot type, can be either `jpeg` or `png`. Defaults to 'png'.
25
+
-`quality` <[number]> The quality of the image, between 0-100. Not applicable to `png` images.
26
+
-`fullPage` <[boolean]> When true, takes a screenshot of the full scrollable page. Defaults to `false`.
27
+
-`clip` <[Object]> An object which specifies clipping region of the page. Should have the following fields:
28
+
-`x` <[number]> x-coordinate of top-left corner of clip area
29
+
-`y` <[number]> y-coordinate of top-left corner of clip area
30
+
-`width` <[number]> width of clipping area
31
+
-`height` <[number]> height of clipping area
32
+
-`omitBackground` <[boolean]> Hides default white background and allows capturing screenshots with transparency. Defaults to `false`.
33
+
34
+
#### viewport
35
+
-`viewport` <[Object]>
36
+
-`width` <[number]> page width in pixels.
37
+
-`height` <[number]> page height in pixels.
38
+
-`deviceScaleFactor` <[number]> Specify device scale factor (can be thought of as dpr). Defaults to `1`.
39
+
-`isMobile` <[boolean]> Whether the `meta viewport` tag is taken into account. Defaults to `false`.
40
+
-`hasTouch`<[boolean]> Specifies if viewport supports touch events. Defaults to `false`
41
+
-`isLandscape` <[boolean]> Specifies if viewport is in landscape mode. Defaults to `false`.
Differencify is a library for visual regression testing by comparing your local changes with reference screenshots of your website.
12
+
Differencify is a library for visual regression testing by comparing your local changes with reference screenshots of your website. It is built on top of chrome headless using [Puppeteer](https://github.com/GoogleChrome/puppeteer)
|`timeout`|`integer` (ms)|no|Maximum time in milliseconds to wait for the Chrome instance to start|30000|
66
80
|`screenshots`|`string`|no|Stores reference screenshots in this directory|./screenshots|
67
-
|`testReportPath`|`string`|no|Stores test screenshots in this directory|./differencify_report|
68
-
|`saveDifferencifiedImage`|`bool`|no|Save differencified image to testReportPath in case of mistmach|true|
69
-
|`mismatchThreshold`|`integer`|no|Difference tolerance between referenced/testsed image|0.01|
81
+
|`testReports`|`string`|no|Stores test screenshots in this directory|./differencify_report|
82
+
|`saveDifferencifiedImage`|`boolean`|no|Save differencified image to testReportPath in case of mismatch|true|
83
+
|`mismatchThreshold`|`integer`|no|Difference tolerance between reference/test image|0.01|
84
+
|`ignoreHTTPSErrors`|`boolean`|no|Whether to ignore HTTPS errors during navigation|false|
85
+
|`slowMo`|`integer`|no|Slows down browser operations by the specified amount of milliseconds|0|
86
+
|`browserArgs`|`Array`|no|Additional arguments to pass to the browser instance. List of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/)|[]|
87
+
|`dumpio`|`boolean`|no|Whether to pipe browser process stdout and stderr into process.stdout and process.stderr|false|
70
88
71
89
### TestOptions
72
90
73
91
|Parameter|type|required|description|default|
74
92
|---------|----|--------|-----------|-------|
75
-
|`name`|`string`|yes|Unique name for your test case|default|
76
-
|`resolution`|`object`|no|Browser width and height|800 * 600|
77
-
|`steps`|`object`|yes|Steps before capturing screenshot|null|
93
+
|`testName`|`string`|yes|Unique name for your test case|test|
94
+
|`newWindow`|`boolean`|no|Whether to open test execution on new browser window or not. By default it opens on new tab|false|
95
+
|`chain`|`boolean`|yes|Whether to chain differencify commands or not. More details on [examples](examples)|null|
78
96
79
97
### Steps API
80
98
81
99
See [API.md](API.md) for full list of Steps API calls
0 commit comments