Conexio amb la api

This commit is contained in:
janmaroto 2022-02-09 18:30:03 +01:00
commit b12369cb47
48513 changed files with 7391639 additions and 7 deletions

3
node_modules/blocking-proxy/.clang-format generated vendored Executable file
View file

@ -0,0 +1,3 @@
Language: JavaScript
BasedOnStyle: Google
ColumnLimit: 100

1
node_modules/blocking-proxy/.nvmrc generated vendored Executable file
View file

@ -0,0 +1 @@
4.6

21
node_modules/blocking-proxy/LICENSE generated vendored Executable file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Angular
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

90
node_modules/blocking-proxy/README.md generated vendored Executable file
View file

@ -0,0 +1,90 @@
# Blocking Proxy [![Build Status](https://circleci.com/gh/angular/blocking-proxy.svg?style=shield)](https://circleci.com/gh/angular/blocking-proxy)
Blocking Proxy is a tool for adding functionality to WebDriver-based
tests. It sits between your tests and the Selenium Server. For each
WebDriver command, it runs a set of 'barriers' that will block
forwarding the command to the Selenium server until some condition
is met.
Because it interacts with WebDriver at the network level, Blocking Proxy can be
used regardless of which language your tests are written in. See [the example](https://github.com/angular/blocking-proxy/blob/master/examples/README.md)
for a demonstration of using Blocking Proxy with WebDriver tests written in Python.
Although Blocking Proxy can handle multiple WebDriver sessions, it can not yet handle
multiple concurrent clients. Thus, it's recommended to start a separate instance
for each test process.
# Usage
Blocking Proxy can be installed globally with `npm install -g blocking-proxy`.
You can also use it by cloning this repo and running these commands:
```
npm install
webdriver-manager update && webdriver-manager start (in another terminal)
node ./built/lib/bin.js --seleniumAddress http://localhost:4444/wd/hub
```
# Features
## Wait for Angular
When testing an Angular application, Blocking Proxy can block webdriver commands
until Angular's change detection is finished, and thus make your tests less flaky.
## Highlight Delay
If `--highlightDelay <delayMS>` is specified, Blocking Proxy will wait for
the specified delay (in milliseconds) before executing click commands or sending
keys. It will also highlight the element that is the target of the command.
Here's an example of highlight delay in action:
![Highlight Delay](http://i.giphy.com/jg7B2HHPIkwak.gif)
## WebDriver logging
When `--logDir <path>` is set, Blocking Proxy will create a readable log of
WebDriver commands at the specified path. The log will look something like this:
```
20:08:14.830 | 834ms | 37f13c | NewSession
{"browserName":"chrome"}
20:08:15.674 | 4ms | 37f13c | SetTimeouts
20:08:15.681 | 578ms | 37f13c | Go http://localhost:8081/ng1/#/interaction
20:08:16.300 | 438ms | 37f13c | FindElement
Using css selector \'.invalid\'
ERROR: no such element
```
Each line shows the command that was executed and how long it took. For some
commands, extra data or the response from WebDriver will be shown on following
lines.
# Development
## Formatting and lint
`gulp format` runs clang-format. `gulp lint` validates format and runs tslint.
## Running tests
Unit tests live in `spec/unit` and can be run with `npm test`. Run `npm run test:auto` to automatically watch for changes and run unit tests.
## Running e2e tests
Start webdriver
webdriver-manager update
webdriver-manager start
in another terminal, start the testapp
npm run testapp
Start the proxy with
npm start
in yet another terminal, run the tests
npm run test:e2e

View file

@ -0,0 +1,44 @@
import { SimpleWebDriverClient } from './simple_webdriver_client';
import { WebDriverCommand } from './webdriver_commands';
import { WebDriverLogger } from './webdriver_logger';
import { WebDriverBarrier } from './webdriver_proxy';
/**
* A barrier that uses Angular's Testability API to block commands until the application is stable.
*/
export declare class AngularWaitBarrier implements WebDriverBarrier {
private client;
rootSelector: string;
enabled: boolean;
logger: WebDriverLogger;
constructor(client: SimpleWebDriverClient);
/**
* A CSS Selector for a DOM element within your Angular application.
* BlockingProxy will attempt to automatically find your application, but it is
* necessary to set rootElement in certain cases.
*
* In Angular 1, BlockingProxy will use the element your app bootstrapped to by
* default. If that doesn't work, it will then search for hooks in `body` or
* `ng-app` elements (details here: https://git.io/v1b2r).
*
* In later versions of Angular, BlockingProxy will try to hook into all angular
* apps on the page. Use rootElement to limit the scope of which apps
* BlockingProxy waits for and searches within.
*
* @param rootSelector A selector for the root element of the Angular app.
*/
setRootSelector(selector: string): void;
private waitForAngularData();
/**
* Turn on WebDriver logging.
*
* @param logDir The directory to create logs in.
*/
enableLogging(logDir: string): void;
/**
* Override the logger instance. Only used for testing.
*/
setLogger(logger: WebDriverLogger): void;
private sendRequestToStabilize(command);
private shouldStabilize(command);
onCommand(command: WebDriverCommand): Promise<void>;
}

108
node_modules/blocking-proxy/built/lib/angular_wait_barrier.js generated vendored Executable file
View file

@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const webdriver_logger_1 = require("./webdriver_logger");
const angularWaits = require('./client_scripts/wait.js');
/**
* A barrier that uses Angular's Testability API to block commands until the application is stable.
*/
class AngularWaitBarrier {
constructor(client) {
this.client = client;
this.enabled = true;
this.rootSelector = '';
}
/**
* A CSS Selector for a DOM element within your Angular application.
* BlockingProxy will attempt to automatically find your application, but it is
* necessary to set rootElement in certain cases.
*
* In Angular 1, BlockingProxy will use the element your app bootstrapped to by
* default. If that doesn't work, it will then search for hooks in `body` or
* `ng-app` elements (details here: https://git.io/v1b2r).
*
* In later versions of Angular, BlockingProxy will try to hook into all angular
* apps on the page. Use rootElement to limit the scope of which apps
* BlockingProxy waits for and searches within.
*
* @param rootSelector A selector for the root element of the Angular app.
*/
setRootSelector(selector) {
this.rootSelector = selector;
}
waitForAngularData() {
return JSON.stringify({
script: 'return (' + angularWaits.NG_WAIT_FN + ').apply(null, arguments);',
args: [this.rootSelector]
});
}
/**
* Turn on WebDriver logging.
*
* @param logDir The directory to create logs in.
*/
enableLogging(logDir) {
if (!this.logger) {
this.logger = new webdriver_logger_1.WebDriverLogger();
}
this.logger.setLogDir(logDir);
}
/**
* Override the logger instance. Only used for testing.
*/
setLogger(logger) {
this.logger = logger;
}
sendRequestToStabilize(command) {
return this.client.executeAsync(command.sessionId, this.waitForAngularData()).then((value) => {
// waitForAngular only returns a value if there was an error
// in the browser.
if (value) {
throw new Error('Error from waitForAngular: ' + value);
}
});
}
shouldStabilize(command) {
const url = command.url;
if (!this.enabled) {
return false;
}
// TODO - should this implement some state, and be smart about whether
// stabilization is necessary or not? Would that be as simple as GET/POST?
// e.g. two gets in a row don't require a wait btwn.
//
// See https://code.google.com/p/selenium/wiki/JsonWireProtocol for
// descriptions of the paths.
// We shouldn't stabilize if we haven't loaded the page yet.
const parts = url.split('/');
if (parts.length < 4) {
return false;
}
const commandsToWaitFor = [
'executeScript', 'screenshot', 'source', 'title', 'element', 'elements', 'execute', 'keys',
'moveto', 'click', 'buttondown', 'buttonup', 'doubleclick', 'touch', 'get'
];
if (commandsToWaitFor.indexOf(parts[3]) != -1) {
return true;
}
return false;
}
onCommand(command) {
if (this.logger) {
command.on('data', () => {
this.logger.logWebDriverCommand(command);
});
}
if (this.shouldStabilize(command)) {
const started = Date.now();
return this.sendRequestToStabilize(command).then(() => {
const ended = Date.now();
if (this.logger) {
this.logger.logEvent('Waiting for Angular', command.sessionId, (ended - started));
}
});
}
return Promise.resolve(null);
}
}
exports.AngularWaitBarrier = AngularWaitBarrier;
//# sourceMappingURL=angular_wait_barrier.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"angular_wait_barrier.js","sourceRoot":"","sources":["../../lib/angular_wait_barrier.ts"],"names":[],"mappings":";;AAEA,yDAAmD;AAGnD,MAAM,YAAY,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA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,sBAAsB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACpD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACzB,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;gBACpF,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAjHD,gDAiHC"}

0
node_modules/blocking-proxy/built/lib/bin.d.ts generated vendored Executable file
View file

28
node_modules/blocking-proxy/built/lib/bin.js generated vendored Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const blockingproxy_1 = require("./blockingproxy");
const config_1 = require("./config");
/**
* Starts up a proxy server which modifies calls between the test process
* and the selenium server.
*/
const argv = config_1.processArgs(process.argv.slice(2));
if (argv.help) {
config_1.printHelp();
process.exit(0);
}
const proxy = new blockingproxy_1.BlockingProxy(argv.seleniumAddress, parseInt(argv.highlightDelay));
if (argv.logDir) {
proxy.enableLogging(argv.logDir);
}
let port = proxy.listen(argv.port);
console.log(`Listening on :${port}`);
if (argv.fork) {
process.send({ ready: true, port: port });
process.on('disconnect', function () {
console.log('parent exited, quitting');
process.exit();
});
}
//# sourceMappingURL=bin.js.map

1
node_modules/blocking-proxy/built/lib/bin.js.map generated vendored Executable file
View file

@ -0,0 +1 @@
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../lib/bin.ts"],"names":[],"mappings":";;;AAEA,mDAA8C;AAC9C,qCAAgD;AAEhD;;;GAGG;AAEH,MAAM,IAAI,GAAG,oBAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhD,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACd,kBAAS,EAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,KAAK,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;AACrF,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAChB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AACD,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;AACrC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACd,OAAO,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE;QACvB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}

41
node_modules/blocking-proxy/built/lib/blockingproxy.d.ts generated vendored Executable file
View file

@ -0,0 +1,41 @@
/// <reference types="node" />
import * as http from 'http';
import { AngularWaitBarrier } from './angular_wait_barrier';
import { HighlightDelayBarrier } from './highlight_delay_barrier';
import { WebDriverLogger } from './webdriver_logger';
export declare const BP_PREFIX = "bpproxy";
/**
* The stability proxy is an http server responsible for intercepting
* JSON webdriver commands. It keeps track of whether the page under test
* needs to wait for page stability, and initiates a wait if so.
*/
export declare class BlockingProxy {
server: http.Server;
logger: WebDriverLogger;
waitBarrier: AngularWaitBarrier;
highlightBarrier: HighlightDelayBarrier;
private proxy;
constructor(seleniumAddress: string, highlightDelay?: number);
/**
* This command is for the proxy server, not to be forwarded to Selenium.
*/
static isProxyCommand(commandPath: string): boolean;
/**
* Turn on WebDriver logging.
*
* @param logDir The directory to create logs in.
*/
enableLogging(logDir: string): void;
/**
* Override the logger instance. Only used for testing.
*/
setLogger(logger: WebDriverLogger): void;
/**
* Change the parameters used by the wait function.
*/
setWaitParams(rootEl: any): void;
handleProxyCommand(message: any, data: any, response: any): void;
requestListener(originalRequest: http.IncomingMessage, response: http.ServerResponse): void;
listen(port: number): number;
quit(): Promise<{}>;
}

119
node_modules/blocking-proxy/built/lib/blockingproxy.js generated vendored Executable file
View file

@ -0,0 +1,119 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http = require("http");
const angular_wait_barrier_1 = require("./angular_wait_barrier");
const highlight_delay_barrier_1 = require("./highlight_delay_barrier");
const simple_webdriver_client_1 = require("./simple_webdriver_client");
const webdriver_proxy_1 = require("./webdriver_proxy");
exports.BP_PREFIX = 'bpproxy';
/**
* The stability proxy is an http server responsible for intercepting
* JSON webdriver commands. It keeps track of whether the page under test
* needs to wait for page stability, and initiates a wait if so.
*/
class BlockingProxy {
constructor(seleniumAddress, highlightDelay = null) {
this.server = http.createServer(this.requestListener.bind(this));
this.proxy = new webdriver_proxy_1.WebDriverProxy(seleniumAddress);
let client = new simple_webdriver_client_1.SimpleWebDriverClient(seleniumAddress);
this.waitBarrier = new angular_wait_barrier_1.AngularWaitBarrier(client);
this.highlightBarrier = new highlight_delay_barrier_1.HighlightDelayBarrier(client, highlightDelay);
this.proxy.addBarrier(this.waitBarrier);
this.proxy.addBarrier(this.highlightBarrier);
}
/**
* This command is for the proxy server, not to be forwarded to Selenium.
*/
static isProxyCommand(commandPath) {
return (commandPath.split('/')[1] === exports.BP_PREFIX);
}
/**
* Turn on WebDriver logging.
*
* @param logDir The directory to create logs in.
*/
enableLogging(logDir) {
this.waitBarrier.enableLogging(logDir);
}
/**
* Override the logger instance. Only used for testing.
*/
setLogger(logger) {
this.waitBarrier.setLogger(logger);
}
/**
* Change the parameters used by the wait function.
*/
setWaitParams(rootEl) {
this.waitBarrier.setRootSelector(rootEl);
}
handleProxyCommand(message, data, response) {
let command = message.url.split('/')[2];
switch (command) {
case 'waitEnabled':
if (message.method === 'GET') {
response.writeHead(200);
response.write(JSON.stringify({ value: this.waitBarrier.enabled }));
response.end();
}
else if (message.method === 'POST') {
response.writeHead(200);
this.waitBarrier.enabled = JSON.parse(data).value;
response.end();
}
else {
response.writeHead(405);
response.write('Invalid method');
response.end();
}
break;
case 'waitParams':
if (message.method === 'GET') {
response.writeHead(200);
response.write(JSON.stringify({ rootSelector: this.waitBarrier.rootSelector }));
response.end();
}
else if (message.method === 'POST') {
response.writeHead(200);
this.waitBarrier.rootSelector = JSON.parse(data).rootSelector;
response.end();
}
else {
response.writeHead(405);
response.write('Invalid method');
response.end();
}
break;
default:
response.writeHead(404);
response.write('Unknown stabilizer proxy command');
response.end();
}
}
requestListener(originalRequest, response) {
if (BlockingProxy.isProxyCommand(originalRequest.url)) {
let commandData = '';
originalRequest.on('data', (d) => {
commandData += d;
});
originalRequest.on('end', () => {
this.handleProxyCommand(originalRequest, commandData, response);
});
return;
}
// OK to ignore the promise returned by this.
this.proxy.handleRequest(originalRequest, response);
}
listen(port) {
this.server.listen(port);
let actualPort = this.server.address().port;
return actualPort;
}
quit() {
return new Promise((resolve) => {
this.server.close(resolve);
});
}
}
exports.BlockingProxy = BlockingProxy;
//# sourceMappingURL=blockingproxy.js.map

1
node_modules/blocking-proxy/built/lib/blockingproxy.js.map generated vendored Executable file
View file

@ -0,0 +1 @@
{"version":3,"file":"blockingproxy.js","sourceRoot":"","sources":["../../lib/blockingproxy.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAE7B,iEAA0D;AAC1D,uEAAgE;AAChE,uEAAgE;AAEhE,uDAAiD;AAEpC,QAAA,SAAS,GAAG,SAAS,CAAC;AA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AAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;QAC5C,MAAM,CAAC,UAAU,CAAC;IACpB,CAAC;IAED,IAAI;QACF,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnHD,sCAmHC"}

20
node_modules/blocking-proxy/built/lib/client.d.ts generated vendored Executable file
View file

@ -0,0 +1,20 @@
export declare class BPClient {
hostname: string;
port: number;
constructor(bpUrlValue: string);
/**
* Toggle whether waiting for Angular is enabled.
*
* @param enabled Whether or not to enable waiting for angular.
* @returns {Promise<T>}
*/
setWaitEnabled(enabled: boolean): Promise<any>;
/**
* Set the selector used to find the root element of the Angular application to wait for. See
* AngularWaitBarrier for more details.
*
* @param selector A selector, or empty string to wait for all Angular apps.
*/
setWaitParams(rootSelector: string): Promise<any>;
isWaitEnabled(): Promise<{}>;
}

68
node_modules/blocking-proxy/built/lib/client.js generated vendored Executable file
View file

@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http = require("http");
const url = require("url");
const blockingproxy_1 = require("./blockingproxy");
class BPClient {
constructor(bpUrlValue) {
let bpUrl = url.parse(bpUrlValue);
this.hostname = bpUrl.hostname;
this.port = parseInt(bpUrl.port);
}
/**
* Toggle whether waiting for Angular is enabled.
*
* @param enabled Whether or not to enable waiting for angular.
* @returns {Promise<T>}
*/
setWaitEnabled(enabled) {
return new Promise((resolve, reject) => {
let options = { host: this.hostname, port: this.port, method: 'POST', path: `/${blockingproxy_1.BP_PREFIX}/waitEnabled` };
let request = http.request(options, (response) => {
response.on('data', () => { });
response.on('error', (err) => reject(err));
response.on('end', () => {
resolve();
});
});
request.write(JSON.stringify({ value: enabled }));
request.end();
});
}
/**
* Set the selector used to find the root element of the Angular application to wait for. See
* AngularWaitBarrier for more details.
*
* @param selector A selector, or empty string to wait for all Angular apps.
*/
setWaitParams(rootSelector) {
return new Promise((resolve, reject) => {
let options = { host: this.hostname, port: this.port, method: 'POST', path: `/${blockingproxy_1.BP_PREFIX}/waitParams` };
let request = http.request(options, (response) => {
response.on('data', () => { });
response.on('error', (err) => reject(err));
response.on('end', () => {
resolve();
});
});
request.write(JSON.stringify({ rootSelector: rootSelector }));
request.end();
});
}
isWaitEnabled() {
return new Promise((res) => {
let options = { host: this.hostname, port: this.port, path: `/${blockingproxy_1.BP_PREFIX}/waitEnabled` };
http.get(options, (response) => {
let body = '';
response.on('data', (data) => {
body += data;
});
response.on('end', () => {
res(JSON.parse(body).value);
});
});
});
}
}
exports.BPClient = BPClient;
//# sourceMappingURL=client.js.map

1
node_modules/blocking-proxy/built/lib/client.js.map generated vendored Executable file
View file

@ -0,0 +1 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../lib/client.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,2BAA2B;AAC3B,mDAA0C;AAE1C;IAIE,YAAY,UAAkB;QAC5B,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,OAAgB;QAC7B,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,OAAO,GACP,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,yBAAS,cAAc,EAAC,CAAC;YAE9F,IAAI,OA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CAAC;YACL,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC,YAAY,EAAE,YAAY,EAAC,CAAC,CAAC,CAAC;YAC5D,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,aAAa;QACX,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACzB,IAAI,OAAO,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,yBAAS,cAAc,EAAC,CAAC;YAExF,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC7B,IAAI,IAAI,GAAG,EAAE,CAAC;gBACd,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC3B,IAAI,IAAI,IAAI,CAAC;gBACf,CAAC,CAAC,CAAC;gBACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBACtB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;gBAC9B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvED,4BAuEC"}

View file

@ -0,0 +1,29 @@
/**
* Creates a floating translucent div at the specified location in order to highlight a particular
* element. Note that these scripts are run directly in the browser under test, so they need to
* be ES5 compatible and serializable.
*/
exports.HIGHLIGHT_FN = function(top, left, width, height) {
console.log('Highlighting at ', top, left, width, height);
var el = document.createElement('div');
el.id = 'BP_ELEMENT_HIGHLIGHT__';
document.body.appendChild(el);
el.style['position'] = 'absolute';
el.style['background-color'] = 'lightblue';
el.style['opacity'] = '0.7';
el.style['top'] = top + 'px';
el.style['left'] = left + 'px';
el.style['width'] = width + 'px';
el.style['height'] = height + 'px';
};
/**
* Removes the highlight
*/
exports.REMOVE_HIGHLIGHT_FN = function() {
var el = document.getElementById('BP_ELEMENT_HIGHLIGHT__');
if (el) {
el.parentElement.removeChild(el);
}
};

180
node_modules/blocking-proxy/built/lib/client_scripts/wait.js generated vendored Executable file
View file

@ -0,0 +1,180 @@
/**
* Copied from Protractor 5.2.0
*
* Wait until Angular has finished rendering and has
* no outstanding $http calls before continuing. The specific Angular app
* is determined by the rootSelector.
*
* Asynchronous.
*
* @param {string} rootSelector The selector housing an ng-app
* @param {function(string)} callback callback. If a failure occurs, it will
* be passed as a parameter.
*/
function waitForAngular(rootSelector, callback) {
try {
// Wait for both angular1 testability and angular2 testability.
var testCallback = callback;
// Wait for angular1 testability first and run waitForAngular2 as a callback
var waitForAngular1 = function(callback) {
if (window.angular) {
var hooks = getNg1Hooks(rootSelector);
if (!hooks){
callback(); // not an angular1 app
}
else{
if (hooks.$$testability) {
hooks.$$testability.whenStable(callback);
} else if (hooks.$injector) {
hooks.$injector.get('$browser')
.notifyWhenNoOutstandingRequests(callback);
} else if (!!rootSelector) {
throw new Error(
'Could not automatically find injector on page: "' +
window.location.toString() + '". Consider using config.rootEl');
} else {
throw new Error(
'root element (' + rootSelector + ') has no injector.' +
' this may mean it is not inside ng-app.');
}
}
}
else {callback();} // not an angular1 app
};
// Wait for Angular2 testability and then run test callback
var waitForAngular2 = function() {
if (window.getAngularTestability) {
if (rootSelector) {
var testability = null;
var el = document.querySelector(rootSelector);
try{
testability = window.getAngularTestability(el);
}
catch(e){}
if (testability) {
return testability.whenStable(testCallback);
}
}
// Didn't specify root element or testability could not be found
// by rootSelector. This may happen in a hybrid app, which could have
// more than one root.
var testabilities = window.getAllAngularTestabilities();
var count = testabilities.length;
// No angular2 testability, this happens when
// going to a hybrid page and going back to a pure angular1 page
if (count === 0) {
return testCallback();
}
var decrement = function() {
count--;
if (count === 0) {
testCallback();
}
};
testabilities.forEach(function(testability) {
testability.whenStable(decrement);
});
}
else {testCallback();} // not an angular2 app
};
if (!(window.angular) && !(window.getAngularTestability)) {
// no testability hook
throw new Error(
'both angularJS testability and angular testability are undefined.' +
' This could be either ' +
'because this is a non-angular page or because your test involves ' +
'client-side navigation, which can interfere with Protractor\'s ' +
'bootstrapping. See http://git.io/v4gXM for details');
} else {waitForAngular1(waitForAngular2);} // Wait for angular1 and angular2
// Testability hooks sequentially
} catch (err) {
callback(err.message);
}
};
/* Tries to find $$testability and possibly $injector for an ng1 app
*
* By default, doesn't care about $injector if it finds $$testability. However,
* these priorities can be reversed.
*
* @param {string=} selector The selector for the element with the injector. If
* falsy, tries a variety of methods to find an injector
* @param {boolean=} injectorPlease Prioritize finding an injector
* @return {$$testability?: Testability, $injector?: Injector} Returns whatever
* ng1 app hooks it finds
*/
function getNg1Hooks(selector, injectorPlease) {
function tryEl(el) {
try {
if (!injectorPlease && angular.getTestability) {
var $$testability = angular.getTestability(el);
if ($$testability) {
return {$$testability: $$testability};
}
} else {
var $injector = angular.element(el).injector();
if ($injector) {
return {$injector: $injector};
}
}
} catch(err) {}
}
function trySelector(selector) {
var els = document.querySelectorAll(selector);
for (var i = 0; i < els.length; i++) {
var elHooks = tryEl(els[i]);
if (elHooks) {
return elHooks;
}
}
}
if (selector) {
return trySelector(selector);
} else if (window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__) {
var $injector = window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__;
var $$testability = null;
try {
$$testability = $injector.get('$$testability');
} catch (e) {}
return {$injector: $injector, $$testability: $$testability};
} else {
return tryEl(document.body) ||
trySelector('[ng-app]') || trySelector('[ng\\:app]') ||
trySelector('[ng-controller]') || trySelector('[ng\\:controller]');
}
}
/* Wraps a function up into a string with its helper functions so that it can
* call those helper functions client side
*
* @param {function} fun The function to wrap up with its helpers
* @param {...function} The helper functions. Each function must be named
*
* @return {string} The string which, when executed, will invoke fun in such a
* way that it has access to its helper functions
*/
function wrapWithHelpers(fun) {
var helpers = Array.prototype.slice.call(arguments, 1);
if (!helpers.length) {
return fun;
}
var FunClass = Function; // Get the linter to allow this eval
return new FunClass(
helpers.join(';') + String.fromCharCode(59) +
' return (' + fun.toString() + ').apply(this, arguments);');
}
exports.NG_WAIT_FN = wrapWithHelpers(waitForAngular, getNg1Hooks);

10
node_modules/blocking-proxy/built/lib/config.d.ts generated vendored Executable file
View file

@ -0,0 +1,10 @@
export interface Config {
help?: boolean;
fork?: boolean;
highlightDelay?: string;
seleniumAddress?: string;
logDir?: string;
port?: number;
}
export declare function processArgs(argv: string[]): Config;
export declare function printHelp(): void;

40
node_modules/blocking-proxy/built/lib/config.js generated vendored Executable file
View file

@ -0,0 +1,40 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const minimist = require("minimist");
const opts = {
boolean: ['help', 'fork'],
string: ['port', 'seleniumAddress', 'highlightDelay', 'logDir'],
alias: {
help: ['h'],
port: ['p'],
seleniumAddress: ['s'],
},
default: {
port: process.env.BP_PORT || 0,
seleniumAddress: process.env.BP_SELENIUM_ADDRESS || 'http://localhost:4444/wd/hub',
}
};
function processArgs(argv) {
return minimist(argv, opts);
}
exports.processArgs = processArgs;
function printHelp() {
console.log(`
Usage: blocking-proxy <options>
Options:
--help, -h Show help.
--port, -p The port to listen on. If unset, will choose a random free port.
--fork Start in fork mode. BlockingProxy will use process.send() to communicate
with the parent process.
--selenumAddress, -s The address of the selenium remote server to proxy.
--highlightDelay If specified, will highlight elements before interacting with them and
wait the specified amount of time (in ms) before allowing WebDriver
to continue.
--logDir If specified, will create a log of WebDriver commands in this directory.
--rootElement Element housing ng-app, if not html or body.
`);
}
exports.printHelp = printHelp;
//# sourceMappingURL=config.js.map

1
node_modules/blocking-proxy/built/lib/config.js.map generated vendored Executable file
View file

@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":";;;AAEA,qCAAqC;AAWrC,MAAM,IAAI,GAAkB;IAC1B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;IAC/D,KAAK,EAAE;QACL,IAAI,EAAE,CAAC,GAAG,CAAC;QACX,IAAI,EAAE,CAAC,GAAG,CAAC;QACX,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC;QAC9B,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,8BAA8B;KACnF;CACF,CAAC;AAEF,qBAA4B,IAAc;IACxC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAW,CAAC;AACxC,CAAC;AAFD,kCAEC;AAED;IACE,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;CAcb,CAAC,CAAC;AACH,CAAC;AAhBD,8BAgBC"}

View file

@ -0,0 +1,18 @@
import { SimpleWebDriverClient } from './simple_webdriver_client';
import { WebDriverCommand } from './webdriver_commands';
import { WebDriverBarrier } from './webdriver_proxy';
/**
* A barrier that delays forwarding WebDriver commands that can affect the app (ie, clicks or
* sending text) for a fixed amount of time. During the delay, the element that's the target
* of the command will be highlighted by drawing a transparent div on top of it.
*/
export declare class HighlightDelayBarrier implements WebDriverBarrier {
private client;
delay: number;
constructor(client: SimpleWebDriverClient, delay: number);
private isHighlightCommand(command);
private highlightData(top, left, width, height);
private removeHighlightData();
private sleep(delay);
onCommand(command: WebDriverCommand): Promise<void>;
}

View file

@ -0,0 +1,67 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const webdriver_commands_1 = require("./webdriver_commands");
const HIGHLIGHT_COMMAND = [webdriver_commands_1.CommandName.ElementClick, webdriver_commands_1.CommandName.ElementSendKeys, webdriver_commands_1.CommandName.ElementClear];
let clientScripts = require('./client_scripts/highlight.js');
/**
* A barrier that delays forwarding WebDriver commands that can affect the app (ie, clicks or
* sending text) for a fixed amount of time. During the delay, the element that's the target
* of the command will be highlighted by drawing a transparent div on top of it.
*/
class HighlightDelayBarrier {
constructor(client, delay) {
this.client = client;
this.delay = delay;
}
isHighlightCommand(command) {
return HIGHLIGHT_COMMAND.indexOf(command.commandName) !== -1;
}
highlightData(top, left, width, height) {
return JSON.stringify({
script: 'return (' + clientScripts.HIGHLIGHT_FN + ').apply(null, arguments);',
args: [top, left, width, height]
});
}
removeHighlightData() {
return JSON.stringify({
script: 'return (' + clientScripts.REMOVE_HIGHLIGHT_FN + ').apply(null, arguments);',
args: []
});
}
// Simple promise-based sleep so we can use async/await
sleep(delay) {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, delay);
});
}
onCommand(command) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.isHighlightCommand(command) || !this.delay) {
return;
}
const sessId = command.sessionId;
const el = command.getParam('elementId');
// The W3C spec does have a 'getRect', but the standalone server doesn't support it yet.
const loc = yield this.client.getLocation(sessId, el);
const size = yield this.client.getSize(sessId, el);
// Set the highlight
yield this.client.execute(sessId, this.highlightData(loc['y'], loc['x'], size['width'], size['height']));
// Wait
yield this.sleep(this.delay);
// Clear the highlight
yield this.client.execute(sessId, this.removeHighlightData());
});
}
}
exports.HighlightDelayBarrier = HighlightDelayBarrier;
//# sourceMappingURL=highlight_delay_barrier.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"highlight_delay_barrier.js","sourceRoot":"","sources":["../../lib/highlight_delay_barrier.ts"],"names":[],"mappings":";;;;;;;;;;AACA,6DAAmE;AAG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AAC,CAAC;gBACrD,MAAM,CAAC;YACT,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;YACjC,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YAEzC,wFAAwF;YACxF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAEnD,oBAAoB;YACpB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACrB,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAEnF,OAAO;YACP,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE7B,sBAAsB;YACtB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAChE,CAAC;KAAA;CACF;AAnDD,sDAmDC"}

