Skip to content

Commit 4f7881e

Browse files
committed
avoid throw in start and stop
1 parent 97c5c3f commit 4f7881e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-appium",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"description": "A brdige to make selenium-webdriver to drive appium to do native app testing",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/appiumdriver.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ interface IAppiumWaitUntilFound {
1616
getByclassName(className: string, timeout?: number, message?: string): WebElementPromise;
1717
}
1818

19-
export interface IAppiumDriver extends IAppiumWaitUntilFound
20-
{
19+
export interface IAppiumDriver extends IAppiumWaitUntilFound {
2120
start(): Promise<void>;
2221
stop(): Promise<void>;
2322
restart(): Promise<void>;
@@ -67,22 +66,22 @@ class AppiumDriver implements IAppiumDriver {
6766
}
6867

6968
start(): Promise<void> {
70-
return new Promise<void>(resolve => {
69+
return new Promise<void>((resolve, reject) => {
7170
new Builder()
7271
.usingServer(this.url_)
7372
.withCapabilities(this.capabilities_)
7473
.build()
7574
.then(driver => { this.webDriver = driver; resolve(); })
76-
.catch(e => { this.error_ = e; throw e; });
75+
.catch(e => { this.error_ = e; reject(e) });
7776
});
7877
}
7978

8079
stop(): Promise<void> {
81-
return new Promise<void>(resolve => {
80+
return new Promise<void>((resolve, reject) => {
8281
this.webDriver && this.webDriver
8382
.quit()
8483
.then(() => resolve())
85-
.catch(e => { this.error_ = e; throw e });
84+
.catch(e => { this.error_ = e; reject(e) });
8685
resolve();
8786
});
8887
}

0 commit comments

Comments
 (0)