Skip to content

Commit aa83da8

Browse files
committed
Add ignoreAreas into testRun payload #44
#44
1 parent 693f915 commit aa83da8

File tree

7 files changed

+228
-694
lines changed

7 files changed

+228
-694
lines changed

README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ const vrt = new VisualRegressionTracker(config);
5151
vrt.start();
5252
```
5353

54+
### Teardown
55+
56+
```js
57+
vrt.stop();
58+
```
59+
5460
### Assert
5561

5662
```js
@@ -78,11 +84,27 @@ await vrt.track({
7884

7985
// Optional
8086
device: "PC",
81-
});
82-
```
83-
84-
### Teardown
8587

86-
```js
87-
vrt.stop();
88+
// Array of areas to be ignored
89+
// Optional
90+
ignoreAreas: [
91+
{
92+
// X-coordinate relative of left upper corner
93+
// Required
94+
x: 10;
95+
96+
// Y-coordinate relative of left upper corner
97+
// Required
98+
y: 20;
99+
100+
// Area width in px
101+
// Required
102+
width: 300;
103+
104+
// Height width in px
105+
// Required
106+
height: 400;
107+
}
108+
]
109+
});
88110
```

lib/types/ignoreArea.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface IgnoreArea {
2+
x: number;
3+
y: number;
4+
width: number;
5+
height: number;
6+
}

lib/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from "./testRun";
33
export * from "./response/buildResponse";
44
export * from "./response/testRunResponse";
55
export * from "./testStatus";
6+
export * from "./ignoreArea";

lib/types/testRun.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { IgnoreArea } from "./ignoreArea";
2+
13
export interface TestRun {
24
name: string;
35
imageBase64: string;
@@ -6,4 +8,5 @@ export interface TestRun {
68
viewport?: string;
79
device?: string;
810
diffTollerancePercent?: number;
11+
ignoreAreas?: IgnoreArea[];
912
}

lib/visualRegressionTracker.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ describe("VisualRegressionTracker", () => {
259259
device: "device",
260260
viewport: "viewport",
261261
browser: "browser",
262+
ignoreAreas: [
263+
{
264+
x: 1,
265+
y: 2,
266+
height: 300,
267+
width: 400,
268+
},
269+
],
262270
};
263271
const buildId = "1312";
264272
const projectId = "asd";
@@ -281,6 +289,7 @@ describe("VisualRegressionTracker", () => {
281289
device: testRun.device,
282290
viewport: testRun.viewport,
283291
browser: testRun.browser,
292+
ignoreAreas: testRun.ignoreAreas,
284293
},
285294
{
286295
headers: {

0 commit comments

Comments
 (0)