2
node_modules/blocking-proxy/built/lib/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,2 @@
export { BlockingProxy } from './blockingproxy';
export { BPClient } from './client';

7
node_modules/blocking-proxy/built/lib/index.js generated vendored Executable file
View file

@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var blockingproxy_1 = require("./blockingproxy");
exports.BlockingProxy = blockingproxy_1.BlockingProxy;
var client_1 = require("./client");
exports.BPClient = client_1.BPClient;
//# sourceMappingURL=index.js.map

1
node_modules/blocking-proxy/built/lib/index.js.map generated vendored Executable file
View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;AAAA,iDAA8C;AAAtC,wCAAA,aAAa,CAAA;AACrB,mCAAkC;AAA1B,4BAAA,QAAQ,CAAA"}

View file

@ -0,0 +1,39 @@
/**
* Super dumb and simple WebDriver client. Works with selenium standalone, may or may not work yet
* directly with other drivers.
*/
export declare class SimpleWebDriverClient {
seleniumAddress: string;
constructor(seleniumAddress: string);
/**
* Send an execute script command.
*
* @param sessionId
* @param data A JSON blob with the script and arguments to execute.
*/
execute(sessionId: string, data: string): Promise<void>;
/**
* Send an execute async script command.
*
* @param sessionId
* @param data A JSON blob with the script and arguments to execute.
*/
executeAsync(sessionId: string, data: string): Promise<void>;
/**
* Get the location of an element.
*
* @param sessionId
* @param elementId
* @returns Promise<{}> A promise that resolves with the x and y coordinates of the element.
*/
getLocation(sessionId: string, elementId: string): Promise<void>;
/**
* Get the size of an element.
*
* @param sessionId
* @param elementId
* @returns Promise<{}> A promise that resolves with the height and width of the element.
*/
getSize(sessionId: string, elementId: string): Promise<void>;
private createSeleniumRequest(method, messageUrl, data?);
}

View file

@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http = require("http");
const url = require("url");
/**
* Super dumb and simple WebDriver client. Works with selenium standalone, may or may not work yet
* directly with other drivers.
*/
class SimpleWebDriverClient {
constructor(seleniumAddress) {
this.seleniumAddress = seleniumAddress;
}
/**
* Send an execute script command.
*
* @param sessionId
* @param data A JSON blob with the script and arguments to execute.
*/
execute(sessionId, data) {
const url = ['session', sessionId, 'execute'].join('/');
return this.createSeleniumRequest('POST', url, data);
}
/**
* Send an execute async script command.
*
* @param sessionId
* @param data A JSON blob with the script and arguments to execute.
*/
executeAsync(sessionId, data) {
const url = ['session', sessionId, 'execute_async'].join('/');
return this.createSeleniumRequest('POST', url, data);
}
/**
* Get the location of an element.
*
* @param sessionId
* @param elementId
* @returns Promise<{}> A promise that resolves with the x and y coordinates of the element.
*/
getLocation(sessionId, elementId) {
const url = ['session', sessionId, 'element', elementId, 'location'].join('/');
return this.createSeleniumRequest('GET', url);
}
/**
* Get the size of an element.
*
* @param sessionId
* @param elementId
* @returns Promise<{}> A promise that resolves with the height and width of the element.
*/
getSize(sessionId, elementId) {
const url = ['session', sessionId, 'element', elementId, 'size'].join('/');
return this.createSeleniumRequest('GET', url);
}
createSeleniumRequest(method, messageUrl, data) {
let parsedUrl = url.parse(this.seleniumAddress);
let options = {};
options['method'] = method;
options['path'] = parsedUrl.path + '/' + messageUrl;
options['hostname'] = parsedUrl.hostname;
options['port'] = parseInt(parsedUrl.port);
let request = http.request(options);
return new Promise((resolve, reject) => {
if (data) {
request.write(data);
}
request.end();
request.on('response', (resp) => {
let respData = '';
resp.on('data', (d) => {
respData += d;
});
resp.on('error', (err) => {
reject(err);
});
resp.on('end', () => {
let response = JSON.parse(respData);
// Selenium 3.5.x or greater
if (response.status && response.status > 0) {
console.error(`Got status ${response.status} from selenium`, response.value);
reject(JSON.stringify(response.value));
}
// Selenium 3.0.x
if (response.state && response.state !== 'success') {
console.error(`Got response ${response.state} from selenium`, response.value);
reject(JSON.stringify(response.value));
}
resolve(response.value);
});
});
});
}
;
}
exports.SimpleWebDriverClient = SimpleWebDriverClient;
//# sourceMappingURL=simple_webdriver_client.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"simple_webdriver_client.js","sourceRoot":"","sources":["../../lib/simple_webdriver_client.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,2BAA2B;AAE3B;;;GAGG;AACH;IAGE,YAAY,eAAuB;QACjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,SAAiB,EAAE,IAAY;QAC5C,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,GAAG,EA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BACnD,OAAO,CAAC,KAAK,CAAC,gBAAgB,QAAQ,CAAC,KAAK,gBAAgB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;wBAC9E,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;oBACzC,CAAC;oBACD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAAA,CAAC;CACH;AA9FD,sDA8FC"}

View file

@ -0,0 +1,67 @@
/// <reference types="node" />
/**
* Utilities for parsing WebDriver commands from HTTP Requests.
*/
import * as events from 'events';
export declare type HttpMethod = 'GET' | 'POST' | 'DELETE';
export declare type paramKey = 'sessionId' | 'elementId' | 'name' | 'propertyName';
export declare enum CommandName {
NewSession = 0,
DeleteSession = 1,
Status = 2,
GetTimeouts = 3,
SetTimeouts = 4,
Go = 5,
GetCurrentURL = 6,
Back = 7,
Forward = 8,
Refresh = 9,
GetTitle = 10,
FindElement = 11,
FindElements = 12,
FindElementFromElement = 13,
FindElementsFromElement = 14,
IsElementSelected = 15,
GetElementAttribute = 16,
GetElementProperty = 17,
GetElementCSSValue = 18,
GetElementText = 19,
GetElementTagName = 20,
GetElementRect = 21,
IsElementEnabled = 22,
ElementClick = 23,
ElementClear = 24,
ElementSendKeys = 25,
WireMoveTo = 26,
WireButtonDown = 27,
WireButtonUp = 28,
GetAlertText = 29,
AcceptAlert = 30,
DismissAlert = 31,
UNKNOWN = 32,
}
/**
* An instance of a WebDriver command, containing the params and data for that request.
*
* @param commandName The enum identifying the command.
* @param params Parameters for the command taken from the request's url.
* @param data Optional data included with the command, taken from the body of the request.
*/
export declare class WebDriverCommand extends events.EventEmitter {
commandName: CommandName;
readonly url: string;
readonly method: HttpMethod;
private params;
data: any;
responseStatus: number;
responseData: any;
readonly sessionId: string;
constructor(commandName: CommandName, url: string, method: HttpMethod, params?: any);
getParam(key: paramKey): string;
handleData(data?: any): void;
handleResponse(statusCode: number, data?: any): void;
}
/**
* Returns a new WebdriverCommand object for the resource at the given URL.
*/
export declare function parseWebDriverCommand(url: any, method: any): WebDriverCommand;

212
node_modules/blocking-proxy/built/lib/webdriver_commands.js generated vendored Executable file
View file

@ -0,0 +1,212 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Utilities for parsing WebDriver commands from HTTP Requests.
*/
const events = require("events");
var CommandName;
(function (CommandName) {
CommandName[CommandName["NewSession"] = 0] = "NewSession";
CommandName[CommandName["DeleteSession"] = 1] = "DeleteSession";
CommandName[CommandName["Status"] = 2] = "Status";
CommandName[CommandName["GetTimeouts"] = 3] = "GetTimeouts";
CommandName[CommandName["SetTimeouts"] = 4] = "SetTimeouts";
CommandName[CommandName["Go"] = 5] = "Go";
CommandName[CommandName["GetCurrentURL"] = 6] = "GetCurrentURL";
CommandName[CommandName["Back"] = 7] = "Back";
CommandName[CommandName["Forward"] = 8] = "Forward";
CommandName[CommandName["Refresh"] = 9] = "Refresh";
CommandName[CommandName["GetTitle"] = 10] = "GetTitle";
CommandName[CommandName["FindElement"] = 11] = "FindElement";
CommandName[CommandName["FindElements"] = 12] = "FindElements";
CommandName[CommandName["FindElementFromElement"] = 13] = "FindElementFromElement";
CommandName[CommandName["FindElementsFromElement"] = 14] = "FindElementsFromElement";
CommandName[CommandName["IsElementSelected"] = 15] = "IsElementSelected";
CommandName[CommandName["GetElementAttribute"] = 16] = "GetElementAttribute";
CommandName[CommandName["GetElementProperty"] = 17] = "GetElementProperty";
CommandName[CommandName["GetElementCSSValue"] = 18] = "GetElementCSSValue";
CommandName[CommandName["GetElementText"] = 19] = "GetElementText";
CommandName[CommandName["GetElementTagName"] = 20] = "GetElementTagName";
CommandName[CommandName["GetElementRect"] = 21] = "GetElementRect";
CommandName[CommandName["IsElementEnabled"] = 22] = "IsElementEnabled";
CommandName[CommandName["ElementClick"] = 23] = "ElementClick";
CommandName[CommandName["ElementClear"] = 24] = "ElementClear";
CommandName[CommandName["ElementSendKeys"] = 25] = "ElementSendKeys";
CommandName[CommandName["WireMoveTo"] = 26] = "WireMoveTo";
CommandName[CommandName["WireButtonDown"] = 27] = "WireButtonDown";
CommandName[CommandName["WireButtonUp"] = 28] = "WireButtonUp";
CommandName[CommandName["GetAlertText"] = 29] = "GetAlertText";
CommandName[CommandName["AcceptAlert"] = 30] = "AcceptAlert";
CommandName[CommandName["DismissAlert"] = 31] = "DismissAlert";
CommandName[CommandName["UNKNOWN"] = 32] = "UNKNOWN";
})(CommandName = exports.CommandName || (exports.CommandName = {}));
/**
* Represents an endpoint in the WebDriver spec. Endpoints are defined by
* the CommandName enum and the url pattern that they match.
*
* For example, the pattern
* /session/:sessionId/element/:elementId/click
* will match urls such as
* /session/d9e52b96-9b6a-4cb3-b017-76e8b4236646/element/1c2855ba-213d-4466-ba16-b14a7e6c3699/click
*
* @param pattern The url pattern
* @param method The HTTP method, ie GET, POST, DELETE
* @param name The CommandName of this endpoint.
*/
class Endpoint {
constructor(pattern, method, name) {
this.pattern = pattern;
this.method = method;
this.name = name;
}
/**
* Tests whether a given url from a request matches this endpoint.
*
* @param url A url from a request to test against the endpoint.
* @param method The HTTP method.
* @returns {boolean} Whether the endpoint matches.
*/
matches(url, method) {
let urlParts = url.split('/');
let patternParts = this.pattern.split('/');
if (method != this.method || urlParts.length != patternParts.length) {
return false;
}
// TODO: Replace this naive search with better parsing.
for (let idx in patternParts) {
if (!patternParts[idx].startsWith(':') && patternParts[idx] != urlParts[idx]) {
return false;
}
}
return true;
}
/**
* Given a url from a http request, create an object containing parameters from the URL.
*
* Parameters are the parts of the endpoint's pattern that start with ':'. The ':' is dropped
* from the parameter key.
*
* @param url The url from the request.
* @returns An object mapping parameter keys to values from the url.
*/
getParams(url) {
let urlParts = url.split('/');
let patternParts = this.pattern.split('/');
let params = {};
for (let idx in patternParts) {
if (patternParts[idx].startsWith(':')) {
let paramName = patternParts[idx].slice(1);
params[paramName] = urlParts[idx];
}
}
return params;
}
}
/**
* An instance of a WebDriver command, containing the params and data for that request.
*
* @param commandName The enum identifying the command.
* @param params Parameters for the command taken from the request's url.
* @param data Optional data included with the command, taken from the body of the request.
*/
class WebDriverCommand extends events.EventEmitter {
constructor(commandName, url, method, params) {
super();
this.commandName = commandName;
this.url = url;
this.method = method;
this.params = params;
}
// All WebDriver commands have a session Id, except for two.
// NewSession will have a session Id in the data
// Status just doesn't
get sessionId() {
if (!this.getParam('sessionId') && this.url.startsWith('/session')) {
return this.url.split('/')[2];
}
return this.getParam('sessionId');
}
getParam(key) {
return this.params[key];
}
handleData(data) {
try {
this.data = JSON.parse(data);
}
catch (err) {
this.data = data;
}
this.emit('data');
}
handleResponse(statusCode, data) {
this.responseStatus = statusCode;
try {
this.responseData = JSON.parse(data);
}
catch (err) {
this.responseData = data;
}
this.emit('response');
}
}
exports.WebDriverCommand = WebDriverCommand;
/**
* The set of known endpoints.
*/
let endpoints = [];
function addWebDriverCommand(command, method, pattern) {
endpoints.push(new Endpoint(pattern, method, command));
}
/**
* Returns a new WebdriverCommand object for the resource at the given URL.
*/
function parseWebDriverCommand(url, method) {
for (let endpoint of endpoints) {
if (endpoint.matches(url, method)) {
let params = endpoint.getParams(url);
return new WebDriverCommand(endpoint.name, url, method, params);
}
}
return new WebDriverCommand(CommandName.UNKNOWN, url, method, {});
}
exports.parseWebDriverCommand = parseWebDriverCommand;
let sessionPrefix = '/session/:sessionId';
addWebDriverCommand(CommandName.NewSession, 'POST', '/session');
addWebDriverCommand(CommandName.DeleteSession, 'DELETE', '/session/:sessionId');
addWebDriverCommand(CommandName.Status, 'GET', '/status');
addWebDriverCommand(CommandName.GetTimeouts, 'GET', sessionPrefix + '/timeouts');
addWebDriverCommand(CommandName.SetTimeouts, 'POST', sessionPrefix + '/timeouts');
addWebDriverCommand(CommandName.Go, 'POST', sessionPrefix + '/url');
addWebDriverCommand(CommandName.GetCurrentURL, 'GET', sessionPrefix + '/url');
addWebDriverCommand(CommandName.Back, 'POST', sessionPrefix + '/back');
addWebDriverCommand(CommandName.Forward, 'POST', sessionPrefix + '/forward');
addWebDriverCommand(CommandName.Refresh, 'POST', sessionPrefix + '/refresh');
addWebDriverCommand(CommandName.GetTitle, 'GET', sessionPrefix + '/title');
addWebDriverCommand(CommandName.FindElement, 'POST', sessionPrefix + '/element');
addWebDriverCommand(CommandName.FindElements, 'POST', sessionPrefix + '/elements');
addWebDriverCommand(CommandName.FindElementFromElement, 'POST', sessionPrefix + '/element/:elementId/element');
addWebDriverCommand(CommandName.FindElementsFromElement, 'POST', sessionPrefix + '/element/:elementId/elements');
addWebDriverCommand(CommandName.IsElementSelected, 'POST', sessionPrefix + '/element/:elementId/selected');
addWebDriverCommand(CommandName.GetElementAttribute, 'GET', sessionPrefix + '/element/:elementId/attribute/:attributeName');
addWebDriverCommand(CommandName.GetElementProperty, 'GET', sessionPrefix + '/element/:elementId/property/:propertyName');
addWebDriverCommand(CommandName.GetElementCSSValue, 'GET', sessionPrefix + '/element/:elementId/css/:cssPropertyName');
addWebDriverCommand(CommandName.GetElementText, 'GET', sessionPrefix + '/element/:elementId/text');
addWebDriverCommand(CommandName.GetElementTagName, 'GET', sessionPrefix + '/element/:elementId/name');
addWebDriverCommand(CommandName.GetElementRect, 'GET', sessionPrefix + '/element/:elementId/rect');
addWebDriverCommand(CommandName.GetElementRect, 'GET', sessionPrefix + '/element/:elementId/size');
addWebDriverCommand(CommandName.IsElementEnabled, 'GET', sessionPrefix + '/element/:elementId/enabled');
addWebDriverCommand(CommandName.ElementClick, 'POST', sessionPrefix + '/element/:elementId/click');
addWebDriverCommand(CommandName.ElementClear, 'POST', sessionPrefix + '/element/:elementId/clear');
addWebDriverCommand(CommandName.ElementSendKeys, 'POST', sessionPrefix + '/element/:elementId/value');
addWebDriverCommand(CommandName.GetAlertText, 'GET', sessionPrefix + '/alert_text');
addWebDriverCommand(CommandName.GetAlertText, 'GET', sessionPrefix + '/alert/text');
addWebDriverCommand(CommandName.AcceptAlert, 'POST', sessionPrefix + '/alert/accept');
addWebDriverCommand(CommandName.AcceptAlert, 'POST', sessionPrefix + '/accept_alert');
addWebDriverCommand(CommandName.DismissAlert, 'POST', sessionPrefix + '/alert/dismiss');
addWebDriverCommand(CommandName.DismissAlert, 'POST', sessionPrefix + '/dismiss_alert');
// These commands are part of the JSON protocol, and were replaced by Perform Actions in the W3C
// spec
addWebDriverCommand(CommandName.WireMoveTo, 'POST', sessionPrefix + '/moveto');
addWebDriverCommand(CommandName.WireButtonDown, 'POST', sessionPrefix + '/buttondown');
addWebDriverCommand(CommandName.WireButtonUp, 'POST', sessionPrefix + '/buttonup');
//# sourceMappingURL=webdriver_commands.js.map

