-
-
Notifications
You must be signed in to change notification settings - Fork 764
#732 FIX #733
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
#732 FIX #733
Conversation
@welnanick you can can comment the PR if you have something to say about this :) |
} | ||
|
||
default Object getSessionDetail(String detail) { | ||
return getSessionDetails().get(detail); | ||
} | ||
|
||
/** | ||
* @return name of the current mobile platform. | ||
*/ | ||
default String getPlatformName() { |
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'd also mark these with Nullable annotation
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.
same comment for the stuff below
boolean isBrowser(); | ||
default boolean isBrowser() { | ||
return ofNullable(getSessionDetail("browserName")) | ||
.map(browserName -> browserName.toString()) |
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.
can be String::valueOf
@@ -34,26 +35,46 @@ | |||
@SuppressWarnings("unchecked") | |||
default Map<String, Object> getSessionDetails() { | |||
Response response = execute(GET_SESSION); | |||
Map<String, Object> resultMap = Map.class.cast(response.getValue()); | |||
|
|||
return ImmutableMap.<String, Object>builder() |
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.
It might be helpful to have a comment here about why additional filtering is necessary
@Override public boolean isBrowser() { | ||
return !getContext().toLowerCase().contains("NATIVE_APP".toLowerCase()); | ||
return super.isBrowser() | ||
&& !getContext().toLowerCase().contains("NATIVE_APP".toLowerCase()); |
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.
Apache's StringUtils has StringUtils.containsIgnoreCase method
Overall good, just several minor things |
@mykola-mokhnach I made improvements. |
@@ -34,26 +36,47 @@ | |||
@SuppressWarnings("unchecked") | |||
default Map<String, Object> getSessionDetails() { | |||
Response response = execute(GET_SESSION); | |||
Map<String, Object> resultMap = Map.class.cast(response.getValue()); | |||
|
|||
//this filtering was added to clear returned result. |
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.
-> was added to avoid unexpected NPE on putAll call if the response map contains null value(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.
@mykola-mokhnach Not only for this purpose. I think empty strings is not useful data and it increases complexity of further operations. So let there will be something useful or null-value when user tries
driver.getSessionDetail("someDetail")
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.
of course, just mention the same thing in the comment
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.
LGTM
@SrinivasanTarget have you run iOS test in legacy and xCUIT mode? What was the result? Could you try to run some browser/webview script in xCUIT mode and check class of elements that are found? What the result? |
Srini, was on vacation. if he is not back today ... I can help run tests on iOS and close it today .... |
Yup i did tested on XCUIT mode including native and webviews but i dont have old xcode to test in legacy mode. Everything looks perfectly fine in XCUIT mode. Will download xcode 7.0.1 and give a try today. Code looks good to me as well. Will keep you posted about legacy mode (including native and webviews) |
Is there a way I can build this locally to verify my issue is fixed? Do I just clone the repo and run a gradle build? |
@welnanick You can try this,
|
@SrinivasanTarget Alright, once I get a chance here in a few minutes I'll try that and let you all know the results. |
Thanks @welnanick |
What you suggested to try to get the build didn't work, I get this error through gradle:
|
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.
Tested, everything looks fine on both legacy and XCUIT modes.
Change list
#732 FIX
Types of changes
Details
Also I found out that logic of Selenium Capabilities has changed since Jan'2017 and
capabilities.getCapability("platformName")
is not the same as the platform name that user gives to start Android/iOS/Windows session.@SrinivasanTarget Could you run iOS tests with this change?
I am looking forward to improve tests to make them run on Sauce env (will be the next PR).