Skip to content

Commit 1fc4c1d

Browse files
chore: update d.ts
1 parent 8a1cd1f commit 1fc4c1d

13 files changed

+48
-40
lines changed

Diff for: lib/appium-driver.d.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export declare class AppiumDriver {
5555
*/
5656
readonly storageByDeviceName: string;
5757
static createAppiumDriver(port: number, args: INsCapabilities): Promise<AppiumDriver>;
58-
private static applyDeviceAdditionsSettings(args, sessionIfno);
58+
private static applyDeviceAdditionsSettings;
5959
/**
6060
*
6161
* @param xPath
@@ -158,7 +158,7 @@ export declare class AppiumDriver {
158158
*/
159159
startRecordingVideo(videoName: any): any;
160160
stopRecordingVideo(): Promise<any>;
161-
private compare(imageName, timeOutSeconds?, tolerance?, rect?, toleranceType?);
161+
private compare;
162162
prepareImageToCompare(filePath: string, rect: IRectangle): Promise<void>;
163163
takeScreenshot(fileName: string): Promise<string>;
164164
logScreenshot(fileName: string): Promise<string>;
@@ -171,10 +171,10 @@ export declare class AppiumDriver {
171171
resetApp(): Promise<void>;
172172
init(): Promise<void>;
173173
quit(): Promise<void>;
174-
private static applyAdditionalSettings(args);
175-
private convertArrayToUIElements(array, searchM, args);
176-
private static configureLogging(driver, verbose);
177-
private getExpectedImagePath(imageName);
174+
private static applyAdditionalSettings;
175+
private convertArrayToUIElements;
176+
private static configureLogging;
177+
private getExpectedImagePath;
178178
/**
179179
* Wait specific amount of time before continue execution
180180
* @param miliseconds
@@ -204,7 +204,7 @@ export declare class AppiumDriver {
204204
* @param waitForElement
205205
*/
206206
findElementByAccessibilityIdIfExists(id: string, waitForElement?: number): Promise<UIElement>;
207-
executeShellCommand(commandAndargs: {
207+
static executeShellCommand(driver: any, commandAndargs: {
208208
command: string;
209209
"args": Array<any>;
210210
}): Promise<any>;

Diff for: lib/appium-driver.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class AppiumDriver {
187187
try {
188188
const sessionIfno = await driver.init(args.appiumCaps);
189189
log(sessionIfno, args.verbose);
190-
AppiumDriver.applyDeviceAdditionsSettings(args, sessionIfno);
190+
await AppiumDriver.applyDeviceAdditionsSettings(driver, args, sessionIfno);
191191

192192
hasStarted = true;
193193
} catch (error) {
@@ -209,10 +209,15 @@ export class AppiumDriver {
209209
return new AppiumDriver(driver, wd, webio, driverConfig, args);
210210
}
211211

212-
private static applyDeviceAdditionsSettings(args: INsCapabilities, sessionIfno: any) {
212+
private static async applyDeviceAdditionsSettings(driver, args: INsCapabilities, sessionIfno: any) {
213213
if (!args.device.config || !args.device.config.density || !args.device.config.offset) {
214214
args.device.config = {};
215-
const density: number = sessionIfno[1].deviceScreenDensity / 100;
215+
let density: number = sessionIfno[1].deviceScreenDensity / 100;
216+
console.log(`Get density from appium session: ${density}`);
217+
if (!density) {
218+
density = await AppiumDriver.executeShellCommand(driver, { command: "wm", args: ["density"] });
219+
console.log(`Device density recieved from adb shell command ${density}`);
220+
}
216221
args.device.config['density'] = density;
217222

218223
if (args.appiumCaps.platformName.toLowerCase() === "android") {
@@ -733,16 +738,17 @@ export class AppiumDriver {
733738
}
734739
}
735740

736-
public async executeShellCommand(commandAndargs: { command: string, "args": Array<any> }) {
737-
const output = await this._driver.execute("mobile: shell", commandAndargs);
741+
public static async executeShellCommand(driver, commandAndargs: { command: string, "args": Array<any> }) {
742+
const output = await driver.execute("mobile: shell", commandAndargs);
738743
return output;
739744
}
745+
740746
public async setDontKeepActivities(value: boolean) {
741747
if (this._args.isAndroid) {
742748
const status = value ? 1 : 0;
743-
const output = await this.executeShellCommand({ command: "settings", args: ['put', 'global', 'always_finish_activities', status] });
749+
const output = await AppiumDriver.executeShellCommand(this._driver, { command: "settings", args: ['put', 'global', 'always_finish_activities', status] });
744750
//check if set
745-
const check = await this.executeShellCommand({ command: "settings", args: ['get', 'global', 'always_finish_activities'] })
751+
const check = await AppiumDriver.executeShellCommand(this._driver, { command: "settings", args: ['get', 'global', 'always_finish_activities'] })
746752
console.info(`always_finish_activities: ${check}`)
747753
} else {
748754
// Do nothing for iOS ...

Diff for: lib/appium-server.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export declare class AppiumServer {
1616
readonly server: child_process.ChildProcess;
1717
hasStarted: boolean;
1818
start(port: any, deviceManager?: IDeviceManager): Promise<boolean>;
19-
private startAppiumServer(logLevel, isSauceLab);
19+
private startAppiumServer;
2020
stop(): Promise<{}>;
21-
private prepareDevice(deviceManager);
22-
private prepareApp();
23-
private resolveAppiumDependency();
21+
private prepareDevice;
22+
private prepareApp;
23+
private resolveAppiumDependency;
2424
}

Diff for: lib/device-controller.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export declare class DeviceManger implements IDeviceManager {
99
installApp(args: INsCapabilities): Promise<any>;
1010
uninstallApp(args: INsCapabilities): Promise<any>;
1111
static kill(device: IDevice): Promise<void>;
12-
private static getDefaultDevice(args);
12+
private static getDefaultDevice;
1313
getPackageId(device: IDevice, appPath: string): string;
1414
}

Diff for: lib/direction.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export declare const enum Direction {
22
down = 0,
33
up = 1,
44
left = 2,
5-
right = 3,
5+
right = 3
66
}

Diff for: lib/image-helper.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ export declare class ImageHelper {
1010
blockOutAreas: IRectangle[];
1111
imageOutputLimit(): ImageOptions;
1212
thresholdType(): ImageOptions;
13-
threshold(thresholdType: any): 0.01 | 10;
13+
threshold(thresholdType: any): 10 | 0.01;
1414
delta(): number;
1515
static cropImageDefault(_args: INsCapabilities): {
1616
x: number;
1717
y: any;
1818
width: any;
1919
height: any;
2020
};
21-
private static getOffsetPixels(args);
22-
private runDiff(diffOptions, diffImage);
21+
private static getOffsetPixels;
22+
private runDiff;
2323
compareImages(actual: string, expected: string, output: string, valueThreshold?: number, typeThreshold?: any): Promise<boolean>;
2424
clipRectangleImage(rect: IRectangle, path: string): Promise<{}>;
2525
readImage(path: string): Promise<any>;

Diff for: lib/image-options.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export declare enum ImageOptions {
22
outputAll,
33
pixel,
4-
percent,
4+
percent
55
}

Diff for: lib/interfaces/ns-capabilities.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { IDevice } from "mobile-devices-controller";
22
export declare enum AutomationName {
33
UiAutomator2 = "UIAutomator2",
44
Appium = "Appium",
5-
XCUITest = "XCUITest",
5+
XCUITest = "XCUITest"
66
}
77
export interface INsCapabilities {
88
projectDir: string;

Diff for: lib/locators.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export declare class Locator {
88
readonly image: string;
99
readonly locators: Map<string, string>;
1010
getElementByName(name: any): string;
11-
private loadAndroidElements();
12-
private loadIOSElements();
13-
private createIosElement(element);
11+
private loadAndroidElements;
12+
private loadIOSElements;
13+
private createIosElement;
1414
}

Diff for: lib/ns-capabilities.d.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export declare class NsCapabilities implements INsCapabilities {
5353
readonly wdaLocalPort: number;
5454
device: IDevice;
5555
readonly emulatorOptions: string;
56-
private isAndroidPlatform();
57-
private setAutomationName();
56+
private isAndroidPlatform;
57+
private setAutomationName;
5858
tryGetAndroidApiLevel(): number;
59-
private resolveApplication();
60-
private checkMandatoryCapabiliies();
61-
private throwExceptions();
59+
private resolveApplication;
60+
private checkMandatoryCapabiliies;
61+
private throwExceptions;
6262
}

Diff for: lib/search-options.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export declare const enum SearchOptions {
22
exact = 0,
3-
contains = 1,
3+
contains = 1
44
}

Diff for: lib/ui-element.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export declare class UIElement {
99
private _args;
1010
private _searchMethod;
1111
private _searchParams;
12-
private _index;
12+
private _index?;
1313
constructor(_element: any, _driver: any, _wd: any, _webio: any, _args: INsCapabilities, _searchMethod: string, _searchParams: string, _index?: number);
1414
/**
1515
* Click on element

Diff for: package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
"appium",
1818
"test"
1919
],
20-
"maintainers": [{
21-
"name": "SvetoslavTsenov",
22-
"email": "[email protected]"
23-
}],
20+
"maintainers": [
21+
{
22+
"name": "SvetoslavTsenov",
23+
"email": "[email protected]"
24+
}
25+
],
2426
"dependencies": {
2527
"app-root-path": "~2.0.1",
2628
"blink-diff": "~1.0.13",
@@ -48,4 +50,4 @@
4850
"prepare": "tsc",
4951
"watch": "tsc --watch"
5052
}
51-
}
53+
}

0 commit comments

Comments
 (0)