min-wd
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -25,3 +25,2 @@ /* | ||
function pollLogs(context, callback) { | ||
@@ -40,10 +39,4 @@ request(context, 'POST', '/execute_async', { | ||
if (match) { | ||
context.logs.push(res.value.substring(0, match.index)); | ||
context.out.write(res.value.substring(0, match.index)); | ||
var browser = context.browser; | ||
var title = browser.name + ' ' + (browser.version || '*'); | ||
var line = new Array(76).join('=').substring(title.length); | ||
context.out.write('= ' + title + ' ' + line + '\n'); | ||
context.out.write(context.logs.join('')); | ||
close(context, function () { | ||
@@ -58,3 +51,3 @@ if (match[1] === '0') { | ||
} | ||
context.logs.push(res.value); | ||
context.out.write(res.value); | ||
pollLogs(context, callback); | ||
@@ -64,3 +57,2 @@ }); | ||
function execute(context, script, callback) { | ||
@@ -77,3 +69,2 @@ request(context, 'POST', '/execute', { | ||
} | ||
context.logs = []; | ||
setTimeout(function () { | ||
@@ -86,2 +77,7 @@ pollLogs(context, callback); | ||
function openUrl(context, script, callback) { | ||
var browser = context.browser; | ||
var title = browser.name + ' ' + (browser.version || '*'); | ||
var line = new Array(76).join('=').substring(title.length); | ||
context.out.write('= ' + title + ' ' + line + '\n'); | ||
var url = context.url; | ||
@@ -140,3 +136,2 @@ if (url) { | ||
function createContext(options, browser, out) { | ||
@@ -154,8 +149,27 @@ return { | ||
function pipe(streams, out) { | ||
if (!streams.length) { | ||
out.write(null); | ||
return; | ||
} | ||
var stream = streams.shift(); | ||
stream.on('data', function (data) { | ||
out.write(data); | ||
}); | ||
stream.on('end', function () { | ||
pipe(streams, out); | ||
}); | ||
stream.resume(); | ||
} | ||
function run(options, out, runner, callback) { | ||
var streams = []; | ||
var listener = listen(); | ||
options.browsers.forEach(function (browser) { | ||
var cb = listener(); | ||
var context = createContext(options, browser, out); | ||
var stream = through(); | ||
stream.pause(); | ||
var cb = listener(function () { | ||
stream.write(null); | ||
}); | ||
var context = createContext(options, browser, stream); | ||
connectBrowser(context, function (err) { | ||
@@ -168,7 +182,8 @@ if (err) { | ||
}); | ||
streams.push(stream); | ||
}); | ||
pipe(streams, out); | ||
listener.then(callback); | ||
} | ||
function createRunner(input) { | ||
@@ -175,0 +190,0 @@ var requests = []; |
{ | ||
"name" : "min-wd", | ||
"version" : "0.4.0", | ||
"description" : "Minimal WebDriver that pipes stdin to browsers", | ||
"keywords" : ["webdriver", "stdin", "browser", "tests", "browserify", "browserify-transform", "saucelabs"], | ||
"author" : "Maximilian Antoni (http://maxantoni.de)", | ||
"homepage" : "https://github.com/mantoni/min-webdriver", | ||
"main" : "./lib/transform.js", | ||
"browser" : "./lib/client.js", | ||
"bin" : { | ||
"min-wd" : "bin/cmd.js" | ||
"name": "min-wd", | ||
"version": "0.4.1", | ||
"description": "Minimal WebDriver that pipes stdin to browsers", | ||
"keywords": [ | ||
"webdriver", | ||
"stdin", | ||
"browser", | ||
"tests", | ||
"browserify", | ||
"browserify-transform", | ||
"saucelabs" | ||
], | ||
"author": "Maximilian Antoni (http://maxantoni.de)", | ||
"homepage": "https://github.com/mantoni/min-webdriver", | ||
"main": "./lib/transform.js", | ||
"browser": "./lib/client.js", | ||
"bin": { | ||
"min-wd": "bin/cmd.js" | ||
}, | ||
"scripts" : { | ||
"test" : "jslint --color './**/*.js'" | ||
"scripts": { | ||
"test": "jslint --color './**/*.js'" | ||
}, | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "https://github.com/mantoni/min-webdriver.git" | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mantoni/min-webdriver.git" | ||
}, | ||
"dependencies" : { | ||
"through" : "~2.3.4", | ||
"listen" : "~1.0.0", | ||
"brout" : "~0.1.2" | ||
"dependencies": { | ||
"through": "~2.3.4", | ||
"listen": "~1.0.0", | ||
"brout": "~0.1.2" | ||
}, | ||
"devDependencies" : { | ||
"jslint" : "~0.3.1" | ||
"devDependencies": { | ||
"jslint": "~0.3.1" | ||
}, | ||
"files" : ["bin", "lib", "README.md", "LICENSE"], | ||
"license" : "MIT" | ||
"files": [ | ||
"bin", | ||
"lib", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
"license": "MIT" | ||
} |
@@ -57,3 +57,3 @@ # Minimal WebDriver | ||
### SauceLabs | ||
## SauceLabs | ||
@@ -76,3 +76,3 @@ Export your SauceLabs credentials: | ||
### Loading a web page | ||
## Loading a web page | ||
@@ -90,3 +90,3 @@ By default, min-webdriver will folk a new browser and inject the given script | ||
### Mocha Support | ||
## Mocha Support | ||
@@ -101,3 +101,3 @@ Testing with [Mocha][] requires [mocaccino][]: | ||
### IE trouble shooting | ||
## IE trouble shooting | ||
@@ -104,0 +104,0 @@ If IE reports it can't find `JSON`, then the Selenium default page makes IE |
14469
404