Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix image download e2e tests

Benjamin King17692f1fc80a
diff --git a/e2e/features/image-download/formats-test.js b/e2e/features/image-download/formats-test.js
index 21a1a61d1..cb9c6d9b6 100644
--- a/e2e/features/image-download/formats-test.js
+++ b/e2e/features/image-download/formats-test.js
@@ -22,9 +22,14 @@ module.exports = {
bookmark(c, startParams);
openImageDownloadPanel(c);
clickDownload(c);
- c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ c.pause(2000);
+ c.expect
+ .element('#wv-image-download-url')
+ .to.have.attribute('url')
.and.to.contain('FORMAT=image/jpeg');
- c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ c.expect
+ .element('#wv-image-download-url')
+ .to.have.attribute('url')
.and.not.to.contain('WORLDFILE');
closeImageDownloadPanel(c);
},
@@ -33,7 +38,10 @@ module.exports = {
openImageDownloadPanel(c);
c.click('#wv-image-worldfile option[value="true"]');
clickDownload(c);
- c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ c.pause(2000);
+ c.expect
+ .element('#wv-image-download-url')
+ .to.have.attribute('url')
.and.to.contain('WORLDFILE=true');
c.click('#wv-image-worldfile option[value="false"]');
closeImageDownloadPanel(c);
@@ -43,7 +51,9 @@ module.exports = {
openImageDownloadPanel(c);
c.click('#wv-image-format option[value="image/png"]');
clickDownload(c);
- c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ c.expect
+ .element('#wv-image-download-url')
+ .to.have.attribute('url')
.contain('FORMAT=image/png');
closeImageDownloadPanel(c);
},
@@ -52,7 +62,9 @@ module.exports = {
switchProjection(c, 'arctic');
openImageDownloadPanel(c);
clickDownload(c);
- c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ c.expect
+ .element('#wv-image-download-url')
+ .to.have.attribute('url')
.contain('FORMAT=image/png');
closeImageDownloadPanel(c);
},
@@ -60,10 +72,17 @@ module.exports = {
'Switch to geographic, select KMZ, switch to arctic, is PNG': function(c) {
switchProjection(c, 'geographic');
openImageDownloadPanel(c);
- c.click('#wv-image-format option[value="application/vnd.google-earth.kmz"]');
+ c.click(
+ '#wv-image-format option[value="application/vnd.google-earth.kmz"]'
+ );
closeImageDownloadPanel(c);
switchProjection(c, 'arctic');
- c.expect.element('#wv-image-download-url').to.have.attribute('url')
- .contain('FORMAT=image/png');
+ openImageDownloadPanel(c);
+ c.pause(500);
+ clickDownload(c);
+ c.expect
+ .element('#wv-image-download-url')
+ .to.have.attribute('url')
+ .contain('FORMAT=image/jpeg');
}
};
diff --git a/e2e/features/image-download/resolutions4326-test.js b/e2e/features/image-download/resolutions4326-test.js
index 8f2be36b2..d049d716d 100644
--- a/e2e/features/image-download/resolutions4326-test.js
+++ b/e2e/features/image-download/resolutions4326-test.js
@@ -23,79 +23,71 @@ module.exports = {
'In geographic, top two zoom levels are 10km': function(c) {
bookmark(c, startParams);
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="40"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="40"]').to.be.selected;
closeImageDownloadPanel(c);
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="40"]')
- .to.be.selected;
+
+ c.expect.element('#wv-image-resolution option[value="40"]').to.be.selected;
closeImageDownloadPanel(c);
},
'Next zoom is 5km': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="20"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="20"]').to.be.selected;
closeImageDownloadPanel(c);
},
'Next two zooms are 1km': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="4"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="4"]').to.be.selected;
closeImageDownloadPanel(c);
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="4"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="4"]').to.be.selected;
closeImageDownloadPanel(c);
},
'Next zoom is 500m': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="2"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="2"]').to.be.selected;
closeImageDownloadPanel(c);
},
'Next two zooms are 250m': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="1"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="1"]').to.be.selected;
closeImageDownloadPanel(c);
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="1"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="1"]').to.be.selected;
closeImageDownloadPanel(c);
},
'Next zoom is 125m': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="0.5"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="0.5"]').to.be.selected;
closeImageDownloadPanel(c);
},
'Next zoom is 60m': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="0.25"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="0.25"]').to.be
+ .selected;
closeImageDownloadPanel(c);
},
'Next zoom is 30m': function(c) {
zoomIn(c, 'geographic');
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="0.125"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="0.125"]').to.be
+ .selected;
closeImageDownloadPanel(c);
},
@@ -105,15 +97,15 @@ module.exports = {
zoomIn(c, 'geographic');
}
openImageDownloadPanel(c);
- c.expect.element('#wv-image-resolution option[value="0.125"]')
- .to.be.selected;
+ c.expect.element('#wv-image-resolution option[value="0.125"]').to.be
+ .selected;
closeImageDownloadPanel(c);
},
'Click download': function(c) {
openImageDownloadPanel(c);
clickDownload(c);
- c.getAttribute('#wv-image-download-url', 'url', (result) => {
+ c.getAttribute('#wv-image-download-url', 'url', result => {
// See if the bounding box here is reasonable. Should be centered
// on 0,0 and not be wider than 0.1 degrees
const matcher = /BBOX=([^,]+),([^,]+),([^,]+),([^&]+)/;
@@ -128,5 +120,4 @@ module.exports = {
c.assert.ok(lon1 > 0 && lon1 < 0.1);
});
}
-
};
diff --git a/e2e/features/image-download/unsupported-test.js b/e2e/features/image-download/unsupported-test.js
index 30954735f..bbcc474d3 100644
--- a/e2e/features/image-download/unsupported-test.js
+++ b/e2e/features/image-download/unsupported-test.js
@@ -1,11 +1,7 @@
const { bookmark } = require('../../reuseables/bookmark');
const { closeImageDownloadPanel } = require('../../reuseables/image-download');
-const startParams = [
- 'v=-180,-90,180,90',
- 't=2018-06-01',
- 'imageDownload='
-];
+const startParams = ['v=-180,-90,180,90', 't=2018-06-01', 'imageDownload='];
const TIME_WAIT = 10000;
@@ -17,27 +13,23 @@ module.exports = {
'Custom palettes are not supported dialog': function(c) {
bookmark(c, startParams.concat(['l=MODIS_Terra_Aerosol(palette=red_1)']));
c.click('#wv-image-button');
- c.waitForElementVisible('.wv-dialog-ask', TIME_WAIT);
+ c.waitForElementVisible('.notify', TIME_WAIT);
},
'Custom palettes: Cancel button': function(c) {
- c.click('.ui-dialog .ui-dialog-buttonset button:nth-of-type(1)');
- c.waitForElementNotVisible('.wv-dialog-ask', TIME_WAIT);
- c.expect.element('.ui-dialog.wv-image').to.not.be.present;
+ c.click('.cancel-notify');
+ c.pause(1000);
+ c.expect.element('.notify').to.not.be.present;
+ c.expect.element('#toolbar_snapshot').to.not.be.present;
},
'Custom palettes: OK button brings up download panel': function(c) {
- // FIXME: Dialog doesn't clean up properly and there will be more than
- // one. Go ahead and remove all dialog elements first.
- c.execute(function() {
- let elements = document.querySelectorAll('.ui-dialog');
- elements.forEach((e) => e.parentNode.removeChild(e));
- });
c.click('#wv-image-button');
- c.waitForElementVisible('.wv-dialog-ask', TIME_WAIT);
- c.click('.ui-dialog .ui-dialog-buttonset button:nth-of-type(2)');
- c.waitForElementNotVisible('.wv-dialog-ask', TIME_WAIT);
- c.waitForElementPresent('.ui-dialog.wv-image', TIME_WAIT);
+ c.waitForElementVisible('.notify', TIME_WAIT);
+ c.click('.accept-notify');
+ c.pause(1000);
+ c.expect.element('.notify').to.not.be.present;
+ c.waitForElementPresent('#toolbar_snapshot', TIME_WAIT);
c.pause(500);
closeImageDownloadPanel(c);
},
@@ -45,27 +37,23 @@ module.exports = {
'Rotation is not supported dialog': function(c) {
bookmark(c, startParams.concat(['p=arctic', 'r=18']));
c.click('#wv-image-button');
- c.waitForElementVisible('.wv-dialog-ask', TIME_WAIT);
+ c.waitForElementVisible('.notify', TIME_WAIT);
},
'Rotation: Cancel button': function(c) {
- c.click('.ui-dialog .ui-dialog-buttonset button:nth-of-type(1)');
- c.waitForElementNotVisible('.wv-dialog-ask', TIME_WAIT);
- c.expect.element('.ui-dialog.wv-image').to.not.be.present;
+ c.click('.cancel-notify');
+ c.pause(1000);
+ c.expect.element('.notify').to.not.be.present;
+ c.expect.element('#toolbar_snapshot').to.not.be.present;
},
'Rotation: OK button brings up download panel': function(c) {
- // FIXME: Dialog doesn't clean up properly and there will be more than
- // one. Go ahead and remove all dialog elements first.
- c.execute(function() {
- let elements = document.querySelectorAll('.ui-dialog');
- elements.forEach((e) => e.parentNode.removeChild(e));
- });
c.click('#wv-image-button');
- c.waitForElementVisible('.wv-dialog-ask', TIME_WAIT);
- c.click('.ui-dialog .ui-dialog-buttonset button:nth-of-type(2)');
- c.waitForElementNotVisible('.wv-dialog-ask', TIME_WAIT);
- c.waitForElementPresent('.ui-dialog.wv-image', TIME_WAIT);
+ c.waitForElementVisible('.notify', TIME_WAIT);
+ c.click('.accept-notify');
+ c.pause(1000);
+ c.expect.element('.notify').to.not.be.present;
+ c.waitForElementPresent('#toolbar_snapshot', TIME_WAIT);
c.pause(500);
closeImageDownloadPanel(c);
}
diff --git a/e2e/reuseables/image-download.js b/e2e/reuseables/image-download.js
index fc68b4ee6..bb59c7e9c 100644
--- a/e2e/reuseables/image-download.js
+++ b/e2e/reuseables/image-download.js
@@ -1,19 +1,19 @@
const TIME_LIMIT = 10000;
module.exports = {
- openImageDownloadPanel: function (c) {
+ openImageDownloadPanel: function(c) {
c.click('#wv-image-button');
c.waitForElementVisible('#wv-image-button', TIME_LIMIT);
c.pause(250);
},
- closeImageDownloadPanel: function (c) {
- c.click('.ui-dialog.wv-image .ui-dialog-titlebar button');
- c.waitForElementNotPresent('.ui-dialog.wv-image', TIME_LIMIT);
+ closeImageDownloadPanel: function(c) {
+ c.click('#toolbar_snapshot .close');
+ c.waitForElementNotPresent('#toolbar_snapshot', TIME_LIMIT);
c.pause(250);
},
clickDownload: function(c) {
- c.click('.ui-dialog.wv-image .wv-image-button button');
+ c.click(' .wv-image-button .wv-button');
}
};
diff --git a/e2e/reuseables/switch-projection.js b/e2e/reuseables/switch-projection.js
index 2e863ab5f..48a655494 100644
--- a/e2e/reuseables/switch-projection.js
+++ b/e2e/reuseables/switch-projection.js
@@ -5,9 +5,9 @@ module.exports = {
switchProjection: function(client, proj) {
const c = client;
c.click('#wv-proj-button');
- c.waitForElementVisible(`#wv-proj-menu li[data-proj="${proj}"]`, TIME_LIMIT);
+ c.waitForElementVisible(`#change-${proj}-button`, TIME_LIMIT);
c.pause(500);
- c.click(`#wv-proj-menu li[data-proj="${proj}"]`);
+ c.click(`#change-${proj}-button`);
c.waitForElementVisible(`#wv-map-${proj}`, TIME_LIMIT);
}
};
diff --git a/e2e/reuseables/zoom.js b/e2e/reuseables/zoom.js
index 2f6eb0526..a556fa95a 100644
--- a/e2e/reuseables/zoom.js
+++ b/e2e/reuseables/zoom.js
@@ -1,6 +1,6 @@
module.exports = {
zoomIn: function(c, proj) {
c.click(`#wv-map [data-proj='${proj}'] div.wv-map-zoom-in`);
- c.pause(100);
+ c.pause(300);
}
};
diff --git a/web/js/components/util/list.js b/web/js/components/util/list.js
index 0b5ec04b5..99cc24ab2 100644
--- a/web/js/components/util/list.js
+++ b/web/js/components/util/list.js
@@ -26,6 +26,7 @@ export default class List extends React.Component {
key={item.key || item.id || ''}
tag={tagType}
active={isActive}
+ id={item.id || ''}
className={className + ' ' + size + '-item'}
href={item.href ? item.href : 'false'}
onClick={
diff --git a/web/js/modules/image-download/reducers.js b/web/js/modules/image-download/reducers.js
index af210297e..afe3f8c69 100644
--- a/web/js/modules/image-download/reducers.js
+++ b/web/js/modules/image-download/reducers.js
@@ -2,9 +2,11 @@ import {
UPDATE_BOUNDARIES,
UPDATE_FILE_TYPE,
UPDATE_WORLDFILE,
- UPDATE_RESOLUTION
+ UPDATE_RESOLUTION,
+ fileTypesPolar
} from './constants';
-import { assign as lodashAssign } from 'lodash';
+import { CHANGE_PROJECTION } from '../projection/constants';
+import { assign as lodashAssign, find as lodashFind } from 'lodash';
export const defaultState = {
fileType: 'image/jpeg',
boundaries: {},
@@ -30,6 +32,13 @@ export function imageDownloadReducer(state = defaultState, action) {
return lodashAssign({}, state, {
resolution: action.value
});
+ case CHANGE_PROJECTION:
+ let fileType =
+ action.selected !== 'geographic' &&
+ !lodashFind(fileTypesPolar.values, { value: state.fileType })
+ ? 'image/jpeg'
+ : state.fileType;
+ return lodashAssign({}, defaultState, { fileType });
default:
return state;
}