File diff suppressed because one or more lines are too long

35
node_modules/blocking-proxy/built/lib/webdriver_logger.d.ts generated vendored Executable file
View file

@ -0,0 +1,35 @@
/// <reference types="node" />
import * as stream from 'stream';
import { WebDriverCommand } from './webdriver_commands';
/**
* Logs WebDriver commands, transforming the command into a user-friendly description.
*/
export declare class WebDriverLogger {
logStream: stream.Writable;
readonly logName: string;
constructor();
/**
* Start logging to the specified directory. Will create a file named
* 'webdriver_log_<process id>.txt'
*
* @param logDir The directory to create log files in.
*/
setLogDir(logDir: string): void;
/**
* Logs a webdriver command to the log file.
*
* @param command The command to log.
*/
logWebDriverCommand(command: WebDriverCommand): void;
/**
* Log an arbitrary event to the log file.
*
* @param msg The message to log.
* @param sessionId The session id associated with the event.
* @param elapsedMs How long the event took, in ms.
*/
logEvent(msg: string, sessionId: string, elapsedMs: number): void;
private renderData(command);
private renderResponse(command);
private timestamp();
}

152
node_modules/blocking-proxy/built/lib/webdriver_logger.js generated vendored Executable file
View file

@ -0,0 +1,152 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
const webdriver_commands_1 = require("./webdriver_commands");
// Generate a random 8 character ID to avoid collisions.
function getLogId() {
return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(36).slice(0, 8);
}
// Super proprietary left pad implementation. Do not copy plzkthx.
function leftPad(field) {
const fieldWidth = 6;
let padding = fieldWidth - field.length;
if (padding > 0) {
return ' '.repeat(padding) + field;
}
return field;
}
const FINDERS = [
webdriver_commands_1.CommandName.FindElement, webdriver_commands_1.CommandName.FindElementFromElement, webdriver_commands_1.CommandName.FindElements,
webdriver_commands_1.CommandName.FindElementsFromElement
];
const READERS = [
webdriver_commands_1.CommandName.GetElementTagName, webdriver_commands_1.CommandName.GetElementText, webdriver_commands_1.CommandName.GetElementAttribute,
webdriver_commands_1.CommandName.GetElementProperty, webdriver_commands_1.CommandName.GetElementCSSValue, webdriver_commands_1.CommandName.GetElementRect
];
const PAD = ' ';
/**
* Logs WebDriver commands, transforming the command into a user-friendly description.
*/
class WebDriverLogger {
constructor() {
this.logName = `webdriver_log_${getLogId()}.txt`;
}
/**
* Start logging to the specified directory. Will create a file named
* 'webdriver_log_<process id>.txt'
*
* @param logDir The directory to create log files in.
*/
setLogDir(logDir) {
this.logStream = fs.createWriteStream(path.join(logDir, this.logName), { flags: 'a' });
}
/**
* Logs a webdriver command to the log file.
*
* @param command The command to log.
*/
logWebDriverCommand(command) {
if (!this.logStream) {
return;
}
let logLine;
logLine = `${this.timestamp()} `;
let started = Date.now();
command.on('response', () => {
let done = Date.now();
let elapsed = leftPad((done - started) + '');
logLine += `| ${elapsed}ms `;
if (command.getParam('sessionId')) {
let session = command.getParam('sessionId').slice(0, 6);
logLine += `| ${session} `;
}
else if (command.commandName == webdriver_commands_1.CommandName.NewSession) {
// Only for new session commands, the sessionId is in the response.
let session = command.responseData['sessionId'].slice(0, 6);
logLine += `| ${session} `;
}
if (command.commandName == webdriver_commands_1.CommandName.UNKNOWN) {
logLine += `| ${command.url}`;
}
else {
logLine += `| ${webdriver_commands_1.CommandName[command.commandName]}`;
}
if (command.commandName == webdriver_commands_1.CommandName.Go) {
logLine += ' ' + command.data['url'];
}
else if (command.getParam('elementId')) {
logLine += ` (${command.getParam('elementId')})`;
}
logLine += '\n';
this.logStream.write(logLine);
this.renderData(command);
this.renderResponse(command);
});
}
/**
* Log an arbitrary event to the log file.
*
* @param msg The message to log.
* @param sessionId The session id associated with the event.
* @param elapsedMs How long the event took, in ms.
*/
logEvent(msg, sessionId, elapsedMs) {
let elapsed = leftPad(elapsedMs.toString());
let logLine = `${this.timestamp()} | ${elapsed}ms | ${sessionId.slice(0, 6)} | ${msg}\n`;
this.logStream.write(logLine);
}
renderData(command) {
let dataLine = '';
if (command.commandName === webdriver_commands_1.CommandName.NewSession) {
dataLine = JSON.stringify(command.data['desiredCapabilities']);
}
else if (command.commandName === webdriver_commands_1.CommandName.ElementSendKeys) {
let value = command.data['value'].join('');
dataLine = `Send: ${value}`;
}
else if (FINDERS.indexOf(command.commandName) !== -1) {
const using = command.data['using'];
const value = command.data['value'];
dataLine = `Using ${using} '${value}'`;
}
if (dataLine) {
this.logStream.write(PAD + dataLine + '\n');
}
}
renderResponse(command) {
let respLine = '';
const data = command.responseData;
if (data['status'] > 0) {
respLine = `ERROR ${data['status']}: ${data['value']['message']}`;
}
else if (FINDERS.indexOf(command.commandName) !== -1) {
let els = command.responseData['value'];
if (!Array.isArray(els)) {
els = [els];
}
els = els.map((e) => e['ELEMENT']);
respLine = 'Elements: ' + els;
}
else if (READERS.indexOf(command.commandName) !== -1) {
respLine = command.responseData['value'];
if (typeof respLine == 'object') {
respLine = JSON.stringify(respLine);
}
}
if (respLine) {
this.logStream.write(PAD + respLine + '\n');
}
}
timestamp() {
let d = new Date();
let hours = d.getHours() < 10 ? '0' + d.getHours() : d.getHours();
let minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes();
let seconds = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds();
let millis = d.getMilliseconds().toString();
millis = '000'.slice(0, 3 - millis.length) + millis;
return `${hours}:${minutes}:${seconds}.${millis}`;
}
}
exports.WebDriverLogger = WebDriverLogger;
//# sourceMappingURL=webdriver_logger.js.map

