Socket
Socket
Sign inDemoInstall

protractor

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protractor - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

globals.d.ts

22

built/browser.js

@@ -48,3 +48,4 @@ "use strict";

* Mix a function from one object onto another. The function will still be
* called in the context of the original object.
* called in the context of the original object. Any arguments of type
* `ElementFinder` will be unwrapped to their underlying `WebElement` instance
*

@@ -57,4 +58,9 @@ * @private

*/
function mixin(to, from, fnName, setupFn) {
function ptorMixin(to, from, fnName, setupFn) {
to[fnName] = function () {
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] instanceof element_1.ElementFinder) {
arguments[i] = arguments[i].getWebElement();
}
}
if (setupFn) {

@@ -110,6 +116,6 @@ setupFn();

if (methodsToSync.indexOf(method) !== -1) {
mixin(_this, webdriverInstance, method, _this.waitForAngular.bind(_this));
ptorMixin(_this, webdriverInstance, method, _this.waitForAngular.bind(_this));
}
else {
mixin(_this, webdriverInstance, method);
ptorMixin(_this, webdriverInstance, method);
}

@@ -633,3 +639,3 @@ }

var nav = this.driver.navigate();
mixin(nav, this, 'refresh');
ptorMixin(nav, this, 'refresh');
return nav;

@@ -687,5 +693,5 @@ };

* debug> repl
* Press Ctrl + C to leave rdebug repl
* > ptor.findElement(protractor.By.input('user').sendKeys('Laura'));
* > ptor.debugger();
* > element(by.input('user')).sendKeys('Laura');
* > browser.debugger();
* Press Ctrl + c to leave debug repl
* debug> c

@@ -692,0 +698,0 @@ *

@@ -405,6 +405,7 @@ "use strict";

noSuchErr = e;
noSuchErr.stack = noSuchErr.stack + callerError.stack;
noSuchErr.stack =
noSuchErr.stack + callerError.stack;
}
else {
noSuchErr = (new Error(e.toString()));
noSuchErr = new Error(e);
noSuchErr.stack = callerError.stack;

@@ -411,0 +412,0 @@ }

@@ -26,2 +26,3 @@ "use strict";

this.setup = pluginFunFactory('setup', PromiseType.Q);
this.onPrepare = pluginFunFactory('onPrepare', PromiseType.Q);
this.teardown = pluginFunFactory('teardown', PromiseType.Q);

@@ -28,0 +29,0 @@ this.postResults = pluginFunFactory('postResults', PromiseType.Q);

@@ -87,3 +87,6 @@ "use strict";

Runner.prototype.runTestPreparer = function () {
return helper.runFilenameOrFn_(this.config_.configDir, this.preparer_);
var _this = this;
return this.plugins_.onPrepare().then(function () {
return helper.runFilenameOrFn_(_this.config_.configDir, _this.preparer_);
});
};

@@ -250,3 +253,3 @@ /**

var testPassed;
var plugins = new plugins_1.Plugins(this.config_);
var plugins = this.plugins_ = new plugins_1.Plugins(this.config_);
var pluginPostTestPromises;

@@ -253,0 +256,0 @@ var browser_;

@@ -16,3 +16,6 @@ // Used to provide better protractor documentation for webdriver. These files

/**
* Protractor's browser object is a wrapper for selenium-webdriver WebDriver.
* Protractor's `browser` object is a wrapper for `selenium-webdriver` WebDriver.
* It inherits call of WebDriver's methods, but only the methods most useful to
* Protractor users are documented here.
*
* A full list of all functions available on WebDriver can be found

@@ -45,2 +48,174 @@ * in the selenium-webdriver

/**
* Creates a new touch sequence using this driver. The sequence will not be
* scheduled for execution until {@link actions.TouchSequence#perform} is
* called.
*
* @example
* browser.touchActions().
* tap(element1).
* doubleTap(element2).
* perform();
*
* @return {!actions.TouchSequence} A new touch sequence for this instance.
*/
webdriver.WebDriver.prototype.touchActions = function() {};
/**
* Schedules a command to execute JavaScript in the context of the currently
* selected frame or window. The script fragment will be executed as the body
* of an anonymous function. If the script is provided as a function object,
* that function will be converted to a string for injection into the target
* window.
*
* Any arguments provided in addition to the script will be included as script
* arguments and may be referenced using the {@code arguments} object.
* Arguments may be a boolean, number, string, or {@linkplain WebElement}.
* Arrays and objects may also be used as script arguments as long as each item
* adheres to the types previously mentioned.
*
* The script may refer to any variables accessible from the current window.
* Furthermore, the script will execute in the window's context, thus
* {@code document} may be used to refer to the current document. Any local
* variables will not be available once the script has finished executing,
* though global variables will persist.
*
* If the script has a return value (i.e. if the script contains a return
* statement), then the following steps will be taken for resolving this
* functions return value:
*
* - For a HTML element, the value will resolve to a {@linkplain WebElement}
* - Null and undefined return values will resolve to null</li>
* - Booleans, numbers, and strings will resolve as is</li>
* - Functions will resolve to their string representation</li>
* - For arrays and objects, each member item will be converted according to
* the rules above
*
* @example
* var el = element(by.module('header'));
* var tag = browser.executeScript('return arguments[0].tagName', el);
* expect(tag).toEqual('h1');
*
* @param {!(string|Function)} script The script to execute.
* @param {...*} var_args The arguments to pass to the script.
* @return {!promise.Promise<T>} A promise that will resolve to the
* scripts return value.
* @template T
*/
webdriver.WebDriver.prototype.executeScript = function(script, var_args) {};
/**
* Schedules a command to execute asynchronous JavaScript in the context of the
* currently selected frame or window. The script fragment will be executed as
* the body of an anonymous function. If the script is provided as a function
* object, that function will be converted to a string for injection into the
* target window.
*
* Any arguments provided in addition to the script will be included as script
* arguments and may be referenced using the {@code arguments} object.
* Arguments may be a boolean, number, string, or {@code WebElement}.
* Arrays and objects may also be used as script arguments as long as each item
* adheres to the types previously mentioned.
*
* Unlike executing synchronous JavaScript with {@link #executeScript},
* scripts executed with this function must explicitly signal they are finished
* by invoking the provided callback. This callback will always be injected
* into the executed function as the last argument, and thus may be referenced
* with {@code arguments[arguments.length - 1]}. The following steps will be
* taken for resolving this functions return value against the first argument
* to the script's callback function:
*
* - For a HTML element, the value will resolve to a
* {@link WebElement}
* - Null and undefined return values will resolve to null
* - Booleans, numbers, and strings will resolve as is
* - Functions will resolve to their string representation
* - For arrays and objects, each member item will be converted according to
* the rules above
*
* @example
* // Example 1
* // Performing a sleep that is synchronized with the currently selected window
* var start = new Date().getTime();
* browser.executeAsyncScript(
* 'window.setTimeout(arguments[arguments.length - 1], 500);').
* then(function() {
* console.log(
* 'Elapsed time: ' + (new Date().getTime() - start) + ' ms');
* });
*
* // Example 2
* // Synchronizing a test with an AJAX application:
* var button = element(by.id('compose-button'));
* button.click();
* browser.executeAsyncScript(
* 'var callback = arguments[arguments.length - 1];' +
* 'mailClient.getComposeWindowWidget().onload(callback);');
* browser.switchTo().frame('composeWidget');
* element(by.id('to')).sendKeys('dog@example.com');
*
* // Example 3
* // Injecting a XMLHttpRequest and waiting for the result. In this example,
* // the inject script is specified with a function literal. When using this
* // format, the function is converted to a string for injection, so it should
* // not reference any symbols not defined in the scope of the page under test.
* browser.executeAsyncScript(function() {
* var callback = arguments[arguments.length - 1];
* var xhr = new XMLHttpRequest();
* xhr.open("GET", "/resource/data.json", true);
* xhr.onreadystatechange = function() {
* if (xhr.readyState == 4) {
* callback(xhr.responseText);
* }
* };
* xhr.send('');
* }).then(function(str) {
* console.log(JSON.parse(str)['food']);
* });
*
* @param {!(string|Function)} script The script to execute.
* @param {...*} var_args The arguments to pass to the script.
* @return {!promise.Promise<T>} A promise that will resolve to the
* scripts return value.
* @template T
*/
webdriver.WebDriver.prototype.executeAsyncScript = (script, var_args) => {};
/**
* Schedules a command to execute a custom function within the context of
* webdriver's control flow.
*
* Most webdriver actions are asynchronous, but the control flow makes sure that
* commands are executed in the order they were received. By running your
* function in the control flow, you can ensure that it is executed before/after
* other webdriver actions. Additionally, Protractor will wait until the
* control flow is empty before deeming a test finished.
*
* @example
* var logText = function(el) {
* return el.getText().then((text) => {
* console.log(text);
* });
* };
* var counter = element(by.id('counter'));
* var button = element(by.id('button'));
* // Use `browser.call()` to make sure `logText` is run before and after
* // `button.click()`
* browser.call(logText, counter);
* button.click();
* browser.call(logText, counter);
*
* @param {function(...): (T|promise.Promise<T>)} fn The function to
* execute.
* @param {Object=} opt_scope The object in whose scope to execute the function
* (i.e. the `this` object for the function).
* @param {...*} var_args Any arguments to pass to the function. If any of the
* arguments are promised, webdriver will wait for these promised to resolve
* and pass the resulting value onto the function.
* @return {!promise.Promise<T>} A promise that will be resolved
* with the function's result.
* @template T
*/
webdriver.WebDriver.prototype.call = function(fn, opt_scope, var_args) {};
/**
* Schedules a command to wait for a condition to hold.

@@ -88,2 +263,19 @@ *

/**
* Schedules a command to retrieve the current page's source. The page source
* returned is a representation of the underlying DOM: do not expect it to be
* formatted or escaped in the same way as the response sent from the web
* server.
* @return {!promise.Promise<string>} A promise that will be
* resolved with the current page source.
*/
webdriver.WebDriver.prototype.getPageSource = function() {};
/**
* Schedules a command to close the current window.
* @return {!promise.Promise<void>} A promise that will be resolved
* when this command has completed.
*/
webdriver.WebDriver.prototype.close = function() {};
/**
* Schedules a command to retrieve the URL of the current page.

@@ -117,2 +309,17 @@ * @returns {!webdriver.promise.Promise.<string>} A promise that will be

/**
* Used to switch WebDriver's focus to a frame or window (e.g. an alert, an
* iframe, another window).
*
* See [WebDriver's TargetLocator Docs](http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_TargetLocator.html)
* for more information.
*
* @example
* browser.switchTo().frame(element(by.tagName('iframe')).getWebElement());
*
* @return {!TargetLocator} The target locator interface for this
* instance.
*/
webdriver.WebDriver.prototype.switchTo = function() {}
// //////////////////////////////////////////////////////////////////////////////

@@ -119,0 +326,0 @@ // //

@@ -9,6 +9,4 @@ {

"tsc": "tsc",
"typings": "typings install",
"postinstall": "typings install",
"pretest": "tsc",
"test": "protractor conf.js"
"pretest": "npm run tsc",
"test": "protractor tmp/conf.js"
},

@@ -18,5 +16,8 @@ "dependencies": {

"protractor": "file:../",
"typescript": "^1.8.10",
"typings": "^1.0.5"
"typescript": "^2.0.0"
},
"devDependencies": {
"@types/jasmine": "^2.2.31",
"@types/node": "^6.0.35"
}
}

@@ -8,7 +8,7 @@ {

"declaration": false,
"noImplicitAny": false
"noImplicitAny": false,
"outDir": "tmp"
},
"exclude": [
"node_modules",
"typings/globals",
"asyncAwait",

@@ -15,0 +15,0 @@ "plugins.ts"

@@ -64,6 +64,2 @@ 'use strict';

gulp.task('typings', function(done) {
runSpawn(done, 'node', ['node_modules/typings/dist/bin.js', 'install']);
});
gulp.task('tsc', function(done) {

@@ -74,3 +70,3 @@ runSpawn(done, 'node', ['node_modules/typescript/bin/tsc']);

gulp.task('tsc:globals', function(done) {
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc', 'globals.ts'],
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc', '-d', 'globals.ts'],
'ignore');

@@ -80,3 +76,3 @@ });

gulp.task('prepublish', function(done) {
runSequence(['typings', 'jshint', 'format'], 'tsc', 'tsc:globals', 'types',
runSequence(['jshint', 'format'], 'tsc', 'tsc:globals', 'types',
'ambient', 'built:copy', done);

@@ -87,3 +83,3 @@ });

runSequence(
['webdriver:update', 'typings', 'jshint', 'format'], 'tsc', 'tsc:globals',
['webdriver:update', 'jshint', 'format'], 'tsc', 'tsc:globals',
'types', 'ambient', 'built:copy', done);

@@ -90,0 +86,0 @@ });

@@ -22,3 +22,3 @@ {

"q": "1.4.1",
"saucelabs": "~1.2.0",
"saucelabs": "~1.3.0",
"selenium-webdriver": "2.53.3",

@@ -29,2 +29,10 @@ "source-map-support": "~0.4.0",

"devDependencies": {
"@types/chalk": "^0.4.28",
"@types/glob": "^5.0.29",
"@types/jasmine": "^2.2.31",
"@types/minimatch": "^2.0.28",
"@types/minimist": "^1.1.28",
"@types/node": "^6.0.35",
"@types/optimist": "0.0.28",
"@types/q": "0.0.29",
"body-parser": "~1.15.2",

@@ -44,4 +52,3 @@ "chai": "~3.5.0",

"run-sequence": "^1.1.5",
"typescript": "^1.8.10",
"typings": "^1.0.4"
"typescript": "^2.0.0"
},

@@ -68,3 +75,3 @@ "repository": {

"license": "MIT",
"version": "4.0.3"
"version": "4.0.4"
}

@@ -17,5 +17,5 @@ {

"website",
"typings/globals",
"scripts",
"globals.ts",
"globals.d.ts",
"exampleTypescript",

@@ -22,0 +22,0 @@ "spec"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc