Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add browserstack test runner (WIP)

Josiah Sprague1bbb908e52a7
diff --git a/.gitignore b/.gitignore
index 3e9ed26c3..561a246c6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ npm-debug.log
reports
selenium-debug.log
*.jar
+local.log
diff --git a/e2e/browserstack.js b/e2e/browserstack.js
new file mode 100644
index 000000000..1ecb4398c
--- /dev/null
+++ b/e2e/browserstack.js
@@ -0,0 +1,33 @@
+#!/usr/bin/env node
+
+var Nightwatch = require('nightwatch');
+var browserstack = require('browserstack-local');
+var bs_local;
+
+try {
+ process.mainModule.filename = "./node_modules/.bin/nightwatch"
+
+ // Code to start browserstack local before start of test
+ console.log("Connecting local");
+ Nightwatch.bs_local = bs_local = new browserstack.Local();
+ bs_local.start({'key': process.env.BROWSERSTACK_ACCESS_KEY }, function(error) {
+ if (error) throw error;
+
+ console.log('Connected. Now testing...');
+ Nightwatch.cli(function(argv) {
+ Nightwatch.CliRunner(argv)
+ .setup(null, function(){
+ // Code to stop browserstack local after end of parallel test
+ bs_local.stop(function(){});
+ })
+ .runTests(function(){
+ // Code to stop browserstack local after end of single test
+ bs_local.stop(function(){});
+ });
+ });
+ });
+} catch (ex) {
+ console.log('There was an error while starting the test runner:\n\n');
+ process.stderr.write(ex.stack + '\n');
+ process.exit(2);
+}
diff --git a/e2e/nightwatch-browserstack.conf.js b/e2e/nightwatch-browserstack.conf.js
new file mode 100644
index 000000000..23a36bdf0
--- /dev/null
+++ b/e2e/nightwatch-browserstack.conf.js
@@ -0,0 +1,38 @@
+const seleniumServer = require('selenium-server-standalone-jar');
+const chromedriver = require('chromedriver');
+const geckodriver = require('geckodriver');
+
+require('nightwatch-cucumber')({
+ cucumberArgs: [
+ '--compiler', 'js:babel-core/register',
+ '--require', 'e2e/step_definitions',
+ '--format', `json:e2e/reports/cucumber-${process.argv[3]}.json`,
+ 'e2e/features'
+ ]
+});
+
+module.exports = {
+ output_folder: 'e2e/reports',
+ globals_path: 'e2e/globals.js',
+ selenium: {
+ start_process: false,
+ host: 'hub-cloud.browserstack.com',
+ port: 80
+ },
+ test_settings: {
+ default: {
+ selenium_host: 'hub-cloud.browserstack.com',
+ selenium_port: 80,
+ desiredCapabilities: {
+ 'browserstack.user': process.env.BROWSERSTACK_USER,
+ 'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY,
+ 'browserstack.local': true,
+ os: 'OS X',
+ os_version: 'El Capitan',
+ browser: 'Chrome',
+ browser_version: '61.0',
+ resolution: '1920x1080'
+ }
+ }
+ }
+};
diff --git a/package.json b/package.json
index 79c81dce5..fcfd027db 100644
--- a/package.json
+++ b/package.json
@@ -22,13 +22,15 @@
"e2e:chrome:report": "node e2e/create-report.js chrome",
"e2e:firefox": "run-s --continue-on-error e2e:firefox:*",
"e2e:firefox:test": "nightwatch -e firefox --skiptags hover",
- "e2e:firefox:report": "node e2e/create-report.js firefox"
+ "e2e:firefox:report": "node e2e/create-report.js firefox",
+ "e2e:browserstack": "node e2e/browserstack.js -c e2e/nightwatch-browserstack.conf.js"
},
"devDependencies": {
"autoprefixer": "7.1.1",
"babel-core": "^6.26.0",
"babel-polyfill": "6.16.0",
"bluebird": "3.4.6",
+ "browserstack-local": "^1.3.0",
"buster": "0.7.12",
"chromedriver": "2.25.1",
"clipboard": "^1.7.1",