File diff suppressed because one or more lines are too long

24
node_modules/blocking-proxy/built/lib/webdriver_proxy.d.ts generated vendored Executable file
View file

@ -0,0 +1,24 @@
/// <reference types="node" />
import * as http from 'http';
import { WebDriverCommand } from './webdriver_commands';
/**
* A proxy that understands WebDriver commands. Users can add barriers (similar to middleware in
* express) that will be called before forwarding the request to WebDriver. The proxy will wait for
* each barrier to finish, calling them in the order in which they were added.
*/
export declare class WebDriverProxy {
barriers: WebDriverBarrier[];
seleniumAddress: string;
constructor(seleniumAddress: string);
addBarrier(barrier: WebDriverBarrier): void;
handleRequest(originalRequest: http.IncomingMessage, response: http.ServerResponse): Promise<void>;
}
/**
* When the proxy receives a WebDriver command, it will call onCommand() for each of it's barriers.
* Barriers may return a promise for the proxy to wait for before proceeding. If the promise is
* rejected, the proxy will reply with an error code and the result of the promise and the command
* will not be forwarded to Selenium.
*/
export interface WebDriverBarrier {
onCommand(command: WebDriverCommand): Promise<void>;
}

81
node_modules/blocking-proxy/built/lib/webdriver_proxy.js generated vendored Executable file
View file

@ -0,0 +1,81 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const http = require("http");
const url = require("url");
const webdriver_commands_1 = require("./webdriver_commands");
/**
* A proxy that understands WebDriver commands. Users can add barriers (similar to middleware in
* express) that will be called before forwarding the request to WebDriver. The proxy will wait for
* each barrier to finish, calling them in the order in which they were added.
*/
class WebDriverProxy {
constructor(seleniumAddress) {
this.barriers = [];
this.seleniumAddress = seleniumAddress;
}
addBarrier(barrier) {
this.barriers.push(barrier);
}
handleRequest(originalRequest, response) {
return __awaiter(this, void 0, void 0, function* () {
let command = webdriver_commands_1.parseWebDriverCommand(originalRequest.url, originalRequest.method);
let replyWithError = (err) => {
response.writeHead(502);
if (err && err.toString) {
response.write(err.toString());
}
response.end();
};
// Process barriers in order, one at a time.
try {
for (let barrier of this.barriers) {
yield barrier.onCommand(command);
}
}
catch (err) {
replyWithError(err);
// Don't call through if a barrier fails.
return;
}
let parsedUrl = url.parse(this.seleniumAddress);
let options = {};
options.method = originalRequest.method;
options.path = parsedUrl.path + originalRequest.url;
options.hostname = parsedUrl.hostname;
options.port = parseInt(parsedUrl.port);
options.headers = originalRequest.headers;
let forwardedRequest = http.request(options);
// clang-format off
let reqData = '';
originalRequest.on('data', (d) => {
reqData += d;
forwardedRequest.write(d);
}).on('end', () => {
command.handleData(reqData);
forwardedRequest.end();
}).on('error', replyWithError);
forwardedRequest.on('response', (seleniumResponse) => {
response.writeHead(seleniumResponse.statusCode, seleniumResponse.headers);
let respData = '';
seleniumResponse.on('data', (d) => {
respData += d;
response.write(d);
}).on('end', () => {
command.handleResponse(seleniumResponse.statusCode, respData);
response.end();
}).on('error', replyWithError);
}).on('error', replyWithError);
// clang-format on
});
}
}
exports.WebDriverProxy = WebDriverProxy;
//# sourceMappingURL=webdriver_proxy.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"webdriver_proxy.js","sourceRoot":"","sources":["../../lib/webdriver_proxy.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,2BAA2B;AAE3B,6DAA6E;AAE7E;;;;GAIG;AACH;IAIE,YAAY,eAAuB;QACjC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,UAAU,CAAC,OAAyB;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEK,aAAa,CAAC,eAAqC,EAAE,QAA6B;;YACtF,IAAI,OAAO,GAAG,0CAAqB,CAAC,e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AE,CAAC;YACjB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC/B,OAAO,IAAI,CAAC,CAAC;gBACb,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBAChB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC5B,gBAAgB,CAAC,GAAG,EAAE,CAAC;YACzB,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAE/B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,gBAAgB,EAAE,EAAE;gBACnD,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;gBAE1E,IAAI,QAAQ,GAAG,EAAE,CAAC;gBAClB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;oBAChC,QAAQ,IAAI,CAAC,CAAC;oBACd,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACpB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBAChB,OAAO,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;oBAC9D,QAAQ,CAAC,GAAG,EAAE,CAAC;gBACjB,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAEjC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAC/B,kBAAkB;QACpB,CAAC;KAAA;CACF;AAtED,wCAsEC"}

29
node_modules/blocking-proxy/circle.yml generated vendored Executable file
View file

@ -0,0 +1,29 @@
machine:
node:
version: 6.9.1
environment:
# Fix issue with selenium-server in containers.
# See http://github.com/SeleniumHQ/docker-selenium/issues/87
DBUS_SESSION_BUS_ADDRESS: /dev/null
dependencies:
override:
- npm update
cache_directories:
- testapp/node_modules
post:
# Install the latest Chrome
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome.deb
- sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
- rm google-chrome.deb
- npm run webdriver:
background: true
- cd testapp && npm update
- npm run testapp:
background: true
test:
override:
- ./node_modules/.bin/gulp lint
- npm test
- npm run test:e2e

22
node_modules/blocking-proxy/examples/README.md generated vendored Executable file
View file

@ -0,0 +1,22 @@
This is an example test that makes use of Blocking Proxy.
## Running the example
The example requires python 2.7 and the python selenium module. Assuming you
have pip and python, you can run the example like so:
```
pip install selenium
./run_example.sh
```
## What it does
The example test is a simple WebDriver test of angularjs.io. It starts a
selenium server (using [WebDriver Manager](https://github.com/angular/webdriver-manager),
starts a Blocking Proxy instance, then runs the test.
Blocking Proxy is set to use a 3 second highlight delay, so you'll see elements
highlighted before they're interacted with. It will also generate a log of WebDriver
commands in the current directory, with the file like `webdriver_log_xxxxxxxx.txt`.

31
node_modules/blocking-proxy/examples/e2e_test.py generated vendored Executable file
View file

@ -0,0 +1,31 @@
from selenium import webdriver
capabilities = webdriver.DesiredCapabilities.CHROME.copy()
WD_URL = 'http://localhost:8001'
driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=WD_URL)
print "Loading angularjs.org"
driver.get('https://angularjs.org/')
print "Testing hello app"
sample_app = driver.find_element_by_css_selector("[app-run='hello.html']")
sample_app.location_once_scrolled_into_view
name_box = sample_app.find_element_by_css_selector('[ng-model="yourName"]')
hello_box = sample_app.find_element_by_css_selector('h1')
name_box.send_keys('Bob')
assert "Hello Bob!" in hello_box.text
print "Testing todo app"
todo_app = driver.find_element_by_css_selector("[app-run='todo.html']")
todo_app.location_once_scrolled_into_view
todo_input = todo_app.find_element_by_css_selector('[ng-model="todoList.todoText"]')
todo_list = todo_app.find_element_by_css_selector('ul')
todo_input.send_keys('write some tests');
add_button = todo_app.find_element_by_css_selector('[value="add"]')
add_button.click()
assert 'write some tests' in todo_list.text

22
node_modules/blocking-proxy/examples/run_example.sh generated vendored Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
trap "kill -- -$$" EXIT
cd ..
npm install
# Start Selenium Server
./node_modules/.bin/webdriver-manager update
./node_modules/.bin/webdriver-manager start &> /dev/null &
# Start Blocking Proxy
node ./built/lib/bin.js \
--seleniumAddress http://localhost:4444/wd/hub \
--port 8001 \
--highlightDelay 3000 \
--logDir examples/ &> /dev/null &
# Wait a bit for things to come up
sleep 2
# Run the test
python examples/e2e_test.py

65
node_modules/blocking-proxy/gulpfile.js generated vendored Executable file
View file

@ -0,0 +1,65 @@
'use strict';
var gulp = require('gulp');
var runSequence = require('run-sequence');
var spawn = require('child_process').spawn;
var tslint = require('gulp-tslint');
var runSpawn = function(done, task, opt_arg) {
var child = spawn(task, opt_arg, {stdio: 'inherit'});
child.on('close', function() {
done();
});
};
gulp.task('built:copy', function() {
return gulp.src(['lib/**/*','!lib/**/*.ts'])
.pipe(gulp.dest('built/lib/'));
});
gulp.task('webdriver:update', function(done) {
runSpawn(done, 'webdriver-manager', ['update']);
});
gulp.task('tslint', function() {
return gulp.src(['lib/**/*.ts', 'spec/**/*.ts']).pipe(tslint()).pipe(tslint.report());
});
gulp.task('format:enforce', () => {
const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
return gulp.src(['lib/**/*.ts', 'spec/**/*.ts']).pipe(
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
});
gulp.task('format', () => {
const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
return gulp.src(['lib/**/*.ts', 'spec/**/*.ts'], { base: '.' }).pipe(
format.format('file', clangFormat)).pipe(gulp.dest('.'));
});
gulp.task('tsc', function(done) {
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc']);
});
gulp.task('lint', function(done) {
runSequence('tslint', 'format:enforce', done);
});
gulp.task('prepublish', function(done) {
runSequence('lint' ,'tsc', 'built:copy', done);
});
gulp.task('pretest', function(done) {
runSequence(
['webdriver:update', 'tslint', 'clang'], 'tsc', 'built:copy', done);
});
gulp.task('default', ['prepublish']);
gulp.task('build', ['prepublish']);
gulp.task('test:copy', function(done) {
return gulp.src(['spec/**/*','!spec/**/*.ts'])
.pipe(gulp.dest('built/spec/'));
});

107
node_modules/blocking-proxy/package.json generated vendored Executable file
View file

@ -0,0 +1,107 @@
{
"_from": "blocking-proxy@^1.0.0",
"_id": "blocking-proxy@1.0.1",
"_inBundle": false,
"_integrity": "sha512-KE8NFMZr3mN2E0HcvCgRtX7DjhiIQrwle+nSVJVC/yqFb9+xznHl2ZcoBp2L9qzkI4t4cBFJ1efXF8Dwi132RA==",
"_location": "/blocking-proxy",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "blocking-proxy@^1.0.0",
"name": "blocking-proxy",
"escapedName": "blocking-proxy",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/protractor"
],
"_resolved": "https://registry.npmjs.org/blocking-proxy/-/blocking-proxy-1.0.1.tgz",
"_shasum": "81d6fd1fe13a4c0d6957df7f91b75e98dac40cb2",
"_spec": "blocking-proxy@^1.0.0",
"_where": "/home/jack/Documents/JDA/m14/projecte_janmaroto/node_modules/protractor",
"bin": {
"blocking-proxy": "built/lib/bin.js"
},
"bugs": {
"url": "https://github.com/angular/jasminewd/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Michael Giambalvo",
"email": "heathkit@google.com"
},
{
"name": "Julie Ralph",
"email": "ju.ralph@gmail.com"
}
],
"dependencies": {
"minimist": "^1.2.0"
},
"deprecated": false,
"description": "WebDriver Proxy for testing rich clients. It block certain calls until Angular is done updating the page under test.",
"devDependencies": {
"@types/jasmine": "2.5.45",
"@types/minimist": "^1.1.29",
"@types/nock": "^8.2.0",
"@types/node": "^6.0.45",
"@types/rimraf": "0.0.28",
"@types/selenium-webdriver": "^2.53.39",
"body-parser": "1.14.2",
"clang-format": "^1.0.34",
"gulp": "^3.9.1",
"gulp-clang-format": "^1.0.23",
"gulp-tslint": "^7.0.1",
"jasmine": "^2.3.2",
"jasmine-co": "^1.2.2",
"jasmine-ts": "^0.2.1",
"jshint": "2.9.1",
"nock": "^9.0.2",
"rimraf": "^2.5.4",
"run-sequence": "^1.2.2",
"selenium-mock": "^0.1.5",
"selenium-webdriver": "^3.6.0",
"ts-node": "^2.1.2",
"tslint": "^4.3.1",
"tslint-eslint-rules": "^3.1.0",
"typescript": "^2.1.5",
"vrsource-tslint-rules": "^0.14.1",
"webdriver-manager": "^12.0.6"
},
"engines": {
"node": ">=6.9.x"
},
"homepage": "https://github.com/angular/blocking-proxy",
"jshintConfig": {
"esversion": 6
},
"keywords": [
"test",
"testing",
"webdriver",
"webdriverjs",
"selenium"
],
"license": "MIT",
"main": "built/lib/index.js",
"name": "blocking-proxy",
"repository": {
"type": "git",
"url": "git://github.com/angular/jasminewd.git"
},
"scripts": {
"prepublish": "gulp prepublish",
"start": "node built/lib/bin.js",
"test": "JASMINE_CONFIG_PATH=spec/jasmine_unit.json jasmine-ts",
"test:auto": "find lib spec | entr npm test",
"test:e2e": "JASMINE_CONFIG_PATH=spec/jasmine_e2e.json jasmine-ts",
"testapp": "cd testapp && npm start",
"webdriver": "webdriver-manager update && webdriver-manager start"
},
"typings": "built/lib/index.d.ts",
"version": "1.0.1"
}

24
node_modules/blocking-proxy/tsconfig.json generated vendored Executable file
View file

@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"sourceMap": true,
"declaration": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "built/"
},
"exclude": [
"built",
"node_modules",
"selenium",
"testapp",
"typings/browser",
"typings/browser.d.ts"
],
"filesGlob": [
"**/*.ts"
]
}

15
node_modules/blocking-proxy/tslint.json generated vendored Executable file
View file

@ -0,0 +1,15 @@
{
"rulesDirectory": [
"node_modules/vrsource-tslint-rules/rules",
"node_modules/tslint-eslint-rules/dist/rules"
],
"rules": {
"no-duplicate-imports": true,
"no-duplicate-variable": true,
"no-jasmine-focus": true,
"no-var-keyword": true,
"semicolon": [true],
"variable-name": [true, "ban-keywords"],
"no-inner-declarations": [true, "function"]
}
}