From ac9218683ea3f441edde470bb750a00334ca6e33 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Fri, 25 Oct 2024 09:44:48 +0200 Subject: [PATCH 1/2] fix: issue with async --- .github/workflows/appiumV2_Android.yml | 1 + lib/helper/Appium.js | 10 +++++----- test/helper/AppiumV2_test.js | 12 ++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/appiumV2_Android.yml b/.github/workflows/appiumV2_Android.yml index 2b4a0f3eb..99e11cd7c 100644 --- a/.github/workflows/appiumV2_Android.yml +++ b/.github/workflows/appiumV2_Android.yml @@ -4,6 +4,7 @@ on: push: branches: - 3.x + - fix-appium-issues-with-async env: CI: true diff --git a/lib/helper/Appium.js b/lib/helper/Appium.js index 58b17335b..ff7e7953a 100644 --- a/lib/helper/Appium.js +++ b/lib/helper/Appium.js @@ -434,8 +434,8 @@ class Appium extends Webdriver { async runOnIOS(caps, fn) { if (this.platform !== 'ios') return recorder.session.start('iOS-only actions') - await this._runWithCaps(caps, fn) - await recorder.add('restore from iOS session', () => recorder.session.restore()) + this._runWithCaps(caps, fn) + recorder.add('restore from iOS session', () => recorder.session.restore()) return recorder.promise() } @@ -476,8 +476,8 @@ class Appium extends Webdriver { async runOnAndroid(caps, fn) { if (this.platform !== 'android') return recorder.session.start('Android-only actions') - await this._runWithCaps(caps, fn) - await recorder.add('restore from Android session', () => recorder.session.restore()) + this._runWithCaps(caps, fn) + recorder.add('restore from Android session', () => recorder.session.restore()) return recorder.promise() } @@ -503,7 +503,7 @@ class Appium extends Webdriver { } /* eslint-enable */ - async _runWithCaps(caps, fn) { + _runWithCaps(caps, fn) { if (typeof caps === 'object') { for (const key in caps) { // skip if capabilities do not match diff --git a/test/helper/AppiumV2_test.js b/test/helper/AppiumV2_test.js index 16272b84d..15e22c9f4 100644 --- a/test/helper/AppiumV2_test.js +++ b/test/helper/AppiumV2_test.js @@ -767,23 +767,23 @@ describe('Appium', function () { await app.see('Welcome to register a new User') }) - it('should execute only on Android @quick', async () => { + it('should execute only on Android @quick', () => { let platform = null - await app.runOnIOS(() => { + app.runOnIOS(() => { platform = 'ios' }) - await app.runOnAndroid(() => { + app.runOnAndroid(() => { platform = 'android' }) - await app.runOnAndroid({ platformVersion: '7.0' }, () => { + app.runOnAndroid({ platformVersion: '7.0' }, () => { platform = 'android7' }) assert.equal('android', platform) }) - it('should execute only on Android >= 5.0 @quick', async () => { - await app.runOnAndroid( + it('should execute only on Android >= 5.0 @quick', () => { + app.runOnAndroid( (caps) => caps.platformVersion >= 5, () => {}, ) From 77b5b82bbdd7769bdc4412a37c5744b1c5bfc925 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Fri, 25 Oct 2024 09:51:01 +0200 Subject: [PATCH 2/2] fix: issue with async --- .github/workflows/appiumV2_Android.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/appiumV2_Android.yml b/.github/workflows/appiumV2_Android.yml index 99e11cd7c..2b4a0f3eb 100644 --- a/.github/workflows/appiumV2_Android.yml +++ b/.github/workflows/appiumV2_Android.yml @@ -4,7 +4,6 @@ on: push: branches: - 3.x - - fix-appium-issues-with-async env: CI: true