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

testcafe

Package Overview
Dependencies
Maintainers
1
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 14.2.2 to 14.2.3

6

control_panel/lib/server.js

@@ -340,5 +340,5 @@ var async = require("async"), path = require("path"), util = require("util"), http = require("http"), EventEmitter = require("events").EventEmitter, express = require("express"), io = require("socket.io"), Errors = require("./errors"), Const = require("./const");

}, onTaskStarted = null;
if (Array.isArray(source)) source.forEach(function(elm) {
source[elm] = decodeURI(source[elm]);
}); else source = decodeURI(source);
if (Array.isArray(options.source)) options.source.forEach(function(elm) {
options.source[elm] = decodeURI(options.source[elm]);
}); else options.source = decodeURI(options.source);
if (!workers.length && !browsers.length) {

@@ -345,0 +345,0 @@ var workerName = this.testRunner.workerPool.createWorkerFromControlPanelWindow(returnUrl, req.headers["user-agent"]);

@@ -7,3 +7,3 @@ "@fixture A set of examples that illustrate how to use TestCafe API";

function isTransparent() {
return $('.article-header').css('opacity') == 0;
return $('.article-header').css('opacity') === '0';
}

@@ -10,0 +10,0 @@

@@ -144,3 +144,3 @@ var zlib = require("zlib"), whacko = require("whacko"), iconv = require("iconv-lite"), sharedConst = require("./../shared/const"), pageProc = require("./../shared/page_processor"), ProcessedJsCache = require("./processed_js_cache"), ERR = require("./server_errs");

$('meta[name="referrer"][content="origin"]').remove();
pageProc.processPage($, injectionOptions.urlReplacer, crossDomainProxyPort);
pageProc.processPage($, injectionOptions.urlReplacer, crossDomainProxyPort, injectionOptions.isIFrame);
var injection = [];

@@ -147,0 +147,0 @@ if (injectionOptions.styleUrl) {

@@ -127,6 +127,7 @@ var dns = require("dns"), tslErrorsDomain = require("domain").create(), http = require("http"), https = require("https"), os = require("os"), url = require("url"), util = require("util"), webauth = require("webauth"), ERR = require("./server_errs"), Events = require("./events"), exec = require("child_process").exec, formData = require("./form_data"), injector = require("./injector"), sharedConst = require("./../shared/const"), urlUtil = require("./url_util");

var injectionOptions = {
urlReplacer: this.getResourceUrlReplacer(ctx),
crossDomainProxyPort: this.crossDomainProxyPort,
isIFrame: ctx.isIFrame,
styleUrl: this.serviceChannel.staticCssUrl,
scripts: []
scripts: [],
urlReplacer: this.getResourceUrlReplacer(ctx)
}, chunks = ctx.originResBodyChunks, encoding = ctx.originResContentInfo.encoding, charset = ctx.originResContentInfo.charset;

@@ -363,3 +364,3 @@ injectionOptions.scripts.push(this.serviceChannel.hammerheadScriptUrl);

Server.prototype._extractOriginResponseContentInfo = function(ctx) {
var isPage = ctx.isPageReqCandidate, contentType = ctx.originRes.headers["content-type"] || "", accept = ctx.req.headers["accept"] || "";
var isPage = ctx.isPageReqCandidate, contentType = ctx.originRes.headers["content-type"] || "", accept = ctx.req.headers["accept"] || "", isFileDownloading = ctx.originRes.headers["content-disposition"] && ctx.originRes.headers["content-disposition"].indexOf("attachment") > -1;
if (ctx.originRes.headers["content-type"]) isPage = isPage && testForPageMime(contentType);

@@ -374,3 +375,4 @@ ctx.originResContentInfo = {

isManifest: isManifest(contentType),
isJSON: isJSON(contentType)
isJSON: isJSON(contentType),
isFileDownloading: isFileDownloading
};

@@ -377,0 +379,0 @@ };

@@ -31,4 +31,5 @@ (function() {

base: true
};
}, IFRAME_FLAG_TAGS = [ "a", "form" ];
PageProc.EVENTS = EVENTS;
PageProc.IFRAME_FLAG_TAGS = IFRAME_FLAG_TAGS;
PageProc.TARGET_ATTR_TAGS = TARGET_ATTR_TAGS;

@@ -46,16 +47,2 @@ PageProc.URL_ATTR_TAGS = URL_ATTR_TAGS;

};
var hasIframeParent = function(el) {
if (!isNode) {
var findDocument = function(el) {
if (el.documentElement) return el;
return el.parentNode ? findDocument(el.parentNode) : document;
};
try {
return window.top.document !== findDocument(el);
} catch (e) {
return true;
}
}
return false;
};
var hasEventHandler = function(el) {

@@ -130,3 +117,3 @@ if (isNode) {

var elTagName = getTagName(el).toLowerCase(), isIframe = elTagName === "iframe", isScript = elTagName === "script", resourceType = null;
if (isIframe || elTagName === "a" && hasIframeParent(el)) resourceType = UrlUtil.IFRAME; else if (isScript) resourceType = UrlUtil.SCRIPT;
if (isIframe || IFRAME_FLAG_TAGS.indexOf(elTagName) !== -1 && PageProc.hasIframeParent(el)) resourceType = UrlUtil.IFRAME; else if (isScript) resourceType = UrlUtil.SCRIPT;
var proxyUrl = resourceUrl ? urlReplacer(resourceUrl, resourceType) : "";

@@ -264,5 +251,8 @@ if (isIframe) {

};
PageProc.processPage = function($, urlReplacer, crossDomainPort) {
var $base = $("base"), baseUrl = $base.length ? getAttr($base[0], "href") : "", replacer = function(resourceUrl, resourceType) {
PageProc.processPage = function($, urlReplacer, crossDomainPort, isIFrame) {
var $base = $("base"), baseUrl = $base.length ? getAttr($base[0], "href") : "", replacer = !isNode ? function(resourceUrl, resourceType) {
return urlReplacer(resourceUrl, resourceType, baseUrl);
} : function(resourceUrl, resourceType) {
resourceType = resourceType || (isIFrame ? UrlUtil.IFRAME : null);
return urlReplacer(resourceUrl, resourceType, baseUrl);
};

@@ -347,2 +337,16 @@ var $all = $("*");

};
PageProc.hasIframeParent = function(el) {
if (!isNode) {
var findDocument = function(el) {
if (el.documentElement) return el;
return el.parentNode ? findDocument(el.parentNode) : document;
};
try {
return window.top.document !== findDocument(el);
} catch (e) {
return true;
}
}
return false;
};
})();

@@ -54,2 +54,3 @@ var uuid = require("node-uuid"), Hammerhead = require("./../../hammerhead"), AssetsManager = require("./assets_manager"), cmd = require("../shared/service_msg_cmd"), Const = require("./const"), ERR = require("./server_errs"), errMsgBuilder = require("./err_msg_builder"), FixtureCode = require("../fixture_code/"), Upload = require("../upload_");

}
if (ctx.originResContentInfo && ctx.originResContentInfo.isFileDownloading) recording.isFileDownloading = true;
callback();

@@ -166,2 +167,7 @@ };

case cmd.GET_AND_UNCHECK_FILE_DOWNLOADING_FLAG:
res = recording.isFileDownloading;
recording.isFileDownloading = false;
break;
case cmd.SAVE_TEST:

@@ -168,0 +174,0 @@ this.saveTest(msg.jobUid, recording.testSaved ? recording.testName : msg.testName, function(res) {

@@ -18,2 +18,3 @@ (function() {

SET_HAS_UNSAVED_CHANGES: "CMD_SET_HAS_UNSAVED_CHANGES",
GET_AND_UNCHECK_FILE_DOWNLOADING_FLAG: "GET_AND_UNCHECK_FILE_DOWNLOADING_FLAG",
SAVE_TEST: "CMD_SAVE_TEST",

@@ -20,0 +21,0 @@ EXIT_RECORDING: "CMD_EXIT_RECORDING",

var EventEmitter = require("events").EventEmitter, util = require("util"), uuid = require("node-uuid"), moment = require("moment"), AssetsManager = require("../server/assets_manager"), CLIENT_ERR = require("../shared/client_errs"), cmd = require("../shared/service_msg_cmd"), Const = require("../server/const"), ERR = require("./../server/server_errs"), Reporter = require("./reporter"), Upload = require("../upload_"), WorkerPool = require("./worker_pool");
var STATIC_SCRIPT_HTML_TEMPLATE = '<script type="text/javascript" src="%s"></script> ', PAGE_ERROR_VERIFICATION_HTML_TEMPLATE_BEGIN = "/*" + "<!DOCTYPE html>" + "<html>" + "<head>" + "<title></title>", PAGE_ERROR_VERIFICATION_HTML_TEMPLATE_END = '<script type="text/javascript">%s</script>' + "</head>" + "<body></body>" + "</html>" + "*/", QUARANTINE_TEST_RUN_COUNT = 3;
var STATIC_SCRIPT_HTML_TEMPLATE = '<script type="text/javascript" src="%s"></script> ', PAGE_ERROR_VERIFICATION_HTML_TEMPLATE_BEGIN = "/*" + "<!DOCTYPE html>" + "<html>" + "<head>" + "<title></title>", PAGE_ERROR_VERIFICATION_HTML_TEMPLATE_END = '<script type="text/javascript">%s</script>' + "</head>" + "<body></body>" + "</html>" + "*/", QUARANTINE_TEST_RUN_COUNT = 5;

@@ -21,2 +21,3 @@ function proxyErrRes(proxyCtx, resBody) {

this.workerPool.on("workerDisconnectedError", this._onWorkerDisconnectedError.bind(this));
this.workerPool.on("workerRestart", this._onWorkerRestarted.bind(this));
var proxyEvents = this.hammerhead.proxyEvents.for(Const.TEST_RUNNER_JOB_OWNER_TOKEN), serviceEvents = this.hammerhead.serviceEvents.for(Const.TEST_RUNNER_JOB_OWNER_TOKEN), crossDomainServiceEvents = this.hammerhead.crossDomainServiceEvents.for(Const.TEST_RUNNER_JOB_OWNER_TOKEN);

@@ -87,3 +88,6 @@ proxyEvents.listen("authCredentialsRequested", this._onAuthCredentialsRequested.bind(this));

}
} else callback();
} else {
if (ctx.originResContentInfo && ctx.originResContentInfo.isFileDownloading) testRun.isFileDownloading = true;
callback();
}
};

@@ -229,2 +233,7 @@

case cmd.GET_AND_UNCHECK_FILE_DOWNLOADING_FLAG:
res = testRun.isFileDownloading;
testRun.isFileDownloading = false;
break;
default:

@@ -323,2 +332,3 @@ break;

uid: testRunUid,
workerUid: worker.uid,
workerName: workerName,

@@ -365,3 +375,3 @@ quarantine: {

return true;
} else testRun.errs = testRun.quarantine.failed > testRun.quarantine.succeeded ? testRun.errs : [];
} else testRun.errs = !testRun.quarantine.succeeded ? testRun.errs : [];
}

