From acc0ea6e208d6212800689dfb0f5807d942b3214 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Wed, 22 Nov 2023 13:09:03 +0100 Subject: [PATCH 1/2] fix(appium): missing await on some steps --- lib/helper/Appium.js | 8 ++++---- test/helper/AppiumV2_test.js | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/helper/Appium.js b/lib/helper/Appium.js index c6e2b9f44..adaa81bb3 100644 --- a/lib/helper/Appium.js +++ b/lib/helper/Appium.js @@ -423,8 +423,8 @@ class Appium extends Webdriver { async runOnIOS(caps, fn) { if (this.platform !== 'ios') return; recorder.session.start('iOS-only actions'); - this._runWithCaps(caps, fn); - recorder.add('restore from iOS session', () => recorder.session.restore()); + await this._runWithCaps(caps, fn); + await recorder.add('restore from iOS session', () => recorder.session.restore()); return recorder.promise(); } @@ -465,8 +465,8 @@ class Appium extends Webdriver { async runOnAndroid(caps, fn) { if (this.platform !== 'android') return; recorder.session.start('Android-only actions'); - this._runWithCaps(caps, fn); - recorder.add('restore from Android session', () => recorder.session.restore()); + await this._runWithCaps(caps, fn); + await recorder.add('restore from Android session', () => recorder.session.restore()); return recorder.promise(); } diff --git a/test/helper/AppiumV2_test.js b/test/helper/AppiumV2_test.js index 540f1765d..98bbfa501 100644 --- a/test/helper/AppiumV2_test.js +++ b/test/helper/AppiumV2_test.js @@ -716,23 +716,23 @@ describe('Appium', function () { await app.see('Welcome to register a new User'); }); - it('should execute only on Android @quick', () => { + it.only('should execute only on Android @quick', async () => { let platform = null; - app.runOnIOS(() => { + await app.runOnIOS(() => { platform = 'ios'; }); - app.runOnAndroid(() => { + await app.runOnAndroid(() => { platform = 'android'; }); - app.runOnAndroid({ platformVersion: '7.0' }, () => { + await app.runOnAndroid({ platformVersion: '7.0' }, () => { platform = 'android7'; }); assert.equal('android', platform); }); - it('should execute only on Android >= 5.0 @quick', () => { - app.runOnAndroid(caps => caps.platformVersion >= 5, () => {}); + it('should execute only on Android >= 5.0 @quick', async () => { + await app.runOnAndroid(caps => caps.platformVersion >= 5, () => {}); }); it('should execute only in Web', () => { From 2cb0225fc5a9780f5833b28eff3bd73979d0f320 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Wed, 22 Nov 2023 13:11:49 +0100 Subject: [PATCH 2/2] remove .only --- test/helper/AppiumV2_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helper/AppiumV2_test.js b/test/helper/AppiumV2_test.js index 98bbfa501..f6871d89a 100644 --- a/test/helper/AppiumV2_test.js +++ b/test/helper/AppiumV2_test.js @@ -716,7 +716,7 @@ describe('Appium', function () { await app.see('Welcome to register a new User'); }); - it.only('should execute only on Android @quick', async () => { + it('should execute only on Android @quick', async () => { let platform = null; await app.runOnIOS(() => { platform = 'ios';