Tests: Resolve -b to full path in webbrowser.js
This allows us to simply use "node test.js -b=firefox" instead of having to type out the full path.
This commit is contained in:
parent
1416a1b521
commit
62cf6536a2
@ -157,17 +157,18 @@ ChromiumBrowser.prototype.buildArguments = function (url) {
|
|||||||
|
|
||||||
WebBrowser.create = function (desc) {
|
WebBrowser.create = function (desc) {
|
||||||
var name = desc.name;
|
var name = desc.name;
|
||||||
|
var path = shelljs.which(desc.path);
|
||||||
// Throws an exception if the path doesn't exist.
|
if (!path) {
|
||||||
fs.statSync(desc.path);
|
throw new Error('Browser executable not found: ' + desc.path);
|
||||||
|
}
|
||||||
|
|
||||||
if (/firefox/i.test(name)) {
|
if (/firefox/i.test(name)) {
|
||||||
return new FirefoxBrowser(desc.name, desc.path);
|
return new FirefoxBrowser(name, path);
|
||||||
}
|
}
|
||||||
if (/(chrome|chromium|opera)/i.test(name)) {
|
if (/(chrome|chromium|opera)/i.test(name)) {
|
||||||
return new ChromiumBrowser(desc.name, desc.path);
|
return new ChromiumBrowser(name, path);
|
||||||
}
|
}
|
||||||
return new WebBrowser(desc.name, desc.path);
|
return new WebBrowser(name, path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user