-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathimage-helper.d.ts
109 lines (109 loc) · 4.17 KB
/
image-helper.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { ImageOptions } from "./image-options";
import { INsCapabilities } from "./interfaces/ns-capabilities";
import { IRectangle } from "./interfaces/rectangle";
import { UIElement } from "./ui-element";
import { AppiumDriver } from "./appium-driver";
export interface IImageCompareOptions {
imageName?: string;
timeOutSeconds?: number;
/**
* pixel
* percentage thresholds: 1 = 100%, 0.2 = 20%"
*/
tolerance?: number;
/**
* pixel
* percentage thresholds: 1 = 100%, 0.2 = 20%"
*/
toleranceType?: ImageOptions;
/**
* Wait milliseconds before capture creating image
* Default value is 5000
*/
waitBeforeCreatingInitialImageCapture?: number;
/**
* This property will preserve not to add be added _actual postfix on initial image capture
*/
donNotAppendActualSuffixOnIntialImageCapture?: boolean;
/**
* This property will ensure that the image name will not be manipulated with count postfix.
* This is very convenient in order to reuses image.
* Default value is false.
*/
keepOriginalImageName?: boolean;
/**
* Clip image before compare. Default value excludes status bar(both android and ios) and software buttons(android).
*/
cropRectangle?: IRectangle;
/**
* Default value is set to true which means that nativescript-dev-appium will save the image
* in original size and compare only the part which cropRectangle specifies.
* If false, the image size will be reduced and saved by the dimensions of cropRectangle.
*/
keepOriginalImageSize?: boolean;
/**
* Default value is set to false. nativescript-dev-appium will recalculate view port for iOS
* so that the top/y will start from the end of the status bar
* So far appium calculates it even more and some part of safe areas are missed
*/
keepAppiumViewportRect?: boolean;
/**
* Defines if an image is device-specific or only by the platform.
* Default value is true and the image will be saved in device-specific directory.
* If the value is set to false, the image will be saved under ios or android folder.
*/
isDeviceSpecific?: boolean;
/**
* Overwrite actual image if doesn't match. Default value is false.
*/
overwriteActualImage?: boolean;
}
export declare class ImageHelper {
private _args;
private _driver;
private _blockOutAreas;
private _imagesResults;
private _options;
private _defaultToleranceType;
private _defaultTolerance;
private _defaultOptions;
constructor(_args: INsCapabilities, _driver: AppiumDriver);
static readonly pngFileExt = ".png";
testName: string;
/**
* Defines when an image output should be created.
* This can be for different images, similar or different images, or all comparisons.
* (default: BlinkDiff.OUTPUT_ALL)
*/
imageOutputLimit: ImageOptions;
/**
* Max. distance colors in the 4 dimensional color-space without triggering a difference. (default: 20)
*/
delta: number;
options: IImageCompareOptions;
blockOutAreas: IRectangle[];
defaultToleranceType: ImageOptions;
defaultTolerance: number;
compareScreen(options?: IImageCompareOptions): Promise<boolean>;
compareElement(element: UIElement, options?: IImageCompareOptions): Promise<boolean>;
compareRectangle(cropRectangle: IRectangle, options?: IImageCompareOptions): Promise<boolean>;
hasImageComparisonPassed(): boolean;
/**
* Reset image comparison results
*/
reset(): void;
/**
* Set comparison option to default
*/
resetDefaultOptions(): void;
getExpectedImagePathByDevice(imageName: string): string;
getExpectedImagePathByPlatform(imageName: string): string;
compare(options: IImageCompareOptions): Promise<boolean>;
compareImages(options: IImageCompareOptions, actual: string, expected: string, output: string): Promise<boolean>;
clipRectangleImage(rect: IRectangle, path: string): Promise<{}>;
readImage(path: string): Promise<any>;
private runDiff;
private increaseImageName;
extendOptions(options: IImageCompareOptions): IImageCompareOptions;
private static fullClone;
}