How to use runPhantom method in istanbul

Best JavaScript code snippet using istanbul

start.js

Source:start.js Github

copy

Full Screen

...13connection.query("use " + conf.mysql.dbname);14var result = {},15 i = 0;16console.log('总计检查:' + monitor_list.length + '个,预计耗时' + monitor_list.length * conf.phantomjs.wait + '秒。');17function runPhantom() {18 var pdps = monitor_list[i++];19 if (pdps) {20 console.log('Monitor:' + pdps);21 exec([conf.phantomjs.path, conf.phantomjs.file, conf.pageurl + '?' + pdps, conf.phantomjs.wait].join(' '), function (error, stdout, stderr) {22 var reqs = JSON.parse(stdout),23 req,24 info,25 httpResult = '',26 httpCode = 0;27 for (var url in reqs) {28 req = {};29 info = '成功';30 if (!reqs[url].end) {31 info = '失败:请求超时';32 } else {33 httpCode = reqs[url].end.status,34 httpResult = reqs[url].end.text || '';35 if (httpCode > 399) {36 info = '失败:状态码错误, ' + httpCode;37 }38 }39 var sql = "INSERT INTO `" + conf.mysql.tablename + "` (`pdps`, `url`, `http_code`, `description`, `http_result`) VALUES('" + pdps + "', '" + url + "', '" + httpCode + "', '" + info + "', '" + httpResult + "')";40 //console.log(sql);41 connection.query(sql, function (err, rows) {42 //console.log(err, rows);43 });44 }45 runPhantom();46 });47 } else {48 connection.end();49 }50}...

Full Screen

Full Screen

headless.js

Source:headless.js Github

copy

Full Screen

...27}28if (!process.env.TRAVIS) {29 builder.buildW3C(false, function () {30 console.log("Script built");31 runPhantom();32 });33}34else {35 runPhantom();...

Full Screen

Full Screen

phantoProc.js

Source:phantoProc.js Github

copy

Full Screen

1var util = require( "util" );2var spawn = require( "child_process" ).spawn;3var phantomExecutable = "phantomjs";4var log = function(msg) {5 util.log( "PhatomJS runner: " + msg );6};7var runPhantom = function( callback, klujsDir, port ) {8 var proc = spawn( phantomExecutable, [ klujsDir + "/phantom-runner.js", port] );9 proc.on( 'exit', function( code, signal) {10 log( "PhantomJs ended: " + code + " " + signal );11 callback( code );12 } );13 proc.stdout.on('data', function (data) {14 log( 'stdout: ' + data);15 });16 proc.stderr.on('data', function (data) {17 log( 'stderr: ' + data);18 } );19};...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run istanbul automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful