Skip to content

Commit

Permalink
Preventing crash and removing promise delay
Browse files Browse the repository at this point in the history
  • Loading branch information
solvd authored and solvd committed Aug 17, 2023
1 parent 489ad70 commit f5b74c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/units/ios-device/plugins/screen/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ module.exports = syrup.serial()
}

// #770: Reset rotation to Portrait when closing device
WdaClient.rotation({orientation: 'PORTRAIT'})
Promise.delay(3000).then(() => stoppingSession())

const rotationPromise = new Promise((resolve, reject) => {
// Ensure that rotation is done, then stop session
WdaClient.rotation({orientation: 'PORTRAIT'})
resolve()
})

rotationPromise.then(() => stoppingSession())
})
ws.on('error', function() {
// @TODO handle error event
Expand Down
14 changes: 12 additions & 2 deletions lib/units/ios-device/plugins/wda/WdaClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,23 @@ module.exports = syrup.serial()
return resolve(response)
})
.catch(err => {
let errMes = err.error.value.message

// #762: Skip lock error message
if (err.error.value.message.includes('Timed out while waiting until the screen gets locked')) {
if (errMes.includes('Timed out while waiting until the screen gets locked')) {
return
}
if (err.error.value.message.includes('Unable To Rotate Device')) {

// #765: Skip rotation error message
if (errMes.includes('Unable To Rotate Device')) {
return log.info('The current application does not support rotation')
}

// #770 Skip session crash, immediately restart after Portrait mode reset
if (errMes.includes('Session does not exist')) {
return this.startSession()
}

recoverDevice()
// #409: capture wda/appium crash asap and exit with status 1 from stf
//notifier.setDeviceTemporaryUnavialable(err)
Expand Down

0 comments on commit f5b74c6

Please sign in to comment.