From ebf2140fad070032a1f10f99a1d8eeb2c55b224b Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 8 Jan 2018 18:32:05 -0600 Subject: [PATCH] Baseline CBT e2e CI setup --- package.json | 4 +++ test/e2e/cbt-globals.js | 24 ++++++++++++++++ test/e2e/db.json | 54 +++++++++++++++++++++++++++++++++++ test/e2e/nightwatch-cbt.json | 55 ++++++++++++++++++++++++++++++++++++ test/e2e/nightwatch.json | 2 +- 5 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 test/e2e/cbt-globals.js create mode 100644 test/e2e/nightwatch-cbt.json diff --git a/package.json b/package.json index c44d17ab..40aef4bf 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,13 @@ "open-localhost": "node -e 'require(\"open\")(\"http://localhost:3200\")'", "predev": "npm install", "test": "npm run lint:errors && npm run test:nodejs", + "test:ci": "npm-run-all lint:errors test:nodejs test:ci:e2e", "test:browser": "karma start --config karma.conf.js", + "test:ci:e2e": "npm-run-all --parallel -r hot-server test:e2e:mock-api test:e2e:all:cbt", "test:coverage": "nyc npm run test:nodejs", "test:e2e": "npm-run-all --parallel -r hot-server test:e2e:mock-api test:e2e:all", "test:e2e:all": "sleep 3 && nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch.json", + "test:e2e:all:cbt": "sleep 3 && nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch-cbt.json", "test:e2e:initial-render": "nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch.json --group initial-render", "test:e2e:mock-api": "json-server --watch test/e2e/db.json --port 3204", "test:nodejs": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package test/xss", @@ -102,6 +105,7 @@ "babel-preset-react": "^6.23.0", "babel-preset-stage-0": "^6.22.0", "babel-runtime": "^6.23.0", + "cbt_tunnels": "^0.3.0", "chromedriver": "^2.30.1", "copy-webpack-plugin": "^4.0.1", "css-loader": "0.28.4", diff --git a/test/e2e/cbt-globals.js b/test/e2e/cbt-globals.js new file mode 100644 index 00000000..82072006 --- /dev/null +++ b/test/e2e/cbt-globals.js @@ -0,0 +1,24 @@ +var cbt = require("cbt_tunnels") + +module.exports = { + baseUrl: "http://local:3200", + + before: function(done) { + console.log("Starting up tunnel") + cbt.start({ + username: process.env.CBT_USERNAME || "", + authkey: process.env.CBT_AUTHKEY || "" + }, function(err, data) { + if (err) { + done(err) + } else { + done(data) + } + }) + }, + after: function(done) { + console.log("Closing Down Tunnel") + cbt.stop() + done() + } +} diff --git a/test/e2e/db.json b/test/e2e/db.json index e33ceaad..a1b5db46 100644 --- a/test/e2e/db.json +++ b/test/e2e/db.json @@ -125,6 +125,60 @@ } ], "status": "available" + }, + { + "id": 8, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + }, + { + "id": 9, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + }, + { + "id": 10, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" } ] } \ No newline at end of file diff --git a/test/e2e/nightwatch-cbt.json b/test/e2e/nightwatch-cbt.json new file mode 100644 index 00000000..11128ed8 --- /dev/null +++ b/test/e2e/nightwatch-cbt.json @@ -0,0 +1,55 @@ +{ + "src_folders" : ["test/e2e/scenarios"], + "output_folder" : "reports", + "custom_commands_path" : "", + "custom_assertions_path" : "", + "page_objects_path" : "test/e2e/pages", + "globals_path" : "test/e2e/cbt-globals.js", + "test_workers" : { + "enabled" : true, + "workers" : "auto" + }, + + "test_runner" : { + "type" : "mocha", + "options" : { + "ui" : "bdd", + "reporter" : "list" + } + }, + + "selenium" : { + "start_process" : false, + "server_path" : "", + "log_path" : "", + "host" : "127.0.0.1", + "port" : 4444, + "cli_args" : { + "webdriver.chrome.driver" : "", + "webdriver.ie.driver" : "" + } + }, + + "test_settings" : { + "default" : { + "launch_url" : "http://localhost", + "selenium_port" : 80, + "selenium_host" : "hub.crossbrowsertesting.com", + "silent": true, + "screenshots" : { + "enabled" : false, + "path" : "" + }, + "username": "${CBT_USERNAME}", + "access_key": "${CBT_AUTHKEY}", + "desiredCapabilities": { + "acceptSslCerts": "1", + "browserName": "chrome", + "javascriptEnabled": "1", + "name": "NightwatchJSExample", + "record_network" : "true", + "record_video" : "true" + } + } + } +} diff --git a/test/e2e/nightwatch.json b/test/e2e/nightwatch.json index 16ac8bcc..861a72ec 100644 --- a/test/e2e/nightwatch.json +++ b/test/e2e/nightwatch.json @@ -60,4 +60,4 @@ } } } -} \ No newline at end of file +}