Interactive interface for browsing global, full-resolution satellite imagery
Update e2e selectors as a result of jquery-ui update #1119
Benjamin King763006484590
diff --git a/e2e/features/animations/gif-test.js b/e2e/features/animations/gif-test.jsindex 609de6fe5..a40a516b2 100644--- a/e2e/features/animations/gif-test.js+++ b/e2e/features/animations/gif-test.js@@ -3,61 +3,110 @@ const localSelectors = require('./selectors.js');const localQuerystrings = require('./querystrings.js');const TIME_LIMIT = 30000; // Sometimes takes a while to generate GIFsconst askDialog = '.wv-dialog-ask';-const askDialogOkButton = 'body > div.ui-dialog.ui-widget.ui-widget-content.ui-corner-all.ui-front.ui-dialog-buttons.ui-draggable > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(2) > span';+const paletteDialogOkButton =+ '.gif-palette-warning .ui-dialog-buttonset > .ui-button:nth-child(2)';+const rotationDialogOkButton =+ '.gif-rotation-warning .ui-dialog-buttonset > .ui-button:nth-child(2)';+const articeRotationResetButton = '#wv-map-arctic .wv-map-reset-rotation';module.exports = {- before: function (client) {+ before: function(client) {reuseables.loadAndSkipTour(client, TIME_LIMIT);},'Downloading GIF when custom colormap is activated': function(client) {- if (client.options.desiredCapabilities.browser !== 'ie') { // Custom colormaps down exist in IE+ if (client.options.desiredCapabilities.browser !== 'ie') {+ // Custom colormaps down exist in IEclient.url(client.globals.url + localQuerystrings.activeCustomColormap);- client.waitForElementVisible(localSelectors.animationWidget, TIME_LIMIT, function() {- client.click(localSelectors.createGifIcon)- .pause(1000);- client.click(localSelectors.gifDownloadIcon)- .pause(1000);- client.expect.element(askDialog).to.be.present;- client.useCss().click(askDialogOkButton);- client.waitForElementVisible(localSelectors.gifResults, TIME_LIMIT, function() {- client.click(localSelectors.gifResultsCloseButton);- client.expect.element(localSelectors.gifResults).to.not.be.present;- client.waitForElementVisible(localSelectors.animationWidget, TIME_LIMIT);- });- });+ client.waitForElementVisible(+ localSelectors.animationWidget,+ TIME_LIMIT,+ function() {+ client.click(localSelectors.createGifIcon).pause(1000);+ client.click(localSelectors.gifDownloadIcon).pause(1000);+ client.expect.element(askDialog).to.be.present;+ client.useCss().click(paletteDialogOkButton);+ client.waitForElementVisible(+ localSelectors.gifResults,+ TIME_LIMIT,+ function() {+ client.click(localSelectors.gifResultsCloseButton);+ client.expect.element(localSelectors.gifResults).to.not.be+ .present;+ client.waitForElementVisible(+ localSelectors.animationWidget,+ TIME_LIMIT+ );+ }+ );+ }+ );}},'Downloading GIF when polar projection is rotated': function(client) {- const globalSelectors = client.globals.selectors;- client.url(client.globals.url + localQuerystrings.animationProjectionRotated);- client.waitForElementVisible(localSelectors.animationWidget, TIME_LIMIT, function() {- client.click(localSelectors.createGifIcon)- .pause(1000);- client.click(localSelectors.gifDownloadIcon)- .pause(1000);- client.useCss().assert.containsText(globalSelectors.clearRotationButton, '-18');- client.expect.element(askDialog).to.be.present;- client.useCss().click(askDialogOkButton)- .pause(1000);- client.useCss().assert.containsText(globalSelectors.clearRotationButton, '0');- });+ client.url(+ client.globals.url + localQuerystrings.animationProjectionRotated+ );+ client.waitForElementVisible(+ localSelectors.animationWidget,+ TIME_LIMIT,+ function() {+ client.click(localSelectors.createGifIcon).pause(1000);+ client.click(localSelectors.gifDownloadIcon).pause(1000);+ client.useCss().assert.containsText(articeRotationResetButton, '-18');+ client.expect.element(askDialog).to.be.present;+ client+ .useCss()+ .click(rotationDialogOkButton)+ .pause(1000);+ client.useCss().assert.containsText(articeRotationResetButton, '0');+ }+ );},- 'GIF selection preview is Accurate and selections that are too high disable GIF download': function(client) {+ 'GIF selection preview is Accurate and selections that are too high disable GIF download': function(+ client+ ) {client.url(client.globals.url + localQuerystrings.activeAnimationWidget);- client.waitForElementVisible(localSelectors.animationWidget, TIME_LIMIT, function() {- client.click(localSelectors.createGifIcon)- .pause(1000);- client.waitForElementVisible(localSelectors.createGifButton, TIME_LIMIT, function() {- client.useCss().assert.containsText(localSelectors.gifPreviewStartDate, '2018-03-28');- client.useCss().assert.containsText(localSelectors.gifPreviewEndDate, '2018-04-04');- client.useCss().assert.containsText(localSelectors.gifPreviewFrameRateValue, '3 Frames Per Second');- client.assert.ok('#wv-checkbox-gif'); // checkbox is checked- client.click(localSelectors.gifPreviewEndResolutionOption250)- .pause(1000);- client.assert.value(localSelectors.gifPreviewEndResolutionSelector, '1');- client.expect.element(localSelectors.gifDownloadButton).to.not.be.enabled;- });- });+ client.waitForElementVisible(+ localSelectors.animationWidget,+ TIME_LIMIT,+ function() {+ client.click(localSelectors.createGifIcon).pause(1000);+ client.waitForElementVisible(+ localSelectors.createGifButton,+ TIME_LIMIT,+ function() {+ client+ .useCss()+ .assert.containsText(+ localSelectors.gifPreviewStartDate,+ '2018-03-28'+ );+ client+ .useCss()+ .assert.containsText(+ localSelectors.gifPreviewEndDate,+ '2018-04-04'+ );+ client+ .useCss()+ .assert.containsText(+ localSelectors.gifPreviewFrameRateValue,+ '3 Frames Per Second'+ );+ client.assert.ok('#wv-checkbox-gif'); // checkbox is checked+ client+ .click(localSelectors.gifPreviewEndResolutionOption250)+ .pause(1000);+ client.assert.value(+ localSelectors.gifPreviewEndResolutionSelector,+ '1'+ );+ client.expect.element(localSelectors.gifDownloadButton).to.not.be+ .enabled;+ }+ );+ }+ );},after: function(client) {client.end();diff --git a/e2e/globals.js b/e2e/globals.jsindex e6b59f5db..09ec4d331 100644--- a/e2e/globals.js+++ b/e2e/globals.js@@ -2,16 +2,16 @@ module.exports = {url: 'http://localhost:3000/',production: 'https://worldview.earthdata.nasa.gov/',selectors: {- 'eventsTab': '#events-sidebar-tab',- 'dataTab': '#download-sidebar-tab',- 'yearlyResolutionTooltip': '#zoom-years',- 'timelineSetToYears': '#current-zoom.zoom-years',- 'modalCloseButton': '.ui-dialog.ui-draggable.ui-resizable .ui-dialog-titlebar-close',- 'notificationDismissButton': '.ui-dialog.notify-alert .fa-times',- 'overlayLayerItems': '#overlays li',- 'resolutionTooltip': '#zoom-btn-container',- 'notifyMessage': '.notify-alert .notify-message',- 'clearRotationButton': '#wv-map-arctic > button.wv-map-reset-rotation.wv-map-zoom.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only > span'+ eventsTab: '#events-sidebar-tab',+ dataTab: '#download-sidebar-tab',+ yearlyResolutionTooltip: '#zoom-years',+ timelineSetToYears: '#current-zoom.zoom-years',+ modalCloseButton:+ '.ui-dialog.ui-draggable.ui-resizable .ui-dialog-titlebar-close',+ notificationDismissButton: '.ui-dialog.notify-alert .fa-times',+ overlayLayerItems: '#overlays li',+ resolutionTooltip: '#zoom-btn-container',+ notifyMessage: '.notify-alert .notify-message'},delay: 3000 // Acceptable delay in ms between performing actions and seeing results};diff --git a/web/js/animation/gif.js b/web/js/animation/gif.jsindex 8a137ce47..3262e0f82 100644--- a/web/js/animation/gif.js+++ b/web/js/animation/gif.js@@ -395,6 +395,7 @@ export function animationGif(models, config, ui) {wvui.ask({header: 'Notice',message: PALETTE_WARNING,+ class: 'gif-palette-warning',onOk: function() {models.palettes.clear();getGif();@@ -411,6 +412,7 @@ export function animationGif(models, config, ui) {wvui.ask({header: 'Notice',message: GRATICULE_WARNING,+ class: 'gif-graticule-warning',onOk: function() {models.layers.setVisibility('Graticule', false);self.getGif();@@ -422,6 +424,7 @@ export function animationGif(models, config, ui) {wvui.ask({header: 'Reset rotation?',message: ROTATE_WARNING,+ class: 'gif-rotation-warning',onOk: function() {resetRotation();// Let rotation finish before reselecting can occurdiff --git a/web/js/ui/ui.js b/web/js/ui/ui.jsindex fd84aae4f..f75b8ae8c 100644--- a/web/js/ui/ui.js+++ b/web/js/ui/ui.js@@ -4,7 +4,7 @@ import loadingIndicator from './indicator';import uiInfo from './info';import mouse from './mouse';-export default (function (self) {+export default (function(self) {// Export other ui methodsself.loadingIndicator = loadingIndicator;self.info = uiInfo;@@ -20,19 +20,20 @@ export default (function (self) {** @param {Exception} cause The exception object that caused the error*/- self.error = function () {+ self.error = function() {console.error.apply(console, arguments);self.notify(- '<div class=\'error-header\'>' +- '<i class=\'error-icon fa fa-exclamation-triangle fa-3x\'></i>' +- 'An unexpected error has occurred' +- '</div>' +- '<div class=\'error-body\'>Please reload the page and try ' +- 'again. If you continue to have problems, contact us at ' +- '<a href=\'mailto:@MAIL@\'>' +- '@MAIL@</a>' +- '</div>', 'Error'+ "<div class='error-header'>" ++ "<i class='error-icon fa fa-exclamation-triangle fa-3x'></i>" ++ 'An unexpected error has occurred' ++ '</div>' ++ "<div class='error-body'>Please reload the page and try " ++ 'again. If you continue to have problems, contact us at ' ++ "<a href='mailto:@MAIL@'>" ++ '@MAIL@</a>' ++ '</div>',+ 'Error');};@@ -46,11 +47,12 @@ export default (function (self) {** @param [title="Notice"] {string} Title for the dialog box.*/- self.notify = function (message, title, width, callback) {+ self.notify = function(message, title, width, callback) {var $dialog = self.getDialog();title = title || 'Notice';width = width || 300;- $dialog.html(message)+ $dialog+ .html(message).dialog({title: title,width: width,@@ -66,39 +68,44 @@ export default (function (self) {},closeText: ''})- .on('dialogclose', function () {- $(this)- .off('dialogclose');+ .on('dialogclose', function() {+ $(this).off('dialogclose');if (callback) {callback();}});};- self.alert = function (body, title, size, glyph, closeFn) {+ self.alert = function(body, title, size, glyph, closeFn) {var $message = $('<span/>', { class: 'notify-message' });var $icon = $('<i/>', { class: 'fa fa-' + glyph + ' fa-1x', title: title });- var $messageWrapper = $('<div/>').click(function () {- self.notify(body, title, size);- }).append($icon).append($message);+ var $messageWrapper = $('<div/>')+ .click(function() {+ self.notify(body, title, size);+ })+ .append($icon)+ .append($message);var $close = $('<i/>', { class: 'fa fa-times fa-1x' }).click(closeFn);- var $alert = $('<div/>').append($close).append($messageWrapper).dialog({- autoOpen: false,- resizable: false,- height: 40,- width: 420,- draggable: false,- show: {- effect: 'fade',- duration: 400- },- hide: {- effect: 'fade',- duration: 200- },- dialogClass: 'no-titlebar notify-alert',- closeText: ''- });+ var $alert = $('<div/>')+ .append($close)+ .append($messageWrapper)+ .dialog({+ autoOpen: false,+ resizable: false,+ height: 40,+ width: 420,+ draggable: false,+ show: {+ effect: 'fade',+ duration: 400+ },+ hide: {+ effect: 'fade',+ duration: 200+ },+ dialogClass: 'no-titlebar notify-alert',+ closeText: ''+ });$message.empty().append(title);return $alert;};@@ -126,34 +133,34 @@ export default (function (self) {* @parma [spec.onCancel] {function} Function to execute when the Cancel* button is pressed. If not specified, the dialog box simply closes.*/- self.ask = function (spec) {+ self.ask = function(spec) {var $dialog = self.getDialog('wv-dialog-ask');var cancelText = spec.cancelButton || 'Cancel';var okText = spec.okButton || 'OK';var buttons = {};- buttons[cancelText] = function () {- $(this)- .dialog('close');+ buttons[cancelText] = function() {+ $(this).dialog('close');if (spec.onCancel) {spec.onCancel();}};- buttons[okText] = function () {- $(this)- .dialog('close');+ buttons[okText] = function() {+ $(this).dialog('close');if (spec.onOk) {spec.onOk();}};- $dialog.dialog({- title: spec.header || 'Notice',- resizable: false,- modal: true,- buttons: buttons,- closeText: ''- })+ $dialog+ .dialog({+ title: spec.header || 'Notice',+ resizable: false,+ modal: true,+ buttons: buttons,+ dialogClass: spec.class || '',+ closeText: ''+ }).html(spec.message)- .on('dialogclose', function () {+ .on('dialogclose', function() {if (spec.onCancel) {spec.onCancel();}@@ -171,26 +178,27 @@ export default (function (self) {* "The <featureName> feature is not supported...". Otherwise it will* state "This feature..."*/- self.unsupported = function (featureName) {+ self.unsupported = function(featureName) {var prefix;if (!featureName) {prefix = 'This feature';} else {prefix = 'The ' + featureName + ' feature';}- self.notify(prefix + ' is not supported with your web ' +- 'browser. Upgrade or try again in a different browser.');+ self.notify(+ prefix ++ ' is not supported with your web ' ++ 'browser. Upgrade or try again in a different browser.'+ );};- var getComponent = function (marker) {- var $element = $('<div></div>')- .addClass(marker);- $('body')- .append($element);+ var getComponent = function(marker) {+ var $element = $('<div></div>').addClass(marker);+ $('body').append($element);return $element;};- var closeComponent = function (marker, fnClose) {+ var closeComponent = function(marker, fnClose) {var selector = '.' + marker;var $element = $(selector);if ($element.length !== 0) {@@ -198,7 +206,7 @@ export default (function (self) {}};- var closeDialog = function ($element) {+ var closeDialog = function($element) {if ($element.length !== 0) {if ($element.dialog) {$element.dialog('close');@@ -207,55 +215,50 @@ export default (function (self) {}};- var closeMenu = function ($element) {+ var closeMenu = function($element) {if ($element.length !== 0) {$element.remove();}};- self.close = function () {+ self.close = function() {closeComponent('wv-dialog', closeDialog);closeComponent('wv-menu', closeMenu);};- self.getDialog = function (marker) {+ self.getDialog = function(marker) {self.close(marker);return getComponent(marker || 'wv-dialog', closeDialog);};- self.getMenu = function (marker) {+ self.getMenu = function(marker) {self.close();return getComponent(marker || 'wv-menu', closeMenu);};- self.closeDialog = function () {+ self.closeDialog = function() {self.close();};- self.positionMenu = function ($menuItems, pos) {- var position = function () {- $menuItems.menu()- .position(pos);+ self.positionMenu = function($menuItems, pos) {+ var position = function() {+ $menuItems.menu().position(pos);};position();- $(window)- .resize(position);- $menuItems.on('hide', function () {- $(window)- .off('resize', position);+ $(window).resize(position);+ $menuItems.on('hide', function() {+ $(window).off('resize', position);});};- self.positionDialog = function ($dialog, pos) {- var position = function () {+ self.positionDialog = function($dialog, pos) {+ var position = function() {$dialog.dialog('option', 'position', pos);};position();- $(window)- .resize(position);- $dialog.on('dialogclose', function () {- $(window)- .off('resize', position);+ $(window).resize(position);+ $dialog.on('dialogclose', function() {+ $(window).off('resize', position);});};