From b3752c0e411b261b45fc1a12d3e8408b5ff211c5 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sat, 25 Aug 2012 17:21:54 -0700 Subject: [PATCH 1/7] Fix Firefox launcher [changelog] --- lib/launcher.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/lib/launcher.js b/lib/launcher.js index 058c9825f..f261dba6e 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -113,24 +113,33 @@ var FirefoxBrowser = function() { var command = this._getCommand(); // create profile first - exec(command + ' -CreateProfile testacular', function(e, stdout, stderr) { + // https://developer.mozilla.org/en-US/docs/Command_Line_Options + exec(command + ' -CreateProfile "testacular ' + this._tempDir + '"', function(e, stdout, stderr) { if (e) { log.error(e); + return; } var match = /at\s\'(.*)\/prefs\.js\'/.exec(stderr.toString()); if (match) { - var profile = self._tempDir = match[1]; - var prefs = 'user_pref("browser.shell.checkDefaultBrowser", false);\n' + - 'user_pref("browser.bookmarks.restore_default_bookmarks", false);\n'; - - fs.createWriteStream(profile + '/prefs.js', {flags: 'a'}).write(prefs); - self._execCommand(command + ' -profile "' + profile + '" ' + url); - } else { - log.warn('Can not create Firefox profile'); - self._execCommand(command + ' ' + url); + self._tempDir = match[1]; } + + var prefsFile = self._tempDir + '/prefs.js'; + + fs.exists(prefsFile, function(exists) { + if (exists) { + var prefs = 'user_pref("browser.shell.checkDefaultBrowser", false);\n' + + 'user_pref("browser.bookmarks.restore_default_bookmarks", false);\n'; + + fs.createWriteStream(prefsFile, {flags: 'a'}).write(prefs); + self._execCommand(command + ' -profile "' + self._tempDir + '" ' + url); + } else { + log.warn('Firefox not started, can not create profile'); + // self._execCommand(command + ' ' + url); + } + }); }); }; }; From 719327f1a401a76ba0e12660f9a0f5423d17719a Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sun, 26 Aug 2012 12:33:54 -0700 Subject: [PATCH 2/7] Add more debug --- lib/launcher.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/launcher.js b/lib/launcher.js index f261dba6e..1ffddb06d 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -112,6 +112,10 @@ var FirefoxBrowser = function() { var self = this; var command = this._getCommand(); + if (fs.existsSync(this._tempDir + '/prefs.js')) { + log.warn('Profile already exists at %s', this._tempDir); + } + // create profile first // https://developer.mozilla.org/en-US/docs/Command_Line_Options exec(command + ' -CreateProfile "testacular ' + this._tempDir + '"', function(e, stdout, stderr) { @@ -120,9 +124,11 @@ var FirefoxBrowser = function() { return; } + console.log(stderr); var match = /at\s\'(.*)\/prefs\.js\'/.exec(stderr.toString()); if (match) { + log.debug('changing temp dir to %s', match[1]) self._tempDir = match[1]; } @@ -136,8 +142,8 @@ var FirefoxBrowser = function() { fs.createWriteStream(prefsFile, {flags: 'a'}).write(prefs); self._execCommand(command + ' -profile "' + self._tempDir + '" ' + url); } else { - log.warn('Firefox not started, can not create profile'); - // self._execCommand(command + ' ' + url); + log.warn('Firefox can not create profile'); + self._execCommand(command + ' ' + url); } }); }); From 48798a2854da6fda5ef8ee20f705794278ce4bba Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sun, 26 Aug 2012 12:48:39 -0700 Subject: [PATCH 3/7] more debug --- tasks/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/test.js b/tasks/test.js index 2df7f1743..7ea3ad9a3 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -34,7 +34,7 @@ module.exports = function(grunt) { var processToKill; var cmd = './bin/testacular'; var args = [ - 'start', null, '--single-run', '--no-auto-watch', '--reporter=dots', '--browsers=' + BROWSERS + 'start', null, '--log-level=debug', '--single-run', '--no-auto-watch', '--reporter=dots', '--browsers=' + BROWSERS ]; var next = function(err, result, code) { @@ -89,7 +89,7 @@ module.exports = function(grunt) { // CLIENT unit tests else if (this.target === 'client') { - exec('testacular', ['start', this.data, '--single-run', '--no-auto-watch', '--reporter=dots', + exec('testacular', ['start', this.data, '--single-run', '--log-level=debug', '--no-auto-watch', '--reporter=dots', '--browsers=' + BROWSERS], 'Client unit tests failed.'); } }); From b3594b92327140de927dfcd1789e9306dd184482 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sun, 26 Aug 2012 13:33:24 -0700 Subject: [PATCH 4/7] fucking travis --- lib/launcher.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/launcher.js b/lib/launcher.js index 1ffddb06d..f4815c0ac 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -114,6 +114,8 @@ var FirefoxBrowser = function() { if (fs.existsSync(this._tempDir + '/prefs.js')) { log.warn('Profile already exists at %s', this._tempDir); + self._execCommand(command + ' ' + url); + return; } // create profile first From 397f8d1dfc5becad0a4b8e5c5379601b4eb4f5f2 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sun, 26 Aug 2012 14:30:16 -0700 Subject: [PATCH 5/7] execute --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a0927fb07..a6a1eab01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,7 @@ before_script: - grunt build script: - - grunt test + - grunt test:unit + - grunt test:client + - grunt test:e2e:basic + - grunt test:e2e:mocha From 18f5fd7a9b3651717027ceca1e075cec50e1fb4b Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sun, 26 Aug 2012 14:37:00 -0700 Subject: [PATCH 6/7] fucking travis --- tasks/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/test.js b/tasks/test.js index 7ea3ad9a3..34aff27ea 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -32,7 +32,7 @@ module.exports = function(grunt) { if (this.target === 'e2e') { var tests = grunt.file.expand(this.data); var processToKill; - var cmd = './bin/testacular'; + var cmd = 'testacular'; var args = [ 'start', null, '--log-level=debug', '--single-run', '--no-auto-watch', '--reporter=dots', '--browsers=' + BROWSERS ]; From 4bcf67fd9b93f834d35e13a58282452b5f8cf4ae Mon Sep 17 00:00:00 2001 From: rdodev Date: Wed, 29 Aug 2012 10:35:33 -0400 Subject: [PATCH 7/7] Quick fix for PhantomJS launcher --- lib/launcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/launcher.js b/lib/launcher.js index f4815c0ac..67d1e204b 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -37,7 +37,7 @@ var Browser = function(id) { return [url]; }; - this._tempDir = (env.TMPDIR || env.TMP || env.TEMP || '/tmp') + '/testacular-' + id; + this._tempDir = (env.TMPDIR || env.TMP || env.TEMP || '/tmp') + '/testacular-' + id.toString(); try { log.debug('Creating temp dir at ' + this._tempDir);