Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Move running data tests to cucumber

Josiah Spragueaf397b02dddd
diff --git a/e2e/features/runningdata.feature b/e2e/features/runningdata.feature
new file mode 100644
index 000000000..a51e18f31
--- /dev/null
+++ b/e2e/features/runningdata.feature
@@ -0,0 +1,14 @@
+Feature: Running Data
+ When I hover over a data layer, I should see the values I'm hovering over displayed in the layers tab
+
+Scenario: Running data on continuous layers
+ Given Worldview production has been loaded
+ And Worldview is in "continuous data layers" state
+ Then label should say "267.2 – 267.8 K" when hovering at 320,320
+ And label should say "260.9 – 261.5 K" when hovering on colorbar
+
+Scenario: Running data on multiple data layers
+ Given Worldview production has been loaded
+ And Worldview is in "multiple data layers" state
+ Then label should say "0.215 – 0.220" when hovering at 320,320
+ And label should say "0.380 – 0.385" when hovering on colorbar
diff --git a/e2e/globals.js b/e2e/globals.js
index 2b66756d4..734b023e6 100644
--- a/e2e/globals.js
+++ b/e2e/globals.js
@@ -1,8 +1,11 @@
module.exports = {
url: 'http://localhost:3000/',
+ production: 'https://worldview.earthdata.nasa.gov/',
querystrings: {
'animation with custom colormap active': '?p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,AIRS_CO_Total_Column_Day(palette=red_1),Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2016-04-08&z=3&v=-223.875,-91.828125,162.84375,98.296875&ab=on&as=2016-03-25&ae=2016-04-08&av=3&al=false',
- 'animation with polar projection rotated': '?p=arctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2016-12-09&z=3&v=-2764195.2298414493,-88762.12734933128,2589496.903095221,3893331.478195751&r=-18.0000&ab=on&as=2016-12-02&ae=2016-12-09&av=3&al=true'
+ 'animation with polar projection rotated': '?p=arctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2016-12-09&z=3&v=-2764195.2298414493,-88762.12734933128,2589496.903095221,3893331.478195751&r=-18.0000&ab=on&as=2016-12-02&ae=2016-12-09&av=3&al=true',
+ 'continuous data layers': '?p=geographic&l=MODIS_Terra_Brightness_Temp_Band31_Day,Coastlines(hidden)&t=2015-05-25&z=2&v=-42.148380855752734,42.13121723408824,22.122734950093943,85.16225953076464',
+ 'multiple data layers':'?p=geographic&l=MODIS_Terra_Aerosol,MODIS_Terra_Brightness_Temp_Band31_Day&t=2017-03-22&z=3&v=136.07019188386334,14.722152527011556,155.59817576644127,24.312819167567586'
},
selectors: {
'info button': '.wv-layers-info',
diff --git a/e2e/step_definitions/runningdata.js b/e2e/step_definitions/runningdata.js
new file mode 100644
index 000000000..bf84373bf
--- /dev/null
+++ b/e2e/step_definitions/runningdata.js
@@ -0,0 +1,30 @@
+const {client} = require('nightwatch-cucumber');
+const {defineSupportCode} = require('cucumber');
+const delay = client.globals.delay;
+
+defineSupportCode(({Given, Then, When}) => {
+
+ Then('label should say {string} when hovering at {int},{int}', (label, x, y) => {
+
+ return client.useCss().moveToElement('.ol-viewport', x, y, ()=>{
+ client.getText('.wv-running-label', function(result) {
+ this.assert.equal(result.value, label);
+ });
+ });
+
+ });
+
+ Then('label should say {string} when hovering on colorbar', (label) => {
+ return client.getElementSize(".wv-palette .wv-palettes-colorbar", function(result) {
+ width = result.value.width;
+ height = result.value.height;
+ client
+ .useCss()
+ .moveToElement('.wv-palette .wv-palettes-colorbar', width/2, height/2).click('.ol-viewport');
+ client.getText('.wv-running-label', function(result) {
+ this.assert.equal(result.value, label);
+ });
+ });
+ });
+
+});
diff --git a/e2e/step_definitions/utility.js b/e2e/step_definitions/utility.js
index 0bf3fc40f..51a303cf7 100644
--- a/e2e/step_definitions/utility.js
+++ b/e2e/step_definitions/utility.js
@@ -5,9 +5,13 @@ const selectors = client.globals.selectors;
const querystrings = client.globals.querystrings;
defineSupportCode(({Given, Then, When}) => {
+ Given('Worldview production has been loaded', () => {
+ return client.url(client.globals.production).waitForElementVisible('body', delay).acceptAlert().pause(100).acceptAlert();
+ });
+
Given('Worldview is in {string} state', (state) => {
var stateUrl = client.globals.url + (querystrings[state]||'');
- return client.url(stateUrl).waitForElementVisible('body', delay);
+ return client.url(stateUrl).waitForElementVisible('body', delay).acceptAlert().pause(100).acceptAlert();
});
// Scroll to an element by predefined selector
diff --git a/e2e/tests/runningdata/running.class.js b/e2e/tests/runningdata/running.class.js
deleted file mode 100644
index 412366042..000000000
--- a/e2e/tests/runningdata/running.class.js
+++ /dev/null
@@ -1,32 +0,0 @@
-module.exports = {
- 'Running Data: Category layer': function(browser) {
- var height, width;
- browser
- .url(browser.globals.url + '?p=geographic&l=ndh-cyclone-hazard-frequency-distribution&t=2017-03-22&z=3&v=82.46635734982672,-6.4831088350501,179.52632254986727,41.18539478390474')
- .pause(500);
-
- browser.getElementSize("#wv-map-geographic .ol-viewport", function(result) {
-
- width = result.value.width;
- height = result.value.height;
-
- browser
- .useCss()
- .moveToElement('.ol-viewport', width - (width / 2), height - (height / 2)) // clicking the very middle point of page
- .pause(10);
- browser.getText('.wv-running-category-label', function(result) {
- this.assert.equal(result.value, '31 - 65');
- });
- browser
- .useCss()
- .moveToElement('.wv-palettes-legend:first-child', 3, 3)
- .mouseButtonDown(0)
- .pause(10);
-
- browser.getText('.wv-running-category-label', function(result) {
- this.assert.equal(result.value, '1 - 5');
- });
- });
- browser.end();
- }
-};
diff --git a/e2e/tests/runningdata/running.cont.js b/e2e/tests/runningdata/running.cont.js
deleted file mode 100644
index 3ad4d00d4..000000000
--- a/e2e/tests/runningdata/running.cont.js
+++ /dev/null
@@ -1,34 +0,0 @@
-module.exports = {
- 'Running Data: Continuous layer': function(browser) {
- var height, width;
- browser
- .url(browser.globals.url + '?p=geographic&l=MODIS_Terra_Brightness_Temp_Band31_Day,Coastlines(hidden)&t=2015-05-25&z=2&v=-42.148380855752734,42.13121723408824,22.122734950093943,85.16225953076464')
- .pause(500);
-
- browser.getElementSize("#wv-map-geographic .ol-viewport", function(result) {
-
- width = result.value.width;
- height = result.value.height;
-
- browser
- .useCss()
- .moveToElement('.ol-viewport', width - (width / 2), height - (height / 2)) // clicking the very middle point of page
- .mouseButtonDown(0)
- .pause(10);
- browser.getText('.wv-running-label', function(result) {
- this.assert.equal(result.value, '271.1 K');
- });
- browser.getElementSize(".wv-palette .wv-palettes-colorbar", function(result) {
- width = result.value.width;
- height = result.value.height;
- browser
- .useCss()
- .moveToElement('.wv-palette .wv-palettes-colorbar', width - (width / 2), height - (height / 2));
- browser.getText('.wv-running-label', function(result) {
- this.assert.equal(result.value, '260.9 K');
- });
- });
- });
- browser.end();
- }
-};
\ No newline at end of file
diff --git a/e2e/tests/runningdata/running.multiple.js b/e2e/tests/runningdata/running.multiple.js
deleted file mode 100644
index 0e1f233a8..000000000
--- a/e2e/tests/runningdata/running.multiple.js
+++ /dev/null
@@ -1,27 +0,0 @@
-module.exports = {
- 'Running Data: Testing multiple layers at same time': function(browser) {
- var height, width;
- browser
- .url(browser.globals.url + '?p=geographic&l=MODIS_Terra_Aerosol,MODIS_Terra_Brightness_Temp_Band31_Day&t=2017-03-22&z=3&v=136.07019188386334,14.722152527011556,155.59817576644127,24.312819167567586')
- .pause(500);
-
- browser.getElementSize("#wv-map-geographic .ol-viewport", function(result) {
-
- width = result.value.width;
- height = result.value.height;
-
- browser
- .useCss()
- .moveToElement('.ol-viewport', width - (width / 2), height - (height / 2)) // clicking the very middle point of page
- .mouseButtonDown(0)
- .pause(1000);
- browser.getText('#overlays-MODIS_Terra_Aerosol .wv-running-label', function(result) {
- this.assert.equal(result.value, '0.070 – 0.075');
- });
- browser.getText('#overlays-MODIS_Terra_Brightness_Temp_Band31_Day .wv-running-label', function(result) {
- this.assert.equal(result.value, '291.9 K');
- });
- });
- browser.end();
- }
-};
\ No newline at end of file