Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testcafe

Package Overview
Dependencies
Maintainers
2
Versions
464
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testcafe - npm Package Compare versions

Comparing version 0.0.7-alpha to 0.0.8-alpha

lib/runner/browser-set.js

3

lib/browser-connection/command.js

@@ -11,5 +11,4 @@ // --------------------------------------------------------

run: 'run',
idle: 'idle',
close: 'close'
idle: 'idle'
};
module.exports = exports.default;

@@ -54,4 +54,5 @@ 'use strict';

this.disconnected = false;
this.closed = false;
this.ready = false;
this.idle = true;
this.heartbeatTimeout = null;

@@ -75,3 +76,3 @@

this.heartbeatTimeout = setTimeout(function () {
_this2.emit('error', _messages.getText(_messages.MESSAGE.browserDisconnected, _this2.userAgent));
_this2.emit('error', new Error(_messages.getText(_messages.MESSAGE.browserDisconnected, _this2.userAgent)));
}, this.HEARTBEAT_TIMEOUT);

@@ -104,7 +105,9 @@ };

BrowserConnection.prototype.close = function close() {
this.disconnected = true;
this.browserConnectionGateway.stopServingConnection(this);
clearTimeout(this.heartbeatTimeout);
this.ready = false;
this.closed = true;
this.browserConnectionGateway.stopServingConnection(this);
clearTimeout(this.heartbeatTimeout);
this.emit('closed');
};

@@ -126,2 +129,6 @@

BrowserConnection.prototype.renderIdlePage = function renderIdlePage() {
this.idle = true;
this.emit('idle');
return _mustache2.default.render(IDLE_PAGE_TEMPLATE, {

@@ -137,3 +144,6 @@ userAgent: this.userAgent,

if (testRunUrl) return { cmd: _command2.default.run, url: testRunUrl };
if (testRunUrl) {
this.idle = false;
return { cmd: _command2.default.run, url: testRunUrl };
}

@@ -140,0 +150,0 @@ return { cmd: _command2.default.idle, url: this.idleUrl };

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

var _command = require('./command');
var _command2 = _interopRequireDefault(_command);
var LocalBrowserConnection = (function (_BrowserConnection) {

@@ -32,9 +28,2 @@ _inherits(LocalBrowserConnection, _BrowserConnection);

this.NATIVE_ACTION_DELAY = 500;
this.WAITING_FOR_CLOSE_TIMEOUT = 10000;
this.forceClose = false;
this.switchedToIdleOnClose = false;
this.waitingForCloseTimeout = 0;
this._runBrowser(browserInfo);

@@ -63,3 +52,3 @@ }

this.emit('error', context$3$0.t0.message);
this.emit('error', context$3$0.t0);

@@ -77,46 +66,18 @@ case 8:

// NOTE: When using local connections, we should close the browser before closing
// the connection. For this, we close connections in the getStatus function.
this.forceClose = true;
this.once('idle', function callee$2$0() {
return _regeneratorRuntime.async(function callee$2$0$(context$3$0) {
while (1) switch (context$3$0.prev = context$3$0.next) {
case 0:
context$3$0.next = 2;
return _regeneratorRuntime.awrap(_testcafeBrowserNatives.close(this.idleUrl));
this.waitingForCloseTimeout = setTimeout(function () {
return _this2.emit('closed');
}, this.WAITING_FOR_CLOSE_TIMEOUT);
};
case 2:
_BrowserConnection.prototype.close.call(this);
LocalBrowserConnection.prototype.getStatus = function getStatus() {
var _this3 = this;
if (this.forceClose) {
// NOTE: when the task is done we should redirect the browser
// to the idle page and close it by the page url.
if (!this.switchedToIdleOnClose) {
this.switchedToIdleOnClose = true;
return { cmd: _command2.default.idle, url: this.idleUrl };
}
setTimeout(function callee$2$0() {
return _regeneratorRuntime.async(function callee$2$0$(context$3$0) {
while (1) switch (context$3$0.prev = context$3$0.next) {
case 0:
context$3$0.next = 2;
return _regeneratorRuntime.awrap(_testcafeBrowserNatives.close(this.idleUrl));
case 2:
_BrowserConnection.prototype.close.call(this);
clearTimeout(this.waitingForCloseTimeout);
this.emit('closed');
case 5:
case 'end':
return context$3$0.stop();
}
}, null, _this3);
}, this.NATIVE_ACTION_DELAY);
return { cmd: _command2.default.close };
}
return _BrowserConnection.prototype.getStatus.call(this);
case 3:
case 'end':
return context$3$0.stop();
}
}, null, _this2);
});
};

@@ -123,0 +84,0 @@

@@ -21,8 +21,10 @@ 'use strict';

var _es6Promise = require('es6-promise');
var _pinkie = require('pinkie');
var _es6Promisify = require('es6-promisify');
var _pinkie2 = _interopRequireDefault(_pinkie);
var _es6Promisify2 = _interopRequireDefault(_es6Promisify);
var _utilsPromisify = require('../utils/promisify');
var _utilsPromisify2 = _interopRequireDefault(_utilsPromisify);
var _dedent = require('dedent');

@@ -54,3 +56,3 @@

var ensureDir = _es6Promisify2.default(_mkdirp2.default);
var ensureDir = _utilsPromisify2.default(_mkdirp2.default);

@@ -267,3 +269,3 @@ var REMOTE_ALIAS_RE = /^(\d*)remote$/;

context$2$0.next = 6;
return _regeneratorRuntime.awrap(_es6Promise.Promise.all([this._parsePorts(), this._parseScreenshotsPath(), this._parseBrowserList(), this._parseFileList()]));
return _regeneratorRuntime.awrap(_pinkie2.default.all([this._parsePorts(), this._parseScreenshotsPath(), this._parseBrowserList(), this._parseFileList()]));

@@ -270,0 +272,0 @@ case 6:

@@ -21,9 +21,5 @@ 'use strict';

var _es6Promise = require('es6-promise');
var _promisifyEvent = require('promisify-event');
function waitBrowserConnectionReady(browserConnection) {
return new _es6Promise.Promise(function (resolve) {
return browserConnection.once('ready', resolve);
});
}
var _promisifyEvent2 = _interopRequireDefault(_promisifyEvent);

@@ -62,3 +58,3 @@ exports.default = function callee$0$0(testCafe, remoteCount, showQRCode) {

context$1$0.next = 10;
return _regeneratorRuntime.awrap(waitBrowserConnectionReady(browserConnection));
return _regeneratorRuntime.awrap(_promisifyEvent2.default(browserConnection, 'ready'));

@@ -65,0 +61,0 @@ case 10:

@@ -1,1443 +0,1 @@

// This file was generated by modules-webmake (modules for web) project.
// See: https://github.com/medikoo/modules-webmake
(function (modules) {
'use strict';
var resolve, getRequire, wmRequire, notFoundError, findFile
, extensions = {".js":[],".json":[],".css":[],".html":[]}
, envRequire = typeof require === 'function' ? require : null;
notFoundError = function (path) {
var error = new Error("Could not find module '" + path + "'");
error.code = 'MODULE_NOT_FOUND';
return error;
};
findFile = function (scope, name, extName) {
var i, ext;
if (typeof scope[name + extName] === 'function') return name + extName;
for (i = 0; (ext = extensions[extName][i]); ++i) {
if (typeof scope[name + ext] === 'function') return name + ext;
}
return null;
};
resolve = function (scope, tree, path, fullPath, state, id) {
var name, dir, exports, module, fn, found, ext;
path = path.split(/[\\/]/);
name = path.pop();
if ((name === '.') || (name === '..')) {
path.push(name);
name = '';
}
while ((dir = path.shift()) != null) {
if (!dir || (dir === '.')) continue;
if (dir === '..') {
scope = tree.pop();
id = id.slice(0, id.lastIndexOf('/'));
} else {
tree.push(scope);
scope = scope[dir];
id += '/' + dir;
}
if (!scope) throw notFoundError(fullPath);
}
if (name && (typeof scope[name] !== 'function')) {
found = findFile(scope, name, '.js');
if (!found) found = findFile(scope, name, '.json');
if (!found) found = findFile(scope, name, '.css');
if (!found) found = findFile(scope, name, '.html');
if (found) {
name = found;
} else if ((state !== 2) && (typeof scope[name] === 'object')) {
tree.push(scope);
scope = scope[name];
id += '/' + name;
name = '';
}
}
if (!name) {
if ((state !== 1) && scope[':mainpath:']) {
return resolve(scope, tree, scope[':mainpath:'], fullPath, 1, id);
}
return resolve(scope, tree, 'index', fullPath, 2, id);
}
fn = scope[name];
if (!fn) throw notFoundError(fullPath);
if (fn.hasOwnProperty('module')) return fn.module.exports;
exports = {};
fn.module = module = { exports: exports, id: id + '/' + name };
fn.call(exports, exports, module, getRequire(scope, tree, id));
return module.exports;
};
wmRequire = function (scope, tree, fullPath, id) {
var name, path = fullPath, t = fullPath.charAt(0), state = 0;
if (t === '/') {
path = path.slice(1);
scope = modules['/'];
if (!scope) {
if (envRequire) return envRequire(fullPath);
throw notFoundError(fullPath);
}
id = '/';
tree = [];
} else if (t !== '.') {
name = path.split('/', 1)[0];
scope = modules[name];
if (!scope) {
if (envRequire) return envRequire(fullPath);
throw notFoundError(fullPath);
}
id = name;
tree = [];
path = path.slice(name.length + 1);
if (!path) {
path = scope[':mainpath:'];
if (path) {
state = 1;
} else {
path = 'index';
state = 2;
}
}
}
return resolve(scope, tree, path, fullPath, state, id);
};
getRequire = function (scope, tree, id) {
return function (path) {
return wmRequire(scope, [].concat(tree), path, id);
};
};
return getRequire(modules, [], '');
})({
"es6-promise": {
":mainpath:": "dist/es6-promise.js",
"dist": {
"es6-promise.js": function (exports, module, require) {
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.0.2
*/
'use strict';
(function () {
"use strict";
function lib$es6$promise$utils$$objectOrFunction(x) {
return typeof x === 'function' || typeof x === 'object' && x !== null;
}
function lib$es6$promise$utils$$isFunction(x) {
return typeof x === 'function';
}
function lib$es6$promise$utils$$isMaybeThenable(x) {
return typeof x === 'object' && x !== null;
}
var lib$es6$promise$utils$$_isArray;
if (!Array.isArray) {
lib$es6$promise$utils$$_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
lib$es6$promise$utils$$_isArray = Array.isArray;
}
var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
var lib$es6$promise$asap$$len = 0;
var lib$es6$promise$asap$$toString = ({}).toString;
var lib$es6$promise$asap$$vertxNext;
var lib$es6$promise$asap$$customSchedulerFn;
var lib$es6$promise$asap$$asap = function asap(callback, arg) {
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
lib$es6$promise$asap$$len += 2;
if (lib$es6$promise$asap$$len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (lib$es6$promise$asap$$customSchedulerFn) {
lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
} else {
lib$es6$promise$asap$$scheduleFlush();
}
}
};
function lib$es6$promise$asap$$setScheduler(scheduleFn) {
lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
}
function lib$es6$promise$asap$$setAsap(asapFn) {
lib$es6$promise$asap$$asap = asapFn;
}
var lib$es6$promise$asap$$browserWindow = typeof window !== 'undefined' ? window : undefined;
var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
// test for web worker but not in IE10
var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
// node
function lib$es6$promise$asap$$useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function () {
process.nextTick(lib$es6$promise$asap$$flush);
};
}
// vertx
function lib$es6$promise$asap$$useVertxTimer() {
return function () {
lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
};
}
function lib$es6$promise$asap$$useMutationObserver() {
var iterations = 0;
var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function () {
node.data = iterations = ++iterations % 2;
};
}
// web worker
function lib$es6$promise$asap$$useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = lib$es6$promise$asap$$flush;
return function () {
channel.port2.postMessage(0);
};
}
function lib$es6$promise$asap$$useSetTimeout() {
return function () {
setTimeout(lib$es6$promise$asap$$flush, 1);
};
}
var lib$es6$promise$asap$$queue = new Array(1000);
function lib$es6$promise$asap$$flush() {
for (var i = 0; i < lib$es6$promise$asap$$len; i += 2) {
var callback = lib$es6$promise$asap$$queue[i];
var arg = lib$es6$promise$asap$$queue[i + 1];
callback(arg);
lib$es6$promise$asap$$queue[i] = undefined;
lib$es6$promise$asap$$queue[i + 1] = undefined;
}
lib$es6$promise$asap$$len = 0;
}
function lib$es6$promise$asap$$attemptVertx() {
try {
var r = require;
var vertx = r('vertx');
lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
return lib$es6$promise$asap$$useVertxTimer();
} catch (e) {
return lib$es6$promise$asap$$useSetTimeout();
}
}
var lib$es6$promise$asap$$scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (lib$es6$promise$asap$$isNode) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
} else if (lib$es6$promise$asap$$BrowserMutationObserver) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
} else if (lib$es6$promise$asap$$isWorker) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
} else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();
} else {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
}
function lib$es6$promise$$internal$$noop() {}
var lib$es6$promise$$internal$$PENDING = void 0;
var lib$es6$promise$$internal$$FULFILLED = 1;
var lib$es6$promise$$internal$$REJECTED = 2;
var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function lib$es6$promise$$internal$$cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.');
}
function lib$es6$promise$$internal$$getThen(promise) {
try {
return promise.then;
} catch (error) {
lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
return lib$es6$promise$$internal$$GET_THEN_ERROR;
}
}
function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then.call(value, fulfillmentHandler, rejectionHandler);
} catch (e) {
return e;
}
}
function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
lib$es6$promise$asap$$asap(function (promise) {
var sealed = false;
var error = lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
if (sealed) {
return;
}
sealed = true;
if (thenable !== value) {
lib$es6$promise$$internal$$resolve(promise, value);
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}, function (reason) {
if (sealed) {
return;
}
sealed = true;
lib$es6$promise$$internal$$reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
lib$es6$promise$$internal$$reject(promise, error);
}
}, promise);
}
function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, thenable._result);
} else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, thenable._result);
} else {
lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
lib$es6$promise$$internal$$resolve(promise, value);
}, function (reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
}
}
function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
if (maybeThenable.constructor === promise.constructor) {
lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
} else {
var then = lib$es6$promise$$internal$$getThen(maybeThenable);
if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
} else if (then === undefined) {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
} else if (lib$es6$promise$utils$$isFunction(then)) {
lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
} else {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
}
}
}
function lib$es6$promise$$internal$$resolve(promise, value) {
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());
} else if (lib$es6$promise$utils$$objectOrFunction(value)) {
lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}
function lib$es6$promise$$internal$$publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
lib$es6$promise$$internal$$publish(promise);
}
function lib$es6$promise$$internal$$fulfill(promise, value) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) {
return;
}
promise._result = value;
promise._state = lib$es6$promise$$internal$$FULFILLED;
if (promise._subscribers.length !== 0) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
}
}
function lib$es6$promise$$internal$$reject(promise, reason) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) {
return;
}
promise._state = lib$es6$promise$$internal$$REJECTED;
promise._result = reason;
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
}
function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
parent._onerror = null;
subscribers[length] = child;
subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
if (length === 0 && parent._state) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
}
}
function lib$es6$promise$$internal$$publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) {
return;
}
var child,
callback,
detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function lib$es6$promise$$internal$$ErrorObject() {
this.error = null;
}
var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$tryCatch(callback, detail) {
try {
return callback(detail);
} catch (e) {
lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
}
}
function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
var hasCallback = lib$es6$promise$utils$$isFunction(callback),
value,
error,
succeeded,
failed;
if (hasCallback) {
value = lib$es6$promise$$internal$$tryCatch(callback, detail);
if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
failed = true;
error = value.error;
value = null;
} else {
succeeded = true;
}
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
return;
}
} else {
value = detail;
succeeded = true;
}
if (promise._state !== lib$es6$promise$$internal$$PENDING) {
// noop
} else if (hasCallback && succeeded) {
lib$es6$promise$$internal$$resolve(promise, value);
} else if (failed) {
lib$es6$promise$$internal$$reject(promise, error);
} else if (settled === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, value);
} else if (settled === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
}
}
function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}, function rejectPromise(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
} catch (e) {
lib$es6$promise$$internal$$reject(promise, e);
}
}
function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
var enumerator = this;
enumerator._instanceConstructor = Constructor;
enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
if (enumerator._validateInput(input)) {
enumerator._input = input;
enumerator.length = input.length;
enumerator._remaining = input.length;
enumerator._init();
if (enumerator.length === 0) {
lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
} else {
enumerator.length = enumerator.length || 0;
enumerator._enumerate();
if (enumerator._remaining === 0) {
lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
}
}
} else {
lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
}
}
lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function (input) {
return lib$es6$promise$utils$$isArray(input);
};
lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function () {
return new Error('Array Methods must be provided an Array');
};
lib$es6$promise$enumerator$$Enumerator.prototype._init = function () {
this._result = new Array(this.length);
};
var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function () {
var enumerator = this;
var length = enumerator.length;
var promise = enumerator.promise;
var input = enumerator._input;
for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
enumerator._eachEntry(input[i], i);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function (entry, i) {
var enumerator = this;
var c = enumerator._instanceConstructor;
if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
entry._onerror = null;
enumerator._settledAt(entry._state, i, entry._result);
} else {
enumerator._willSettleAt(c.resolve(entry), i);
}
} else {
enumerator._remaining--;
enumerator._result[i] = entry;
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function (state, i, value) {
var enumerator = this;
var promise = enumerator.promise;
if (promise._state === lib$es6$promise$$internal$$PENDING) {
enumerator._remaining--;
if (state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
} else {
enumerator._result[i] = value;
}
}
if (enumerator._remaining === 0) {
lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function (promise, i) {
var enumerator = this;
lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
}, function (reason) {
enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
});
};
function lib$es6$promise$promise$all$$all(entries) {
return new lib$es6$promise$enumerator$$default(this, entries).promise;
}
var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
function lib$es6$promise$promise$race$$race(entries) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
if (!lib$es6$promise$utils$$isArray(entries)) {
lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
return promise;
}
var length = entries.length;
function onFulfillment(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}
function onRejection(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
}
for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
}
return promise;
}
var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
function lib$es6$promise$promise$resolve$$resolve(object) {
/*jshint validthis:true */
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$resolve(promise, object);
return promise;
}
var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
function lib$es6$promise$promise$reject$$reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$reject(promise, reason);
return promise;
}
var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
var lib$es6$promise$promise$$counter = 0;
function lib$es6$promise$promise$$needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function lib$es6$promise$promise$$needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
var promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {function} resolver
Useful for tooling.
@constructor
*/
function lib$es6$promise$promise$$Promise(resolver) {
this._id = lib$es6$promise$promise$$counter++;
this._state = undefined;
this._result = undefined;
this._subscribers = [];
if (lib$es6$promise$$internal$$noop !== resolver) {
if (!lib$es6$promise$utils$$isFunction(resolver)) {
lib$es6$promise$promise$$needsResolver();
}
if (!(this instanceof lib$es6$promise$promise$$Promise)) {
lib$es6$promise$promise$$needsNew();
}
lib$es6$promise$$internal$$initializePromise(this, resolver);
}
}
lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
lib$es6$promise$promise$$Promise.prototype = {
constructor: lib$es6$promise$promise$$Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
var result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
var author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: function (onFulfillment, onRejection) {
var parent = this;
var state = parent._state;
if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
return this;
}
var child = new this.constructor(lib$es6$promise$$internal$$noop);
var result = parent._result;
if (state) {
var callback = arguments[state - 1];
lib$es6$promise$asap$$asap(function () {
lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
});
} else {
lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
}
return child;
},
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
'catch': function (onRejection) {
return this.then(null, onRejection);
}
};
function lib$es6$promise$polyfill$$polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
return;
}
local.Promise = lib$es6$promise$promise$$default;
}
var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
var lib$es6$promise$umd$$ES6Promise = {
'Promise': lib$es6$promise$promise$$default,
'polyfill': lib$es6$promise$polyfill$$default
};
/* global define:true module:true window: true */
if (typeof define === 'function' && define['amd']) {
define(function () {
return lib$es6$promise$umd$$ES6Promise;
});
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = lib$es6$promise$umd$$ES6Promise;
} else if (typeof this !== 'undefined') {
this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
}
}).call(undefined);
}
}
},
"testcafe": {
"src": {
"browser-connection": {
"command.js": function (exports, module, require) {
// --------------------------------------------------------
// WARNING: this file is used by both the client and the server.
// Do not use any browser or node-specific API!
// --------------------------------------------------------
'use strict';
exports.__esModule = true;
exports.default = {
run: 'run',
idle: 'idle',
close: 'close'
};
module.exports = exports.default;
}
},
"client": {
"browser": {
"idle-page": {
"index.js": function (exports, module, require) {
'use strict';
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _ = require('../');
var browser = _interopRequireWildcard(_);
var _statusIndicator = require('./status-indicator');
var _statusIndicator2 = _interopRequireDefault(_statusIndicator);
var _browserConnectionCommand = require('../../../browser-connection/command');
var _browserConnectionCommand2 = _interopRequireDefault(_browserConnectionCommand);
var CHECK_STATUS_DELAY = 1000;
var IdlePage = (function () {
function IdlePage(statusUrl, heartbeatUrl) {
_classCallCheck(this, IdlePage);
this.statusUrl = statusUrl;
this.statusIndicator = new _statusIndicator2.default();
browser.startHeartbeat(heartbeatUrl, window.XMLHttpRequest);
this._checkStatus();
}
IdlePage.prototype._checkStatus = function _checkStatus() {
var _this = this;
browser.checkStatus(this.statusUrl, window.XMLHttpRequest).then(function (cmd) {
if (cmd === _browserConnectionCommand2.default.idle) window.setTimeout(function () {
return _this._checkStatus();
}, CHECK_STATUS_DELAY);
}).catch(function () {
return _this.statusIndicator.showDisconnection();
});
};
return IdlePage;
})();
window.IdlePage = IdlePage;
},
"status-indicator.js": function (exports, module, require) {
'use strict';
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var SPINNER_WIDTH = 8;
var RELATED_SPINNER_SIZE = 0.8;
var MAXIMUM_SPINNER_SIZE = 400;
var ROTATION_ANGLE = 7;
var FONT_SIZE_EQUATION_SLOPE = 0.03;
var FONT_SIZE_EQUATION_Y_INTERCEPT = 3.5;
var START_GRADIENT_POINT_OFFSET = { x: 0.75, y: 0.7 };
var END_GRADIENT_POINT_OFFSET = { x: 1.025, y: 0.575 };
var LINE_HEIGHT_INDENT = 6;
var CONNECTED_SPINNER_COLOR = '#28687F';
var DISCONNECTED_SPINNER_COLOR = '#882E24';
var SPINNER_GRADIENT_COLOR = '#181818';
var CONNECTED_TEXT = 'CONNECTED';
var DISCONNECTED_TEXT = 'DISCONNECTED';
var PAGE_BACKGROUND_CLASS_NAME = 'page-background';
var CONTAINER_CLASS_NAME = 'container';
var STATUS_TEXT_AREA_CLASS_NAME = 'status-text-area';
var USER_AGENT_ELEMENT_CLASS_NAME = 'user-agent';
var STATUS_ELEMENT_CLASS_NAME = 'status';
var CANVAS_CLASS_NAME = 'spinner';
var CONNECTED_CLASS_NAME = 'connected';
var DISCONNECTED_CLASS_NAME = 'disconnected';
var ANIMATION_DELAY = 30;
//Utils
function convertToRadian(angle) {
return angle * Math.PI / 180;
}
function convertToString(value) {
return value + 'px';
}
function rotateAxes(point, rotationAngle) {
var angle = convertToRadian(rotationAngle);
return {
x: Math.round(point.x * Math.cos(angle) - point.y * Math.sin(angle)),
y: Math.round(point.x * Math.sin(angle) + point.y * Math.cos(angle))
};
}
function moveAxes(point, distance) {
return {
x: Math.round(point.x - distance),
y: Math.round(point.y - distance)
};
}
var StatusIndicator = (function () {
function StatusIndicator() {
_classCallCheck(this, StatusIndicator);
this.connected = true;
this.canvas = document.getElementsByClassName(CANVAS_CLASS_NAME)[0];
this.canvasContext = this.canvas.getContext("2d");
this.spinnerAnimationInterval = null;
this.rotationAngle = 0;
this.size = null;
this.spinnerCenter = null;
this.gradient = null;
this._setSize();
this._setFontSize();
this._setSpinnerGradient();
StatusIndicator._createStatusMessage(this.connected);
StatusIndicator._alignContainerVertically();
this._drawSpinner(this.connected, 0);
this._watchWindowResize();
}
//Markup
StatusIndicator._getContainer = function _getContainer() {
return document.getElementsByClassName('container')[0];
};
StatusIndicator._getStatusElementSpan = function _getStatusElementSpan() {
return document.getElementsByClassName(STATUS_ELEMENT_CLASS_NAME)[0].children[0];
};
StatusIndicator._createStatusMessage = function _createStatusMessage(connected) {
var statusSpan = StatusIndicator._getStatusElementSpan();
statusSpan.className = connected ? CONNECTED_CLASS_NAME : DISCONNECTED_CLASS_NAME;
statusSpan.textContent = connected ? CONNECTED_TEXT : DISCONNECTED_TEXT;
};
StatusIndicator._alignContainerVertically = function _alignContainerVertically() {
var background = document.getElementsByClassName(PAGE_BACKGROUND_CLASS_NAME)[0];
var container = StatusIndicator._getContainer();
var topMargin = Math.ceil((background.offsetHeight - container.offsetHeight) / 2);
if (topMargin > 0) container.style.marginTop = convertToString(topMargin);
};
StatusIndicator.prototype._setSize = function _setSize() {
var documentElement = window.document.documentElement;
var minResolution = Math.min(documentElement.clientWidth, documentElement.clientHeight);
var container = StatusIndicator._getContainer();
var newSize = Math.round(Math.min(MAXIMUM_SPINNER_SIZE, minResolution * RELATED_SPINNER_SIZE));
if (newSize === this.size) return;
this.size = Math.round(Math.min(MAXIMUM_SPINNER_SIZE, minResolution * RELATED_SPINNER_SIZE));
this.spinnerCenter = this.size / 2;
container.style.width = convertToString(this.size);
container.style.height = convertToString(this.size);
this.canvas.width = this.canvas.height = this.size;
};
StatusIndicator.prototype._setFontSize = function _setFontSize() {
var userAgentSpan = document.getElementsByClassName(USER_AGENT_ELEMENT_CLASS_NAME)[0].children[0];
var statusSpan = StatusIndicator._getStatusElementSpan();
// NOTE: We have established proportions for two edge cases:
// the maximum spinner size of 400px corresponds to the 16px font,
// the minimum spinner size of 240px corresponds to the 11px font.
// Actual sizes are calculated from these proportions.
var fontSize = Math.round(FONT_SIZE_EQUATION_SLOPE * this.size + FONT_SIZE_EQUATION_Y_INTERCEPT);
var lineHeight = fontSize + LINE_HEIGHT_INDENT;
userAgentSpan.style.fontSize = convertToString(fontSize);
userAgentSpan.style.lineHeight = convertToString(lineHeight);
userAgentSpan.style.maxHeight = convertToString(2 * lineHeight);
statusSpan.style.fontSize = convertToString(fontSize);
statusSpan.style.lineHeight = convertToString(lineHeight - 1);
};
StatusIndicator.prototype._watchWindowResize = function _watchWindowResize() {
var _this = this;
window.onresize = function () {
var oldSize = _this.size;
_this._setSize();
_this._setFontSize();
StatusIndicator._alignContainerVertically();
if (oldSize !== _this.size) {
if (_this.connected) _this._setSpinnerGradient();
_this._drawSpinner(_this.connected, _this.rotationAngle);
}
};
};
//Spinner
StatusIndicator.prototype._drawSpinner = function _drawSpinner(connected, startAngle) {
var _this2 = this;
this._clearCanvas();
clearInterval(this.spinnerAnimationInterval);
if (connected) {
this.spinnerAnimationInterval = window.setInterval(function () {
_this2._clearCanvas();
_this2._rotateSpinner();
_this2._drawCircle(_this2.gradient, 240, startAngle);
}, ANIMATION_DELAY);
this._drawCircle(this.gradient, 240, startAngle);
} else this._drawCircle(DISCONNECTED_SPINNER_COLOR, 360, 0);
};
StatusIndicator.prototype._drawCircle = function _drawCircle(strokeStyle, centralAngle, startAngle) {
var radius = this.spinnerCenter - SPINNER_WIDTH / 2;
this.canvasContext.beginPath();
this.canvasContext.lineWidth = SPINNER_WIDTH;
this.canvasContext.strokeStyle = strokeStyle;
this.canvasContext.arc(this.spinnerCenter, this.spinnerCenter, radius, convertToRadian(startAngle), convertToRadian(startAngle + centralAngle), false);
this.canvasContext.stroke();
};
StatusIndicator.prototype._rotateSpinner = function _rotateSpinner() {
this.rotationAngle += ROTATION_ANGLE;
this.rotationAngle = this.rotationAngle > 360 ? this.rotationAngle % 360 : this.rotationAngle;
this.canvasContext.translate(this.spinnerCenter, this.spinnerCenter);
this.canvasContext.rotate(convertToRadian(ROTATION_ANGLE));
this.canvasContext.translate(-this.spinnerCenter, -this.spinnerCenter);
};
StatusIndicator.prototype._getRotatedGradientPoints = function _getRotatedGradientPoints(point) {
var changedPoint = moveAxes(point, this.spinnerCenter);
changedPoint = rotateAxes(changedPoint, this.rotationAngle);
changedPoint = moveAxes(changedPoint, -this.spinnerCenter);
return changedPoint;
};
StatusIndicator.prototype._setSpinnerGradient = function _setSpinnerGradient() {
var startGradientPoint = {
x: Math.round(this.size * START_GRADIENT_POINT_OFFSET.x),
y: Math.round(this.size * START_GRADIENT_POINT_OFFSET.y)
};
var endGradientPoint = {
x: Math.round(this.size * END_GRADIENT_POINT_OFFSET.x),
y: Math.round(this.size * END_GRADIENT_POINT_OFFSET.y)
};
if (this.rotationAngle !== 0) {
startGradientPoint = this._getRotatedGradientPoints(startGradientPoint);
endGradientPoint = this._getRotatedGradientPoints(endGradientPoint);
}
var gradient = this.canvasContext.createLinearGradient(startGradientPoint.x, startGradientPoint.y, endGradientPoint.x, endGradientPoint.y);
gradient.addColorStop(0, CONNECTED_SPINNER_COLOR);
gradient.addColorStop(1, SPINNER_GRADIENT_COLOR);
this.gradient = gradient;
};
StatusIndicator.prototype._clearCanvas = function _clearCanvas() {
this.canvasContext.clearRect(0, 0, this.canvas.width, this.canvas.height);
};
//API
StatusIndicator.prototype.showDisconnection = function showDisconnection() {
this.connected = false;
StatusIndicator._createStatusMessage(this.connected);
this._drawSpinner(this.connected, 0);
};
return StatusIndicator;
})();
exports.default = StatusIndicator;
module.exports = exports.default;
}
},
"index.js": function (exports, module, require) {
'use strict';
exports.__esModule = true;
exports.startHeartbeat = startHeartbeat;
exports.checkStatus = checkStatus;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _es6Promise = require('es6-promise');
var _browserConnectionCommand = require('../../browser-connection/command');
var _browserConnectionCommand2 = _interopRequireDefault(_browserConnectionCommand);
var HEARTBEAT_INTERVAL = 30 * 1000;
//Utils
// NOTE: the window.XMLHttpRequest may have been wrapped by Hammerhead, while we should send a request to
// the original URL. That's why we need the XMLHttpRequest argument to send the request via native methods.
function sendXHR(url, XMLHttpRequest) {
return new _es6Promise.Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) resolve(xhr.responseText ? JSON.parse(xhr.responseText) : '');else reject('disconnected');
}
};
xhr.send(null);
});
}
function isCurrentLocation(url) {
return document.location.href.toLowerCase() === url.toLowerCase();
}
//API
function startHeartbeat(heartbeatUrl, XMLHttpRequest) {
sendXHR(heartbeatUrl, XMLHttpRequest);
window.setInterval(function () {
return sendXHR(heartbeatUrl, XMLHttpRequest);
}, HEARTBEAT_INTERVAL);
}
function checkStatus(statusUrl, XMLHttpRequest) {
return sendXHR(statusUrl, XMLHttpRequest).then(function (res) {
if (res.cmd === _browserConnectionCommand2.default.run || res.cmd === _browserConnectionCommand2.default.idle && !isCurrentLocation(res.url)) document.location = res.url;
//NOTE: prepare to close the browser
if (res.cmd === _browserConnectionCommand2.default.close) document.title = '[' + document.location.toString() + ']';
return res.cmd;
});
}
}
}
}
}
}
})("testcafe/src/client/browser/idle-page/index");
!function(t){"use strict";var n,e,i,r,o,s={".js":[],".json":[],".css":[],".html":[]},a="function"==typeof require?require:null;return r=function(t){var n=new Error("Could not find module '"+t+"'");return n.code="MODULE_NOT_FOUND",n},o=function(t,n,e){var i,r;if("function"==typeof t[n+e])return n+e;for(i=0;r=s[e][i];++i)if("function"==typeof t[n+r])return n+r;return null},n=function(t,i,s,a,c,u){var h,l,f,d,p,_;for(s=s.split(/[\\/]/),h=s.pop(),("."===h||".."===h)&&(s.push(h),h="");null!=(l=s.shift());)if(l&&"."!==l&&(".."===l?(t=i.pop(),u=u.slice(0,u.lastIndexOf("/"))):(i.push(t),t=t[l],u+="/"+l),!t))throw r(a);if(h&&"function"!=typeof t[h]&&(_=o(t,h,".js"),_||(_=o(t,h,".json")),_||(_=o(t,h,".css")),_||(_=o(t,h,".html")),_?h=_:2!==c&&"object"==typeof t[h]&&(i.push(t),t=t[h],u+="/"+h,h="")),!h)return 1!==c&&t[":mainpath:"]?n(t,i,t[":mainpath:"],a,1,u):n(t,i,"index",a,2,u);if(p=t[h],!p)throw r(a);return p.hasOwnProperty("module")?p.module.exports:(f={},p.module=d={exports:f,id:u+"/"+h},p.call(f,f,d,e(t,i,u)),d.exports)},i=function(e,i,o,s){var c,u=o,h=o.charAt(0),l=0;if("/"===h){if(u=u.slice(1),e=t["/"],!e){if(a)return a(o);throw r(o)}s="/",i=[]}else if("."!==h){if(c=u.split("/",1)[0],e=t[c],!e){if(a)return a(o);throw r(o)}s=c,i=[],u=u.slice(c.length+1),u||(u=e[":mainpath:"],u?l=1:(u="index",l=2))}return n(e,i,u,o,l,s)},(e=function(t,n,e){return function(r){return i(t,[].concat(n),r,e)}})(t,[],"")}({pinkie:{"index.js":function(t,n,e){"use strict";function i(){for(var t=0;t<M.length;t++)M[t][0](M[t][1]);M=[],y=!1}function r(t,n){M.push([t,n]),y||(y=!0,S(i,0))}function o(t,n){function e(t){c(n,t)}function i(t){h(n,t)}try{t(e,i)}catch(r){i(r)}}function s(t){var n=t.owner,e=n._state,i=n._data,r=t[e],o=t.then;if("function"==typeof r){e=v;try{i=r(i)}catch(s){h(o,s)}}a(o,i)||(e===v&&c(o,i),e===g&&h(o,i))}function a(t,n){var e;try{if(t===n)throw new TypeError("A promises callback cannot return that same promise.");if(n&&("function"==typeof n||"object"==typeof n)){var i=n.then;if("function"==typeof i)return i.call(n,function(i){e||(e=!0,n===i?u(t,i):c(t,i))},function(n){e||(e=!0,h(t,n))}),!0}}catch(r){return e||h(t,r),!0}return!1}function c(t,n){t!==n&&a(t,n)||u(t,n)}function u(t,n){t._state===w&&(t._state=m,t._data=n,r(f,t))}function h(t,n){t._state===w&&(t._state=m,t._data=n,r(d,t))}function l(t){t._then=t._then.forEach(s)}function f(t){t._state=v,l(t)}function d(t){t._state=g,l(t),!t._handled&&x&&process.emit("unhandledRejection",t._data,t)}function p(t){process.emit("rejectionHandled",t)}function _(t){if("function"!=typeof t)throw new TypeError("Promise resolver "+t+" is not a function");if(this instanceof _==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._then=[],o(t,this)}var y,w="pending",m="settled",v="fulfilled",g="rejected",C=function(){},x="undefined"!=typeof process&&"function"==typeof process.emit,S="undefined"==typeof setImmediate?setTimeout:setImmediate,M=[];_.prototype={constructor:_,_state:w,_then:null,_data:void 0,_handled:!1,then:function(t,n){var e={owner:this,then:new this.constructor(C),fulfilled:t,rejected:n};return!n&&!t||this._handled||(this._handled=!0,this._state===g&&x&&r(p,this)),this._state===v||this._state===g?r(s,e):this._then.push(e),e.then},"catch":function(t){return this.then(null,t)}},_.all=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.all().");return new _(function(n,e){function i(t){return s++,function(e){o[t]=e,--s||n(o)}}for(var r,o=[],s=0,a=0;a<t.length;a++)r=t[a],r&&"function"==typeof r.then?r.then(i(a),e):o[a]=r;s||n(o)})},_.race=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.race().");return new _(function(n,e){for(var i,r=0;r<t.length;r++)i=t[r],i&&"function"==typeof i.then?i.then(n,e):n(i)})},_.resolve=function(t){return t&&"object"==typeof t&&t.constructor===_?t:new _(function(n){n(t)})},_.reject=function(t){return new _(function(n,e){e(t)})},n.exports=_}},testcafe:{src:{"browser-connection":{"command.js":function(t,n,e){"use strict";t.__esModule=!0,t["default"]={run:"run",idle:"idle"},n.exports=t["default"]}},client:{browser:{"idle-page":{"index.js":function(t,n,e){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n["default"]=t,n}function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var s=e("../"),a=r(s),c=e("./status-indicator"),u=i(c),h=e("../../../browser-connection/command"),l=i(h),f=1e3,d=function(){function t(n,e){o(this,t),this.statusUrl=n,this.statusIndicator=new u["default"],a.startHeartbeat(e,window.XMLHttpRequest),this._checkStatus(),document.title="["+document.location.toString()+"]"}return t.prototype._checkStatus=function(){var t=this;a.checkStatus(this.statusUrl,window.XMLHttpRequest).then(function(n){n===l["default"].idle&&window.setTimeout(function(){return t._checkStatus()},f)})["catch"](function(){return t.statusIndicator.showDisconnection()})},t}();window.IdlePage=d},"status-indicator.js":function(t,n,e){"use strict";function i(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function r(t){return t*Math.PI/180}function o(t){return t+"px"}function s(t,n){var e=r(n);return{x:Math.round(t.x*Math.cos(e)-t.y*Math.sin(e)),y:Math.round(t.x*Math.sin(e)+t.y*Math.cos(e))}}function a(t,n){return{x:Math.round(t.x-n),y:Math.round(t.y-n)}}t.__esModule=!0;var c=8,u=.8,h=400,l=7,f=.03,d=3.5,p={x:.75,y:.7},_={x:1.025,y:.575},y=6,w="#28687F",m="#882E24",v="#181818",g="CONNECTED",C="DISCONNECTED",x="page-background",S="user-agent",M="status",z="spinner",E="connected",j="disconnected",A=30,b=function(){function t(){i(this,t),this.connected=!0,this.canvas=document.getElementsByClassName(z)[0],this.canvasContext=this.canvas.getContext("2d"),this.spinnerAnimationInterval=null,this.rotationAngle=0,this.size=null,this.spinnerCenter=null,this.gradient=null,this._setSize(),this._setFontSize(),this._setSpinnerGradient(),t._createStatusMessage(this.connected),t._alignContainerVertically(),this._drawSpinner(this.connected,0),this._watchWindowResize()}return t._getContainer=function(){return document.getElementsByClassName("container")[0]},t._getStatusElementSpan=function(){return document.getElementsByClassName(M)[0].children[0]},t._createStatusMessage=function(n){var e=t._getStatusElementSpan();e.className=n?E:j,e.textContent=n?g:C},t._alignContainerVertically=function(){var n=document.getElementsByClassName(x)[0],e=t._getContainer(),i=Math.ceil((n.offsetHeight-e.offsetHeight)/2);i>0&&(e.style.marginTop=o(i))},t.prototype._setSize=function(){var n=window.document.documentElement,e=Math.min(n.clientWidth,n.clientHeight),i=t._getContainer(),r=Math.round(Math.min(h,e*u));r!==this.size&&(this.size=Math.round(Math.min(h,e*u)),this.spinnerCenter=this.size/2,i.style.width=o(this.size),i.style.height=o(this.size),this.canvas.width=this.canvas.height=this.size)},t.prototype._setFontSize=function(){var n=document.getElementsByClassName(S)[0].children[0],e=t._getStatusElementSpan(),i=Math.round(f*this.size+d),r=i+y;n.style.fontSize=o(i),n.style.lineHeight=o(r),n.style.maxHeight=o(2*r),e.style.fontSize=o(i),e.style.lineHeight=o(r-1)},t.prototype._watchWindowResize=function(){var n=this;window.onresize=function(){var e=n.size;n._setSize(),n._setFontSize(),t._alignContainerVertically(),e!==n.size&&(n.connected&&n._setSpinnerGradient(),n._drawSpinner(n.connected,n.rotationAngle))}},t.prototype._drawSpinner=function(t,n){var e=this;this._clearCanvas(),clearInterval(this.spinnerAnimationInterval),t?(this.spinnerAnimationInterval=window.setInterval(function(){e._clearCanvas(),e._rotateSpinner(),e._drawCircle(e.gradient,240,n)},A),this._drawCircle(this.gradient,240,n)):this._drawCircle(m,360,0)},t.prototype._drawCircle=function(t,n,e){var i=this.spinnerCenter-c/2;this.canvasContext.beginPath(),this.canvasContext.lineWidth=c,this.canvasContext.strokeStyle=t,this.canvasContext.arc(this.spinnerCenter,this.spinnerCenter,i,r(e),r(e+n),!1),this.canvasContext.stroke()},t.prototype._rotateSpinner=function(){this.rotationAngle+=l,this.rotationAngle=this.rotationAngle>360?this.rotationAngle%360:this.rotationAngle,this.canvasContext.translate(this.spinnerCenter,this.spinnerCenter),this.canvasContext.rotate(r(l)),this.canvasContext.translate(-this.spinnerCenter,-this.spinnerCenter)},t.prototype._getRotatedGradientPoints=function(t){var n=a(t,this.spinnerCenter);return n=s(n,this.rotationAngle),n=a(n,-this.spinnerCenter)},t.prototype._setSpinnerGradient=function(){var t={x:Math.round(this.size*p.x),y:Math.round(this.size*p.y)},n={x:Math.round(this.size*_.x),y:Math.round(this.size*_.y)};0!==this.rotationAngle&&(t=this._getRotatedGradientPoints(t),n=this._getRotatedGradientPoints(n));var e=this.canvasContext.createLinearGradient(t.x,t.y,n.x,n.y);e.addColorStop(0,w),e.addColorStop(1,v),this.gradient=e},t.prototype._clearCanvas=function(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.showDisconnection=function(){this.connected=!1,t._createStatusMessage(this.connected),this._drawSpinner(this.connected,0)},t}();t["default"]=b,n.exports=t["default"]}},"index.js":function(t,n,e){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,n){return new u["default"](function(e,i){var r=new n;r.open("GET",t,!0),r.onreadystatechange=function(){4===r.readyState&&(200===r.status?e(r.responseText?JSON.parse(r.responseText):""):i("disconnected"))},r.send(null)})}function o(t){return document.location.href.toLowerCase()===t.toLowerCase()}function s(t,n){r(t,n),window.setInterval(function(){return r(t,n)},f)}function a(t,n){return r(t,n).then(function(t){return(t.cmd===l["default"].run||t.cmd===l["default"].idle&&!o(t.url))&&(document.location=t.url),t.cmd})}t.__esModule=!0,t.startHeartbeat=s,t.checkStatus=a;var c=e("pinkie"),u=i(c),h=e("../../browser-connection/command"),l=i(h),f=3e4}}}}}})("testcafe/src/client/browser/idle-page/index");

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

