@percy/nightwatch 2.2.0 → 2.2.1-beta.1
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/README.md +209 -139
- package/commands/percySnapshot.js +62 -24
- package/lib/regions.js +59 -0
- package/lib/snapshot.js +733 -0
- package/package.json +18 -12
- package/types/percySnapshot.d.ts +64 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/nightwatch",
|
|
3
3
|
"description": "Nightwatch client library for visual testing with Percy",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.1-beta.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Perceptual Inc.",
|
|
7
7
|
"repository": "https://github.com/percy/percy-nightwatch",
|
|
@@ -14,35 +14,41 @@
|
|
|
14
14
|
"types": "types/percySnapshot.d.ts",
|
|
15
15
|
"files": [
|
|
16
16
|
"commands/percySnapshot.js",
|
|
17
|
+
"lib",
|
|
17
18
|
"types/percySnapshot.d.ts"
|
|
18
19
|
],
|
|
19
20
|
"engines": {
|
|
20
21
|
"node": ">=14"
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
|
-
"lint": "eslint
|
|
24
|
-
"test": "
|
|
25
|
-
"test:
|
|
24
|
+
"lint": "eslint .",
|
|
25
|
+
"test": "yarn test:unit && yarn test:nightwatch",
|
|
26
|
+
"test:unit": "mocha \"test/unit/**/*.test.js\"",
|
|
27
|
+
"test:nightwatch": "cross-env MOZ_HEADLESS=1 percy exec --testing -- nightwatch",
|
|
28
|
+
"test:coverage": "nyc yarn test:unit",
|
|
26
29
|
"test:types": "tsd"
|
|
27
30
|
},
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"@percy/sdk-utils": "
|
|
32
|
+
"@percy/sdk-utils": "1.32.3-beta.1",
|
|
33
|
+
"@percy/selenium-webdriver": "^2.2.3"
|
|
30
34
|
},
|
|
31
35
|
"peerDependencies": {
|
|
32
36
|
"nightwatch": ">=1 || >=2 || >=3"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
|
-
"@percy/cli": "
|
|
39
|
+
"@percy/cli": "1.31.14",
|
|
40
|
+
"cross-env": "^10.1.0",
|
|
36
41
|
"eslint": "^7.11.0",
|
|
37
42
|
"eslint-config-standard": "^16.0.1",
|
|
38
43
|
"eslint-plugin-import": "^2.22.1",
|
|
39
44
|
"eslint-plugin-node": "^11.1.0",
|
|
40
45
|
"eslint-plugin-promise": "^5.1.0",
|
|
41
46
|
"eslint-plugin-standard": "^5.0.0",
|
|
42
|
-
"expect": "^
|
|
43
|
-
"mocha": "^
|
|
44
|
-
"nightwatch": "^3.
|
|
45
|
-
"nyc": "^
|
|
46
|
-
"tsd": "^0.
|
|
47
|
-
}
|
|
47
|
+
"expect": "^30.2.0",
|
|
48
|
+
"mocha": "^11.7.5",
|
|
49
|
+
"nightwatch": "^3.12.3",
|
|
50
|
+
"nyc": "^17.1.0",
|
|
51
|
+
"tsd": "^0.33.0"
|
|
52
|
+
},
|
|
53
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
48
54
|
}
|
package/types/percySnapshot.d.ts
CHANGED
|
@@ -1,12 +1,75 @@
|
|
|
1
1
|
import { SnapshotOptions } from '@percy/core';
|
|
2
2
|
import { NightwatchAPI, NightwatchCustomCommands } from 'nightwatch';
|
|
3
3
|
|
|
4
|
+
export type PercyRegionAlgorithm = 'standard' | 'layout' | 'ignore' | 'intelliignore';
|
|
5
|
+
|
|
6
|
+
export interface PercyRegionBoundingBox {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface PercyRegionPadding {
|
|
14
|
+
top?: number;
|
|
15
|
+
right?: number;
|
|
16
|
+
bottom?: number;
|
|
17
|
+
left?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PercyRegionSelector {
|
|
21
|
+
boundingBox?: PercyRegionBoundingBox;
|
|
22
|
+
elementXpath?: string;
|
|
23
|
+
elementCSS?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PercyRegionConfiguration {
|
|
27
|
+
diffSensitivity?: number;
|
|
28
|
+
imageIgnoreThreshold?: number;
|
|
29
|
+
carouselsEnabled?: boolean;
|
|
30
|
+
bannersEnabled?: boolean;
|
|
31
|
+
adsEnabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PercyRegionAssertion {
|
|
35
|
+
diffIgnoreThreshold?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PercyRegion {
|
|
39
|
+
algorithm: PercyRegionAlgorithm;
|
|
40
|
+
elementSelector?: PercyRegionSelector;
|
|
41
|
+
padding?: PercyRegionPadding;
|
|
42
|
+
configuration?: PercyRegionConfiguration;
|
|
43
|
+
assertion?: PercyRegionAssertion;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface CreateRegionOptions extends PercyRegionSelector {
|
|
47
|
+
padding?: PercyRegionPadding;
|
|
48
|
+
algorithm?: PercyRegionAlgorithm;
|
|
49
|
+
diffSensitivity?: number;
|
|
50
|
+
imageIgnoreThreshold?: number;
|
|
51
|
+
carouselsEnabled?: boolean;
|
|
52
|
+
bannersEnabled?: boolean;
|
|
53
|
+
adsEnabled?: boolean;
|
|
54
|
+
diffIgnoreThreshold?: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type CreateRegion = (options?: CreateRegionOptions) => PercyRegion;
|
|
58
|
+
|
|
59
|
+
export interface PercyNightwatchExports {
|
|
60
|
+
path: string;
|
|
61
|
+
createRegion: CreateRegion;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare const percyNightwatch: PercyNightwatchExports;
|
|
65
|
+
export default percyNightwatch;
|
|
66
|
+
|
|
4
67
|
declare module 'nightwatch' {
|
|
5
68
|
interface NightwatchCustomCommands {
|
|
6
69
|
percySnapshot(
|
|
7
70
|
this: NightwatchAPI,
|
|
8
71
|
name?: string,
|
|
9
72
|
options?: SnapshotOptions
|
|
10
|
-
): this
|
|
73
|
+
): this;
|
|
11
74
|
}
|
|
12
75
|
}
|