-
-
Notifications
You must be signed in to change notification settings - Fork 159
added system_time endpoint #361
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
Conversation
@@ -15,6 +15,7 @@ module Device | |||
device_locked?: 'session/:session_id/appium/device/is_locked' | |||
}, | |||
get: { | |||
get_device_time: 'session/:sessionId/appium/device/system_time', |
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.
We should follow Ruby coding conventions and not use get
prefixes in method names. So the better name would be device_time
.
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.
Just wondering since all the other endpoints are session/:session_id
but this one is session/:sessionId
. Is this correct?
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.
@JaniJegoroff https://github.com/appium/node-mobile-json-wire-protocol/blob/master/lib/routes.js#L294 It should be "sessionId" not "session_id".
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.
Just wondering since all the other endpoints are session/:session_id but this one is session/:sessionId. Is this correct?
@JaniJegoroff https://github.com/appium/node-mobile-json-wire-protocol/blob/master/lib/routes.js#L294 It should be "sessionId" not "session_id".
@bootstraponline What do you think about this? Quickly looking the code there's some kind of patching done for session_id
's.
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.
:sessionId
is wrong. routes.js is JavaScript, not Ruby. Device methods in Ruby are specified like this:
session/:session_id/appium/device/
Hi, this should have a test. |
Will update the tests as well soon |
@bootstraponline @JaniJegoroff Could you please help me in tests i added, on what value i can assert the device date time? |
I'm assuming the date time is reported in a certain format that can be matched generically with the use of a regular expression. |
@bootstraponline But that changes with the time zone right? sample result: Fri Jan 29 23:53:35 IST 2016 |
> 'Fri Jan 29 23:53:35 IST 2016'.match /\d{2}:\d{2}:\d{2}/
=> #<MatchData "23:53:35"> All we care about is that the server returned something reasonable, it doesn't matter what. The actual device time tests should already exist in the appium node.js repo and hopefully they're mocking the device time. |
This should work:
|
Please squash to one commit.
|
Why not |
e9fe84d
to
c5637a5
Compare
Date.parse could again needs the regular expression.Both does the same right? |
because all we care about is that the server responded with something resembling a date. If the appium server is sending invalid dates then that should be detected by the JavaScript tests in the server repo, not the Ruby bindings. I don't think appium server has any guarantees that the returned date will work with Ruby's Date.parse. The idea is for the test to be resilient if/when appium decides to change their date format. |
Squashed now @bootstraponline |
No, it doesn't need a regex. > Date.parse 'Fri Jan 29 23:53:35 IST 2016'
=> #<Date: 2016-01-29 ((2457417j,0s,0n),+0s,2299161j)> It means if appium gives us an invalid date then the Ruby test will fail, which I think is wrong. We're not testing that appium returns valid dates since that's beyond the scope of the client bindings. |
Looks good to me. Unless @bayandin has a good argument for why we should validate the date at the Ruby layer then I'm ready to merge. |
Ok Got it.Thanks @bootstraponline |
@bootstraponline I'm completely agree with you, but it seems |
oh, I didn't think of it like that. I agree Date.parse is better then.
I think we'll want to be more strict than just a string so we'll go with Date.parse. Thanks for commenting! @SrinivasanTarget the test can be updated to just be |
@SrinivasanTarget needs to be squashed to one commit :) then it'll be ready to merge. |
8b64265
to
02a3f5f
Compare
Yup Squashed @bootstraponline |
added system_time endpoint
merged! Thanks for contributing to appium. |
Thanks @bootstraponline @bayandin |
Just wondering, is there somewhere |
Yes it has to be.Shit missed it.I saw in one example now! |
I released 8.0.2 to Rubygems. |
|
What is the reason for this error @bootstraponline ? |
The appium server doesn't recognize the endpoint.
|
Usually how does an endpoint been activated in mjsonwp/appium? |
My guess is the appium devs only added this new endpoint for appium 1.5 and it wasn't accepted into 1.4. |
Yes i raised PR only on 1.5 branch |
ok, it should work in 1.5 then (I don't use that for testing hence the failure). |
Ok Thanks @bootstraponline |
will run in 1.5 and check |
I don't see endpoint in 1.5 yet.
|
You probably need the latest revision from the 1.5 branch. |
I tried against revision whatever is installed with command |
I think you'd have to use nightly and not beta. |
Actually, it looks like beta is in sync with 1.5 branch commits. |
really? d19c85fa5aa8359ea81f5fbe8c3fe977b45ea526 isn't the latest though. |
I was looking the recent changes. I updated beta version and
|
awesome! good to know that beta is tracking the 1.5 branch. |
https://github.com/appium/node-mobile-json-wire-protocol/issues/40