-
-
Save zeroasterisk/c59f8096f1011efc78c3 to your computer and use it in GitHub Desktop.
Nightwatch ideas implemented for a Meteor server
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
language: node_js | |
node_js: | |
- "0.10" | |
services: | |
- mongodb | |
sudo: required | |
cache: | |
directories: | |
- ~/.nvm | |
- node_modules | |
- ~/.meteor | |
- build-prod/bundle/programs/server/node_modules | |
before_install: | |
# install meteor | |
# TODO logic to only install if not already there (cached @ /usr/local/bin/meteor) | |
- "curl https://install.meteor.com | /bin/sh" | |
# install all npm packages | |
- "npm install" | |
# install pm2 process manager for Node | |
- "npm install pm2 -g" | |
# install bcrypt globally (trying to circumvent a bug in bundled version) | |
- "npm install bcrypt -g" | |
# everything should be done INSIDE webapp (aside from the build) | |
- "cd webapp" | |
# fire up xvfb on port :99.0 | |
- "export DISPLAY=:99.0" | |
- "sh -e /etc/init.d/xvfb start" | |
# set the xvfb screen size to 1280x1024x16 | |
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" | |
#- "mongo travisci --eval 'db.addUser(\"travisi\", \"test\");'" | |
# build Meteor app for production | |
- "meteor build --server localhost:3000 --directory ../build-prod" | |
- "cd ../build-prod" | |
- "(cd bundle/programs/server && npm install)" | |
# start meteor with pm2 (1 instance only) | |
- "cp ../deployment/process-travisci.json ./process.json" | |
- "pm2 start process.json --name 'myapp'" | |
- "cd .." | |
before_script: | |
# give Meteor some time to init data, and to start | |
- "sleep 15" | |
- "cat ~/.pm2/logs/*" | |
script: | |
- "cd webapp" | |
#- "./nightwatch -e travis --verbose" | |
- "./nightwatch -e travis" |
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
#!/usr/bin/env node | |
// ------------------- | |
// nightwatchjs script running | |
// - automatically downloads the selenium jar if missing | |
// - automatically passes through all arguments to the runner.js | |
// ------------------- | |
// 1st time Setup: | |
// cd webapp/tests/nightwatch/custom-maxgalbu | |
// npm install | |
// | |
// Assumptions: | |
// | |
// cd webapp | |
// ./nightwatch | |
// ------------------- | |
var fs = require('fs'); | |
var path = require('path'); | |
// ------------------- | |
// CONFIG | |
// ------------------- | |
// ------------------- | |
// runner for nightwatch | |
// ------------------- | |
var runNightwatch = function() { | |
require('nightwatch/bin/runner.js'); | |
} | |
// ------------------- | |
// Verify PWD / CWD of this process | |
// we want to start this process from webapp | |
// ------------------- | |
if (path.basename(process.cwd()) != "webapp") { | |
console.log('./nightwatch should be started from the webapp folder'); | |
console.log(' current:' + path.basename(process.cwd())); | |
console.log(' full:' + process.cwd()); | |
console.log(''); | |
console.log(' cd webapp'); | |
console.log(' ./nightwatch'); | |
console.log(''); | |
process.exit(1); | |
} | |
// ------------------- | |
// Verify selenium-standalone NPM package exists | |
// indicative of a valid setup | |
// $ (cd .. && npm install) | |
// ------------------- | |
var npm_path = "../node_modules/selenium-standalone"; | |
if (!fs.existsSync(npm_path)) { | |
console.log('Selenium Standalone NPM Not Found: ' + server_path); | |
console.log(''); | |
console.log(' (cd .. && npm install)'); | |
console.log(''); | |
console.log('then try again...'); | |
console.log(''); | |
console.log('if still not working, look to see if the selenium-server-standalone version has changed'); | |
console.log(' note: it must match on ./nightwatch.json {selenium{server_path'); | |
console.log(''); | |
process.exit(1); | |
} | |
// ------------------- | |
// Verify selenium drivers exist as needed | |
// indicative of a valid setup | |
// ------------------- | |
var selenium = require('selenium-standalone'); | |
selenium.install({ | |
version: '2.45.0', | |
baseURL: 'http://selenium-release.storage.googleapis.com', | |
drivers: { | |
chrome: { | |
// check for more recent versions of chrome driver here: | |
// http://chromedriver.storage.googleapis.com/index.html | |
version: '2.15', | |
arch: process.arch, | |
baseURL: 'http://chromedriver.storage.googleapis.com' | |
}, | |
/* | |
}, | |
logger: function(message) { | |
console.log(message); | |
}, | |
progressCb: function(totalLength, progressLength, chunkLength) { | |
*/ | |
} | |
}, runNightwatch); | |
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
{ | |
"src_folders" : ["./tests/nightwatch/walkthroughs"], | |
"output_folder" : "./tests/nightwatch/logs", | |
"custom_commands_path" : [ | |
"./tests/nightwatch/commands", | |
"../node_modules/nightwatch-custom-commands-assertions/js/commands" | |
], | |
"custom_assertions_path" : [ | |
"./tests/nightwatch/assertions", | |
"../node_modules/nightwatch-custom-commands-assertions/js/assertions" | |
], | |
"globals_path" : "./tests/nightwatch/globals.json", | |
"live_output" : false, | |
"parallel_process_delay" : 10, | |
"disable_colors": false, | |
"selenium" : { | |
"start_process" : true, | |
"server_path" : "../node_modules/selenium-standalone/.selenium/selenium-server/2.45.0-server.jar", | |
"log_path" : "./tests/nightwatch/logs", | |
"host" : "127.0.0.1", | |
"port" : 4444, | |
"cli_args" : { | |
"webdriver.chrome.driver": "selenium/chromedriver", | |
"webdriver.ie.driver" : "", | |
"_comment": [ | |
" custom Firefox profile for nightwatch", | |
" see: https://github.com/beatfactor/nightwatch/wiki/Enable-Firebug-in-Firefox-for-Nightwatch-tests", | |
" - added Firebug", | |
" - browsed to about:config", | |
" - Set network.http.use-cache to false", | |
" - Set extensions.firebug.*.enableSites to true", | |
" - browsed to http://localhost:3000", | |
" - at the `share location prompt`", | |
" - always enable for this site", | |
"webdriver.firefox.profile: nightwatch" | |
] | |
} | |
}, | |
"test_settings" : { | |
"default" : { | |
"launch_url" : "http://localhost:3000", | |
"selenium_host" : "127.0.0.1", | |
"selenium_port" : 4444, | |
"pathname": "/wd/hub", | |
"silent" : true, | |
"disable_colors": false, | |
"screenshots" : { | |
"enabled" : true, | |
"path" : "./tests/nightwatch/screenshots" | |
}, | |
"desiredCapabilities" : { | |
"browsername" : "firefox", | |
"javascriptEnabled": true, | |
"databaseEnabled": true, | |
"locationContextEnabled": true, | |
"applicationCacheEnabled": true, | |
"browserConnectionEnabled": true, | |
"webStorageEnabled": true, | |
"acceptSslCerts": true, | |
"rotatable": true, | |
"nativeEvents": true | |
} | |
}, | |
"chrome" : { | |
"launch_url" : "http://localhost:3000", | |
"selenium_host" : "127.0.0.1", | |
"selenium_port" : 4444, | |
"silent" : true, | |
"disable_colors": false, | |
"screenshots" : { | |
"enabled" : true, | |
"path" : "./tests/nightwatch/screenshots" | |
}, | |
"desiredCapabilities" : { | |
"browserName" : "chrome", | |
"javascriptEnabled": true, | |
"databaseEnabled": true, | |
"locationContextEnabled": true, | |
"applicationCacheEnabled": true, | |
"browserConnectionEnabled": true, | |
"webStorageEnabled": true, | |
"acceptSslCerts": true, | |
"rotatable": true, | |
"nativeEvents": true, | |
"chromeOptions": { | |
"args":["disable-web-security", "ignore-certificate-errors"] | |
} | |
} | |
}, | |
"debug" : { | |
"launch_url" : "http://localhost:3000", | |
"selenium_host" : "127.0.0.1", | |
"selenium_port" : 4444, | |
"silent" : false, | |
"disable_colors": false, | |
"screenshots" : { | |
"enabled" : true, | |
"path" : "./tests/nightwatch/screenshots" | |
}, | |
"desiredCapabilities" : { | |
"browserName" : "firefox", | |
"javascriptEnabled": true, | |
"databaseEnabled": true, | |
"locationContextEnabled": true, | |
"applicationCacheEnabled": true, | |
"browserConnectionEnabled": true, | |
"webStorageEnabled": true, | |
"acceptSslCerts": true, | |
"rotatable": true, | |
"nativeEvents": true | |
} | |
}, | |
"travis" : { | |
"launch_url" : "http://localhost:3000", | |
"selenium_host" : "127.0.0.1", | |
"selenium_port" : 4444, | |
"silent" : true, | |
"disable_colors": false, | |
"screenshots" : { | |
"enabled" : false, | |
"path" : "./tests/nightwatch/screenshots" | |
}, | |
"desiredCapabilities" : { | |
"browserName" : "firefox", | |
"javascriptEnabled": true, | |
"databaseEnabled": true, | |
"locationContextEnabled": true, | |
"applicationCacheEnabled": true, | |
"browserConnectionEnabled": true, | |
"webStorageEnabled": true, | |
"acceptSslCerts": true, | |
"rotatable": true, | |
"nativeEvents": true | |
} | |
}, | |
"saucelabs" : { | |
"selenium_host" : "ondemand.saucelabs.com", | |
"selenium_port" : 80, | |
"username" : "${SAUCE_USERNAME}", | |
"access_key" : "${SAUCE_ACCESS_KEY}", | |
"use_ssl" : false, | |
"silent" : true, | |
"output" : true, | |
"screenshots" : { | |
"enabled" : false, | |
"path" : "" | |
}, | |
"desiredCapabilities": { | |
"name" : "test-example", | |
"browserName": "firefox", | |
"javascriptEnabled": true, | |
"databaseEnabled": true, | |
"locationContextEnabled": true, | |
"applicationCacheEnabled": true, | |
"browserConnectionEnabled": true, | |
"webStorageEnabled": true, | |
"acceptSslCerts": true, | |
"rotatable": true, | |
"nativeEvents": true | |
}, | |
"globals" : { | |
"myGlobal" : "some_sauce_global" | |
}, | |
"selenium" : { | |
"start_process" : false | |
} | |
}, | |
"phantomjs" : { | |
"desiredCapabilities" : { | |
"browserName" : "phantomjs", | |
"javascriptEnabled": true, | |
"databaseEnabled": true, | |
"locationContextEnabled": true, | |
"applicationCacheEnabled": true, | |
"browserConnectionEnabled": true, | |
"webStorageEnabled": true, | |
"acceptSslCerts": true, | |
"rotatable": true, | |
"nativeEvents": true, | |
"phantomjs.binary.path" : "../node_modules/phantomjs/bin/phantomjs" | |
} | |
}, | |
"browserstack" : { | |
"selenium" : { | |
"start_process" : false | |
}, | |
"selenium_host" : "hub.browserstack.com", | |
"selenium_port" : 80, | |
"silent" : true, | |
"desiredCapabilities": { | |
"name" : "test-example", | |
"browserName": "firefox", | |
"browserstack.user" : "...", | |
"browserstack.key" : "..." | |
} | |
} | |
} | |
} | |
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": "dart", | |
"version": "0.0.1", | |
"description": "dart meteor repo", | |
"main": "Gruntfile.js", | |
"directories": { | |
"doc": "docs" | |
}, | |
"dependencies": { | |
"modulus": "^3.4.2", | |
"nightwatch": "^0.5.36", | |
"nightwatch-custom-commands-assertions": "^1.0.2" | |
}, | |
"devDependencies": { | |
"selenium-standalone": "^4.4.2", | |
"phantomjs": "^1.9.17" | |
}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+https://github.com/justinberg/dart.git" | |
}, | |
"author": "", | |
"license": "ISC", | |
"bugs": { | |
"url": "https://github.com/justinberg/dart/issues" | |
}, | |
"homepage": "https://github.com/justinberg/dart#readme" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment