Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add partial animation tests to Cucumber (WIP)

Josiah Spragueef62d9ea657f
diff --git a/e2e/features/animations.feature b/e2e/features/animations.feature
new file mode 100644
index 000000000..aff667715
--- /dev/null
+++ b/e2e/features/animations.feature
@@ -0,0 +1,22 @@
+Feature: Animations
+ Animating the map date
+
+Background:
+ Given Worldview is in "initial" state
+ And I click "Skip Tour"
+
+Scenario: Toggling animation mode
+ Then I should not see the "animation widget"
+ When I click the "animation button"
+ Then I should see the "animation widget"
+
+Scenario: Changing date range of animation
+ When I click the "animation button"
+ Then the animation range selector works
+
+Scenario: Changing animation time resolution
+ When I click the "animation button"
+ And I scroll to the "animation resolution tooltip"
+ And I click the "yearly resolution tooltip"
+ And I wait 1 seconds
+ Then the page should have the "timeline set to years"
diff --git a/e2e/features/animations.gif.colormap.feature b/e2e/features/animations.gif.colormap.feature
new file mode 100644
index 000000000..f15293538
--- /dev/null
+++ b/e2e/features/animations.gif.colormap.feature
@@ -0,0 +1,14 @@
+Feature: Animation GIF Downloads
+ Download GIFs
+
+Scenario: Downloading GIF when custom colormap is activated
+ Given Worldview is in "custom colormap active" state
+ Then I should see the "animation widget"
+ When I click the "create GIF button"
+ And I click the "GIF download icon"
+ Then I should see "Would you like to temporarily revert"
+ When I click "OK"
+ Then I should see the "GIF results" within 6 seconds
+ When I click the "GIF results close button"
+ Then the page should not have the "GIF results"
+ And I should see the "animation widget"
diff --git a/e2e/features/events.feature b/e2e/features/events.feature
index a0cbd6ecc..eb9f68898 100644
--- a/e2e/features/events.feature
+++ b/e2e/features/events.feature
@@ -4,7 +4,7 @@ Feature: Natural Events
So that I can see imagery related to events
Background:
- Given Worldview is in initial state
+ Given Worldview is in "initial" state
And I click "Skip Tour"
Scenario: Selecting Events Tab
diff --git a/e2e/features/layers.feature b/e2e/features/layers.feature
index afd9ebe37..49a97d491 100644
--- a/e2e/features/layers.feature
+++ b/e2e/features/layers.feature
@@ -2,7 +2,7 @@ Feature: Layers
The layers sidebar tab
Background:
- Given Worldview is in initial state
+ Given Worldview is in "initial" state
And I click "Skip Tour"
Scenario: Getting Layer Info
@@ -10,14 +10,14 @@ Scenario: Getting Layer Info
When I click the "info button"
Then I should see the "info dialog"
When I click the "info button"
- Then I should not see the "info dialog"
+ Then the page should not have the "info dialog"
When I click the "info button"
Then I should see the "info dialog"
Scenario: Changing Layer Options
When I click the "options button"
- Then I should not see the "info dialog"
+ Then the page should not have the "info dialog"
Then I should see the "options dialog"
Scenario: Adding Layers and Layer Search
diff --git a/e2e/features/tour.feature b/e2e/features/tour.feature
index 23b87d463..9e59669b0 100644
--- a/e2e/features/tour.feature
+++ b/e2e/features/tour.feature
@@ -4,7 +4,7 @@ Feature: Tour
So that I can learn how to use Worldview
Background:
- Given Worldview is in initial state
+ Given Worldview is in "initial" state
Then I should see "Take Tour"
Scenario: Skipping Tour
diff --git a/e2e/globals.js b/e2e/globals.js
index b7e64c14a..291dc4e2d 100644
--- a/e2e/globals.js
+++ b/e2e/globals.js
@@ -1,5 +1,8 @@
module.exports = {
- url: 'http://localhost:3000',
+ url: 'http://localhost:3000/',
+ querystrings: {
+ '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'
+ },
selectors: {
'info button': '.wv-layers-info',
'options button': '.wv-layers-options',
@@ -7,7 +10,16 @@ module.exports = {
'options dialog': '[aria-describedby="wv-layers-options-dialog"]',
'layers search field': '#layers-search-input',
'source info icon': '.layers-all-layer .fa-info-circle',
- 'source metadata close button': '.source-metadata .metadata-more'
+ 'source metadata close button': '.source-metadata .metadata-more',
+ 'animation widget': '#wv-animation-widget',
+ 'animation button': '#animate-button',
+ 'animation resolution tooltip': '.wv-tooltip-case:first-child',
+ 'yearly resolution tooltip': '.wv-tooltip #yearly',
+ 'timeline set to years':'#zoom-years.depth-1',
+ 'create GIF button': '.fa-file-video-o.wv-animation-widget-icon',
+ 'GIF download icon': '.jcrop-holder .fa-download',
+ 'GIF results': '.gif-results-dialog-case img',
+ 'GIF results close button': '.wv-gif-results button.ui-dialog-titlebar-close'
},
delay: 3000 // Acceptable delay in ms between performing actions and seeing results
};
diff --git a/e2e/step_definitions/animations.js b/e2e/step_definitions/animations.js
new file mode 100644
index 000000000..ff2414d1b
--- /dev/null
+++ b/e2e/step_definitions/animations.js
@@ -0,0 +1,25 @@
+const {client} = require('nightwatch-cucumber');
+const {defineSupportCode} = require('cucumber');
+const delay = client.globals.delay;
+
+defineSupportCode(({Given, Then, When}) => {
+
+ Then('the animation range selector works', () => {
+ return client
+ .getValue('.wv-anim-dates-case .wv-date-selector-widget:first-child #day-input-group', function(result) {
+ var startDay = result.value;
+ client
+ .useCss()
+ .moveToElement('#wv-timeline-range-selector:first-child polygon', 1, 1)
+ .mouseButtonDown(0)
+ .moveTo(null, -40, 0)
+ .mouseButtonUp(0)
+ .pause(100);
+ client.getValue('.wv-anim-dates-case .wv-date-selector-widget:first-child #day-input-group', function(result) {
+ newDay = result.value;
+ this.assert.notEqual(startDay, newDay);
+ });
+ });
+ });
+
+});
diff --git a/e2e/step_definitions/app.js b/e2e/step_definitions/app.js
deleted file mode 100644
index 212aee7d7..000000000
--- a/e2e/step_definitions/app.js
+++ /dev/null
@@ -1,71 +0,0 @@
-const {client} = require('nightwatch-cucumber');
-const {defineSupportCode} = require('cucumber');
-const delay = client.globals.delay;
-const selectors = client.globals.selectors;
-
-defineSupportCode(({Given, Then, When}) => {
- Given('Worldview is in initial state', () => {
- return client.url(client.globals.url).waitForElementVisible('body', delay);
- });
-
- // Scroll to an element by predefined selector
- When('I scroll to the {string}', (label) => {
- return client.useCss().moveToElement(selectors[label], 10, 10);
- });
-
- // Click any element that contains the string
- When('I click {string}', (string) => {
- return client.useXpath().click('//*[contains(text(),"' + string + '")]');
- });
-
- // Click a link by link text
- When('I click the {string} link', (text) => {
- return client.useXpath().click('//a[text()="'+ text +'"]');
- });
-
- // Click an element by predefined selector
- When('I click the {string}', (label) => {
- return client.useCss().click(selectors[label]);
- });
-
- // Click a Worldview tab
- When('I click the {string} tab', (name) => {
- return client.useCss().click('[data-tab="' + name + '"]');
- });
-
- // Input a value into a labeled element
- When('I input {string} in the {string}', (value, label) => {
- return client.useCss().setValue(selectors[label], value);
- });
-
- // Wait until an element is visible
- When('I wait to see {string}', (label) => {
- return client.useCss().waitForElementVisible(selectors[label], delay);
- });
-
- // Pause for n seconds
- When('I wait {int} seconds', (seconds) => {
- return client.pause(seconds*1000);
- });
-
- // Check for a string
- Then('I should see {string}', (text) => {
- return client.useCss().assert.containsText('body', text);
- });
-
- // Check for a string
- Then('I should not see {string}', (text) => {
- return client.useCss().expect.element('body').text.not.contains(text);
- });
-
- // Check for an element by predefined selector
- Then('I should see the {string}', (label) => {
- return client.useCss().expect.element(selectors[label]).to.be.visible;
- });
-
- // Check for abscense of an element by predefined selector
- Then('I should not see the {string}', (label) => {
- return client.useCss().expect.element(selectors[label]).to.not.be.present;
- });
-
-});
diff --git a/e2e/step_definitions/utility.js b/e2e/step_definitions/utility.js
new file mode 100644
index 000000000..0bf3fc40f
--- /dev/null
+++ b/e2e/step_definitions/utility.js
@@ -0,0 +1,83 @@
+const {client} = require('nightwatch-cucumber');
+const {defineSupportCode} = require('cucumber');
+const delay = client.globals.delay;
+const selectors = client.globals.selectors;
+const querystrings = client.globals.querystrings;
+
+defineSupportCode(({Given, Then, When}) => {
+ Given('Worldview is in {string} state', (state) => {
+ var stateUrl = client.globals.url + (querystrings[state]||'');
+ return client.url(stateUrl).waitForElementVisible('body', delay);
+ });
+
+ // Scroll to an element by predefined selector
+ When('I scroll to the {string}', (key) => {
+ return client.useCss().moveToElement(selectors[key]||key, 10, 10);
+ });
+
+ // Click any element that contains the string
+ When('I click {string}', (string) => {
+ return client.useXpath().click('//*[contains(text(),"' + string + '")]');
+ });
+
+ // Click a link by link text
+ When('I click the {string} link', (text) => {
+ return client.useXpath().click('//a[text()="'+ text +'"]');
+ });
+
+ // Click an element by predefined selector
+ When('I click the {string}', (key) => {
+ return client.useCss().click(selectors[key]||key);
+ });
+
+ // Click a Worldview tab
+ When('I click the {string} tab', (name) => {
+ return client.useCss().click('[data-tab="' + name + '"]');
+ });
+
+ // Input a value into a keyed element
+ When('I input {string} in the {string}', (value, key) => {
+ return client.useCss().setValue(selectors[key]||key, value);
+ });
+
+ // Pause for n seconds
+ When('I wait {int} seconds', (seconds) => {
+ return client.pause(seconds*1000);
+ });
+
+ // Check for a string
+ Then('I should see {string}', (text) => {
+ return client.useCss().assert.containsText('body', text);
+ });
+
+ // Check for a string
+ Then('I should not see {string}', (text) => {
+ return client.useCss().expect.element('body').text.not.contains(text);
+ });
+
+ // Check that an element is visible by predefined selector
+ Then('I should see the {string}', (key) => {
+ return client.useCss().expect.element(selectors[key]||key).to.be.visible;
+ });
+
+ // Wait for an element to be visible
+ Then('I should see the {string} within {int} seconds', (key, seconds) => {
+ return client.useCss().expect.element(selectors[key]||key).to.be.visible.before(seconds*1000);
+ });
+
+ // Check for an element by predefined selector
+ Then('the page should have the {string}', (key) => {
+ return client.useCss().expect.element(selectors[key]||key).to.be.present;
+ });
+
+ // Check for abscense of an element by predefined selector
+ Then('the page should not have the {string}', (key) => {
+ return client.useCss().expect.element(selectors[key]||key).to.not.be.present;
+ });
+
+ // Check that an element is hidden
+ Then('I should not see the {string}', (key) => {
+ return client.useCss().expect.element(selectors[key]||key).to.not.be.visible;
+ });
+
+});
diff --git a/e2e/tests/anim/anim.general.js b/e2e/tests/anim/anim.general.js
deleted file mode 100644
index 295151ed0..000000000
--- a/e2e/tests/anim/anim.general.js
+++ /dev/null
@@ -1,46 +0,0 @@
-module.exports = {
- 'Animation tests': function(browser) {
- browser.url(browser.globals.url)
- .pause(1000);
- browser.waitForElementVisible('#skipTour', 10000, function(el) {
- browser.click('#skipTour');
- /*
- * check to see if animation widget is visible
- * after Icon is clicked
- */
- browser.expect.element('.wv-animation-widget-header').to.not.be.visible;
- browser.click('#animate-button');
- browser.pause(1000);
- browser.expect.element('.wv-animation-widget-header').to.be.visible;
- /*
- * Verify that date selectors adjust when
- * animation draggers are dragged
- */
- browser.getValue('.wv-anim-dates-case .wv-date-selector-widget:first-child #day-input-group', function(result) {
- startDay = result.value;
- browser.useCss()
- .moveToElement('#wv-timeline-range-selector:first-child polygon', 1, 1)
- .mouseButtonDown(0)
- .moveTo(null, -40, 0)
- .mouseButtonUp(0)
- .pause(100);
- browser.getValue('.wv-anim-dates-case .wv-date-selector-widget:first-child #day-input-group', function(result) {
- newDay = result.value;
- // startDay != newDay
- this.assert.notEqual(startDay, newDay);
- });
- });
-
- /*
- * Verify that timeline zoom changes on tooltip click
- */
- browser.useCss()
- .moveToElement('.wv-tooltip-case:first-child', 1, 1)
- .click('.wv-tooltip #yearly')
- .pause(1000);
- // Check if correct timeline zoom is selected
- browser.expect.element('#zoom-years.depth-1').to.be.present;
- });
- browser.end();
- }
-};
\ No newline at end of file
diff --git a/e2e/tests/anim/anim.gif.colormap.js b/e2e/tests/anim/anim.gif.colormap.js
deleted file mode 100644
index 43b666768..000000000
--- a/e2e/tests/anim/anim.gif.colormap.js
+++ /dev/null
@@ -1,37 +0,0 @@
-module.exports = {
- 'Animation GIF when custom colormap is activated': function(browser) {
- browser.url(browser.globals.url + '?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')
- .pause(1000);
- /*
- * Should not show Tour
- */
- browser.expect.element('#skipTour').to.not.be.present;
-
- /*
- * check to see if animation widget
- * is active after page load
- */
- browser.waitForElementVisible('#wv-animation-widget', 1000, function(el) {
- // Click on GIF icon
- browser.click('.fa-file-video-o.wv-animation-widget-icon');
- // Wait for GIF selection to appear
- browser.waitForElementVisible('.fa-download', 1000, function(el) {
- // Initiate download
- browser.click('.fa-download');
- // wait for GIF to be created
- browser.waitForElementVisible('.wv-dialog-ask', 1000, function(el) {
- // Verify dialogue asking to revert colormap appears
- browser.expect.element('.ui-dialog-buttonset button:nth-child(2)').to.be.present;
- // Close GIF results
- browser.click('.ui-dialog-buttonset button:nth-child(2)');
- browser.waitForElementVisible('.gif-results-dialog-case', 10000, function(el) {
- browser.expect.element('.gif-results-dialog').to.be.present;
- browser.expect.element('.gif-results-dialog-case img').to.be.present;
- });
- });
-
- });
- });
- browser.end();
- }
-};
\ No newline at end of file
diff --git a/e2e/tests/anim/anim.gif.js b/e2e/tests/anim/anim.gif.js
deleted file mode 100644
index 08525d2ef..000000000
--- a/e2e/tests/anim/anim.gif.js
+++ /dev/null
@@ -1,48 +0,0 @@
-module.exports = {
- 'Animation GIF tests': function(browser) {
- var startDay, newDay;
- browser
- .url(browser.globals.url + '?p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2016-11-28&z=1&v=-209.109375,-63.421875,148.078125,69.890625&ab=on&as=2013-11-21&ae=2016-11-28&av=3&al=false')
- .pause(1000);
- /*
- * Should not show Tour
- */
- browser.expect.element('#skipTour').to.not.be.present;
-
- /*
- * check to see if animation widget
- * is active after page load
- */
- browser.waitForElementVisible('#wv-animation-widget', 1000, function(el) {
- // Click on GIF icon
- browser.click('.fa-file-video-o.wv-animation-widget-icon');
- // Wait for GIF selection to appear
- browser.waitForElementVisible('.fa-download', 1000, function(el) {
- // Initiate download
- browser.click('.fa-download');
- // wait for GIF to be created
- browser.waitForElementVisible('.gif-results-dialog-case', 10000, function(el) {
- // Verify that GIF was created
- browser.expect.element('.gif-results-dialog').to.be.present;
- browser.expect.element('.gif-results-dialog-case img').to.be.present;
- browser.pause(1000);
- // Close GIF results
- browser.expect.element('.wv-gif-results button.ui-dialog-titlebar-close').to.be.visible;
- browser.click('.wv-gif-results button.ui-dialog-titlebar-close');
- // Verify that animation widget is visible again
- browser.waitForElementVisible('#wv-animation-widget', 3000, function(el) {
- browser.pause(1000);
- });
- });
-
- });
- });
-
- /*
- * Verify that timeline zoom is changed
- */
-
-
- browser.end();
- }
-};
diff --git a/e2e/tests/anim/anim.js b/e2e/tests/anim/anim.js
deleted file mode 100644
index c122d7c2b..000000000
--- a/e2e/tests/anim/anim.js
+++ /dev/null
@@ -1,49 +0,0 @@
-module.exports = {
- 'Animation tests': function(browser) {
- browser
- .url(browser.globals.url)
- .pause(1000);
- browser.waitForElementVisible('#skipTour', 1000, function(el) {
- browser.click('#skipTour');
- /*
- * check to see if animation widget is visible
- * after Icon is clicked
- */
- browser.expect.element('.wv-animation-widget-header').to.not.be.visible;
- browser.click('#animate-button');
- browser.pause(1000);
- browser.expect.element('.wv-animation-widget-header').to.be.visible;
- /*
- * Verify that date selectors adjust when
- * animation draggers are dragged
- */
- browser.getValue('.wv-anim-dates-case .wv-date-selector-widget:first-child #day-input-group', function(result) {
- startDay = result.value;
- browser
- .useCss()
- .moveToElement('#wv-timeline-range-selector:first-child polygon', 1, 1)
- .mouseButtonDown(0)
- .moveTo(null, -40, 0)
- .mouseButtonUp(0)
- .pause(100);
- browser.getValue('.wv-anim-dates-case .wv-date-selector-widget:first-child #day-input-group', function(result) {
- newDay = result.value;
- // startDay != newDay
- this.assert.notEqual(startDay, newDay);
- });
- });
-
- /*
- * Verify that timeline zoom changes on tooltip click
- */
- browser
- .useCss()
- .moveToElement('.wv-tooltip-case:first-child', 1, 1)
- .click('.wv-tooltip #yearly')
- .pause(1000);
- // Check if correct timeline zoom is selected
- browser.expect.element('#zoom-years.depth-1').to.be.present;
- });
- browser.end();
- }
-};