Interactive interface for browsing global, full-resolution satellite imagery
fix a few bugs and get e2e tests passing
Jason Kentdbc7970fb2b4
diff --git a/e2e/features/animation/animation-test.js b/e2e/features/animation/animation-test.jsindex 5016c5ba4..c791a57f8 100644--- a/e2e/features/animation/animation-test.js+++ b/e2e/features/animation/animation-test.js@@ -4,19 +4,21 @@ const localQuerystrings = require('../../reuseables/querystrings.js');const TIME_LIMIT = 10000;module.exports = {- before(client) {+ beforeEach(client) {reuseables.loadAndSkipTour(client, TIME_LIMIT);},/*** Clicking the animation widget button* Opens the widget*/- 'Toggling Animation Mode': function(client) {- client.expect.element(localSelectors.animationWidget).to.not.be.present;- client.useCss().click(localSelectors.animationButton);- client.waitForElementVisible(localSelectors.animationWidget, TIME_LIMIT);+ 'Toggling Animation Mode': (client) => {+ client.waitForElementVisible(localSelectors.dragger, TIME_LIMIT, (el) => {+ client.expect.element(localSelectors.animationWidget).to.not.be.present;+ client.useCss().click(localSelectors.animationButton);+ client.waitForElementVisible(localSelectors.animationWidget, TIME_LIMIT);+ });},- 'Opening custom interval widget': function(client) {+ 'Opening custom interval widget': (client) => {client.url(client.globals.url + localQuerystrings.activeAnimationWidget);client.waitForElementVisible(localSelectors.animationButton,@@ -38,7 +40,7 @@ module.exports = {* Moving the range selector updates the selected range* in the animation widget date selector*/- 'Changing date range of animation': function(client) {+ 'Changing date range of animation': (client) => {client.url(client.globals.url + localQuerystrings.activeAnimationWidget);// Test Permalink opens widgetclient.waitForElementVisible(@@ -58,9 +60,9 @@ module.exports = {.moveToElement('.timeline-dragger', 0, 0).mouseButtonUp(0).pause(2000);- client.getValue('#day-animation-widget-start', function(result) {+ client.getValue('#day-animation-widget-start', (result) => {const newDay = result.value;- this.assert.notEqual(startDay, newDay);+ client.assert.notEqual(startDay, newDay);});});},@@ -70,7 +72,7 @@ module.exports = {/*** Changing animation time interval*/- 'Changing animation time interval': function(client) {+ 'Changing animation time interval': (client) => {// Can't use moveToElement twice with same elements// because of selenium catching.// Loading a different Url fixed the problemdiff --git a/e2e/features/events/events-test.js b/e2e/features/events/events-test.jsindex f07aeb4a8..74276ffe1 100644--- a/e2e/features/events/events-test.js+++ b/e2e/features/events/events-test.js@@ -18,9 +18,7 @@ module.exports = {before(client) {reuseables.loadAndSkipTour(client, TIME_LIMIT);},- 'Make sure that 4 fire layers are not present in layer list: use mock': function(- client,- ) {+ 'Make sure that 4 fire layers are not present in layer list: use mock': (client) => {client.url(client.globals.url + localQuerystrings.mockEvents);client.waitForElementVisible('#sidebar-event-EONET_3931',@@ -37,10 +35,10 @@ module.exports = {},);},- 'Click fire event': function(client) {+ 'Click fire event': (client) => {client.click('#sidebar-event-EONET_3931');},- 'Check that 4 fire layers are now present': function(client) {+ 'Check that 4 fire layers are now present': (client) => {client.click(layersTab);client.waitForElementPresent('#active-VIIRS_SNPP_Thermal_Anomalies_375m_Night',@@ -55,25 +53,21 @@ module.exports = {},);},- 'Use Mock to make sure appropriate number of event markers are appended to map': function(- client,- ) {+ 'Use Mock to make sure appropriate number of event markers are appended to map': (client) => {client.url(client.globals.url + localQuerystrings.mockEvents);client.waitForElementVisible(listOfEvents, TIME_LIMIT, () => {- client.assert.elementCountEquals(eventIcons, 9);+ client.expect.elements(eventIcons).count.to.equal(9);});},- 'On events tab click events list is loaded': function(client) {+ 'On events tab click events list is loaded': (client) => {client.url(client.globals.url + localQuerystrings.mockEvents);client.waitForElementVisible(listOfEvents, TIME_LIMIT);},- 'Use Mock Ensure number of event track points is correct and event markers and tabs are not visible when layer tab is clicked': function(- client,- ) {+ 'Use Mock Ensure number of event track points is correct and event markers and tabs are not visible when layer tab is clicked': (client) => {const globalSelectors = client.globals.selectors;client.click(firstEvent);client.waitForElementVisible(trackMarker, TIME_LIMIT, () => {- client.assert.elementCountEquals(trackMarker, 5);+ client.expect.elements(trackMarker).count.to.equal(5);client.click(globalSelectors.dataTab).pause(2000);client.expect.element(trackMarker).to.not.be.present;client.expect.element(eventIcons).to.not.be.present;@@ -82,7 +76,7 @@ module.exports = {client.expect.element(eventIcons).to.be.present;});},- 'Click Events tab and select an Event from the List': function(client) {+ 'Click Events tab and select an Event from the List': (client) => {client.url(client.globals.url + localQuerystrings.mockEvents);client.waitForElementVisible(listOfEvents, TIME_LIMIT, () => {client.click(firstEvent);@@ -91,16 +85,14 @@ module.exports = {});});},- 'Verify that Url is updated': function(client) {+ 'Verify that Url is updated': (client) => {client.assert.urlParameterEquals('l', true).assert.urlParameterEquals('t', true).assert.urlParameterEquals('v', true).assert.urlParameterEquals('e', true);},- 'Verify Events may not be visible at all times is visible ': function(- client,- ) {+ 'Verify Events may not be visible at all times is visible ': (client) => {const globalSelectors = client.globals.selectors;client.waitForElementVisible(globalSelectors.notifyMessage,@@ -113,7 +105,7 @@ module.exports = {},);},- 'Clicking event notifcation opens explanation in dialog': function(client) {+ 'Clicking event notifcation opens explanation in dialog': (client) => {const globalSelectors = client.globals.selectors;client.click(globalSelectors.notifyMessage).pause(2000);@@ -127,11 +119,11 @@ module.exports = {client.expect.element(globalSelectors.notificationDismissButton).to.not.be.present;},- 'Clicking selected event deselects event': function(client) {+ 'Clicking selected event deselects event': (client) => {client.click(selectedFirstEvent).pause(500);client.expect.element(selectedFirstEvent).to.not.be.present;},- 'Check that clicking eternal link opens in new window': function(client) {+ 'Check that clicking eternal link opens in new window': (client) => {client.click(firstEvent).pause(500);client.windowHandles((tabs) => {client.assert.equal(tabs.value.length, 1);diff --git a/e2e/features/measure/measure-test.js b/e2e/features/measure/measure-test.jsindex 9d7e48e60..40ac792ae 100644--- a/e2e/features/measure/measure-test.js+++ b/e2e/features/measure/measure-test.js@@ -18,13 +18,13 @@ module.exports = {before(client) {reuseables.loadAndSkipTour(client, TIME_LIMIT);},- 'Clicking the measure button opens the menu': function(client) {+ 'Clicking the measure button opens the menu': (client) => {client.expect.element(measureMenu).to.not.be.present;client.useCss().click(measureBtn);client.waitForElementVisible(measureMenu, TIME_LIMIT);client.pause(300);},- 'Initiating a measurement causes an alert to show and sidebar to collapse': function(client) {+ 'Initiating a measurement causes an alert to show and sidebar to collapse': (client) => {client.useCss().click(measureDistanceBtn);client.waitForElementVisible('#measurement-alert', TIME_LIMIT);client.useCss().assert.elementPresent(sidebarContainer);@@ -35,7 +35,7 @@ module.exports = {);client.pause(300);},- 'Cancelling a measurement causes an alert to disappear and sidebar to expand': function(client) {+ 'Cancelling a measurement causes an alert to disappear and sidebar to expand': (client) => {if (client.options.desiredCapabilities.browserName !== 'firefox') { // right click doesn't work in firefoxclient.useCss().click(measureBtn);client.waitForElementVisible(measureMenu, TIME_LIMIT, (el) => {@@ -54,7 +54,7 @@ module.exports = {});}},- 'Creating a distance measurement causes a tooltip to show': function(client) {+ 'Creating a distance measurement causes a tooltip to show': (client) => {client.useCss().click(measureBtn);client.waitForElementVisible(measureMenu, TIME_LIMIT, (el) => {client.useCss().click(measureDistanceBtn);@@ -70,7 +70,7 @@ module.exports = {client.waitForElementVisible(measurementTooltip, TIME_LIMIT);});},- 'Creating a area measurement causes a tooltip to show': function(client) {+ 'Creating a area measurement causes a tooltip to show': (client) => {client.useCss().click(measureBtn);client.waitForElementVisible(measureMenu, TIME_LIMIT, (el) => {client.useCss().click(measureAreaBtn);@@ -90,7 +90,7 @@ module.exports = {client.waitForElementVisible(measurementTooltip, TIME_LIMIT);});},- 'Toggling unit of measure updates the measurement value': async function(client) {+ 'Toggling unit of measure updates the measurement value': async(client) => {if (client.options.desiredCapabilities.browserName !== 'firefox') { // client.elements() returns different values for firefoxclient.click(measureBtn);await client.waitForElementVisible(measureMenu, TIME_LIMIT);@@ -104,7 +104,7 @@ module.exports = {});}},- 'Clearing a measurements removes all tooltips': function(client) {+ 'Clearing a measurements removes all tooltips': (client) => {if (client.options.desiredCapabilities.browserName !== 'firefox') { // client.elements() returns different values for firefoxclient.waitForElementVisible(measureMenu, TIME_LIMIT, (el) => {client.useCss().click(clearMeasurementsBtn);diff --git a/e2e/features/timeline/date-selector-test.js b/e2e/features/timeline/date-selector-test.jsindex 431274ec5..5972e9537 100644--- a/e2e/features/timeline/date-selector-test.js+++ b/e2e/features/timeline/date-selector-test.js@@ -39,11 +39,13 @@ module.exports = {// verify default left arrow enabled since loaded on current day'Left timeline arrow will not be disabled by default': (client) => {+ reuseables.loadAndSkipTour(client, 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 by default': (client) => {+ reuseables.loadAndSkipTour(client, TIME_LIMIT);client.assert.cssClassPresent('#right-arrow-group', 'button-disabled');},diff --git a/e2e/reuseables/normalize-viewport.js b/e2e/reuseables/normalize-viewport.jsindex 40d822b53..c57477123 100644--- a/e2e/reuseables/normalize-viewport.js+++ b/e2e/reuseables/normalize-viewport.js@@ -2,12 +2,18 @@ module.exports = {normalizeViewport(client, width, height) {client.windowSize('current', width, height);client- .execute((width, height) => ({- width: width === window.innerWidth ? 0 : window.outerWidth - window.innerWidth,- height: height === window.innerHeight ? 0 : window.outerHeight - window.innerHeight,- }), [width, height], (result) => {- const padding = result.value;- client.windowSize('current', width + padding.width, height + padding.height);- });+ .execute(+ (width, height) => ({+ width: width === window.innerWidth ? 0 : window.outerWidth - window.innerWidth,+ height: height === window.innerHeight ? 0 : window.outerHeight - window.innerHeight,+ }),+ [width, height],+ (result) => {+ const padding = result.value;+ const newHeight = padding.height ? height + padding.height : height;+ const newWidth = padding.width ? width + padding.width : width;+ client.windowSize('current', newWidth, newHeight);+ },+ );},};diff --git a/web/js/app.js b/web/js/app.jsindex d296e7e85..77af2f5e3 100644--- a/web/js/app.js+++ b/web/js/app.js@@ -6,6 +6,7 @@ import googleTagManager from 'googleTagManager';// Utilsimport { calculateResponsiveState } from 'redux-responsive';import util from './util/util';+// eslint-disable-next-line import/no-named-as-defaultimport MapInteractions from './containers/map-interactions';// Toolbarimport Toolbar from './containers/toolbar';diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.jsindex 7134071f9..aba7318e4 100644--- a/web/js/components/timeline/timeline-axis/timeline-axis.js+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js@@ -94,7 +94,8 @@ class TimelineAxis extends Component {// this is the middle on the axis based on number of tiles determined from width of axis and gridwidth// this is used to determine position and also to "reset" position after an axis drag has stopped- const midPoint = numberOfVisibleTiles / (2 * gridWidth) - (gridWidth * gridNumber) / 2;+ // eslint-disable-next-line no-mixed-operators+ const midPoint = numberOfVisibleTiles / 2 * gridWidth - gridWidth * gridNumber / 2;// horizontal scroll will disable this, so use frontDate in that caselet hoverTimeString = hoverTime || this.props.draggerTimeState;diff --git a/web/js/map/measure/ui.js b/web/js/map/measure/ui.jsindex 071c48892..4507470ee 100644--- a/web/js/map/measure/ui.js+++ b/web/js/map/measure/ui.js@@ -176,13 +176,13 @@ export function measure(map, mapUiEvents, store) {* current settings of unit of measurement*/function recalculateAllMeasurements() {- Object.keys(allMeasureTooltips.forEach((id) => {+ Object.keys(allMeasureTooltips).forEach((id) => {const geomForTooltip = allGeometries[id];const tooltipElement = allMeasureTooltips[id].element.children[0];tooltipElement.innerHtml = setMeasurementTooltip(geomForTooltip, tooltipElement);geomForTooltip.changed();allMeasureTooltips[id].setOffset([0, -7]);- }));+ });}/**diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.jsindex 904879b11..f7afef6c4 100644--- a/web/js/modules/layers/util.js+++ b/web/js/modules/layers/util.js@@ -183,6 +183,7 @@ export function datesinDateRanges(def, date) {if (dateArray.length > 0) {// prevent earlier dates from being added after later dates while building dateArrayif (day < dateArray[dateArray.length - 1]) {+ // eslint-disable-next-line no-continuecontinue;}}