!function(){function e(t){var s=t.document;!function(e){"use strict";var t,s,o,i,n,r={".js":[],".json":[],".css":[],".html":[]},u="function"==typeof require?require:null;return i=function(e){var t=new Error("Could not find module '"+e+"'");return t.code="MODULE_NOT_FOUND",t},n=function(e,t,s){var o,i;if("function"==typeof e[t+s])return t+s;for(o=0;i=r[s][o];++o)if("function"==typeof e[t+i])return t+i;return null},t=function(e,o,r,u,a,l){var d,c,f,h,p,E;for(r=r.split(/[\\/]/),d=r.pop(),("."===d||".."===d)&&(r.push(d),d="");null!=(c=r.shift());)if(c&&"."!==c&&(".."===c?(e=o.pop(),l=l.slice(0,l.lastIndexOf("/"))):(o.push(e),e=e[c],l+="/"+c),!e))throw i(u);if(d&&"function"!=typeof e[d]&&(E=n(e,d,".js"),E||(E=n(e,d,".json")),E||(E=n(e,d,".css")),E||(E=n(e,d,".html")),E?d=E:2!==a&&"object"==typeof e[d]&&(o.push(e),e=e[d],l+="/"+d,d="")),!d)return 1!==a&&e[":mainpath:"]?t(e,o,e[":mainpath:"],u,1,l):t(e,o,"index",u,2,l);if(p=e[d],!p)throw i(u);return p.hasOwnProperty("module")?p.module.exports:(f={},p.module=h={exports:f,id:l+"/"+d},p.call(f,f,h,s(e,o,l)),h.exports)},o=function(s,o,n,r){var a,l=n,d=n.charAt(0),c=0;if("/"===d){if(l=l.slice(1),s=e["/"],!s){if(u)return u(n);throw i(n)}r="/",o=[]}else if("."!==d){if(a=l.split("/",1)[0],s=e[a],!s){if(u)return u(n);throw i(n)}r=a,o=[],l=l.slice(a.length+1),l||(l=s[":mainpath:"],l?c=1:(l="index",c=2))}return t(s,o,l,n,c,r)},(s=function(e,t,s){return function(i){return o(e,[].concat(t),i,s)}})(e,[],"")}({testcafe:{src:{client:{ui:{cursor:{"base-behavior.js":function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}e.__esModule=!0;var n=o("./../deps/hammerhead"),r=i(n),u=o("./../deps/testcafe-core"),a=i(u),l=r["default"].shadowUI,d=a["default"].$,c=a["default"].serviceUtils,f=a["default"].positionUtils,h="l-mouse-down",p="r-mouse-down",E=[h,p].join(" "),_=function(){this.cursorPosition=null,this.pointerOffsetX=0,this.pointerOffsetY=0,this.eventEmitter=new c.EventEmitter,this.started=!1};_.prototype.start=function(){this.started=!0},_.prototype.isStarted=function(){return this.started},_.prototype.on=function(e,t){this.eventEmitter.on(e,t)},_.prototype.STARTED_EVENT="cursorStarted",_.CURSOR_MOVE_REQUEST_CMD="cursorMoveRequest",_.CURSOR_LMOUSEDOWN_REQUEST_CMD="cursorLMouseDownRequest",_.CURSOR_RMOUSEDOWN_REQUEST_CMD="cursorRMouseDownRequest",_.CURSOR_MOUSEUP_REQUEST_CMD="cursorMouseUpRequest",_.CURSOR_HIDE_REQUEST_CMD="cursorHideRequest",_.CURSOR_SHOW_REQUEST_CMD="cursorShowRequest",_.CURSOR_MOVE_RESPONSE_CMD="cursorMoveResponse",_.CURSOR_LMOUSEDOWN_RESPONSE_CMD="cursorLMouseDownResponse",_.CURSOR_RMOUSEDOWN_RESPONSE_CMD="cursorRMouseDownResponse",_.CURSOR_MOUSEUP_RESPONSE_CMD="cursorMouseUpResponse",_.CURSOR_HIDE_RESPONSE_CMD="cursorHideResponse",_.CURSOR_SHOW_RESPONSE_CMD="cursorShowResponse",_.prototype.move=function(e,t,o){this.cursorPosition=f.getFixedPosition(e,o,!0),this.$cursor&&this.$cursor.css({left:this.cursorPosition.x+d(s).scrollLeft()-this.pointerOffsetX+"px",top:this.cursorPosition.y+d(s).scrollTop()-this.pointerOffsetY+"px"}),t&&t()},_.prototype.lMouseDown=function(e){this.$cursor&&(l.removeClass(this.$cursor[0],E),l.addClass(this.$cursor[0],h)),e&&e()},_.prototype.rMouseDown=function(e){this.$cursor&&(l.removeClass(this.$cursor[0],E),l.addClass(this.$cursor[0],p)),e&&e()},_.prototype.mouseUp=function(e){this.$cursor&&l.removeClass(this.$cursor[0],E),e&&e()},_.prototype.hide=function(e){this.$cursor&&this.$cursor.css({visibility:"hidden"}),e&&e()},_.prototype.show=function(e){this.$cursor&&this.$cursor.css({visibility:""}),e&&e()},_.prototype.getPosition=function(){return this.cursorPosition},e["default"]=_,t.exports=e["default"]},"behavior.js":function(e,s,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function n(){return!_.get().RECORDING||_.get().PLAYBACK}e.__esModule=!0;var r=o("./../deps/hammerhead"),u=i(r),a=o("./../deps/testcafe-core"),l=i(a),d=o("./base-behavior"),c=i(d),f=u["default"].shadowUI,h=u["default"].utils.browser,p=u["default"].eventSandbox.message,E=l["default"].$,_=l["default"].SETTINGS,S=l["default"].serviceUtils,m=l["default"].positionUtils,R="cursor",v="touch",M=function(){var e=this;E(t).scroll(function(){var t=e?e.cursorPosition:null;t&&e.move({x:t.x,y:t.y})}),this._initCursorIFrameBehavior(),this.$cursor=E("<div></div>"),f.addClass(this.$cursor[0],R),this.$cursor.appendTo(E(f.getRoot())),this.hide(),c["default"].call(this)};S.inherit(M,c["default"]),M.prototype.start=function(e,s){var o=this;!h.isTouchDevice||h.isIE&&s||(f.addClass(this.$cursor[0],v),this.pointerOffsetX=Math.ceil(this.$cursor.width()/2),this.pointerOffsetY=Math.ceil(this.$cursor.height()/2)),this.move(m.getFixedPosition(e,s,!0)),n()&&this.show(),c["default"].prototype.start.call(this),t.setTimeout(function(){o.eventEmitter.emit(o.STARTED_EVENT,null)},0)},M.prototype._initCursorIFrameBehavior=function(){function e(e){var s=e.message;switch(s.cmd){case c["default"].CURSOR_MOVE_REQUEST_CMD:t.move(s.position,function(){p.sendServiceMsg({cmd:c["default"].CURSOR_MOVE_RESPONSE_CMD},e.source)},e.source);break;case c["default"].CURSOR_LMOUSEDOWN_REQUEST_CMD:t.lMouseDown(function(){p.sendServiceMsg({cmd:c["default"].CURSOR_LMOUSEDOWN_RESPONSE_CMD},e.source)});break;case c["default"].CURSOR_RMOUSEDOWN_REQUEST_CMD:t.rMouseDown(function(){p.sendServiceMsg({cmd:c["default"].CURSOR_RMOUSEDOWN_RESPONSE_CMD},e.source)});break;case c["default"].CURSOR_MOUSEUP_REQUEST_CMD:t.mouseUp(function(){p.sendServiceMsg({cmd:c["default"].CURSOR_MOUSEUP_RESPONSE_CMD},e.source)});break;case c["default"].CURSOR_HIDE_REQUEST_CMD:t.hide(function(){p.sendServiceMsg({cmd:c["default"].CURSOR_HIDE_RESPONSE_CMD},e.source)});break;case c["default"].CURSOR_SHOW_REQUEST_CMD:t.show(function(){p.sendServiceMsg({cmd:c["default"].CURSOR_SHOW_RESPONSE_CMD},e.source)})}}var t=this;p.on(p.SERVICE_MSG_RECEIVED_EVENT,e)},M.prototype.getElementUnderCursor=function(e,t,s){var o="hidden"!==this.$cursor.css("visibility");o&&this.hide();var i=m.getElementFromPoint(e,t,s);return o&&this.show(),i},M.prototype.getAbsolutePosition=function(){if(this.$cursor){var e=m.getOffsetPosition(this.$cursor[0]),t=Math.round(e.left)+this.pointerOffsetX,s=Math.round(e.top)+this.pointerOffsetY;return{x:t,y:s}}return null},e["default"]=M,s.exports=e["default"]},"iframe-behavior.js":function(e,s,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}e.__esModule=!0;var n=o("./../deps/hammerhead"),r=i(n),u=o("./../deps/testcafe-core"),a=i(u),l=o("./base-behavior"),d=i(l),c=r["default"].eventSandbox.message,f=r["default"].utils.browser,h=a["default"].CROSS_DOMAIN_MESSAGES,p=a["default"].serviceUtils,E=a["default"].positionUtils,_=function(){d["default"].call(this)};p.inherit(_,d["default"]),_.prototype._bindMessageHandler=function(e,t){function s(o){o.message&&o.message.cmd===e&&(c.off(c.SERVICE_MSG_RECEIVED_EVENT,s),t&&t())}c.on(c.SERVICE_MSG_RECEIVED_EVENT,s)},_.prototype.start=function(e){var s=f.isIE?1:0,o=this,i={cmd:h.CURSOR_START_REQUEST_CMD,position:{x:e.x+s,y:e.y+s}};this.cursorPosition=e,this._bindMessageHandler(h.CURSOR_START_RESPONSE_CMD,function(){d["default"].prototype.start.call(o),o.eventEmitter.emit(o.STARTED_EVENT,null)}),c.sendServiceMsg(i,t.top)},_.prototype.move=function(e,s){var o=f.isIE?1:0;this.cursorPosition=e,this._bindMessageHandler(d["default"].CURSOR_MOVE_RESPONSE_CMD,s);var i={cmd:d["default"].CURSOR_MOVE_REQUEST_CMD,position:{x:e.x+o,y:e.y+o}};c.sendServiceMsg(i,t.top)},_.prototype.lMouseDown=function(e){this._bindMessageHandler(d["default"].CURSOR_LMOUSEDOWN_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_LMOUSEDOWN_REQUEST_CMD},t.top)},_.prototype.rMouseDown=function(e){this._bindMessageHandler(d["default"].CURSOR_RMOUSEDOWN_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_RMOUSEDOWN_REQUEST_CMD},t.top)},_.prototype.mouseUp=function(e){this._bindMessageHandler(d["default"].CURSOR_MOUSEUP_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_MOUSEUP_REQUEST_CMD},t.top)},_.prototype.hide=function(e){this._bindMessageHandler(d["default"].CURSOR_HIDE_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_HIDE_REQUEST_CMD},t.top)},_.prototype.show=function(e){this._bindMessageHandler(d["default"].CURSOR_SHOW_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_SHOW_REQUEST_CMD},t.top)},_.prototype.getElementUnderCursor=function(e,t,s){return E.getElementFromPoint(e,t,s)},e["default"]=_,s.exports=e["default"]},"index.js":function(e,s,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function n(){U||(U=t.top!==t.self?new g["default"]:new M["default"])}function r(e,t,s){if(U.isStarted()&&U.getPosition())return void s();var o={x:Math.max(0,e.x-(t?0:50)),y:Math.max(0,e.y-(t?0:50))};a(o,s)}function u(e){U.isStarted()?U.cursorPosition=e:a(e,function(){})}function a(e,s,o){U.isStarted()?U.move(e,function(){t.setTimeout(s,0)},o):!O.get().RECORDING||O.get().PLAYBACK?(U.start(e,o),U.on(U.STARTED_EVENT,s)):s()}function l(e,t){U.move(e,t)}function d(e){U.lMouseDown(e)}function c(e){U.rMouseDown(e)}function f(e){U.mouseUp(e)}function h(e){U.hide(e)}function p(e){U.show(e)}function E(e,t,s){return U?U.getElementUnderCursor(e,t,s):void 0}function _(){return U.getPosition?U.getPosition():null}function S(){return U.getAbsolutePosition?U.getAbsolutePosition():null}e.__esModule=!0,e.init=n,e.ensureCursorPosition=r,e.setPosition=u,e.start=a,e.move=l,e.lMouseDown=d,e.rMouseDown=c,e.mouseUp=f,e.hide=h,e.show=p,e.getElementUnderCursor=E,e.getPosition=_,e.getAbsolutePosition=S;var m=o("./../deps/testcafe-core"),R=i(m),v=o("./behavior"),M=i(v),C=o("./iframe-behavior"),g=i(C),O=R["default"].SETTINGS,U=null}},deps:{"hammerhead.js":function(e,s,o){"use strict";e.__esModule=!0,e["default"]=t["%hammerhead%"],s.exports=e["default"]},"testcafe-core.js":function(e,s,o){"use strict";e.__esModule=!0,e["default"]=t["%testCafeCore%"],s.exports=e["default"]}},"index.js":function(s,o,i){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}var u=i("./deps/hammerhead"),a=r(u),l=i("./cursor"),d=n(l),c=i("./select-element"),f=n(c),h=i("./modal-background"),p=n(h),E=i("./progress-panel"),_=r(E);s.cursor=d,s.selectElement=f,s.modalBackground=p,s.ProgressPanel=_["default"],s.get=i,Object.defineProperty(t,"%testCafeUI%",{enumerable:!1,configurable:!1,writable:!1,value:s}),a["default"].on(a["default"].EVENTS.iframeReadyToInit,function(t){return e(t.iframe.contentWindow,!0)})},"modal-background.js":function(e,o,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(){var e=v(R.getRoot());T=v("<div></div>").appendTo(e),R.addClass(T[0],C),D=v("<div></div>").appendTo(e).text(M),R.addClass(D[0],g),y=v("<div></div>").css("visibility","hidden").appendTo(e),R.addClass(y[0],w)}function u(){var e=v(t),s=e.height(),o=e.width(),i=D.is(":visible");i||(D.attr("visibility","hidden"),D.show()),D.css({left:Math.max((o-D.width())/2,0),top:Math.max((s-D.height())/2,0)}),i||(D.hide(),D.attr("visibility",""))}function a(){var e=v(t),s=function(){var t=e.height(),s=e.width();T.width(s),T.height(t),y.css("top",Math.round((t-y.height())/2)),y.css("left",Math.round((s-y.width())/2))};s(),e.resize(s)}function l(){r(),a(),u(),b=!0}function d(){var e=!1,o=function(){l(),T.css({opacity:U}),T.show(),D.show(),e=!0},i=function(){e||(s.body?o():t.setTimeout(i,0))};i(),v(s).ready(function(){e||o()})}function c(e){b||l(),T.css({opacity:e?0:O}),T.show()}function f(){b&&(D.hide(),T.hide())}function h(){y.css("visibility","visible")}function p(){y.css("visibility","hidden")}e.__esModule=!0,e.initAndShowLoadingText=d,e.show=c,e.hide=f,e.showLoadingIcon=h,e.hideLoadingIcon=p;var E=i("./deps/hammerhead"),_=n(E),S=i("./deps/testcafe-core"),m=n(S),R=_["default"].shadowUI,v=m["default"].$,M="Loading page...",C="modal-background",g="loading-text",O=.7,U=.8,w="loading-icon",T=null,D=null,y=null,b=!1},"progress-panel":{"index.js":function(e,s,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var r=o("../deps/hammerhead"),u=i(r),a=o("../deps/testcafe-core"),l=i(a),d=o("./progress-bar"),c=i(d),f=u["default"].shadowUI,h=l["default"].eventUtils,p=l["default"].$,E="progress-panel",_="title",S="content",m=100,R=300,v=200,M=600,C=1e3,g=function(){function e(){var t=this;n(this,e),this.startTime=null,this.openingTimeout=null,this.updateInterval=null,this.$panel=p("<div></div>").appendTo(p(f.getRoot())),this.$title=p("<div></div>").appendTo(this.$panel),this.$content=p("<div></div>").appendTo(this.$panel),f.addClass(this.$panel[0],E),f.addClass(this.$title[0],_),f.addClass(this.$content[0],S),e._showAtWindowCenter(this.$panel),this.progressBar=new c["default"](this.$content[0]),this.disposePanel=function(){return e._showAtWindowCenter(t.$panel)}}return e._showAtWindowCenter=function(e){var s=p(t),o=Math.round(s.height()/2-e.outerHeight()/2),i=Math.round(s.width()/2-e.outerWidth()/2);e.css({top:o,left:i})},e.prototype._setCurrentProgress=function(){var e=Math.round((Date.now()-this.startTime)/this.maxTimeout*100);this.progressBar.setValue(e)},e.prototype._setSuccess=function(e){this.progressBar.setSuccess(e)},e.prototype._showPanel=function(){h.bind(p(t),"resize",this.disposePanel),this.$panel.fadeIn(v)},e.prototype._hidePanel=function(e){var s=this;this.startTime=null,h.unbind(p(t),"resize",this.disposePanel),this.$panel.fadeOut(e?0:M,function(){return s.$panel.css("display","none")})},e.prototype.show=function(e,s){var o=this;this.startTime=Date.now(),this.maxTimeout=s,this.$title.text(e),this._setSuccess(!1),this.openingTimeout=t.setTimeout(function(){o.openingTimeout=null,o._setCurrentProgress(),o._showPanel(),o.updateInterval=t.setInterval(function(){return o._setCurrentProgress()},m)},R)},e.prototype.close=function(e){var s=this;e&&this._setSuccess(!0),this.openingTimeout&&(t.clearTimeout(this.openingTimeout),this.openingTimeout=null),this.updateInterval&&(t.clearInterval(this.updateInterval),this.updateInterval=null),e?this.startTime&&Date.now()-this.startTime<C?t.setTimeout(function(){t.setTimeout(function(){return s._hidePanel(!1)},v)},m):t.setTimeout(function(){return s._hidePanel(!1)},v):this._hidePanel(!0)},e}();e["default"]=g,s.exports=e["default"]},"progress-bar.js":function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var r=o("../deps/hammerhead"),u=i(r),a=o("../deps/testcafe-core"),l=(i(a),u["default"].shadowUI),d="progress-bar",c="value",f="success",h=function(){function e(t){n(this,e),this.containerElement=s.createElement("div"),this.valueElement=s.createElement("div"),t.appendChild(this.containerElement),this.containerElement.appendChild(this.valueElement),l.addClass(this.containerElement,d),l.addClass(this.valueElement,c)}return e.prototype.setValue=function(e){e="number"!=typeof e?0:Math.min(Math.max(e,0),100),this.valueElement.style.width=e+"%"},e.prototype.setSuccess=function(e){e?l.addClass(this.containerElement,f):l.removeClass(this.containerElement,f)},e}();e["default"]=h,t.exports=e["default"]}},"select-element.js":function(e,o,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){(e.target||e.srcElement)===I[0]||I.has(e.target).length||N.has(e.target).length||c()}function u(e,t){var s=O("<div></div>").text(e.text).appendTo(t),o=e.disabled||"optgroup"===e.parentElement.tagName.toLowerCase()&&e.parentElement.disabled;M.addClass(s[0],b),o&&(M.addClass(s[0],P),s.css("color",O(e).css("color"))),o&&C.isWebKit?s.click(function(){return!1}):s.click(function(){var e=I[0],t=e.selectedIndex,s=O.inArray(this,H),i=O(e).find("option")[s],n=!o&&s!==t;n&&!C.isIE&&(e.selectedIndex=s),C.isFirefox||C.isIE||!n||g.change(e),(C.isFirefox||C.isIE)&&g.mousedown(C.isFirefox?i:e),g.mouseup(C.isFirefox?i:e),(C.isFirefox||C.isIE)&&n&&(g.change(e),C.isIE&&(e.selectedIndex=s)),g.click(C.isFirefox||C.isIE?i:e),o||c()}),H=H&&H.length?H.add(s):s}function a(e,t){var s=O("<div></div>").text(e.label||" ").appendTo(t);M.addClass(s[0],y),e.disabled&&(M.addClass(s[0],P),s.css("color",O(e).css("color"))),l(O(e).children(),s),$=$&&$.length?$.add(s):s}function l(e,t){O.each(e,function(e,s){"option"===s.tagName.toLowerCase()?u(s,t):"optgroup"===s.tagName.toLowerCase()&&a(s,t)})}function d(e){var o=O(e),i=O(e).children();if(i.length){if(I){var n=o[0]===I[0];if(c(),n)return}I=o,N=O("<div></div>").appendTo(O(M.getRoot())),M.addClass(N[0],D),l(i,N),t.setTimeout(function(){O(s).bind("mousedown",r)},0),N.css({position:"absolute",fontSize:I.css("fontSize"),fontFamily:I.css("fontFamily"),minWidth:I.width(),left:U.getOffsetPosition(I[0]).left,height:w.getSelectVisibleChildren(o[0]).length>x?T.getOptionHeight(e)*x:""});var u=O(t),a=U.getOffsetPosition(I[0]).top,d=N.height(),f=a+I.height()+2;if(f+d>u.scrollTop()+u.height()){var h=a-3-d;h>=u.scrollTop()&&(f=h)}N.css("top",f)}}function c(){N.remove(),O(s).unbind("mousedown",r),N=null,I=null,H=null,$=null}function f(e){return e?e.is(I):!!I}function h(e,t){return t?$[e]:H[e]}function p(e){var t=w.getSelectParent(e);if(t){var s=O(t),o=T.getSelectElementSize(t),i=T.getOptionHeight(t),n=0,r=Math.max(s.scrollTop()/i,0),u=r+o-1,a=w.getChildVisibleIndex(s[0],e);r>a?(n=i*(r-a),s.scrollTop(Math.max(s.scrollTop()-n,0))):a>u&&(n=i*(a-u),s.scrollTop(s.scrollTop()+n))}}function E(e){var t=w.getSelectParent(e);if(!t)return{x:0,y:0};var s=T.getOptionHeight(t),o=U.getElementRectangle(e);return{x:Math.round(o.left+o.width/2),y:Math.round(o.top+s/2)}}function _(e){var t=O(w.getActiveElement());if("select"===t[0].tagName.toLowerCase()&&(/enter|tab|esc/.test(e)&&c(),/down|up/.test(e)||!C.isIE&&(T.getSelectElementSize(t[0])<=1||C.isFirefox)&&(!O(M.select("."+D)).is(":visible")||C.isFirefox)&&/left|right/.test(e))){var s=t.find("option"),o=s.filter(function(){var e=O(this).parent()[0];return!(this.disabled||"optgroup"===e.tagName.toLowerCase()&&e.disabled)}),i=O.inArray(t.find("option:selected")[0],o);i+=/down|right/.test(e)?1:-1,i>=0&&i<o.length&&(t[0].selectedIndex=O.inArray(o[i],s),g.change(t[0]))}}e.__esModule=!0,e.expandOptionList=d,e.collapseOptionList=c,e.isOptionListExpanded=f,e.getEmulatedChildElement=h,e.scrollOptionListByChild=p,e.getSelectChildCenter=E,e.switchOptionsByKeys=_;var S=i("./deps/hammerhead"),m=n(S),R=i("./deps/testcafe-core"),v=n(R),M=m["default"].shadowUI,C=m["default"].utils.browser,g=m["default"].eventSandbox.eventSimulator,O=v["default"].$,U=v["default"].positionUtils,w=v["default"].domUtils,T=v["default"].styleUtils,D="tcOptionList",y="tcOptionGroup",b="tcOption",P="disabled",x=C.isIE?30:20,I=null,N=null,$=null,H=null}}}}}})("testcafe/src/client/ui/index")}e(window)}();
!function(){function e(t){var n=t.document;!function(e){"use strict";var t,n,i,s,o,r={".js":[],".json":[],".css":[],".html":[]},a="function"==typeof require?require:null;return s=function(e){var t=new Error("Could not find module '"+e+"'");return t.code="MODULE_NOT_FOUND",t},o=function(e,t,n){var i,s;if("function"==typeof e[t+n])return t+n;for(i=0;s=r[n][i];++i)if("function"==typeof e[t+s])return t+s;return null},t=function(e,i,r,a,u,l){var d,c,f,h,p,E;for(r=r.split(/[\\/]/),d=r.pop(),("."===d||".."===d)&&(r.push(d),d="");null!=(c=r.shift());)if(c&&"."!==c&&(".."===c?(e=i.pop(),l=l.slice(0,l.lastIndexOf("/"))):(i.push(e),e=e[c],l+="/"+c),!e))throw s(a);if(d&&"function"!=typeof e[d]&&(E=o(e,d,".js"),E||(E=o(e,d,".json")),E||(E=o(e,d,".css")),E||(E=o(e,d,".html")),E?d=E:2!==u&&"object"==typeof e[d]&&(i.push(e),e=e[d],l+="/"+d,d="")),!d)return 1!==u&&e[":mainpath:"]?t(e,i,e[":mainpath:"],a,1,l):t(e,i,"index",a,2,l);if(p=e[d],!p)throw s(a);return p.hasOwnProperty("module")?p.module.exports:(f={},p.module=h={exports:f,id:l+"/"+d},p.call(f,f,h,n(e,i,l)),h.exports)},i=function(n,i,o,r){var u,l=o,d=o.charAt(0),c=0;if("/"===d){if(l=l.slice(1),n=e["/"],!n){if(a)return a(o);throw s(o)}r="/",i=[]}else if("."!==d){if(u=l.split("/",1)[0],n=e[u],!n){if(a)return a(o);throw s(o)}r=u,i=[],l=l.slice(u.length+1),l||(l=n[":mainpath:"],l?c=1:(l="index",c=2))}return t(n,i,l,o,c,r)},(n=function(e,t,n){return function(s){return i(e,[].concat(t),s,n)}})(e,[],"")}({testcafe:{src:{client:{ui:{cursor:{"base-behavior.js":function(e,t,i){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}e.__esModule=!0;var o=i("./../deps/hammerhead"),r=s(o),a=i("./../deps/testcafe-core"),u=s(a),l=r["default"].shadowUI,d=u["default"].serviceUtils,c=u["default"].positionUtils,f=u["default"].styleUtils,h="l-mouse-down",p="r-mouse-down",E=[h,p].join(" "),m=function(){this.cursorPosition=null,this.pointerOffsetX=0,this.pointerOffsetY=0,this.eventEmitter=new d.EventEmitter,this.started=!1};m.prototype.start=function(){this.started=!0},m.prototype.isStarted=function(){return this.started},m.prototype.on=function(e,t){this.eventEmitter.on(e,t)},m.prototype.STARTED_EVENT="cursorStarted",m.CURSOR_MOVE_REQUEST_CMD="cursorMoveRequest",m.CURSOR_LMOUSEDOWN_REQUEST_CMD="cursorLMouseDownRequest",m.CURSOR_RMOUSEDOWN_REQUEST_CMD="cursorRMouseDownRequest",m.CURSOR_MOUSEUP_REQUEST_CMD="cursorMouseUpRequest",m.CURSOR_HIDE_REQUEST_CMD="cursorHideRequest",m.CURSOR_SHOW_REQUEST_CMD="cursorShowRequest",m.CURSOR_MOVE_RESPONSE_CMD="cursorMoveResponse",m.CURSOR_LMOUSEDOWN_RESPONSE_CMD="cursorLMouseDownResponse",m.CURSOR_RMOUSEDOWN_RESPONSE_CMD="cursorRMouseDownResponse",m.CURSOR_MOUSEUP_RESPONSE_CMD="cursorMouseUpResponse",m.CURSOR_HIDE_RESPONSE_CMD="cursorHideResponse",m.CURSOR_SHOW_RESPONSE_CMD="cursorShowResponse",m.prototype.move=function(e,t,i){this.cursorPosition=c.getFixedPosition(e,i,!0),this.cursorElement&&f.set(this.cursorElement,{left:this.cursorPosition.x+f.getScrollLeft(n)-this.pointerOffsetX+"px",top:this.cursorPosition.y+f.getScrollTop(n)-this.pointerOffsetY+"px"}),t&&t()},m.prototype.lMouseDown=function(e){this.cursorElement&&(l.removeClass(this.cursorElement,E),l.addClass(this.cursorElement,h)),e&&e()},m.prototype.rMouseDown=function(e){this.cursorElement&&(l.removeClass(this.cursorElement,E),l.addClass(this.cursorElement,p)),e&&e()},m.prototype.mouseUp=function(e){this.cursorElement&&l.removeClass(this.cursorElement,E),e&&e()},m.prototype.hide=function(e){this.cursorElement&&f.set(this.cursorElement,"visibility","hidden"),e&&e()},m.prototype.show=function(e){this.cursorElement&&f.set(this.cursorElement,"visibility",""),e&&e()},m.prototype.getPosition=function(){return this.cursorPosition},e["default"]=m,t.exports=e["default"]},"behavior.js":function(e,i,s){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(){return!m.get().RECORDING||m.get().PLAYBACK}e.__esModule=!0;var a=s("./../deps/hammerhead"),u=o(a),l=s("./../deps/testcafe-core"),d=o(l),c=s("./base-behavior"),f=o(c),h=u["default"].shadowUI,p=u["default"].utils.browser,E=u["default"].eventSandbox.message,m=d["default"].SETTINGS,_=d["default"].serviceUtils,S=d["default"].positionUtils,v=d["default"].styleUtils,g=d["default"].eventUtils,R="cursor",C="touch",M=function(){var e=this;g.bind(t,"scroll",function(){var t=e?e.cursorPosition:null;t&&e.move({x:t.x,y:t.y})}),this._initCursorIFrameBehavior(),this.cursorElement=n.createElement("div"),h.addClass(this.cursorElement,R),h.getRoot().appendChild(this.cursorElement),this.hide(),f["default"].call(this)};_.inherit(M,f["default"]),M.prototype.start=function(e,n){var i=this;!p.isTouchDevice||p.isIE&&n||(h.addClass(this.cursorElement,C),this.pointerOffsetX=Math.ceil(v.getWidth(this.cursorElement)/2),this.pointerOffsetY=Math.ceil(v.getHeight(this.cursorElement)/2)),this.move(S.getFixedPosition(e,n,!0)),r()&&this.show(),f["default"].prototype.start.call(this),t.setTimeout(function(){i.eventEmitter.emit(i.STARTED_EVENT,null)},0)},M.prototype._initCursorIFrameBehavior=function(){function e(e){var n=e.message;switch(n.cmd){case f["default"].CURSOR_MOVE_REQUEST_CMD:t.move(n.position,function(){E.sendServiceMsg({cmd:f["default"].CURSOR_MOVE_RESPONSE_CMD},e.source)},e.source);break;case f["default"].CURSOR_LMOUSEDOWN_REQUEST_CMD:t.lMouseDown(function(){E.sendServiceMsg({cmd:f["default"].CURSOR_LMOUSEDOWN_RESPONSE_CMD},e.source)});break;case f["default"].CURSOR_RMOUSEDOWN_REQUEST_CMD:t.rMouseDown(function(){E.sendServiceMsg({cmd:f["default"].CURSOR_RMOUSEDOWN_RESPONSE_CMD},e.source)});break;case f["default"].CURSOR_MOUSEUP_REQUEST_CMD:t.mouseUp(function(){E.sendServiceMsg({cmd:f["default"].CURSOR_MOUSEUP_RESPONSE_CMD},e.source)});break;case f["default"].CURSOR_HIDE_REQUEST_CMD:t.hide(function(){E.sendServiceMsg({cmd:f["default"].CURSOR_HIDE_RESPONSE_CMD},e.source)});break;case f["default"].CURSOR_SHOW_REQUEST_CMD:t.show(function(){E.sendServiceMsg({cmd:f["default"].CURSOR_SHOW_RESPONSE_CMD},e.source)})}}var t=this;E.on(E.SERVICE_MSG_RECEIVED_EVENT,e)},M.prototype.getElementUnderCursor=function(e,t,n){var i="hidden"!==v.get(this.cursorElement,"visibility");i&&this.hide();var s=S.getElementFromPoint(e,t,n);return i&&this.show(),s},M.prototype.getAbsolutePosition=function(){if(this.cursorElement){var e=S.getOffsetPosition(this.cursorElement),t=Math.round(e.left)+this.pointerOffsetX,n=Math.round(e.top)+this.pointerOffsetY;return{x:t,y:n}}return null},e["default"]=M,i.exports=e["default"]},"iframe-behavior.js":function(e,n,i){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}e.__esModule=!0;var o=i("./../deps/hammerhead"),r=s(o),a=i("./../deps/testcafe-core"),u=s(a),l=i("./base-behavior"),d=s(l),c=r["default"].eventSandbox.message,f=r["default"].utils.browser,h=u["default"].CROSS_DOMAIN_MESSAGES,p=u["default"].serviceUtils,E=u["default"].positionUtils,m=function(){d["default"].call(this)};p.inherit(m,d["default"]),m.prototype._bindMessageHandler=function(e,t){function n(i){i.message&&i.message.cmd===e&&(c.off(c.SERVICE_MSG_RECEIVED_EVENT,n),t&&t())}c.on(c.SERVICE_MSG_RECEIVED_EVENT,n)},m.prototype.start=function(e){var n=f.isIE?1:0,i=this,s={cmd:h.CURSOR_START_REQUEST_CMD,position:{x:e.x+n,y:e.y+n}};this.cursorPosition=e,this._bindMessageHandler(h.CURSOR_START_RESPONSE_CMD,function(){d["default"].prototype.start.call(i),i.eventEmitter.emit(i.STARTED_EVENT,null)}),c.sendServiceMsg(s,t.top)},m.prototype.move=function(e,n){var i=f.isIE?1:0;this.cursorPosition=e,this._bindMessageHandler(d["default"].CURSOR_MOVE_RESPONSE_CMD,n);var s={cmd:d["default"].CURSOR_MOVE_REQUEST_CMD,position:{x:e.x+i,y:e.y+i}};c.sendServiceMsg(s,t.top)},m.prototype.lMouseDown=function(e){this._bindMessageHandler(d["default"].CURSOR_LMOUSEDOWN_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_LMOUSEDOWN_REQUEST_CMD},t.top)},m.prototype.rMouseDown=function(e){this._bindMessageHandler(d["default"].CURSOR_RMOUSEDOWN_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_RMOUSEDOWN_REQUEST_CMD},t.top)},m.prototype.mouseUp=function(e){this._bindMessageHandler(d["default"].CURSOR_MOUSEUP_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_MOUSEUP_REQUEST_CMD},t.top)},m.prototype.hide=function(e){this._bindMessageHandler(d["default"].CURSOR_HIDE_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_HIDE_REQUEST_CMD},t.top)},m.prototype.show=function(e){this._bindMessageHandler(d["default"].CURSOR_SHOW_RESPONSE_CMD,e),c.sendServiceMsg({cmd:d["default"].CURSOR_SHOW_REQUEST_CMD},t.top)},m.prototype.getElementUnderCursor=function(e,t,n){return E.getElementFromPoint(e,t,n)},e["default"]=m,n.exports=e["default"]},"index.js":function(e,n,i){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function o(){U||(U=t.top!==t.self?new M["default"]:new R["default"])}function r(e,t,n){if(U.isStarted()&&U.getPosition())return void n();var i={x:Math.max(0,e.x-(t?0:50)),y:Math.max(0,e.y-(t?0:50))};u(i,n)}function a(e){U.isStarted()?U.cursorPosition=e:u(e,function(){})}function u(e,n,i){U.isStarted()?U.move(e,function(){t.setTimeout(n,0)},i):!O.get().RECORDING||O.get().PLAYBACK?(U.start(e,i),U.on(U.STARTED_EVENT,n)):n()}function l(e,t){U.move(e,t)}function d(e){U.lMouseDown(e)}function c(e){U.rMouseDown(e)}function f(e){U.mouseUp(e)}function h(e){U.hide(e)}function p(e){U.show(e)}function E(e,t,n){return U?U.getElementUnderCursor(e,t,n):void 0}function m(){return U.getPosition?U.getPosition():null}function _(){return U.getAbsolutePosition?U.getAbsolutePosition():null}e.__esModule=!0,e.init=o,e.ensureCursorPosition=r,e.setPosition=a,e.start=u,e.move=l,e.lMouseDown=d,e.rMouseDown=c,e.mouseUp=f,e.hide=h,e.show=p,e.getElementUnderCursor=E,e.getPosition=m,e.getAbsolutePosition=_;var S=i("./../deps/testcafe-core"),v=s(S),g=i("./behavior"),R=s(g),C=i("./iframe-behavior"),M=s(C),O=v["default"].SETTINGS,U=null}},deps:{"hammerhead.js":function(e,n,i){"use strict";e.__esModule=!0,e["default"]=t["%hammerhead%"],n.exports=e["default"]},"testcafe-core.js":function(e,n,i){"use strict";e.__esModule=!0,e["default"]=t["%testCafeCore%"],n.exports=e["default"]}},"index.js":function(n,i,s){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}var a=s("./deps/hammerhead"),u=r(a),l=s("./cursor"),d=o(l),c=s("./select-element"),f=o(c),h=s("./modal-background"),p=o(h),E=s("./progress-panel"),m=r(E);n.cursor=d,n.selectElement=f,n.modalBackground=p,n.ProgressPanel=m["default"],n.get=s,Object.defineProperty(t,"%testCafeUI%",{enumerable:!1,configurable:!1,writable:!1,value:n}),u["default"].on(u["default"].EVENTS.iframeReadyToInit,function(t){return e(t.iframe.contentWindow,!0)})},"modal-background.js":function(e,i,s){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(){var e=v.getRoot();w=n.createElement("div"),e.appendChild(w),v.addClass(w,O),x=n.createElement("div"),x.textContent=M,e.appendChild(x),v.addClass(x,U),T=n.createElement("div"),C.set(T,"visibility","hidden"),e.appendChild(T),v.addClass(T,b)}function a(){var e=C.getHeight(t),n=C.getWidth(t),i=!C.hasDimensions(x);i&&(C.set(x,"visibility","hidden"),C.set(x,"display","block")),C.set(x,{left:Math.max((n-C.getWidth(x))/2,0)+"px",top:Math.max((e-C.getHeight(x))/2,0)+"px"}),i&&(C.set(x,"display","none"),C.set(x,"visibility",""))}function u(){var e=function(){var e=C.getHeight(t),n=C.getWidth(t);C.set(w,"width",n+"px"),C.set(w,"height",e+"px"),C.set(T,{left:Math.round((n-C.getWidth(T))/2)+"px",top:Math.round((e-C.getHeight(T))/2)+"px"})};e(),R.bind(t,"resize",e)}function l(){r(),u(),a(),P=!0}function d(){var e=!1,i=function(){l(),C.set(w,"opacity",y),C.set(w,"display","block"),C.set(x,"display","block"),e=!0},s=function(){e||(n.body?i():t.setTimeout(s,0))};s(),g(n).ready(function(){e||i()})}function c(e){P||l(),C.set(w,"opacity",e?0:D),C.set(w,"display","block")}function f(){P&&(C.set(x,"display","none"),C.set(w,"display","none"))}function h(){C.set(T,"visibility","visible")}function p(){C.set(T,"visibility","hidden")}e.__esModule=!0,e.initAndShowLoadingText=d,e.show=c,e.hide=f,e.showLoadingIcon=h,e.hideLoadingIcon=p;var E=s("./deps/hammerhead"),m=o(E),_=s("./deps/testcafe-core"),S=o(_),v=m["default"].shadowUI,g=S["default"].$,R=S["default"].eventUtils,C=S["default"].styleUtils,M="Loading page...",O="modal-background",U="loading-text",D=.7,y=.8,b="loading-icon",w=null,x=null,T=null,P=!1},"progress-panel":{"index.js":function(e,i,s){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var a=s("../deps/hammerhead"),u=o(a),l=s("../deps/testcafe-core"),d=o(l),c=s("./progress-bar"),f=o(c),h=u["default"].shadowUI,p=d["default"].eventUtils,E=d["default"].styleUtils,m=(d["default"].$,"progress-panel"),_="title",S="content",v=100,g=10,R=300,C=200,M=600,O=1e3,U=function(){function e(){var t=this;r(this,e),this.startTime=null,this.openingTimeout=null,this.updateInterval=null,this.animationInterval=null,this.panelDiv=n.createElement("div"),h.getRoot().appendChild(this.panelDiv),this.titleDiv=n.createElement("div"),this.panelDiv.appendChild(this.titleDiv),this.contentDiv=n.createElement("div"),this.panelDiv.appendChild(this.contentDiv),h.addClass(this.panelDiv,m),h.addClass(this.titleDiv,_),h.addClass(this.contentDiv,S),e._showAtWindowCenter(this.panelDiv),this.progressBar=new f["default"](this.contentDiv),this.disposePanel=function(){return e._showAtWindowCenter(t.panelDiv)}}return e._getInvisibleElementProperty=function(e,t){var n="none"===E.get(e,"display");n&&E.set(e,"display","block");var i=e[t];return n&&E.set(e,"display","none"),i},e._showAtWindowCenter=function(n){var i=e._getInvisibleElementProperty(n,"offsetHeight"),s=e._getInvisibleElementProperty(n,"offsetWidth"),o=Math.round(E.getHeight(t)/2-i/2),r=Math.round(E.getWidth(t)/2-s/2);E.set(n,{left:r+"px",top:o+"px"})},e.prototype._setCurrentProgress=function(){var e=Math.round((Date.now()-this.startTime)/this.maxTimeout*100);this.progressBar.setValue(e)},e.prototype._setSuccess=function(e){this.progressBar.setSuccess(e)},e.prototype._stopAnimation=function(){t.clearInterval(this.animationInterval)},e.prototype._animate=function(e,n,i,s){var o=this,r=Date.now(),a=i?0:1,u=0,l=0,d=0;i&&(E.set(e,"opacity",a),E.set(e,"display","block")),this._stopAnimation(),this.animationInterval=t.setInterval(function(){u=Date.now()-r,l=Math.min(u/n,1),d=.5-Math.cos(l*Math.PI)/2,E.set(e,"opacity",a+(i?d:-d)),1===l&&(o._stopAnimation(),s&&s())},g)},e.prototype._showPanel=function(){p.bind(t,"resize",this.disposePanel),this._animate(this.panelDiv,C,!0)},e.prototype._hidePanel=function(e){var n=this;this.startTime=null,p.unbind(t,"resize",this.disposePanel),this._animate(this.panelDiv,e?0:M,!1,function(){return E.set(n.panelDiv,"display","none")})},e.prototype.show=function(e,n){var i=this;this.startTime=Date.now(),this.maxTimeout=n,this.titleDiv.textContent=e,this._setSuccess(!1),this.openingTimeout=t.setTimeout(function(){i.openingTimeout=null,i._setCurrentProgress(),i._showPanel(),i.updateInterval=t.setInterval(function(){return i._setCurrentProgress()},v)},R)},e.prototype.close=function(e){var n=this;e&&this._setSuccess(!0),this.openingTimeout&&(t.clearTimeout(this.openingTimeout),this.openingTimeout=null),this.updateInterval&&(t.clearInterval(this.updateInterval),this.updateInterval=null),e?this.startTime&&Date.now()-this.startTime<O?t.setTimeout(function(){t.setTimeout(function(){return n._hidePanel(!1)},C)},v):t.setTimeout(function(){return n._hidePanel(!1)},C):this._hidePanel(!0)},e}();e["default"]=U,i.exports=e["default"]},"progress-bar.js":function(e,t,i){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var r=i("../deps/hammerhead"),a=s(r),u=i("../deps/testcafe-core"),l=s(u),d=a["default"].shadowUI,c=l["default"].styleUtils,f="progress-bar",h="value",p="success",E=function(){function e(t){o(this,e),this.containerElement=n.createElement("div"),this.valueElement=n.createElement("div"),t.appendChild(this.containerElement),this.containerElement.appendChild(this.valueElement),d.addClass(this.containerElement,f),d.addClass(this.valueElement,h)}return e.prototype.setValue=function(e){e="number"!=typeof e?0:Math.min(Math.max(e,0),100),c.set(this.valueElement,"width",e+"%")},e.prototype.setSuccess=function(e){e?d.addClass(this.containerElement,p):d.removeClass(this.containerElement,p)},e}();e["default"]=E,t.exports=e["default"]}},"select-element.js":function(e,i,s){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){(e.target||e.srcElement)===N||U.containsElement(N,e.target)||U.containsElement(H,e.target)||c()}function a(e,t){var i=n.createElement("div"),s=e.disabled||"optgroup"===e.parentElement.tagName.toLowerCase()&&e.parentElement.disabled;i.textContent=e.text,t.appendChild(i),R.addClass(i,T),s&&(R.addClass(i,P),D.set(i,"color",D.get(e,"color"))),s&&C.isWebKit?y.bind(i,"click",function(){return!1}):y.bind(i,"click",function(){var e=N.selectedIndex,t=b.indexOf(A,this),n=N.getElementsByTagName("option")[t],i=!s&&t!==e,o=C.isSafari&&C.hasTouchEvents||C.isAndroid;i&&!C.isIE&&(N.selectedIndex=t),C.isFirefox||C.isIE||!i||M.change(N),(C.isFirefox||C.isIE)&&M.mousedown(C.isFirefox?n:N),o||M.mouseup(C.isFirefox?n:N),(C.isFirefox||C.isIE)&&i&&(M.change(N),C.isIE&&(N.selectedIndex=t)),o||M.click(C.isFirefox||C.isIE?n:N),s||c()}),A.push(i)}function u(e,t){var i=n.createElement("div");i.textContent=e.label||" ",t.appendChild(i),R.addClass(i,x),i.disabled&&(R.addClass(i,P),D.set(i,"color",D.get(e,"color"))),l(e.children,i),W.push(i)}function l(e,t){for(var n=0;n<e.length;n++)"option"===e[n].tagName.toLowerCase()?a(e[n],t):"optgroup"===e[n].tagName.toLowerCase()&&u(e[n],t)}function d(e){var i=e.children;if(i.length){if(N){var s=e===N;if(c(),s)return}N=e,H=n.createElement("div"),R.getRoot().appendChild(H),R.addClass(H,w),l(i,H),t.setTimeout(function(){y.bind(n,"mousedown",r)},0),D.set(H,{position:"absolute",fontSize:D.get(N,"fontSize"),fontFamily:D.get(N,"fontFamily"),minWidth:D.getWidth(N)+"px",left:O.getOffsetPosition(N).left+"px",height:U.getSelectVisibleChildren(e).length>I?D.getOptionHeight(e)*I:""});var o=O.getOffsetPosition(N).top,a=D.getHeight(H),u=o+D.getHeight(N)+2;if(u+a>D.getScrollTop(t)+D.getHeight(t)){var d=o-3-a;d>=D.getScrollTop(t)&&(u=d)}D.set(H,"top",u+"px")}}function c(){U.remove(H),y.unbind(n,"mousedown",r),H=null,N=null,A=[],W=[]}function f(e){return e?e===N:!!N}function h(e,t){return t?W[e]:A[e]}function p(e){var t=U.getSelectParent(e);if(t){var n=D.getSelectElementSize(t),i=D.getOptionHeight(t),s=0,o=Math.max(D.getScrollTop(t)/i,0),r=o+n-1,a=U.getChildVisibleIndex(t,e);o>a?(s=i*(o-a),D.setScrollTop(t,Math.max(D.getScrollTop(t)-s,0))):a>r&&(s=i*(a-r),D.setScrollTop(t,D.getScrollTop(t)+s))}}function E(e){var t=U.getSelectParent(e);if(!t)return{x:0,y:0};var n=D.getOptionHeight(t),i=O.getElementRectangle(e);return{x:Math.round(i.left+i.width/2),y:Math.round(i.top+n/2)}}function m(e){var t=U.getActiveElement();if("select"===t.tagName.toLowerCase()){/enter|tab|esc/.test(e)&&c();var n=D.getSelectElementSize(t),i=!D.hasDimensions(R.select("."+w)[0]);if(/down|up/.test(e)||!C.isIE&&(1>=n||C.isFirefox)&&(i||C.isFirefox)&&/left|right/.test(e)){for(var s=t.querySelectorAll("option"),o=[],r=0;r<s.length;r++){var a=s[r].parentElement;s[r].disabled||"optgroup"===a.tagName.toLowerCase()&&a.disabled||o.push(s[r])}var u=b.indexOf(o,s[t.selectedIndex]),l=u+(/down|right/.test(e)?1:-1);l>=0&&l<o.length&&(t.selectedIndex=b.indexOf(s,o[l]),M.change(t))}}}e.__esModule=!0,e.expandOptionList=d,e.collapseOptionList=c,e.isOptionListExpanded=f,e.getEmulatedChildElement=h,e.scrollOptionListByChild=p,e.getSelectChildCenter=E,e.switchOptionsByKeys=m;var _=s("./deps/hammerhead"),S=o(_),v=s("./deps/testcafe-core"),g=o(v),R=S["default"].shadowUI,C=S["default"].utils.browser,M=S["default"].eventSandbox.eventSimulator,O=g["default"].positionUtils,U=g["default"].domUtils,D=g["default"].styleUtils,y=g["default"].eventUtils,b=g["default"].arrayUtils,w="tcOptionList",x="tcOptionGroup",T="tcOption",P="disabled",I=C.isIE?30:20,N=null,H=null,W=[],A=[]}}}}}})("testcafe/src/client/ui/index")}e(window)}();

