Socket
Socket
Sign inDemoInstall

protractor

Package Overview
Dependencies
161
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.0-beta to 6.0.0

.circleci/config.yml

31

built/browser.d.ts
import { BPClient } from 'blocking-proxy';
import { Navigation, WebDriver, WebElement, WebElementPromise } from 'selenium-webdriver';
import { ExtendedWebDriver } from 'webdriver-js-extender';
import { ElementArrayFinder, ElementFinder } from './element';

@@ -8,10 +7,2 @@ import { ProtractorExpectedConditions } from './expectedConditions';

import { Plugins } from './plugins';
export declare class AbstractWebDriver {
}
export interface AbstractWebDriver extends WebDriver {
}
export declare class AbstractExtendedWebDriver extends AbstractWebDriver {
}
export interface AbstractExtendedWebDriver extends ExtendedWebDriver {
}
export interface ElementHelper extends Function {

@@ -32,3 +23,3 @@ (locator: Locator): ElementFinder;

*/
export declare class ProtractorBrowser extends AbstractExtendedWebDriver {
export declare class ProtractorBrowser {
/**

@@ -43,8 +34,7 @@ * @type {ProtractorBy}

/**
* The wrapped webdriver instance. Use this to interact with pages that do
* not contain Angular (such as a log-in screen).
* The browser's WebDriver instance
*
* @type {webdriver_extensions.ExtendedWebDriver}
* @type {webdriver.WebDriver}
*/
driver: ExtendedWebDriver;
driver: WebDriver;
/**

@@ -159,4 +149,3 @@ * The client used to control the BlockingProxy. If unset, BlockingProxy is

*
* @type {Array<{name: string, script: function|string, args:
* Array.<string>}>}
* @type {Array<{name: string, script: function|string, args: Array.<string>}>}
*/

@@ -299,3 +288,3 @@ mockModules_: {

/**
* Waits for Angular to finish rendering before searching for elements.
* Waits for Angular to finish renderActionSequenceing before searching for elements.
* @see webdriver.WebDriver.findElement

@@ -404,3 +393,3 @@ * @returns {!webdriver.WebElementPromise} A promise that will be resolved to

* expect(await browser.getCurrentUrl())
* .toBe('http://angular.github.io/protractor/#/api');
* .toBe('http://angular.g../../ithub.io/protractor/#/api');
*

@@ -428,8 +417,2 @@ * @param {string} url In page URL using the same syntax as $location.url()

getLocationAbsUrl(): Promise<any>;
/**
* Determine if the control flow is enabled.
*
* @returns true if the control flow is enabled, false otherwise.
*/
controlFlowIsEnabled(): any;
}

@@ -13,4 +13,5 @@ "use strict";

const selenium_webdriver_1 = require("selenium-webdriver");
const command_1 = require("selenium-webdriver/lib/command");
const url = require("url");
const webdriver_js_extender_1 = require("webdriver-js-extender");
const CommandName = require('selenium-webdriver/lib/command').Name;
const element_1 = require("./element");

@@ -21,5 +22,2 @@ const expectedConditions_1 = require("./expectedConditions");

const clientSideScripts = require('./clientsidescripts');
// TODO: fix the typings for selenium-webdriver/lib/command
const Command = require('selenium-webdriver/lib/command').Command;
const CommandName = require('selenium-webdriver/lib/command').Name;
// jshint browser: true

@@ -39,11 +37,2 @@ const DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';

}
// Explicitly define types for webdriver.WebDriver and ExtendedWebDriver.
// We do this because we use composition over inheritance to implement polymorphism, and therefore
// we don't want to inherit WebDriver's constructor.
class AbstractWebDriver {
}
exports.AbstractWebDriver = AbstractWebDriver;
class AbstractExtendedWebDriver extends AbstractWebDriver {
}
exports.AbstractExtendedWebDriver = AbstractExtendedWebDriver;
/**

@@ -107,5 +96,4 @@ * Mix a function from one object onto another. The function will still be

*/
class ProtractorBrowser extends AbstractExtendedWebDriver {
class ProtractorBrowser {
constructor(webdriverInstance, opt_baseUrl, opt_rootElement, opt_untrackOutstandingTimeouts, opt_blockingProxyUrl) {
super();
// These functions should delegate to the webdriver instance, but should

@@ -115,23 +103,14 @@ // wait for Angular to sync up before performing the action. This does not

let methodsToSync = ['getCurrentUrl', 'getPageSource', 'getTitle'];
let extendWDInstance;
try {
extendWDInstance = webdriver_js_extender_1.extend(webdriverInstance);
}
catch (e) {
// Probably not a driver that can be extended (e.g. gotten using
// `directConnect: true` in the config)
extendWDInstance = webdriverInstance;
}
// Mix all other driver functionality into Protractor.
Object.getOwnPropertyNames(selenium_webdriver_1.WebDriver.prototype).forEach(method => {
if (!this[method] && typeof extendWDInstance[method] === 'function') {
if (!this[method] && typeof webdriverInstance[method] === 'function') {
if (methodsToSync.indexOf(method) !== -1) {
ptorMixin(this, extendWDInstance, method, this.waitForAngular.bind(this));
ptorMixin(this, webdriverInstance, method, this.waitForAngular.bind(this));
}
else {
ptorMixin(this, extendWDInstance, method);
ptorMixin(this, webdriverInstance, method);
}
}
});
this.driver = extendWDInstance;
this.driver = webdriverInstance;
if (opt_blockingProxyUrl) {

@@ -323,4 +302,3 @@ logger.info('Starting BP client for ' + opt_blockingProxyUrl);

// TODO(selenium4): schedule does not exist on driver. Should use execute instead.
return this.driver
.execute(new Command(CommandName.EXECUTE_SCRIPT)
return this.driver.execute(new command_1.Command(CommandName.EXECUTE_SCRIPT)
.setParameter('script', script)

@@ -349,3 +327,3 @@ .setParameter('args', scriptArgs));

return this.driver
.execute(new Command(CommandName.EXECUTE_ASYNC_SCRIPT)
.execute(new command_1.Command(CommandName.EXECUTE_ASYNC_SCRIPT)
.setParameter('script', script)

@@ -445,3 +423,3 @@ .setParameter('args', scriptArgs));

/**
* Waits for Angular to finish rendering before searching for elements.
* Waits for Angular to finish renderActionSequenceing before searching for elements.
* @see webdriver.WebDriver.findElement

@@ -682,3 +660,3 @@ * @returns {!webdriver.WebElementPromise} A promise that will be resolved to

* expect(await browser.getCurrentUrl())
* .toBe('http://angular.github.io/protractor/#/api');
* .toBe('http://angular.g../../ithub.io/protractor/#/api');
*

@@ -722,16 +700,2 @@ * @param {string} url In page URL using the same syntax as $location.url()

}
/**
* Determine if the control flow is enabled.
*
* @returns true if the control flow is enabled, false otherwise.
*/
controlFlowIsEnabled() {
if (selenium_webdriver_1.promise.USE_PROMISE_MANAGER !== undefined) {
return selenium_webdriver_1.promise.USE_PROMISE_MANAGER;
}
else {
// True for old versions of `selenium-webdriver`, probably false in >=5.0.0
return !!selenium_webdriver_1.promise.ControlFlow;
}
}
}

@@ -738,0 +702,0 @@ /**

@@ -17,5 +17,5 @@ "use strict";

const selenium_webdriver_1 = require("selenium-webdriver");
const http_1 = require("selenium-webdriver/http");
const logger_1 = require("../logger");
const driverProvider_1 = require("./driverProvider");
const http = require('selenium-webdriver/http');
let logger = new logger_1.Logger('attachSession');

@@ -45,4 +45,4 @@ class AttachSession extends driverProvider_1.DriverProvider {

return __awaiter(this, void 0, void 0, function* () {
const httpClient = new http.HttpClient(this.config_.seleniumAddress);
const executor = new http.Executor(httpClient);
const httpClient = new http_1.HttpClient(this.config_.seleniumAddress);
const executor = new http_1.Executor(httpClient);
const session = new selenium_webdriver_1.Session(this.config_.seleniumSessionId, null);

@@ -49,0 +49,0 @@ const newDriver = new selenium_webdriver_1.WebDriver(session, executor);

@@ -77,3 +77,3 @@ "use strict";

}
let chromeService = new chrome_1.ServiceBuilder(chromeDriverFile).build();
const chromeService = new chrome_1.ServiceBuilder(chromeDriverFile).build();
driver = yield chrome_1.Driver.createSession(new selenium_webdriver_1.Capabilities(this.config_.capabilities), chromeService);

@@ -80,0 +80,0 @@ break;

@@ -25,3 +25,3 @@ /**

* @public
* @return webdriver instance
* @return a promise to a webdriver instance
*/

@@ -28,0 +28,0 @@ getNewDriver(): Promise<WebDriver>;

@@ -46,3 +46,3 @@ "use strict";

* @public
* @return webdriver instance
* @return a promise to a webdriver instance
*/

@@ -49,0 +49,0 @@ getNewDriver() {

@@ -0,5 +1,6 @@

import { SeleniumServer } from 'selenium-webdriver/remote';
import { Config } from '../config';
import { DriverProvider } from './driverProvider';
export declare class Local extends DriverProvider {
server_: any;
server_: SeleniumServer;
constructor(config: Config);

@@ -6,0 +7,0 @@ /**

@@ -5,3 +5,3 @@ import { WebDriver } from 'selenium-webdriver';

export declare class MockExecutor {
execute(command: any): any;
execute(_: any): any;
}

@@ -8,0 +8,0 @@ export declare class Mock extends DriverProvider {

@@ -19,3 +19,3 @@ "use strict";

class MockExecutor {
execute(command) { }
execute(_) { }
}

@@ -52,4 +52,4 @@ exports.MockExecutor = MockExecutor;

return __awaiter(this, void 0, void 0, function* () {
let mockSession = new selenium_webdriver_1.Session('test_session_id', {});
let newDriver = new selenium_webdriver_1.WebDriver(mockSession, new MockExecutor());
const mockSession = new selenium_webdriver_1.Session('test_session_id', {});
const newDriver = new selenium_webdriver_1.WebDriver(mockSession, new MockExecutor());
this.drivers_.push(newDriver);

@@ -56,0 +56,0 @@ return newDriver;

@@ -36,12 +36,11 @@ "use strict";

updateJob(update) {
let mappedDrivers = this.drivers_.map((driver) => {
driver.getSession().then((session) => {
logger.info('SauceLabs results available at http://saucelabs.com/jobs/' + session.getId());
this.sauceServer_.updateJob(session.getId(), update, (err) => {
if (err) {
throw new Error('Error updating Sauce pass/fail status: ' + util.inspect(err));
}
});
let mappedDrivers = this.drivers_.map((driver) => __awaiter(this, void 0, void 0, function* () {
const session = yield driver.getSession();
logger.info('SauceLabs results available at http://saucelabs.com/jobs/' + session.getId());
this.sauceServer_.updateJob(session.getId(), update, (err) => {
if (err) {
throw new Error('Error updating Sauce pass/fail status: ' + util.inspect(err));
}
});
});
}));
return Promise.all(mappedDrivers);

@@ -48,0 +47,0 @@ }

@@ -72,2 +72,8 @@ let RunnerReporter = function(emitter) {

// Jasmine 3 allows for tests to be in random order by default. This does not
// work well with e2e tests where the browser state is determined by the
// order of the tests. Setting to false will prevent random execution.
// See https://jasmine.github.io/api/3.3/Env.html
jasmine.getEnv().randomizeTests(false);
// Add hooks for afterEach

@@ -74,0 +80,0 @@ require('./setupAfterEach').setup(runner, specs);

@@ -7,3 +7,3 @@ import { ElementHelper, ProtractorBrowser } from './browser';

import { Ptor } from './ptor';
export { /*Actions,*/ Browser, Builder, Button, Capabilities, Capability, error, EventEmitter, FileDetector, Key, logging, promise, Session, until, WebDriver, WebElement, WebElementPromise } from 'selenium-webdriver';
export { Actions, Browser, Builder, Button, Capabilities, Capability, error, EventEmitter, FileDetector, Key, logging, promise, Session, until, WebDriver, WebElement, WebElementPromise } from 'selenium-webdriver';
export { ElementHelper, ProtractorBrowser } from './browser';

@@ -18,3 +18,3 @@ export { Config } from './config';

export declare type ProtractorPlugin = ProtractorPlugin;
export declare let utils: {
export declare const utils: {
firefox: any;

@@ -24,4 +24,3 @@ http: any;

};
export declare let Command: any;
export declare let CommandName: any;
export { Command, Name as CommandName } from 'selenium-webdriver/lib/command';
export declare let protractor: Ptor;

@@ -28,0 +27,0 @@ export declare let browser: ProtractorBrowser;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Re-export selenium-webdriver types.
// TODO(selenium4): Actions class typings missing. ActionSequence is deprecated.
// Re-export selenium-webdriver types from typings directory.
var selenium_webdriver_1 = require("selenium-webdriver");
exports.Actions = selenium_webdriver_1.Actions;
exports.Browser = selenium_webdriver_1.Browser;

@@ -41,4 +41,5 @@ exports.Builder = selenium_webdriver_1.Builder;

};
exports.Command = require('selenium-webdriver/lib/command').Command;
exports.CommandName = require('selenium-webdriver/lib/command').Name;
var command_1 = require("selenium-webdriver/lib/command");
exports.Command = command_1.Command;
exports.CommandName = command_1.Name;
Object.defineProperty(exports, 'protractor', { get: () => global['protractor'] });

@@ -45,0 +46,0 @@ function registerGlobal(name) {

@@ -7,3 +7,3 @@ import { By, ByHash, WebDriver, WebElement } from 'selenium-webdriver';

linkText: (linkText: string) => By;
js: (js: string | Function, ...var_args: any[]) => By;
js: (js: string | Function, ...var_args: any[]) => (webdriver: WebDriver) => Promise<any>;
name: (name: string) => By;

@@ -10,0 +10,0 @@ partialLinkText: (partialText: string) => By;

@@ -1,2 +0,1 @@

import * as webdriver from 'selenium-webdriver';
import { ProtractorBrowser } from './browser';

@@ -100,7 +99,7 @@ import { Config } from './config';

*
* @return {webdriver.promise.Promise=} Can return a promise, in which case
* @return {Promise=} Can return a promise, in which case
* protractor will wait for the promise to resolve before continuing. If
* the promise is rejected, a failed assertion is added to the test results.
*/
onPageLoad?(browser: ProtractorBrowser): void | webdriver.promise.Promise<void>;
onPageLoad?(browser: ProtractorBrowser): void | Promise<void>;
/**

@@ -118,7 +117,7 @@ * This is called inside browser.get() directly after angular is done

*
* @return {webdriver.promise.Promise=} Can return a promise, in which case
* @return {Promise=} Can return a promise, in which case
* protractor will wait for the promise to resolve before continuing. If
* the promise is rejected, a failed assertion is added to the test results.
*/
onPageStable?(browser: ProtractorBrowser): void | webdriver.promise.Promise<void>;
onPageStable?(browser: ProtractorBrowser): void | Promise<void>;
/**

@@ -137,3 +136,3 @@ * Between every webdriver action, Protractor calls browser.waitForAngular() to

*
* @return {webdriver.promise.Promise=} Can return a promise, in which case
* @return {Promise=} Can return a promise, in which case
* protractor will wait for the promise to resolve before continuing. If the

@@ -145,3 +144,3 @@ * promise is rejected, a failed assertion is added to the test results, and

*/
waitForPromise?(browser: ProtractorBrowser): webdriver.promise.Promise<void>;
waitForPromise?(browser: ProtractorBrowser): Promise<void>;
/**

@@ -161,3 +160,3 @@ * Between every webdriver action, Protractor calls browser.waitForAngular() to

*
* @return {webdriver.promise.Promise<boolean>|boolean} If truthy, Protractor
* @return {Promise<boolean>|boolean} If truthy, Protractor
* will continue onto the next command. If falsy, webdriver will

@@ -168,3 +167,3 @@ * continuously re-run this function until it is truthy. If a rejected promise

*/
waitForCondition?(browser: ProtractorBrowser): webdriver.promise.Promise<boolean> | boolean;
waitForCondition?(browser: ProtractorBrowser): Promise<boolean> | boolean;
/**

@@ -171,0 +170,0 @@ * Used to turn off default checks for angular stability

@@ -5,2 +5,3 @@ import * as webdriver from 'selenium-webdriver';

import * as http from 'selenium-webdriver/http';
import * as command from 'selenium-webdriver/lib/command';
import * as remote from 'selenium-webdriver/remote';

@@ -25,6 +26,6 @@ import { ElementHelper, ProtractorBrowser } from './browser';

ProtractorExpectedConditions: any;
ActionSequence: typeof webdriver.ActionSequence;
Actions: typeof webdriver.Actions;
Browser: webdriver.IBrowser;
Builder: typeof webdriver.Builder;
Button: webdriver.IButton;
Button: typeof webdriver.Button;
Capabilities: typeof webdriver.Capabilities;

@@ -34,3 +35,3 @@ Capability: webdriver.ICapability;

FileDetector: typeof webdriver.FileDetector;
Key: webdriver.IKey;
Key: import("./selenium-webdriver/lib/input").IKey;
Session: typeof webdriver.Session;

@@ -44,4 +45,4 @@ WebDriver: typeof webdriver.WebDriver;

until: typeof webdriver.until;
Command: any;
CommandName: any;
Command: typeof command.Command;
CommandName: command.ICommandName;
utils: {

@@ -48,0 +49,0 @@ firefox: typeof firefox;

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

const http = require("selenium-webdriver/http");
const command = require("selenium-webdriver/lib/command");
const remote = require("selenium-webdriver/remote");

@@ -24,3 +25,3 @@ class Ptor {

// Export selenium webdriver.
this.ActionSequence = webdriver.ActionSequence;
this.Actions = webdriver.Actions;
this.Browser = webdriver.Browser;

@@ -42,4 +43,4 @@ this.Builder = webdriver.Builder;

this.until = webdriver.until;
this.Command = require('selenium-webdriver/lib/command').Command;
this.CommandName = require('selenium-webdriver/lib/command').Name;
this.Command = command.Command;
this.CommandName = command.Name;
this.utils = { firefox: firefox, http: http, remote: remote, chrome: chrome };

@@ -46,0 +47,0 @@ }

@@ -12,4 +12,2 @@ "use strict";

const events_1 = require("events");
// TODO(cnishina): remove when selenium webdriver is upgraded.
const selenium_webdriver_1 = require("selenium-webdriver");
const util = require("util");

@@ -294,6 +292,2 @@ const browser_1 = require("./browser");

}
// TODO(selenium4): Remove when selenium is upgraded.
if (this.config_.SELENIUM_PROMISE_MANAGER != null) {
selenium_webdriver_1.promise.USE_PROMISE_MANAGER = this.config_.SELENIUM_PROMISE_MANAGER;
}
if (this.config_.webDriverLogDir || this.config_.highlightDelay) {

@@ -300,0 +294,0 @@ this.config_.useBlockingProxy = true;

@@ -12,3 +12,3 @@ "use strict";

const path = require("path");
const selenium_webdriver_1 = require("selenium-webdriver");
const webdriver = require("selenium-webdriver");
let STACK_SUBSTRINGS_TO_FILTER = [

@@ -102,4 +102,4 @@ 'node_modules/jasmine/', 'node_modules/selenium-webdriver', 'at Module.', 'at Object.Module.',

function falseIfMissing(error) {
if ((error instanceof selenium_webdriver_1.error.NoSuchElementError) ||
(error instanceof selenium_webdriver_1.error.StaleElementReferenceError)) {
if ((error instanceof webdriver.error.NoSuchElementError) ||
(error instanceof webdriver.error.StaleElementReferenceError)) {
return false;

@@ -106,0 +106,0 @@ }

@@ -43,3 +43,4 @@ 'use strict';

return gulp.src(['lib/**/*.ts'])
.pipe(format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
.pipe(format.checkFormat('file', clangFormat,
{verbose: true, fail: true}));
});

@@ -69,4 +70,10 @@

gulp.task('built:copy:typings', () => {
return gulp.src(['lib/selenium-webdriver/**/*.d.ts'])
.pipe(gulp.dest('built/selenium-webdriver/'));
});
gulp.task('webdriver:update', (done) => {
runSpawn(done, 'node', ['bin/webdriver-manager', 'update']);
runSpawn(done, 'node', ['bin/webdriver-manager', 'update',
'--versions.chrome=2.44']);
});

@@ -93,5 +100,5 @@

gulp.parallel('webdriver:update', 'tslint', 'format'),
'tsc', 'built:copy', 'tsc:spec'));
'tsc', 'built:copy', 'built:copy:typings', 'tsc:spec'));
gulp.task('default', gulp.series('prepublish'));

@@ -24,7 +24,5 @@ {

"source-map-support": "~0.4.0",
"webdriver-js-extender": "2.1.0",
"webdriver-manager": "13.0.0-beta"
"webdriver-manager": "13.0.0"
},
"devDependencies": {
"@types/node": "^6.0.46",
"@types/chalk": "^0.4.28",

@@ -36,5 +34,6 @@ "@types/glob": "^5.0.29",

"@types/minimist": "^1.1.28",
"@types/node": "^6.0.46",
"@types/optimist": "^0.0.29",
"@types/yargs": "^12.0.1",
"body-parser": "~1.15.2",
"body-parser": "^1.18.3",
"chai": "~3.5.0",

@@ -44,9 +43,9 @@ "chai-as-promised": "~5.3.0",

"expect.js": "~0.3.1",
"express": "~4.14.0",
"express": "^4.16.4",
"gulp": "^4.0.0",
"gulp-clang-format": "1.0.23",
"gulp-tslint": "^8.1.3",
"lodash": "^4.5.1",
"lodash": "^4.17.11",
"marked": "^0.3.3",
"mocha": "2.5.3",
"mocha": "^6.0.2",
"rimraf": "~2.5.3",

@@ -84,3 +83,3 @@ "semver": "^5.3.0",

},
"version": "6.0.0-beta"
"version": "6.0.0"
}

@@ -10,3 +10,12 @@ {

"noImplicitAny": true,
"outDir": "spec/built"
"outDir": "spec/built",
"baseUrl": ".",
"paths": {
"selenium-webdriver": ["lib/selenium-webdriver"],
"selenium-webdriver/chrome": ["lib/selenium-webdriver/chrome.d.ts"],
"selenium-webdriver/firefox": ["lib/selenium-webdriver/firefox.d.ts"],
"selenium-webdriver/http": ["lib/selenium-webdriver/http.d.ts"],
"selenium-webdriver/remote": ["lib/selenium-webdriver/remote.d.ts"],
"selenium-webdriver/lib/command": ["lib/selenium-webdriver/lib/command.d.ts"]
}
},

@@ -13,0 +22,0 @@ "include": [

@@ -10,3 +10,12 @@ {

"noImplicitAny": true,
"outDir": "built/"
"outDir": "built/",
"baseUrl": ".",
"paths": {
"selenium-webdriver": ["lib/selenium-webdriver"],
"selenium-webdriver/chrome": ["lib/selenium-webdriver/chrome.d.ts"],
"selenium-webdriver/firefox": ["lib/selenium-webdriver/firefox.d.ts"],
"selenium-webdriver/http": ["lib/selenium-webdriver/http.d.ts"],
"selenium-webdriver/remote": ["lib/selenium-webdriver/remote.d.ts"],
"selenium-webdriver/lib/command": ["lib/selenium-webdriver/lib/command.d.ts"]
}
},

@@ -21,4 +30,4 @@ "exclude": [

"spec/**/*",
"typings"
"lib/selenium-webdriver]"
]
}

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc