Skip to content

Commit cc82852

Browse files
authored
fix(appium): issue with async on runOnIos and runOnAndroid (#4525)
* fix: issue with async * fix: issue with async
1 parent 4aafd75 commit cc82852

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/helper/Appium.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ class Appium extends Webdriver {
434434
async runOnIOS(caps, fn) {
435435
if (this.platform !== 'ios') return
436436
recorder.session.start('iOS-only actions')
437-
await this._runWithCaps(caps, fn)
438-
await recorder.add('restore from iOS session', () => recorder.session.restore())
437+
this._runWithCaps(caps, fn)
438+
recorder.add('restore from iOS session', () => recorder.session.restore())
439439
return recorder.promise()
440440
}
441441

@@ -476,8 +476,8 @@ class Appium extends Webdriver {
476476
async runOnAndroid(caps, fn) {
477477
if (this.platform !== 'android') return
478478
recorder.session.start('Android-only actions')
479-
await this._runWithCaps(caps, fn)
480-
await recorder.add('restore from Android session', () => recorder.session.restore())
479+
this._runWithCaps(caps, fn)
480+
recorder.add('restore from Android session', () => recorder.session.restore())
481481
return recorder.promise()
482482
}
483483

@@ -503,7 +503,7 @@ class Appium extends Webdriver {
503503
}
504504
/* eslint-enable */
505505

506-
async _runWithCaps(caps, fn) {
506+
_runWithCaps(caps, fn) {
507507
if (typeof caps === 'object') {
508508
for (const key in caps) {
509509
// skip if capabilities do not match

test/helper/AppiumV2_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -767,23 +767,23 @@ describe('Appium', function () {
767767
await app.see('Welcome to register a new User')
768768
})
769769

770-
it('should execute only on Android @quick', async () => {
770+
it('should execute only on Android @quick', () => {
771771
let platform = null
772-
await app.runOnIOS(() => {
772+
app.runOnIOS(() => {
773773
platform = 'ios'
774774
})
775-
await app.runOnAndroid(() => {
775+
app.runOnAndroid(() => {
776776
platform = 'android'
777777
})
778-
await app.runOnAndroid({ platformVersion: '7.0' }, () => {
778+
app.runOnAndroid({ platformVersion: '7.0' }, () => {
779779
platform = 'android7'
780780
})
781781

782782
assert.equal('android', platform)
783783
})
784784

785-
it('should execute only on Android >= 5.0 @quick', async () => {
786-
await app.runOnAndroid(
785+
it('should execute only on Android >= 5.0 @quick', () => {
786+
app.runOnAndroid(
787787
(caps) => caps.platformVersion >= 5,
788788
() => {},
789789
)

0 commit comments

Comments
 (0)