@@ -144,3 +144,3 @@ 'use strict';

msg = _utilsWordWrap2.default(msg, prefix.length, maxMsgLength);
if (this[wordWrapEnabled]) msg = _utilsWordWrap2.default(msg, prefix.length, maxMsgLength);

@@ -147,0 +147,0 @@ return prefix + msg.substr(prefix.length);

@@ -11,6 +11,12 @@ 'use strict';

var _es6Promise = require('es6-promise');
var _pinkie = require('pinkie');
var _pinkie2 = _interopRequireDefault(_pinkie);
var _testcafeBrowserNatives = require('testcafe-browser-natives');
var _testcafeLegacyApi = require('testcafe-legacy-api');
var _testcafeHammerhead = require('testcafe-hammerhead');
var _browserConnection = require('../browser-connection');

@@ -24,7 +30,7 @@

var _compiler = require('../compiler');
var _messages = require('../messages');
var _compiler2 = _interopRequireDefault(_compiler);
var _browserSet = require('./browser-set');
var _messages = require('../messages');
var _browserSet2 = _interopRequireDefault(_browserSet);

@@ -35,4 +41,2 @@ var Bootstrapper = (function () {

this.BROWSER_CONNECTION_READY_TIMEOUT = 30 * 1000;
this.browserConnectionGateway = browserConnectionGateway;

@@ -46,14 +50,2 @@

Bootstrapper._createBrowserConnectionsReadyPromise = function _createBrowserConnectionsReadyPromise(browserConnections) {
var ready = browserConnections.filter(function (bc) {
return !bc.ready;
}).map(function (bc) {
return new _es6Promise.Promise(function (resolve) {
return bc.once('ready', resolve);
});
});
return _es6Promise.Promise.all(ready);
};
Bootstrapper._convertAliasOrPathToBrowserInfo = function _convertAliasOrPathToBrowserInfo(browser) {

@@ -101,43 +93,6 @@ var browserInfo;

Bootstrapper.prototype._waitBrowserConnectionsReady = function _waitBrowserConnectionsReady(browserConnections) {
var _this = this;
return new _es6Promise.Promise(function (resolve, reject) {
var timeout = setTimeout(function () {
reject(new Error(_messages.getText(_messages.MESSAGE.cantEstablishBrowserConnection)));
}, _this.BROWSER_CONNECTION_READY_TIMEOUT);
var onError = function (msg) {
clearTimeout(timeout);
reject(new Error(msg));
};
browserConnections.forEach(function (bc) {
return bc.once('error', onError);
});
Bootstrapper._createBrowserConnectionsReadyPromise(browserConnections).then(function () {
browserConnections.forEach(function (bc) {
return bc.removeListener('error', onError);
});
clearTimeout(timeout);
resolve();
});
});
};
Bootstrapper.prototype._checkForDisconnectedBrowsers = function _checkForDisconnectedBrowsers() {
var disconnectedUserAgents = this.browsers.filter(function (browser) {
return browser instanceof _browserConnection2.default && browser.disconnected;
}).map(function (bc) {
return bc.userAgent;
});
if (disconnectedUserAgents.length) throw new Error(_messages.getText(_messages.MESSAGE.cantRunAgainstDisconnectedBrowsers, disconnectedUserAgents.join(', ')));
};
Bootstrapper.prototype._getBrowserConnections = function _getBrowserConnections() {
var browsers, browserConnections;
return _regeneratorRuntime.async(function _getBrowserConnections$(context$2$0) {
var _this2 = this;
var _this = this;

@@ -154,45 +109,21 @@ while (1) switch (context$2$0.prev = context$2$0.next) {

case 2:
context$2$0.next = 4;
return _regeneratorRuntime.awrap(_pinkie2.default.all(this.browsers.map(Bootstrapper._convertAliasOrPathToBrowserInfo)));
this._checkForDisconnectedBrowsers();
context$2$0.next = 5;
return _regeneratorRuntime.awrap(_es6Promise.Promise.all(this.browsers.map(Bootstrapper._convertAliasOrPathToBrowserInfo)));
case 5:
case 4:
browsers = context$2$0.sent;
browserConnections = browsers.map(function (browser) {
return _this2._createConnectionFromBrowserInfo(browser);
return _this._createConnectionFromBrowserInfo(browser);
});
context$2$0.prev = 7;
context$2$0.next = 10;
return _regeneratorRuntime.awrap(this._waitBrowserConnectionsReady(browserConnections));
context$2$0.next = 8;
return _regeneratorRuntime.awrap(_browserSet2.default.from(browserConnections));
case 10:
context$2$0.next = 17;
break;
case 8:
return context$2$0.abrupt('return', context$2$0.sent);
case 12:
context$2$0.prev = 12;
context$2$0.t0 = context$2$0['catch'](7);
context$2$0.next = 16;
return _regeneratorRuntime.awrap(_es6Promise.Promise.all(browserConnections.map(function (bc) {
return new _es6Promise.Promise(function (resolve) {
if (bc instanceof _browserConnectionLocal2.default && !bc.disconnected) {
bc.close();
bc.once('closed', resolve);
} else resolve();
});
})));
case 16:
throw context$2$0.t0;
case 17:
return context$2$0.abrupt('return', browserConnections);
case 18:
case 9:
case 'end':
return context$2$0.stop();
}
}, null, this, [[7, 12]]);
}, null, this);
};

@@ -203,3 +134,3 @@

return _regeneratorRuntime.async(function _getTests$(context$2$0) {
var _this3 = this;
var _this2 = this;

@@ -216,3 +147,3 @@ while (1) switch (context$2$0.prev = context$2$0.next) {

case 2:
compiler = new _compiler2.default(this.sources);
compiler = new _testcafeLegacyApi.Compiler(this.sources, _testcafeHammerhead.wrapDomAccessors);
context$2$0.next = 5;

@@ -225,3 +156,3 @@ return _regeneratorRuntime.awrap(compiler.getTests());

if (this.filter) tests = tests.filter(function (test) {
return _this3.filter(test.name, test.fixture.name, test.fixture.path);
return _this2.filter(test.name, test.fixture.name, test.fixture.path);
});

@@ -251,6 +182,5 @@

try {
// TODO
var alias = this.reporter || 'spec';
pluginFactory = require('../reporter/plugins/' + alias);
pluginFactory = require('testcafe-reporter-' + alias);
} catch (err) {

@@ -267,3 +197,3 @@ throw new Error(_messages.getText(_messages.MESSAGE.cantFindReporterForAlias, this.reporter));

Bootstrapper.prototype.createRunnableConfiguration = function createRunnableConfiguration() {
var reporterPlugin, tests, browserConnections;
var reporterPlugin, tests, browserSet;
return _regeneratorRuntime.async(function createRunnableConfiguration$(context$2$0) {

@@ -282,4 +212,4 @@ while (1) switch (context$2$0.prev = context$2$0.next) {

case 6:
browserConnections = context$2$0.sent;
return context$2$0.abrupt('return', { reporterPlugin: reporterPlugin, browserConnections: browserConnections, tests: tests });
browserSet = context$2$0.sent;
return context$2$0.abrupt('return', { reporterPlugin: reporterPlugin, browserSet: browserSet, tests: tests });

@@ -286,0 +216,0 @@ case 8:

@@ -13,4 +13,10 @@ 'use strict';

var _es6Promise = require('es6-promise');
var _pinkie = require('pinkie');
var _pinkie2 = _interopRequireDefault(_pinkie);
var _promisifyEvent = require('promisify-event');
var _promisifyEvent2 = _interopRequireDefault(_promisifyEvent);
var _path = require('path');

@@ -36,6 +42,2 @@

var _browserConnectionLocal = require('../browser-connection/local');
var _browserConnectionLocal2 = _interopRequireDefault(_browserConnectionLocal);
var Runner = (function (_EventEmitter) {

@@ -61,100 +63,49 @@ _inherits(Runner, _EventEmitter);

// Static
// Run task
Runner._waitForLocalBrowserClose = function _waitForLocalBrowserClose(bc) {
return new _es6Promise.Promise(function (resolve) {
if (bc.disconnected) {
resolve();
return;
}
bc.close();
bc.once('closed', resolve);
});
};
Runner._freeBrowserConnection = function _freeBrowserConnection(bc, errorHandler) {
return _regeneratorRuntime.async(function _freeBrowserConnection$(context$2$0) {
Runner.prototype._runTask = function _runTask(reporterPlugin, browserSet, tests) {
var task, reporter;
return _regeneratorRuntime.async(function _runTask$(context$2$0) {
while (1) switch (context$2$0.prev = context$2$0.next) {
case 0:
bc.removeListener('error', errorHandler);
task = new _task2.default(tests, browserSet.connections, this.proxy, this.opts);
reporter = new _reporter3.default(reporterPlugin, task, this.opts.reportOutStream);
// NOTE: we should close local connections and
// related browsers once we've done
task.on('browser-job-done', function (job) {
return browserSet.releaseConnection(job.browserConnection);
});
if (!(bc instanceof _browserConnectionLocal2.default)) {
context$2$0.next = 4;
break;
}
context$2$0.prev = 3;
context$2$0.next = 6;
return _regeneratorRuntime.awrap(_pinkie2.default.race([_promisifyEvent2.default(task, 'done'), _promisifyEvent2.default(browserSet, 'error')]));
context$2$0.next = 4;
return _regeneratorRuntime.awrap(Runner._waitForLocalBrowserClose(bc));
case 6:
context$2$0.next = 15;
break;
case 4:
case 'end':
return context$2$0.stop();
}
}, null, this);
};
case 8:
context$2$0.prev = 8;
context$2$0.t0 = context$2$0['catch'](3);
// Run task
task.abort();
task.removeAllListeners();
Runner.prototype._runTask = function _runTask(reporterPlugin, browserConnections, tests) {
var _this = this;
context$2$0.next = 14;
return _regeneratorRuntime.awrap(browserSet.dispose());
return new _es6Promise.Promise(function (resolve, reject) {
var task = new _task2.default(tests, browserConnections, _this.proxy, _this.opts);
var reporter = new _reporter3.default(reporterPlugin, task, _this.opts.reportOutStream);
case 14:
throw context$2$0.t0;
var bcErrorHandler = function callee$3$0(msg) {
return _regeneratorRuntime.async(function callee$3$0$(context$4$0) {
while (1) switch (context$4$0.prev = context$4$0.next) {
case 0:
context$4$0.next = 2;
return _regeneratorRuntime.awrap(_es6Promise.Promise.all(browserConnections.map(function (bc) {
return Runner._freeBrowserConnection(bc, bcErrorHandler);
})));
case 15:
context$2$0.next = 17;
return _regeneratorRuntime.awrap(browserSet.dispose());
case 2:
case 17:
return context$2$0.abrupt('return', reporter.testCount - reporter.passed);
task.abort();
task.removeAllListeners();
reject(new Error(msg));
case 5:
case 'end':
return context$4$0.stop();
}
}, null, _this);
};
browserConnections.forEach(function (bc) {
return bc.once('error', bcErrorHandler);
});
var promisedCloses = [];
task.on('browser-job-done', function (job) {
promisedCloses.push(Runner._freeBrowserConnection(job.browserConnection, bcErrorHandler));
});
task.once('done', function callee$3$0() {
return _regeneratorRuntime.async(function callee$3$0$(context$4$0) {
while (1) switch (context$4$0.prev = context$4$0.next) {
case 0:
context$4$0.next = 2;
return _regeneratorRuntime.awrap(_es6Promise.Promise.all(promisedCloses));
case 2:
resolve(reporter.testCount - reporter.passed);
case 3:
case 'end':
return context$4$0.stop();
}
}, null, _this);
});
});
case 18:
case 'end':
return context$2$0.stop();
}
}, null, this, [[3, 8]]);
};

@@ -216,3 +167,3 @@

reporterPlugin,
browserConnections,
browserSet,
tests,

@@ -237,3 +188,3 @@ args$2$0 = arguments;

reporterPlugin = _ref2.reporterPlugin;
browserConnections = _ref2.browserConnections;
browserSet = _ref2.browserSet;
tests = _ref2.tests;

@@ -244,3 +195,3 @@

context$2$0.next = 14;
return _regeneratorRuntime.awrap(this._runTask(reporterPlugin, browserConnections, tests));
return _regeneratorRuntime.awrap(this._runTask(reporterPlugin, browserSet, tests));

@@ -247,0 +198,0 @@ case 14:

@@ -13,5 +13,5 @@ 'use strict';

var _es6Promisify = require('es6-promisify');
var _utilsPromisify = require('../../utils/promisify');
var _es6Promisify2 = _interopRequireDefault(_es6Promisify);
var _utilsPromisify2 = _interopRequireDefault(_utilsPromisify);

@@ -24,3 +24,3 @@ var _mkdirp = require('mkdirp');

var ensureDir = _es6Promisify2.default(_mkdirp2.default);
var ensureDir = _utilsPromisify2.default(_mkdirp2.default);

@@ -27,0 +27,0 @@ var Capturer = (function () {

{
"name": "testcafe",
"version": "0.0.7-alpha",
"version": "0.0.8-alpha",
"main": "lib/index",

@@ -10,3 +10,2 @@ "bin": {

"array-find": "^1.0.0",
"async": "0.2.6",
"babel-runtime": "^5.6.15",

@@ -18,4 +17,2 @@ "chalk": "^1.1.0",

"endpoint-utils": "^1.0.0",
"es6-promise": "^3.0.2",
"es6-promisify": "^3.0.0",
"escape-html": "^1.0.2",

@@ -31,9 +28,18 @@ "flatten": "0.0.1",

"mustache": "^2.1.2",
"noop-fn": "^1.0.0",
"os-family": "^1.0.0",
"parse5": "^1.5.0",
"pinkie": "^2.0.1",
"promisify-event": "^1.0.0",
"qrcode-terminal": "^0.10.0",
"read-file-relative": "^1.2.0",
"testcafe-browser-natives": "^0.10.0",
"testcafe-hammerhead": "^2.0.1",
"uglify-js": "1.2.6",
"testcafe-hammerhead": "^3.1.1",
"testcafe-legacy-api": "^0.1.0",
"testcafe-reporter-json": "^1.0.0",
"testcafe-reporter-list": "^1.0.0",
"testcafe-reporter-minimal": "^1.0.0",
"testcafe-reporter-spec": "^1.0.0",
"testcafe-reporter-xunit": "^1.0.0",
"time-limit-promise": "^1.0.2",
"useragent": "^2.1.7",

@@ -51,2 +57,3 @@ "uuid": "^2.0.1"

"gulp-eslint": "^1.0.0",
"gulp-filter": "^3.0.1",
"gulp-if": "^2.0.0",

@@ -62,3 +69,4 @@ "gulp-less": "^3.0.3",

"gulp-webmake": "0.0.4",
"noop-fn": "^1.0.0",
"pify": "^2.3.0",
"publish-please": "^1.0.1",
"request": "^2.58.0",

@@ -65,0 +73,0 @@ "tmp": "0.0.28"

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc