Skip to content

Commit a23688d

Browse files
authored
fix(appium): missing await on some steps of runOnIOS and runOnAndroid (#4018)
1 parent ff81e2a commit a23688d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Diff for: lib/helper/Appium.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ class Appium extends Webdriver {
423423
async runOnIOS(caps, fn) {
424424
if (this.platform !== 'ios') return;
425425
recorder.session.start('iOS-only actions');
426-
this._runWithCaps(caps, fn);
427-
recorder.add('restore from iOS session', () => recorder.session.restore());
426+
await this._runWithCaps(caps, fn);
427+
await recorder.add('restore from iOS session', () => recorder.session.restore());
428428
return recorder.promise();
429429
}
430430

@@ -465,8 +465,8 @@ class Appium extends Webdriver {
465465
async runOnAndroid(caps, fn) {
466466
if (this.platform !== 'android') return;
467467
recorder.session.start('Android-only actions');
468-
this._runWithCaps(caps, fn);
469-
recorder.add('restore from Android session', () => recorder.session.restore());
468+
await this._runWithCaps(caps, fn);
469+
await recorder.add('restore from Android session', () => recorder.session.restore());
470470
return recorder.promise();
471471
}
472472

Diff for: test/helper/AppiumV2_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -716,23 +716,23 @@ describe('Appium', function () {
716716
await app.see('Welcome to register a new User');
717717
});
718718

719-
it('should execute only on Android @quick', () => {
719+
it('should execute only on Android @quick', async () => {
720720
let platform = null;
721-
app.runOnIOS(() => {
721+
await app.runOnIOS(() => {
722722
platform = 'ios';
723723
});
724-
app.runOnAndroid(() => {
724+
await app.runOnAndroid(() => {
725725
platform = 'android';
726726
});
727-
app.runOnAndroid({ platformVersion: '7.0' }, () => {
727+
await app.runOnAndroid({ platformVersion: '7.0' }, () => {
728728
platform = 'android7';
729729
});
730730

731731
assert.equal('android', platform);
732732
});
733733

734-
it('should execute only on Android >= 5.0 @quick', () => {
735-
app.runOnAndroid(caps => caps.platformVersion >= 5, () => {});
734+
it('should execute only on Android >= 5.0 @quick', async () => {
735+
await app.runOnAndroid(caps => caps.platformVersion >= 5, () => {});
736736
});
737737

738738
it('should execute only in Web', () => {

0 commit comments

Comments
 (0)