Innovenergy_trunk/frontend/node_modules/testcafe/lib/testcafe.js

124 lines
18 KiB
JavaScript

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const runtime_1 = require("./errors/runtime");
const types_1 = require("./errors/types");
const content_types_1 = __importDefault(require("./assets/content-types"));
const option_names_1 = __importDefault(require("./configuration/option-names"));
const INJECTABLES = __importStar(require("./assets/injectables"));
const setup_sourcemap_support_1 = require("./utils/setup-sourcemap-support");
const lazyRequire = require('import-lazy')(require);
const hammerhead = lazyRequire('testcafe-hammerhead');
const loadAssets = lazyRequire('./load-assets');
const errorHandlers = lazyRequire('./utils/handle-errors');
const BrowserConnectionGateway = lazyRequire('./browser/connection/gateway');
const BrowserConnection = lazyRequire('./browser/connection');
const browserProviderPool = lazyRequire('./browser/provider/pool');
const CompilerHost = lazyRequire('./services/compiler/host');
const Runner = lazyRequire('./runner');
const LiveModeRunner = lazyRequire('./live/test-runner');
// NOTE: CoffeeScript can't be loaded lazily, because it will break stack traces
require('coffeescript');
class TestCafe {
constructor(configuration) {
(0, setup_sourcemap_support_1.setupSourceMapSupport)();
errorHandlers.registerErrorHandlers();
const { hostname, port1, port2, options } = configuration.startOptions;
this.closed = false;
this.proxy = new hammerhead.Proxy(hostname, port1, port2, options);
this.runners = [];
this.configuration = configuration;
this.browserConnectionGateway = new BrowserConnectionGateway(this.proxy, {
retryTestPages: configuration.getOption(option_names_1.default.retryTestPages),
proxyless: configuration.getOption(option_names_1.default.experimentalProxyless),
});
if (configuration.getOption(option_names_1.default.experimentalDebug)) {
const developmentMode = configuration.getOption(option_names_1.default.developmentMode);
const v8Flags = configuration.getOption(option_names_1.default.v8Flags);
this.compilerService = new CompilerHost({ developmentMode, v8Flags });
}
this._registerAssets(options.developmentMode);
}
_registerAssets(developmentMode) {
const { favIcon, coreScript, driverScript, uiScript, uiStyle, uiSprite, uiSpriteSvg, automationScript, legacyRunnerScript } = loadAssets(developmentMode);
this.proxy.GET(INJECTABLES.TESTCAFE_CORE, { content: coreScript, contentType: content_types_1.default.javascript });
this.proxy.GET(INJECTABLES.TESTCAFE_DRIVER, { content: driverScript, contentType: content_types_1.default.javascript });
this.proxy.GET(INJECTABLES.TESTCAFE_LEGACY_RUNNER, {
content: legacyRunnerScript,
contentType: content_types_1.default.javascript,
});
this.proxy.GET(INJECTABLES.TESTCAFE_AUTOMATION, { content: automationScript, contentType: content_types_1.default.javascript });
this.proxy.GET(INJECTABLES.TESTCAFE_UI, { content: uiScript, contentType: content_types_1.default.javascript });
this.proxy.GET(INJECTABLES.TESTCAFE_UI_SPRITE, { content: uiSprite, contentType: content_types_1.default.png });
this.proxy.GET(INJECTABLES.TESTCAFE_UI_SPRITE_SVG, { content: uiSpriteSvg, contentType: content_types_1.default.svg });
this.proxy.GET(INJECTABLES.DEFAULT_FAVICON_PATH, { content: favIcon, contentType: content_types_1.default.icon });
this.proxy.GET(INJECTABLES.TESTCAFE_UI_STYLES, {
content: uiStyle,
contentType: content_types_1.default.css,
isShadowUIStylesheet: true,
});
}
_createRunner(isLiveMode) {
const Ctor = isLiveMode ? LiveModeRunner : Runner;
const newRunner = new Ctor({
proxy: this.proxy,
browserConnectionGateway: this.browserConnectionGateway,
configuration: this.configuration.clone(option_names_1.default.hooks),
compilerService: this.compilerService,
});
this.runners.push(newRunner);
return newRunner;
}
// API
async createBrowserConnection() {
const browserInfo = await browserProviderPool.getBrowserInfo('remote');
return new BrowserConnection(this.browserConnectionGateway, browserInfo, true);
}
createRunner() {
return this._createRunner(false);
}
createLiveModeRunner() {
if (this.runners.some(runner => runner instanceof LiveModeRunner))
throw new runtime_1.GeneralError(types_1.RUNTIME_ERRORS.cannotCreateMultipleLiveModeRunners);
return this._createRunner(true);
}
async close() {
if (this.closed)
return;
this.closed = true;
await Promise.all(this.runners.map(runner => runner.stop()));
await browserProviderPool.dispose();
if (this.compilerService)
this.compilerService.stop();
await this.browserConnectionGateway.close();
this.proxy.close();
}
}
exports.default = TestCafe;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGNhZmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdGVzdGNhZmUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDhDQUFnRDtBQUNoRCwwQ0FBZ0Q7QUFDaEQsMkVBQW1EO0FBQ25ELGdGQUF3RDtBQUN4RCxrRUFBb0Q7QUFDcEQsNkVBQXdFO0FBRXhFLE1BQU0sV0FBVyxHQUFnQixPQUFPLENBQUMsYUFBYSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDakUsTUFBTSxVQUFVLEdBQWlCLFdBQVcsQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0FBQ3BFLE1BQU0sVUFBVSxHQUFpQixXQUFXLENBQUMsZUFBZSxDQUFDLENBQUM7QUFDOUQsTUFBTSxhQUFhLEdBQWMsV0FBVyxDQUFDLHV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JpdGVTdmcsIGNvbnRlbnRUeXBlOiBDT05URU5UX1RZUEVTLnN2ZyB9KTtcbiAgICAgICAgdGhpcy5wcm94eS5HRVQoSU5KRUNUQUJMRVMuREVGQVVMVF9GQVZJQ09OX1BBVEgsIHsgY29udGVudDogZmF2SWNvbiwgY29udGVudFR5cGU6IENPTlRFTlRfVFlQRVMuaWNvbiB9KTtcblxuICAgICAgICB0aGlzLnByb3h5LkdFVChJTkpFQ1RBQkxFUy5URVNUQ0FGRV9VSV9TVFlMRVMsIHtcbiAgICAgICAgICAgIGNvbnRlbnQ6ICAgICAgICAgICAgICB1aVN0eWxlLFxuICAgICAgICAgICAgY29udGVudFR5cGU6ICAgICAgICAgIENPTlRFTlRfVFlQRVMuY3NzLFxuICAgICAgICAgICAgaXNTaGFkb3dVSVN0eWxlc2hlZXQ6IHRydWUsXG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIF9jcmVhdGVSdW5uZXIgKGlzTGl2ZU1vZGUpIHtcbiAgICAgICAgY29uc3QgQ3RvciAgICAgID0gaXNMaXZlTW9kZSA/IExpdmVNb2RlUnVubmVyIDogUnVubmVyO1xuICAgICAgICBjb25zdCBuZXdSdW5uZXIgPSBuZXcgQ3Rvcih7XG4gICAgICAgICAgICBwcm94eTogICAgICAgICAgICAgICAgICAgIHRoaXMucHJveHksXG4gICAgICAgICAgICBicm93c2VyQ29ubmVjdGlvbkdhdGV3YXk6IHRoaXMuYnJvd3NlckNvbm5lY3Rpb25HYXRld2F5LFxuICAgICAgICAgICAgY29uZmlndXJhdGlvbjogICAgICAgICAgICB0aGlzLmNvbmZpZ3VyYXRpb24uY2xvbmUoT1BUSU9OX05BTUVTLmhvb2tzKSxcbiAgICAgICAgICAgIGNvbXBpbGVyU2VydmljZTogICAgICAgICAgdGhpcy5jb21waWxlclNlcnZpY2UsXG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMucnVubmVycy5wdXNoKG5ld1J1bm5lcik7XG5cbiAgICAgICAgcmV0d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