Created
March 5, 2015 20:46
-
-
Save Risto-Stevcev/022a26ede86b8235f0dd to your computer and use it in GitHub Desktop.
Protractor issue #1895 - Cannot start webdriver as a process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.registerMultiTask('foo', 'foo bar baz', function () { | |
var done = this.async() | |
var webdriver = grunt.util.spawn({ | |
opts: { stdio: 'pipe' }, | |
cmd: 'node', | |
args:['./node_modules/.bin/webdriver-manager', 'start'] | |
}) | |
webdriver.stdout.pipe(process.stdout) | |
webdriver.stderr.pipe(process.stderr) | |
function runProtractor() { | |
var ptor = grunt.util.spawn({ | |
opts: { stdio: 'pipe' }, | |
cmd: 'node', | |
args: ['./node_modules/.bin/protractor', '--seleniumAddress', 'http://localhost:4444/wd/hub', '--specs', 'tspec.js', '--browser', 'firefox'] | |
}, | |
function(error, result, code) { | |
done() | |
}) | |
ptor.stdout.pipe(process.stdout) | |
ptor.stderr.pipe(process.stderr) | |
} | |
var webdriverStarted = false | |
webdriver.stderr.on('data', function(data) { | |
if (!webdriverStarted && (data && data.toString().match(/Started .*Server/))) { | |
webdriverStarted = true | |
runProtractor() | |
} | |
}) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
foo: { | |
bar: { | |
options: {} | |
} | |
} | |
}) | |
grunt.loadTasks('tasks') | |
grunt.registerTask('default', ['foo']) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "tmp", | |
"version": "1.0.0", | |
"description": "", | |
"main": "proc.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "MIT", | |
"dependencies": { | |
"grunt": "^0.4.5", | |
"grunt-cli": "^0.1.13", | |
"protractor": "1.8.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn | |
var webdriver | |
(function runWebdriver() { | |
webdriver = spawn('node', ['./node_modules/.bin/webdriver-manager', 'start']) | |
webdriver.stdout.pipe(process.stdout) | |
webdriver.stderr.pipe(process.stderr) | |
})() | |
function runProtractor() { | |
var ptor = spawn('node', ['./node_modules/.bin/protractor', '--seleniumAddress', 'http://localhost:4444/wd/hub', '--specs', 'tspec.js', '--browser', 'firefox']) | |
ptor.stdout.pipe(process.stdout) | |
ptor.stderr.pipe(process.stderr) | |
} | |
var webdriverStarted = false | |
webdriver.stderr.on('data', function(data) { | |
if (!webdriverStarted && (data && data.toString().match(/Started .*Server/))) { | |
webdriverStarted = true | |
runProtractor() | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('it', function() { | |
beforeEach(function() { | |
browser.get('https://www.angularjs.org') | |
}) | |
it('should sleep', function() { | |
browser.sleep(1000) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment