-
-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement WDA restart for unexpected crashes #2531
base: master
Are you sure you want to change the base?
Changes from all commits
66f5bba
acb00af
8682769
add2077
5da6a48
2bf35ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,8 +89,8 @@ export default { | |
if (rewroteSelector) { | ||
this.log.info( | ||
`Rewrote incoming selector from '${initSelector}' to ` + | ||
`'${selector}' to match XCUI type. You should consider ` + | ||
`updating your tests to use the new selectors directly`, | ||
`'${selector}' to match XCUI type. You should consider ` + | ||
`updating your tests to use the new selectors directly`, | ||
); | ||
} | ||
|
||
|
@@ -122,7 +122,10 @@ export default { | |
els = /** @type {Element[]|undefined} */ ( | ||
await this.proxyCommand(endpoint, method, body) | ||
); | ||
} catch { | ||
} catch (err) { | ||
if (err.message && err.message.match(/socket hang up/)) { | ||
throw err; | ||
} | ||
els = []; | ||
} | ||
// we succeed if we get some elements | ||
|
@@ -132,6 +135,9 @@ export default { | |
if (err.message && err.message.match(/Condition unmet/)) { | ||
// condition was not met setting res to empty array | ||
els = []; | ||
} | ||
else if (err.message && err.message.match(/socket hang up/)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure how what difference this condition makes here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the error message in case of socket hangups for find element commands was getting overriden by NoSuchElementError which makes it undetectable in driver.js file, hence we are trying to bubble it up as socket hang up only to be able to identify on driver.js level and trigger the restart flow |
||
throw err; | ||
} else { | ||
throw err; | ||
} | ||
|
@@ -193,7 +199,7 @@ function rewriteMagicScrollable(mult, log = null) { | |
} | ||
log?.info( | ||
'Rewrote request for scrollable descendants to class chain ' + | ||
`format with selector '${selector}'`, | ||
`format with selector '${selector}'`, | ||
); | ||
return [strategy, selector]; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,7 +383,11 @@ const desiredCapConstraints = /** @type {const} */ ({ | |
pageLoadStrategy: { | ||
isString: true, | ||
inclusionCaseInsensitive: ['none', 'eager', 'normal'] | ||
} | ||
}, | ||
enableWdaRestart: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the capability name is too broad. I would rather use something like |
||
presence: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the default setting, so not needed |
||
isBoolean: true, | ||
}, | ||
}); | ||
|
||
export {desiredCapConstraints, PLATFORM_NAME_IOS, PLATFORM_NAME_TVOS}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the regexp should be moved to a global constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do something like
SOCKET_HANG_UP_PATTERN.test(err.message)
instead