@@ -373,2 +383,3 @@ return false;

var task = this.tasks[testRun.taskUid], workerName = testRun.workerName, worker = this.workerPool.get(workerName);
if (testRun.workerUid !== worker.uid) return;
if (task.quarantineMode && this._quarantine(testRun)) return;

@@ -399,2 +410,10 @@ this.hammerhead.removeCookies({

TestRunner.prototype._onWorkerRestarted = function(workerName, uid) {
var testRunner = this, worker = this.workerPool.get(workerName);
worker.testRuns.forEach(function(testRunUid) {
testRunner.testRuns[testRunUid].workerUid = uid;
});
this._resetTestRun(this.testRuns[worker.testRuns[0]]);
};
TestRunner.prototype._resetTestRun = function(testRun) {

@@ -401,0 +420,0 @@ testRun.errs = [];

@@ -149,3 +149,5 @@ var util = require("util"), errMsgBuilder = require("./../server/err_msg_builder"), moment = require("moment"), ejs = require("ejs"), path = require("path"), fs = require("fs"), ERR = require("./../server/server_errs"), EventEmitter = require("events").EventEmitter;

testRun2Errs: [],
testRun3Errs: []
testRun3Errs: [],
testRun4Errs: [],
testRun5Errs: []
};

@@ -198,3 +200,2 @@ }

fixturePath: testRun.fixture.path.join("/"),
time: getElapsedTime(testRun.startTime),
errs: []

@@ -207,2 +208,3 @@ };

}
taskReport.testErrReports[testUid].time = taskReport.testErrReports[testUid].time ? Math.max(taskReport.testErrReports[testUid].time, testRun.time) : testRun.time;
testRun.errs.forEach(function(err) {

@@ -209,0 +211,0 @@ var reportItem = reporter._buildReportItem(testRun, err);

@@ -20,2 +20,4 @@ var async = require("async"), EventEmitter = require("events").EventEmitter, childProc = require("child_process"), path = require("path"), url = require("url"), util = require("util"), userAgentParser = require("useragent"), uuid = require("node-uuid"), ERR = require("./../server/server_errs");

WorkerPool.WORKER_RESTART_TIMEOUT = 10 * 1e3;
var WORKER_TYPE = WorkerPool.WORKER_TYPE = {

@@ -66,8 +68,20 @@ CONNECTED: "CONNECTED",

WorkerPool.prototype._disconnectWorker = function(workerName) {
this.emit("workerDisconnected", workerName);
this.emit("workerDisconnectedError", {
code: ERR.WORKER_POOL_WORKER_DISCONNECTED,
name: workerName
}, this.get(workerName));
delete this.workers[workerName];
var workerPool = this, worker = this.workers[workerName], testRunUid = worker.testRuns[0];
if (this.config.initedFromObj && worker.type === WORKER_TYPE.NEW_BROWSER_WINDOW && (!worker.restartInfo[testRunUid] || worker.restartInfo[testRunUid] < 3)) {
var uid = uuid.v4();
worker.uid = uid;
this.emit("workerRestart", workerName, uid);
worker.restartInfo[testRunUid] = worker.restartInfo[testRunUid] ? worker.restartInfo[testRunUid] + 1 : 1;
worker.browserProc.kill();
setTimeout(function() {
workerPool.execBrowsersAndCreateWorkers([ worker.browserName ], function() {}, true);
}, WorkerPool.WORKER_RESTART_TIMEOUT);
} else {
this.emit("workerDisconnected", workerName);
this.emit("workerDisconnectedError", {
code: ERR.WORKER_POOL_WORKER_DISCONNECTED,
name: workerName
}, this.get(workerName));
delete this.workers[workerName];
}
};

@@ -160,2 +174,3 @@

var worker = this.workers[sanitizedName] = {
uid: uuid.v4(),
heartbeatTimeout: null,

@@ -172,2 +187,3 @@ type: type,

lastTask: null,
restartInfo: {},
connected: type === WORKER_TYPE.CONNECTED

@@ -241,7 +257,7 @@ };

WorkerPool.prototype.execBrowsersAndCreateWorkers = function(browserNames, callback) {
WorkerPool.prototype.execBrowsersAndCreateWorkers = function(browserNames, callback, restartFlag) {
var errs = [], starters = [], workerNames = [], workerPool = this;
browserNames.forEach(function(browserName) {
starters.push(function(asyncCallback) {
var workerName = workerPool._getUnusedWorkerName(browserName), browser = workerPool.config.browsers[browserName], addWorkerUrl = workerPool._getAddWorkerUrl(workerName), execParams = workerPool._getBrowserExecParams(browser, addWorkerUrl), added = false, addTimeout = null;
var workerName = restartFlag ? browserName : workerPool._getUnusedWorkerName(browserName), browser = workerPool.config.browsers[browserName], addWorkerUrl = workerPool._getAddWorkerUrl(workerName), workerIdleUrl = workerPool.getWorkerIdleUrl(workerName), workerUrl = restartFlag ? workerIdleUrl : addWorkerUrl, execParams = workerPool._getBrowserExecParams(browser, workerUrl), added = false, addTimeout = null;
workerPool.workerAddedHandlers[workerName] = function(worker) {

@@ -248,0 +264,0 @@ clearTimeout(addTimeout);

{
"name": "testcafe",
"description": "Functional testing for the web",
"version": "14.2.2",
"version": "14.2.3",
"dependencies": {

@@ -6,0 +6,0 @@ "async": "0.2.6",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc