Interactive interface for browsing global, full-resolution satellite imagery
Add nightwatch-cucumber and e2e npm scripts
Josiah Spraguec3d482ec0c57
diff --git a/e2e/create-html-report.js b/e2e/create-html-report.jsnew file mode 100644index 000000000..97d110df6--- /dev/null+++ b/e2e/create-html-report.js@@ -0,0 +1,12 @@+var reporter = require('cucumber-html-reporter');++var options = {+ name: 'Worldview e2e Tests',+ theme: 'bootstrap',+ jsonFile: 'e2e/reports/cucumber.json',+ output: 'e2e/reports/cucumber.html',+ reportSuiteAsScenarios: true,+ launchReport: true+};++reporter.generate(options);diff --git a/e2e/features/google.feature b/e2e/features/google.featurenew file mode 100644index 000000000..487f18542--- /dev/null+++ b/e2e/features/google.feature@@ -0,0 +1,7 @@+Feature: Google Search++Scenario: Searching Google++ Given I open Google's search page+ Then the title is "Google"+ And the Google search form existsdiff --git a/e2e/step_definitions/google.js b/e2e/step_definitions/google.jsnew file mode 100644index 000000000..2f7c80682--- /dev/null+++ b/e2e/step_definitions/google.js@@ -0,0 +1,19 @@+const {client} = require('nightwatch-cucumber');+const {defineSupportCode} = require('cucumber');++defineSupportCode(({Given, Then, When}) => {+ Given(/^I open Google's search page$/, () => {+ return client+ .url('http://google.com')+ .waitForElementVisible('body', 1000);+ });++ Then(/^the title is "([^"]*)"$/, (title) => {+ return client.assert.title(title);+ });++ Then(/^the Google search form exists$/, () => {+ return client.assert.visible('input[name="q"]');+ });++});diff --git a/nightwatch.conf.js b/nightwatch.conf.jsnew file mode 100644index 000000000..40e6533c6--- /dev/null+++ b/nightwatch.conf.js@@ -0,0 +1,40 @@+require('nightwatch-cucumber')({+ cucumberArgs: [+ '--compiler', 'js:babel-core/register',+ '--require', 'e2e/step_definitions',+ '--format', 'json:e2e/reports/cucumber.json',+ 'e2e/features'+ ]+});++module.exports = {+ src_folders: ['./e2e/tests'],+ output_folder: './e2e/reports',+ globals_path: './e2e/globals.js',+ selenium: {+ start_process: true,+ server_path: 'node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.0.1.jar',+ port: 4444,+ cli_args: {+ 'webdriver.chrome.driver': 'node_modules/chromedriver/lib/chromedriver/chromedriver',+ 'webdriver.gecko.driver': 'node_modules/geckodriver/bin/geckodriver'+ }+ },+ test_settings: {+ default: {+ launch_url: 'http://localhost',+ selenium_port: 4444,+ selenium_host: 'localhost',+ silent: true,+ desiredCapabilities: {+ browserName: 'chrome',+ marionette: true+ }+ },+ firefox: {+ desiredCapabilities: {+ browserName: 'firefox'+ }+ }+ }+};diff --git a/package.json b/package.jsonindex cb1f9b128..73008c80c 100644--- a/package.json+++ b/package.json@@ -14,16 +14,21 @@},"scripts": {"test": "grunt test lint",+ "e2e-test": "nightwatch",+ "poste2e-test": "node e2e/create-html-report.js","start": "node ./bin/www","preinstall": "node version-check.js"},"devDependencies": {"autoprefixer": "7.1.1",+ "babel-core": "^6.26.0","babel-polyfill": "6.16.0","bluebird": "3.4.6","buster": "0.7.12","chromedriver": "2.25.1","clipboard": "^1.7.1",+ "cucumber": "^3.0.2",+ "cucumber-html-reporter": "^3.0.4","express": "4.15.2","font-awesome": "4.7.0","geckodriver": "1.2.0",@@ -53,7 +58,8 @@"isotope-packery": "2.x.x","lodash": "4.15.0","moment": "2.13.x",- "nightwatch": "^0.9.9",+ "nightwatch": "^0.9.16",+ "nightwatch-cucumber": "^8.1.0","openlayers": "4.3.1","perfect-scrollbar": "0.7.x","phantomjs": "2.1.x",