Skip to content

Commit 5905bff

Browse files
committed
handle socket hangup
1 parent 55ec02f commit 5905bff

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"appium",
66
"flutter"
77
],
8-
"version": "1.0.0-beta.6",
8+
"version": "1.0.0-beta.7",
99
"author": "",
1010
"license": "MIT License",
1111
"repository": {

src/driver.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,25 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
217217
server: '127.0.0.1',
218218
port: this.flutterPort,
219219
});
220-
await waitForCondition(async () => {
221-
try {
222-
// @ts-ignore
223-
await this.proxy.command('/status', 'GET');
224-
return true;
225-
} catch(err: any) {
226-
log.info('FlutterServer not reachable, Trying..', err);
227-
return false;
228-
}
229-
})
220+
try {
221+
await waitForCondition(async () => {
222+
try {
223+
// @ts-ignore
224+
await this.proxy.command('/status', 'GET');
225+
return true;
226+
} catch(err: any) {
227+
log.info('FlutterServer not reachable, Trying..', err);
228+
return false;
229+
}
230+
}, {
231+
waitMs: 15000,
232+
intervalMs: 1000,
233+
})
234+
} catch(err: any) {
235+
log.error('FlutterServer not reachable', err);
236+
throw new Error(err);
237+
}
238+
230239

231240
await this.proxy.command('/session', 'POST', { capabilities: caps });
232241
return sessionCreated;

0 commit comments

Comments
 (0)