diff --git a/nightwatch.conf.js b/nightwatch.conf.js index 9d8bb7b..8bcf0a6 100644 --- a/nightwatch.conf.js +++ b/nightwatch.conf.js @@ -2,26 +2,30 @@ const seleniumServer = require('selenium-server'); const chromedriver = require('chromedriver'); const phantomjs = require('phantomjs-prebuilt'); const dockerSeleniumHub = 'seleniumhub'; +const argv = require('yargs').argv; + +if (argv.cucumber) { + require('nightwatch-cucumber')({ + cucumberArgs: ['--require', 'timeout.js', '--require', 'features/step_definitions', '--format', 'pretty', '--format', 'json:features/reports/cucumber.json', 'features'] + }); +} module.exports = { selenium : { start_process : true, server_path : seleniumServer.path, log_path : '' , - host : '127.0.0.1', - port : 4444, + selenium_host : '127.0.0.1', + selenium_port : 4444, cli_args : { 'webdriver.chrome.driver' : chromedriver.path, 'webdriver.ie.driver' :'' , 'webdriver.firefox.profile':'' } }, - test_settings : { default : { launch_url : 'http://localhost', - selenium_host : '127.0.0.1', - selenium_port : 4444, silent : true, disable_colors: false, screenshots: { @@ -31,44 +35,51 @@ module.exports = { path: 'screenshoots/' // relativ to src directory }, desiredCapabilities : { - browserName : 'firefox', + browserName : 'chrome', javascriptEnabled : true, acceptSslCerts : true, 'phantomjs.binary.path': phantomjs.path }, + }, + chrome: { + desiredCapabilities: { + browserName: 'chrome', + javascriptEnabled: true, + acceptSslCerts: true + } + }, - chrome: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true - } - }, - - firefox: { - desiredCapabilities: { - browserName: 'firefox', - javascriptEnabled: true, - acceptSslCerts: true - } - }, - phantomjs: { - desiredCapabilities: { - browserName: 'phantomjs', - javascriptEnabled: true, - acceptSslCerts: true, - 'phantomjs.binary.path': phantomjs.path - } - }, - local_docker:{ - selenium_host: dockerSeleniumHub, - selenium_port: 4444, - start_process : false, - desiredCapabilities: { - browserName: 'firefox' + firefox: { + desiredCapabilities: { + browserName: 'firefox', + javascriptEnabled: true, + acceptSslCerts: true + } + }, + phantomjs: { + desiredCapabilities: { + browserName: 'phantomjs', + javascriptEnabled: true, + acceptSslCerts: true, + 'phantomjs.binary.path': phantomjs.path + } + }, + local_docker:{ + selenium_host: dockerSeleniumHub, + selenium_port: 4444, + start_process : false, + desiredCapabilities: { + browserName: 'firefox' + } + }, + mocha: { + test_runner: { + type: 'mocha', + options: { + ui: 'bdd', + reporter: 'list' } } - } } }; diff --git a/package.json b/package.json index d1561bb..b3af318 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,18 @@ { "name": "nightwatch-Boilerplate", - "description": "nightwatch boilerplate with selenium testing", - "version": "0.1.0", + "description": "nightwatch boilerplate for End-to-End test with either nightwatch plain oder nightwatch-cucumber", + "version": "1.0.0", + "license": "MIT", "author": { "name": "Christine Zierold" }, - "repository": { + "repository": { "type": "git", "url": "git@github.com/christinezierold27/nightwatch-boilerplate.git" }, "scripts": { "start": "cd tests/ && nightwatch ./src && cd ../", - "start:cucumber": "cd features/ && nightwatch --group group && cd ../", + "start:cucumber": "nightwatch --cucumber", "lint": "eslint ./tests --max-warnings 0" }, "dependencies": { @@ -21,14 +22,15 @@ "nightwatch": "^0.9.5", "nightwatch-html-reporter": "^1.0.6", "phantomjs-prebuilt": "^2.1.7", - "selenium-server": "^2.53.1" + "selenium-server": "^3.3.1", + "yargs": "^7.0.2" }, "devDependencies": { "chai": "^3.5.0", - "cucumber": "^1.2.0", + "cucumber": "^2.0.0-rc.8", "eslint": "^3.13.1", - "mocha": "^2.5.3", - "nightwatch-cucumber": "^4.0.0" + "mocha": "^3.2.0", + "nightwatch-cucumber": "^7.0.0" }, "bin": { "nightwatch": "./node_modules/nightwatch/bin/nightwatch"