Skip to content

Commit

Permalink
[js] rewrite webdriver.logging as a pure node module
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyba committed Jan 25, 2016
1 parent 3c1f820 commit 2e0a0bd
Show file tree
Hide file tree
Showing 11 changed files with 963 additions and 23 deletions.
2 changes: 1 addition & 1 deletion javascript/node/selenium-webdriver/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Builder.prototype.setProxy = function(config) {
/**
* Sets the logging preferences for the created session. Preferences may be
* changed by repeated calls, or by calling {@link #withCapabilities}.
* @param {!(webdriver.logging.Preferences|Object.<string, string>)} prefs The
* @param {!(./lib/logging.Preferences|Object<string, string>)} prefs The
* desired logging preferences.
* @return {!Builder} A self reference.
*/
Expand Down
4 changes: 2 additions & 2 deletions javascript/node/selenium-webdriver/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ var Options = function() {
/** @private {!Array.<(string|!Buffer)>} */
this.extensions_ = [];

/** @private {?webdriver.logging.Preferences} */
/** @private {?./lib/logging.Preferences} */
this.logPrefs_ = null;

/** @private {?webdriver.ProxyConfig} */
Expand Down Expand Up @@ -530,7 +530,7 @@ Options.prototype.setUserPreferences = function(prefs) {

/**
* Sets the logging preferences for the new session.
* @param {!webdriver.logging.Preferences} prefs The logging preferences.
* @param {!./lib/logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
Options.prototype.setLoggingPrefs = function(prefs) {
Expand Down
4 changes: 2 additions & 2 deletions javascript/node/selenium-webdriver/firefox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var Options = function() {
/** @private {Binary} */
this.binary_ = null;

/** @private {webdriver.logging.Preferences} */
/** @private {./lib/logging.Preferences} */
this.logPrefs_ = null;

/** @private {webdriver.ProxyConfig} */
Expand Down Expand Up @@ -162,7 +162,7 @@ Options.prototype.setBinary = function(binary) {

/**
* Sets the logging preferences for the new session.
* @param {webdriver.logging.Preferences} prefs The logging preferences.
* @param {./lib/logging.Preferences} prefs The logging preferences.
* @return {!Options} A self reference.
*/
Options.prototype.setLoggingPreferences = function(prefs) {
Expand Down
2 changes: 1 addition & 1 deletion javascript/node/selenium-webdriver/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const url = require('url');
const error = require('../error');
const base = require('../lib/_base');
const cmd = require('../lib/command');
const logging = base.require('webdriver.logging');
const logging = require('../lib/logging');



Expand Down
6 changes: 2 additions & 4 deletions javascript/node/selenium-webdriver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var builder = require('./builder');
var error = require('./error');
var base = require('./lib/_base');
var command = require('./lib/command');
var logging = require('./lib/logging');


// NOTE: the remainder of this file is nasty and verbose, but the annotations
Expand Down Expand Up @@ -114,10 +115,7 @@ exports.WebElementPromise = base.require('webdriver.WebElementPromise');
}));


/** @type {webdriver.logging.} */
(exports.__defineGetter__('logging', function() {
return base.exportPublicApi('webdriver.logging');
}));
exports.logging = logging;


/** @type {webdriver.promise.} */
Expand Down
8 changes: 5 additions & 3 deletions javascript/node/selenium-webdriver/lib/_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ function Context(opt_configureForTesting) {
goog: {},
webdriver: {
get Command() { return require('./command').Command; },
get CommandName() { return require('./command').Name; }
// get CommandExecutor() { return require('./command').Executor; }
get CommandName() { return require('./command').Name; },
get CommandExecutor() { return require('./command').Executor; },
get logging() { return require('./logging'); }
}
});
closure.window = closure.top = closure;
Expand All @@ -132,7 +133,8 @@ function Context(opt_configureForTesting) {

let provide = closure.goog.provide;
closure.goog.provide = function(symbol) {
if (symbol.startsWith('webdriver.Command')) {
if (symbol.startsWith('webdriver.Command')
|| symbol.startsWith('webdriver.logging')) {
return;
}
provide(symbol);
Expand Down
Loading

0 comments on commit 2e0a0bd

Please sign in to comment.