Skip to content
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

Fix session payload for W3C #913

Merged
merged 3 commits into from
Jun 13, 2018
Merged

Fix session payload for W3C #913

merged 3 commits into from
Jun 13, 2018

Conversation

SrinivasanTarget
Copy link
Member

Change list

Fix appium/dotnet-client#229

https://github.com/jlipps/simple-wd-spec#processing-capabilities

Types of changes

What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

@dpgraham @mykola-mokhnach ping

@@ -268,12 +268,9 @@ public void writeTo(Appendable appendable) throws IOException {
json.name(CAPABILITIES);
json.beginObject();

json.name(DESIRED_CAPABILITIES);
json.name(ALWAYS_MATCH);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like we were writing DESIRED_CAPABILITIES twice before

Copy link
Contributor

@dpgraham dpgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Is anyone able to fix the C# client too?

@SrinivasanTarget
Copy link
Member Author

@dpgraham It doesn't initiate w3c post this change instead it instantiates JSWP sesson so i'm revisiting this in sometime.

@SrinivasanTarget
Copy link
Member Author

SrinivasanTarget commented Jun 6, 2018

@mykola-mokhnach @dpgraham I make the changes and java client session payload is as same as other clients now.

For w3c,

[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"app":"/Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk","automationName":"UIAutomator2","platformName":"Android","deviceName":"Android Emulator"},"capabilities":{"alwaysMatch":{"appium:app":"/Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk","appium:automationName":"UIAutomator2","appium:deviceName":"Android Emulator","platformName":"android"},"firstMatch":[{}]}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk","automationName":"UIAutomator2","platformName":"Android","deviceName":"Android Emulator"},null,{"alwaysMatch":{"appium:app":"/Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk","appium:automationName":"UIAutomator2","appium:deviceName":"Android Emulator","platformName":"android"},"firstMatch":[{}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1528309687741 (23:58:07 GMT+0530 (IST))
[Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session
[Appium] Capabilities:
[Appium]   platformName: android
[Appium]   app: /Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk
[Appium]   automationName: UIAutomator2
[Appium]   deviceName: Android Emulator
[debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities [object Object] were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[BaseDriver] Session created with session id: 52ef9fd7-ceb1-46c0-8bee-0db707686b51

For MJSWP,

[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"app":"/Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk","automationName":"UIAutomator2","platformName":"Android","deviceName":"Android Emulator"},"capabilities":{"alwaysMatch":{"platformName":"android"},"firstMatch":[{}]}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk","automationName":"UIAutomator2","platformName":"Android","deviceName":"Android Emulator"},null,{"alwaysMatch":{"platformName":"android"},"firstMatch":[{}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1528310015357 (00:03:35 GMT+0530 (IST))
[Appium] Could not parse W3C capabilities: 'deviceName' can't be blank. Falling back to JSONWP protocol.
[Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: ["app","automationName","platformName","deviceName"]. Falling back to JSONWP protocol.
[Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session
[Appium] Capabilities:
[Appium]   app: /Users/ssekar/workspace/java-client/src/test/java/io/appium/java_client/ApiDemos-debug.apk
[Appium]   automationName: UIAutomator2
[Appium]   platformName: Android
[Appium]   deviceName: Android Emulator
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {"app":"/Users/ssekar/works...
[BaseDriver] Session created with session id: 5b2fa500-f32d-4be9-906a-95e58b2a5ffd

Payload was like this before the change,

{
  "desiredCapabilities": {...},
  "capabilities": {
    "desiredCapabilities": {...},
    "firstMatch": [{...}]
  }
}

@dpgraham
Copy link
Contributor

dpgraham commented Jun 7, 2018

Looks good.

@SrinivasanTarget SrinivasanTarget merged commit a50785e into appium:master Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

W3C capabilities are incorrect
4 participants