-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[js] Allow SafariDriver to use Safari Technology Preview #3422
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
ebd15a9
to
d8357d4
Compare
@jleyba do you mind taking a look at this? thx in advance... |
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.
boolean
, not Boolean
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.
Updated the PR with code review feedback
d8357d4
to
bb72a01
Compare
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.
This will always be false. You don't set the capability on the top-level capabilities object.
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.
As requested, the capability is not set on the top-level capabilities objects.
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 meant you need to properly handle extracting options from the capabilities object.
For consistency with Java, you should end up with something alone the lines of
// Some details omitted for brevity
class Options {
setTechnologyPreview(preview) {
this.options_['technologyPreview'] = !!preview;
return this;
}
}
function useTechnologyPreview(obj) {
if (obj instanceof Options) {
return !!obj.options_['technologyPreview']
}
if (obj && typeof obj === 'object') {
return !!obj['technologyPreview'];
}
return false;
}
class Driver extends webdriver.WebDriver {
static createSession(opt_config, opt_flow) {
let caps, exe;
if (opt_config instanceof Options) {
caps = opt_config.toCapabilities();
} else {
caps = opt_config || Capabilities.safari();
}
if (useTechnologyPreview(caps.get(OPTIONS_CAPABILITY_KEY))) {
exe = SAFARIDRIVER_TECHNOLOGY_PREVIEW_EXE;
}
// ...
}
}
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.
@jleyba, ah gotcha! Pushing up an update in a few minutes...
add2ae2
to
d249070
Compare
@jleyba, does everything look okay or is there any more feedback in case I missed something? |
f7463a9
to
e26c37c
Compare
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.
One more nit
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.
options_
may be null. Need:
!!(o.options_ && o.options_[TECHNOLOGY_PREVIEW_OPTIONS_KEY]);
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.
@jleyba null-check included
Update CHANGES.md with note that SafariDriver JS bindings now supports Safari Technology Preview Use correct Closure Compiler annotation for boolean parameters Set technologyPreview capability on the top-level capabilities object To be consistent with Java, set technologyPreview boolean in options object and properly extract the options object when creating a session Add Closer Compiler annotations to useTechnologyPreview helper function Null check the options_ object within useTechnologyPreview helper function
e26c37c
to
cee6b5c
Compare
X
in the preceding checkbox, I verify that I have signed the Contributor License Agreement