Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

remove unneeded code. add test for subdaily intervals, timescale, and restoring each from permalink to timeline e2e.

Jason Kent7ef7d40f69da
diff --git a/e2e/features/timeline/timeline-test.js b/e2e/features/timeline/timeline-test.js
index ea17876fb..62fc8ed67 100644
--- a/e2e/features/timeline/timeline-test.js
+++ b/e2e/features/timeline/timeline-test.js
@@ -5,15 +5,17 @@ const dateSelectorDayInput = '#date-selector-main .input-wrapper-day input';
const TIME_LIMIT = 20000;
module.exports = {
- beforeEach: function(client) {
+ beforeEach: client => {
reuseables.loadAndSkipTour(client, TIME_LIMIT);
},
+
// verify timescale dragger is visible
- 'Dragger is visible': function(client) {
+ 'Dragger is visible': client => {
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
},
+
// verify timescale is expanded and can be opened/closed
- 'Timeline is expanded by default and closes/reopen on clicking timeline chevrons': function(client) {
+ 'Timeline is expanded by default and closes/reopen on clicking timeline chevrons': client => {
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.expect.element('#timeline-footer').to.be.visible;
// hide timeline
@@ -28,13 +30,17 @@ module.exports = {
client.expect.element('#timeline-footer').to.be.visible;
client.end();
},
+
// verify default 1 day interval
- 'Interval defaults to 1 DAY': function(client) {
+ 'Interval defaults to 1 DAY': client => {
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.containsText('#current-interval', '1 DAY');
},
- // verify default year, month, day, and custom intervals
- 'Interval default year, month, day, and custom available': function(client) {
+
+ // verify subdaily default year, month, day, hour, minute, and custom intervals
+ 'Interval subdaily default year, month, day, hour, minute, and custom available': client => {
+ client.url(client.globals.url + localQuerystrings.subdailyLayerIntervalTimescale);
+ client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client
.useCss()
.moveToElement('#timeline-interval-btn-container', 0, 0)
@@ -43,26 +49,25 @@ module.exports = {
client.expect.element('#interval-years').to.be.visible;
client.expect.element('#interval-months').to.be.visible;
client.expect.element('#interval-days').to.be.visible;
+ client.expect.element('#interval-hours').to.be.visible;
+ client.expect.element('#interval-minutes').to.be.visible;
client.expect.element('#interval-custom-static').to.be.visible;
client.end();
},
- // verify subdaily default year, month, day, hour, minute, and custom intervals
- // 'Interval subdaily default year, month, day, hour, minute, and custom available': function(client) {
- // client
- // .useCss()
- // .moveToElement('#timeline-interval-btn-container', 0, 0)
- // .waitForElementVisible('#interval-years', TIME_LIMIT);
-
- // client.expect.element('#interval-years').to.be.visible;
- // client.expect.element('#interval-months').to.be.visible;
- // client.expect.element('#interval-days').to.be.visible;
- // client.expect.element('#interval-hours').to.be.visible;
- // client.expect.element('#interval-minutes').to.be.visible;
- // client.expect.element('#interval-custom-static').to.be.visible;
- // client.end();
- // },
+
+ // verify interval state restored from permalink
+ 'Interval state of HOUR restored from permalink': client => {
+ client.url(client.globals.url + localQuerystrings.subdailyLayerIntervalTimescale);
+ client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
+ client
+ .useCss()
+ .moveToElement('#timeline-interval-btn-container', 0, 0)
+ .waitForElementVisible('#current-interval', TIME_LIMIT);
+ client.assert.containsText('#current-interval', '1 HOUR');
+ },
+
// verify custom interval widget panel opens
- 'Custom interval widget opens on selecting custom': function(client) {
+ 'Custom interval widget opens on selecting custom': client => {
client
.useCss()
.moveToElement('#timeline-interval-btn-container', 0, 0)
@@ -73,8 +78,9 @@ module.exports = {
client.expect.element('.custom-interval-widget').to.be.visible;
client.end();
},
+
// verify changing custom interval changes current interval and how many time units change with date arrows
- 'Select custom interval changes current interval and changes date by current interval': function(client) {
+ 'Select custom interval changes current interval and changes date by current interval': client => {
client.url(client.globals.url + localQuerystrings.knownDate);
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.attributeContains(dateSelectorDayInput, 'value', '22');
@@ -92,40 +98,43 @@ module.exports = {
client.assert.containsText('#current-interval', '2 DAY');
client.assert.attributeContains(dateSelectorDayInput, 'value', '20');
},
+
// verify default day timescale zoom level
- 'Timescale zoom level defaults to DAY': function(client) {
+ 'Timescale zoom level defaults to DAY': client => {
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.containsText('#current-zoom', 'DAY');
},
- // verify default year, month, day, and custom intervals
- 'Timescale zoom default year, month, day, and custom available': function(client) {
+
+ // verify subdaily default year, month, day, hour, minute, and custom intervals
+ 'Timescale zoom subdaily default year, month, day, hour, minute, and custom intervals': client => {
+ client.url(client.globals.url + localQuerystrings.subdailyLayerIntervalTimescale);
+ client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client
.useCss()
- .moveToElement('#zoom-btn-container-axis', 0, 0)
+ .moveToElement('#current-zoom', 0, 0)
.waitForElementVisible('#zoom-years', TIME_LIMIT);
client.expect.element('#zoom-years').to.be.visible;
client.expect.element('#zoom-months').to.be.visible;
client.expect.element('#zoom-days').to.be.visible;
+ client.expect.element('#zoom-hours').to.be.visible;
+ client.expect.element('#zoom-minutes').to.be.visible;
+ client.end();
+ },
+
+ // verify timescale zoom state restored from permalink
+ 'Timescale zoom HOUR restored from permalink': client => {
+ client.url(client.globals.url + localQuerystrings.subdailyLayerIntervalTimescale);
+ client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
+ client
+ .useCss()
+ .waitForElementVisible('#current-zoom', TIME_LIMIT);
+ client.assert.containsText('#current-zoom', 'HOUR');
client.end();
},
- // verify subdaily default year, month, day, hour, minute, and custom intervals
- // 'Interval subdaily default year, month, day, hour, minute, and custom available': function(client) {
- // client
- // .useCss()
- // .moveToElement('#current-zoom', 0, 0)
- // .waitForElementVisible('#zoom-years', TIME_LIMIT);
-
- // client.expect.element('#zoom-years').to.be.visible;
- // client.expect.element('#zoom-months').to.be.visible;
- // client.expect.element('#zoom-days').to.be.visible;
- // client.expect.element('#zoom-hours').to.be.visible;
- // client.expect.element('#zoom-minutes').to.be.visible;
- // client.end();
- // },
// verify change date using left/right date arrows
- 'Change date using left/right arrows': function(client) {
+ 'Change date using left/right arrows': client => {
client.url(client.globals.url + localQuerystrings.knownDate);
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.attributeContains(dateSelectorDayInput, 'value', '22');
@@ -134,23 +143,27 @@ module.exports = {
client.click('#right-arrow-group');
client.assert.attributeContains(dateSelectorDayInput, 'value', '22');
},
+
// verify default left arrow enabled since loaded on current day
- 'Left timeline arrow will not be disabled': function(client) {
+ 'Left timeline arrow will not be disabled': client => {
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.cssClassNotPresent('#left-arrow-group', 'button-disabled');
},
+
// verify default right arrow disabled since loaded on current day
- 'Right timeline arrow will be disabled': function(client) {
+ 'Right timeline arrow will be disabled': client => {
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.cssClassPresent('#right-arrow-group', 'button-disabled');
},
+
// verify valid right arrow enabled since NOT loaded on current day
- 'Right timeline arrow will not be disabled': function(client) {
+ 'Right timeline arrow will not be disabled': client => {
client.url(client.globals.url + localQuerystrings.knownDate);
client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT);
client.assert.cssClassNotPresent('#right-arrow-group', 'button-disabled');
},
- after: function(client) {
+
+ after: client => {
client.end();
}
};
diff --git a/e2e/reuseables/querystrings.js b/e2e/reuseables/querystrings.js
index 04ddd2736..520a674a7 100644
--- a/e2e/reuseables/querystrings.js
+++ b/e2e/reuseables/querystrings.js
@@ -19,6 +19,9 @@ module.exports = {
// date
knownDate: '?t=2019-07-22',
+ // timeline
+ subdailyLayerIntervalTimescale: '?t=2019-10-04-T09%3A46%3A32Z&z=4&i=4&l=GOES-East_ABI_Band2_Red_Visible,Reference_Labels(hidden),Reference_Features(hidden),Coastlines,VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor',
+
// events
eventsTabActive: '?e=true',
mockEvents: '?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=2018-05-02-T00%3A00%3A00Z&z=3&v=-409.00147812273656,-205.62883007565202,270.5880270080828,219.11461063111003&e=true&mockEvents=20170530',
diff --git a/web/js/modules/date/util.js b/web/js/modules/date/util.js
index bc084a8a0..72baba5ae 100644
--- a/web/js/modules/date/util.js
+++ b/web/js/modules/date/util.js
@@ -1,7 +1,6 @@
import util from '../../util/util';
import { each as lodashEach, get } from 'lodash';
import update from 'immutability-helper';
-import { timeScaleFromNumberKey, timeScaleToNumberKey } from './constants';
export function serializeDate(date) {
return (
@@ -63,11 +62,6 @@ export function mapLocationToDateState(
config
) {
const appNow = get(state, 'date.appNow');
- const interval = get(stateFromLocation, 'date.interval') || get(state, 'date.interval');
- const selectedZoom = get(stateFromLocation, 'date.selectedZoom') || get(state, 'date.selectedZoom');
- const isCustom = get(stateFromLocation, 'date.customSelected') || get(state, 'date.customSelected');
- const timeScaleChangeUnit = timeScaleFromNumberKey[interval];
- const timeScale = timeScaleFromNumberKey[selectedZoom.toString()];
// legacy time permalink
if (parameters.time && !parameters.t && appNow) {
@@ -80,18 +74,5 @@ export function mapLocationToDateState(
});
}
}
- // update interval selectedzoom level as default interval
- if (timeScale !== timeScaleChangeUnit && !isCustom) {
- const defaultValues = {
- interval,
- delta: 1,
- customSelected: false
- };
- stateFromLocation = update(stateFromLocation, {
- date: {
- $merge: defaultValues
- }
- });
- }
return stateFromLocation;
}