diff --git a/lib/runner/cli/cli.js b/lib/runner/cli/cli.js index 5d14ef2cd2..5b4e7d5de8 100644 --- a/lib/runner/cli/cli.js +++ b/lib/runner/cli/cli.js @@ -293,7 +293,7 @@ class CliRunner { if (plugins.length > 0) { plugins.forEach((plugin) => { - if (plugin.globals && Utils.isFunction(plugin.globals.registerEventHandlers)){ + if (plugin.globals && Utils.isFunction(plugin.globals.registerEventHandlers)) { plugin.globals.registerEventHandlers(NightwatchEventHub); } }); @@ -450,7 +450,11 @@ class CliRunner { } isTestWorkersEnabled() { - const testWorkers = this.test_settings.testWorkersEnabled && !singleSourceFile(this.argv); + if (this.testRunner.supportsParallelTestSuiteRun === false) { + return false; + } + + const testWorkers = this.test_settings.testWorkersEnabled && !singleSourceFile(this.argv); if (!testWorkers) { if (this.argv.debug) { @@ -466,7 +470,7 @@ class CliRunner { if (isMobile(desiredCapabilities) && !this.usingServer(this.testEnvSettings[env])) { - if (Concurrency.isWorker()) { + if (Concurrency.isWorker()) { Logger.info('Disabling parallelism while running tests on mobile platform'); } diff --git a/lib/runner/test-runners/cucumber.js b/lib/runner/test-runners/cucumber.js index 6a505a03f8..bb270a63f5 100644 --- a/lib/runner/test-runners/cucumber.js +++ b/lib/runner/test-runners/cucumber.js @@ -246,6 +246,10 @@ class CucumberSuite extends TestSuite { class CucumberRunnner extends Runner { get supportsConcurrency() { + return true; + } + + get supportsParallelTestSuiteRun() { return false; } diff --git a/test/cucumber-integration-tests/testCucumberTestsInParallel.js b/test/cucumber-integration-tests/testCucumberTestsInParallel.js index ca6a7ae34f..f34c9702d7 100644 --- a/test/cucumber-integration-tests/testCucumberTestsInParallel.js +++ b/test/cucumber-integration-tests/testCucumberTestsInParallel.js @@ -5,17 +5,17 @@ const commandMocks = require('../lib/command-mocks.js'); const common = require('../common.js'); const MockServer = require('../lib/mockserver.js'); -describe('Cucumber integration - parallel running single formatter', function() { - beforeEach(function(done) { +describe('Cucumber integration - parallel running single formatter', function () { + beforeEach(function (done) { this.server = MockServer.init(null, {port: 10190}); this.server.on('listening', () => done()); }); - afterEach(function(done) { + afterEach(function (done) { Globals.afterEach.call(this, done); }); - it('testCucumberSampleTests in parallel with single formatter', function() { + it('testCucumberSampleTests in parallel with single formatter', function () { const source = [ path.join(__dirname, './sample_cucumber_tests/parallel/testSample.js') ]; @@ -41,7 +41,7 @@ describe('Cucumber integration - parallel running single formatter', function() }); }); - it('testCucumberSampleTests in parallel with multiple step definition files', function() { + it('testCucumberSampleTests in parallel with multiple step definition files', function () { commandMocks.elementText('5cc459b8-36a8-3042-8b4a-258883ea642b', 'xx'); @@ -56,6 +56,7 @@ describe('Cucumber integration - parallel running single formatter', function() parallel: true, verbose: true, timeout: 10, + env: 'chrome', silent: false, tags: ['not @fail'], format: 'progress', @@ -71,4 +72,36 @@ describe('Cucumber integration - parallel running single formatter', function() assert.strictEqual(errorOrFailed, false); }); }); -}); \ No newline at end of file + + it('testCucumberSampleTests in parallel environments with multiple step definition files', function () { + + commandMocks.elementText('5cc459b8-36a8-3042-8b4a-258883ea642b', 'xx'); + + const source = [ + path.join(__dirname, './sample_cucumber_tests/parallelWithMultipleDefinition') + ]; + + const {runTests} = common.require('index.js'); + + return runTests({ + source, + parallel: true, + verbose: true, + timeout: 10, + env: 'chrome,firefox', + silent: false, + tags: ['not @fail'], + format: 'progress', + config: path.join(__dirname, '../extra/cucumber-config-parallel.js'), + 'format-options': '', + ['retry-interval']: 5, + ['persist-globals']: true, + ['webdriver-host']: 'localhost', + ['start-process']: false, + ['webdriver-port']: 10190 + }, {}) + .then(errorOrFailed => { + assert.strictEqual(errorOrFailed, false); + }); + }); +}); diff --git a/test/extra/cucumber-config-parallel.js b/test/extra/cucumber-config-parallel.js index 302ea4212d..16badba911 100644 --- a/test/extra/cucumber-config-parallel.js +++ b/test/extra/cucumber-config-parallel.js @@ -26,6 +26,19 @@ module.exports = { feature_path: path.join(__dirname, '../cucumber-integration-tests/sample_cucumber_tests/parallel/sample.feature') } }, + + test_settings: { + chrome: { + desiredCapabilities: { + browserName: 'chrome' + } + }, + firefox: { + desiredCapabilities: { + browserName: 'firefox' + } + } + }, output: false, silent: false -} \ No newline at end of file +}; \ No newline at end of file