Conversation
A workaround for WinAppDriver. For some messages, WinAppDriver doesn't return value when status is 0.
Codecov Report
@@ Coverage Diff @@
## master #4369 +/- ##
==========================================
+ Coverage 99.32% 99.32% +<.01%
==========================================
Files 180 180
Lines 4414 4415 +1
Branches 950 951 +1
==========================================
+ Hits 4384 4385 +1
Misses 27 27
Partials 3 3
Continue to review full report at Codecov.
|
mgrybyk
left a comment
There was a problem hiding this comment.
Got some thoughts on it.
Can it break somehow something else? When status is 0 for other drivers except of WinApp?
| @@ -22,8 +22,14 @@ export function isSuccessfulResponse (statusCode, body) { | |||
| * response contains a body | |||
| */ | |||
| if (!body || typeof body.value === 'undefined') { | |||
There was a problem hiding this comment.
I think overall condition can be improved to avoid nested conditions
There was a problem hiding this comment.
I thought about that, and my first local copy is in one line.
splitting it to nested condition would make easy to read. Otherwise I have to write test case on it to provide more context.
I have no knowledge about other drivers. |
| if (!body || typeof body.value === 'undefined') { | ||
| log.debug('request failed due to missing body') | ||
| return false | ||
| if (body && body.status === 0) { |
There was a problem hiding this comment.
if (body
This will be always be true given that the parent if clause starts with
if (!body
| return false | ||
| if (body && body.status === 0) { | ||
| /** | ||
| * A workaround for WinAppDriver. For some messages, WinAppDriver doesn't return value when status is 0. |
There was a problem hiding this comment.
This should be fixed in WinAppDriver then. WebdriverIO follows the W3C standard and so should the driver.
|
Will close this as the issue should rather be fixed in WinAppDriver to follow the protocol rather than here. |
|
For people who have the same problem, you can workaround the problem by customized webdriver. |
I do not recommend using this custom |
Proposed changes
WinAppDriver is a service to support Selenium-like UI Test Automation on Windows Applications.
For some message like click, the return message is
{"sessionId":"19C1CE26-1887-4DA1-AD04-521307B5445C","status":0}which doesn't include value. then WebDriverIO consider it as failed message and will retry.This pullrequest try to consider value is optional when status=0 to workaround WinAppDriver problem.
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/technical-committee