Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add e2e tests

Mike McGann88bef5cb83f4
diff --git a/e2e/features/image-download/formats-test.js b/e2e/features/image-download/formats-test.js
new file mode 100644
index 000000000..21a1a61d1
--- /dev/null
+++ b/e2e/features/image-download/formats-test.js
@@ -0,0 +1,69 @@
+const { switchProjection } = require('../../reuseables/switch-projection');
+const { bookmark } = require('../../reuseables/bookmark');
+const {
+ openImageDownloadPanel,
+ closeImageDownloadPanel,
+ clickDownload
+} = require('../../reuseables/image-download');
+
+const startParams = [
+ 'l=MODIS_Terra_CorrectedReflectance_TrueColor',
+ 'v=-1,-1,1,1',
+ 't=2018-06-01',
+ 'imageDownload='
+];
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ 'JPEG is the default': function(c) {
+ bookmark(c, startParams);
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ 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')
+ .and.not.to.contain('WORLDFILE');
+ closeImageDownloadPanel(c);
+ },
+
+ 'Add a worldfile': function(c) {
+ openImageDownloadPanel(c);
+ c.click('#wv-image-worldfile option[value="true"]');
+ clickDownload(c);
+ 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);
+ },
+
+ 'Select PNG': function(c) {
+ openImageDownloadPanel(c);
+ c.click('#wv-image-format option[value="image/png"]');
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .contain('FORMAT=image/png');
+ closeImageDownloadPanel(c);
+ },
+
+ 'Swtich to arctic, is PNG': function(c) {
+ switchProjection(c, 'arctic');
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .contain('FORMAT=image/png');
+ closeImageDownloadPanel(c);
+ },
+
+ '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"]');
+ closeImageDownloadPanel(c);
+ switchProjection(c, 'arctic');
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .contain('FORMAT=image/png');
+ }
+};
diff --git a/e2e/features/image-download/initial-state-test.js b/e2e/features/image-download/initial-state-test.js
new file mode 100644
index 000000000..338db4471
--- /dev/null
+++ b/e2e/features/image-download/initial-state-test.js
@@ -0,0 +1,76 @@
+const { loadAndSkipTour } = require('../../reuseables/skip-tour');
+const { switchProjection } = require('../../reuseables/switch-projection');
+const {
+ openImageDownloadPanel,
+ closeImageDownloadPanel
+} = require('../../reuseables/image-download');
+
+const TIME_LIMIT = 10000;
+
+module.exports = {
+ before: function (client) {
+ loadAndSkipTour(client, TIME_LIMIT);
+ },
+
+ after: function(client) {
+ client.end();
+ },
+
+ 'Check resolutions': function(c) {
+ openImageDownloadPanel(c);
+ const expected = [
+ '30m',
+ '60m',
+ '125m',
+ '250m',
+ '500m',
+ '1km',
+ '5km',
+ '10km']
+ .join('\n');
+ c.expect.element('#wv-image-resolution').text.to.equal(expected);
+ },
+
+ 'Check formats': function(c) {
+ const expected = [
+ 'JPEG',
+ 'PNG',
+ 'GeoTIFF',
+ 'KMZ']
+ .join('\n');
+ c.expect.element('#wv-image-format').text.to.equal(expected);
+ },
+
+ 'Check worldfile option': function(c) {
+ const expected = [
+ 'No',
+ 'Yes'
+ ].join('\n');
+ c.expect.element('#wv-image-worldfile').text.to.equal(expected);
+ },
+
+ 'Check arctic formats': function(c) {
+ closeImageDownloadPanel(c);
+ switchProjection(c, 'arctic');
+ openImageDownloadPanel(c);
+ const expected = [
+ 'JPEG',
+ 'PNG',
+ 'GeoTIFF']
+ .join('\n');
+ c.expect.element('#wv-image-format').text.to.equal(expected);
+ },
+
+ 'Check antarctic formats': function(c) {
+ closeImageDownloadPanel(c);
+ switchProjection(c, 'antarctic');
+ openImageDownloadPanel(c);
+ const expected = [
+ 'JPEG',
+ 'PNG',
+ 'GeoTIFF']
+ .join('\n');
+ c.expect.element('#wv-image-format').text.to.equal(expected);
+ closeImageDownloadPanel(c);
+ }
+};
diff --git a/e2e/features/image-download/layers-test.js b/e2e/features/image-download/layers-test.js
new file mode 100644
index 000000000..4217366a8
--- /dev/null
+++ b/e2e/features/image-download/layers-test.js
@@ -0,0 +1,51 @@
+const { bookmark } = require('../../reuseables/bookmark');
+const {
+ openImageDownloadPanel,
+ clickDownload
+} = require('../../reuseables/image-download');
+
+const startParams = [
+ 'v=-180,-90,180,90',
+ 't=2018-06-01',
+ 'imageDownload='
+];
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ 'List layers in draw order': function(c) {
+ bookmark(c, startParams.concat(['l=MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Features,MODIS_Terra_Aerosol']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Aerosol,Reference_Features');
+ },
+
+ 'Move AOD over the reference features': function(c) {
+ bookmark(c, startParams.concat(['l=MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Aerosol,Reference_Features']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Features,MODIS_Terra_Aerosol');
+ },
+
+ 'Do not include obscured layers': function(c) {
+ bookmark(c, startParams.concat(['l=MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor');
+ },
+
+ 'Multiple base layers when one is semi-transparent': function(c) {
+ bookmark(c, startParams.concat(['l=MODIS_Terra_CorrectedReflectance_TrueColor(opacity=0.5),MODIS_Aqua_CorrectedReflectance_TrueColor']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('LAYERS=MODIS_Aqua_CorrectedReflectance_TrueColor,MODIS_Terra_CorrectedReflectance_TrueColor')
+ .and.to.contain('OPACITIES=,0.5');
+ }
+
+};
diff --git a/e2e/features/image-download/projection-test.js b/e2e/features/image-download/projection-test.js
new file mode 100644
index 000000000..be8d58557
--- /dev/null
+++ b/e2e/features/image-download/projection-test.js
@@ -0,0 +1,46 @@
+const { switchProjection } = require('../../reuseables/switch-projection');
+const { bookmark } = require('../../reuseables/bookmark');
+const {
+ openImageDownloadPanel,
+ closeImageDownloadPanel,
+ clickDownload
+} = require('../../reuseables/image-download');
+
+const startParams = [
+ 'l=MODIS_Terra_CorrectedReflectance_TrueColor',
+ 't=2018-06-01',
+ 'imageDownload='
+];
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ 'Geographic is EPSG:4326': function(c) {
+ bookmark(c, startParams);
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('CRS=EPSG:4326');
+ closeImageDownloadPanel(c);
+ },
+
+ 'Arctic is EPSG:3413': function(c) {
+ switchProjection(c, 'arctic');
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('CRS=EPSG:3413');
+ closeImageDownloadPanel(c);
+ },
+
+ 'Antarctic is EPSG:3031': function(c) {
+ switchProjection(c, 'antarctic');
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('CRS=EPSG:3031');
+ closeImageDownloadPanel(c);
+ }
+};
diff --git a/e2e/features/image-download/resolutions3413-test.js b/e2e/features/image-download/resolutions3413-test.js
new file mode 100644
index 000000000..3157cb03a
--- /dev/null
+++ b/e2e/features/image-download/resolutions3413-test.js
@@ -0,0 +1,95 @@
+const { zoomIn } = require('../../reuseables/zoom');
+const { bookmark } = require('../../reuseables/bookmark');
+
+const {
+ openImageDownloadPanel,
+ closeImageDownloadPanel,
+ clickDownload
+} = require('../../reuseables/image-download');
+
+const startParams = [
+ 'p=arctic',
+ 'v=-4194304,-4194304,4194304,4194304',
+ 'l=MODIS_Terra_CorrectedReflectance_TrueColor',
+ 't=2018-06-01',
+ 'imageDownload='
+];
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ 'In the arctic, top zoom levels is 5km': function(c) {
+ bookmark(c, startParams);
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="20"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ },
+
+ 'Next two zooms are 1km': function(c) {
+ zoomIn(c, 'arctic');
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="4"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ zoomIn(c, 'arctic');
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="4"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ },
+
+ 'Next zoom is 500m': function(c) {
+ zoomIn(c, 'arctic');
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="2"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ },
+
+ 'Next zoom is 250m': function(c) {
+ zoomIn(c, 'arctic');
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="1"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ zoomIn(c, 'arctic');
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="1"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ },
+
+ 'Last zoom level is 250m': function(c) {
+ // mash the zoom button a bunch of times and see if it changes
+ for (i = 0; i < 5; i++) {
+ zoomIn(c, 'arctic');
+ }
+ openImageDownloadPanel(c);
+ c.expect.element('#wv-image-resolution option[value="1"]')
+ .to.be.selected;
+ closeImageDownloadPanel(c);
+ },
+
+ 'Click download': function(c) {
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ 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 20km
+ const matcher = /BBOX=([^,]+),([^,]+),([^,]+),([^&]+)/;
+ const matches = matcher.exec(result.value);
+ const x0 = Number.parseFloat(matches[1]);
+ const y0 = Number.parseFloat(matches[2]);
+ const x1 = Number.parseFloat(matches[3]);
+ const y1 = Number.parseFloat(matches[4]);
+ c.assert.ok(x0 < 0 && x0 > -20000);
+ c.assert.ok(y0 < 0 && y0 > -20000);
+ c.assert.ok(x1 > 0 && x1 < 20000);
+ c.assert.ok(y1 > 0 && y1 < 20000);
+ });
+ }
+
+};
diff --git a/e2e/features/image-download/resolutions4326-test.js b/e2e/features/image-download/resolutions4326-test.js
new file mode 100644
index 000000000..f95cd35f7
--- /dev/null
+++ b/e2e/features/image-download/resolutions4326-test.js
@@ -0,0 +1,132 @@
+const { zoomIn } = require('../../reuseables/zoom');
+const { bookmark } = require('../../reuseables/bookmark');
+
+const {
+ openImageDownloadPanel,
+ closeImageDownloadPanel,
+ clickDownload
+} = require('../../reuseables/image-download');
+
+const startParams = [
+ 'p=geographic',
+ 'v=-180,-90,180,90',
+ 'l=MODIS_Terra_CorrectedReflectance_TrueColor',
+ 't=2018-06-01',
+ 'imageDownload='
+];
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ '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;
+ closeImageDownloadPanel(c);
+ zoomIn(c, 'geographic');
+ openImageDownloadPanel(c);
+ 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;
+ 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;
+ closeImageDownloadPanel(c);
+ zoomIn(c, 'geographic');
+ openImageDownloadPanel(c);
+ 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;
+ 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;
+ closeImageDownloadPanel(c);
+ zoomIn(c, 'geographic');
+ openImageDownloadPanel(c);
+ 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;
+ 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;
+ 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;
+ closeImageDownloadPanel(c);
+ },
+
+ 'Last zoom level is 30m': function(c) {
+ // mash the zoom button a bunch of times and see if it changes
+ for (i = 0; i < 5; i++) {
+ zoomIn(c, 'geographic');
+ }
+ openImageDownloadPanel(c);
+ 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) => {
+ // 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=([^,]+),([^,]+),([^,]+),([^&]+)/;
+ const matches = matcher.exec(result.value);
+ const lat0 = Number.parseFloat(matches[1]);
+ const lon0 = Number.parseFloat(matches[2]);
+ const lat1 = Number.parseFloat(matches[3]);
+ const lon1 = Number.parseFloat(matches[4]);
+ c.assert.ok(lat0 < 0 && lat0 > -0.1);
+ c.assert.ok(lon0 < 0 && lon0 > -0.1);
+ c.assert.ok(lat1 > 0 && lat1 < 0.1);
+ c.assert.ok(lon1 > 0 && lon1 < 0.1);
+ });
+ }
+
+};
diff --git a/e2e/features/image-download/time-test.js b/e2e/features/image-download/time-test.js
new file mode 100644
index 000000000..29a25497a
--- /dev/null
+++ b/e2e/features/image-download/time-test.js
@@ -0,0 +1,47 @@
+const { bookmark } = require('../../reuseables/bookmark');
+
+const {
+ openImageDownloadPanel,
+ closeImageDownloadPanel,
+ clickDownload
+} = require('../../reuseables/image-download');
+
+const startParams = [
+ 'imageDownload='
+];
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ 'Image for today': function(c) {
+ bookmark(c, startParams.concat(['now=2018-06-01T3']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('TIME=2018-06-01');
+ closeImageDownloadPanel(c);
+ },
+
+ // Don't show 'today' until three hours after (when the latency
+ // catches up)
+ 'Image for yesterday': function(c) {
+ bookmark(c, startParams.concat(['now=2018-06-01T0']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('TIME=2018-05-31');
+ closeImageDownloadPanel(c);
+ },
+
+ 'Image for 2018-05-15': function(c) {
+ bookmark(c, startParams.concat(['t=2018-05-15']));
+ openImageDownloadPanel(c);
+ clickDownload(c);
+ c.expect.element('#wv-image-download-url').to.have.attribute('url')
+ .and.to.contain('TIME=2018-05-15');
+ closeImageDownloadPanel(c);
+ }
+
+};
diff --git a/e2e/features/image-download/unsupported-test.js b/e2e/features/image-download/unsupported-test.js
new file mode 100644
index 000000000..30954735f
--- /dev/null
+++ b/e2e/features/image-download/unsupported-test.js
@@ -0,0 +1,72 @@
+const { bookmark } = require('../../reuseables/bookmark');
+const { closeImageDownloadPanel } = require('../../reuseables/image-download');
+
+const startParams = [
+ 'v=-180,-90,180,90',
+ 't=2018-06-01',
+ 'imageDownload='
+];
+
+const TIME_WAIT = 10000;
+
+module.exports = {
+ after: function(client) {
+ client.end();
+ },
+
+ '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);
+ },
+
+ '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;
+ },
+
+ '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.pause(500);
+ closeImageDownloadPanel(c);
+ },
+
+ '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);
+ },
+
+ '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;
+ },
+
+ '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.pause(500);
+ closeImageDownloadPanel(c);
+ }
+};
diff --git a/e2e/reuseables/bookmark.js b/e2e/reuseables/bookmark.js
new file mode 100644
index 000000000..c7fee40ae
--- /dev/null
+++ b/e2e/reuseables/bookmark.js
@@ -0,0 +1,9 @@
+const TIME_LIMIT = 10000;
+
+module.exports = {
+ bookmark: function(c, params) {
+ const url = c.globals.url + '?' + params.join('&');
+ c.url(url);
+ c.waitForElementVisible('#wv-logo', TIME_LIMIT);
+ }
+};
diff --git a/e2e/reuseables/image-download.js b/e2e/reuseables/image-download.js
new file mode 100644
index 000000000..fc68b4ee6
--- /dev/null
+++ b/e2e/reuseables/image-download.js
@@ -0,0 +1,19 @@
+const TIME_LIMIT = 10000;
+
+module.exports = {
+ 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);
+ c.pause(250);
+ },
+
+ clickDownload: function(c) {
+ c.click('.ui-dialog.wv-image .wv-image-button button');
+ }
+};
diff --git a/e2e/reuseables/switch-projection.js b/e2e/reuseables/switch-projection.js
new file mode 100644
index 000000000..2e863ab5f
--- /dev/null
+++ b/e2e/reuseables/switch-projection.js
@@ -0,0 +1,13 @@
+const TIME_LIMIT = 10000;
+
+// proj is either 'geographic', 'arctic', or 'antarctic'
+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.pause(500);
+ c.click(`#wv-proj-menu li[data-proj="${proj}"]`);
+ c.waitForElementVisible(`#wv-map-${proj}`, TIME_LIMIT);
+ }
+};
diff --git a/e2e/reuseables/zoom.js b/e2e/reuseables/zoom.js
new file mode 100644
index 000000000..85b1b6b9e
--- /dev/null
+++ b/e2e/reuseables/zoom.js
@@ -0,0 +1,10 @@
+const TIME_LIMIT = 10000;
+
+module.exports = {
+
+ zoomIn: function(c, proj) {
+ c.click(`#wv-map [data-proj='${proj}'] div.wv-map-zoom-in`);
+ c.pause(100);
+ }
+
+};
diff --git a/web/js/image/panel.js b/web/js/image/panel.js
index 4489dc10c..d4dc76fbc 100644
--- a/web/js/image/panel.js
+++ b/web/js/image/panel.js
@@ -41,7 +41,7 @@ const fileTypesGeo = {
{ value: 'image/jpeg', text: 'JPEG' },
{ value: 'image/png', text: 'PNG' },
{ value: 'image/geotiff', text: 'GeoTIFF' },
- { value: 'image/kmz', text: 'KMZ' }
+ { value: 'application/vnd.google-earth.kmz', text: 'KMZ' }
]
};
const fileTypesPolar = {
@@ -61,8 +61,6 @@ export function imagePanel(models, ui, config, dialogConfig) {
let resolution = '1';
let lastZoom = -1;
let htmlElements;
- let host;
- let path;
let containerId = 'wv-image-button';
let id = containerId;
// state items as global lets
@@ -75,12 +73,13 @@ export function imagePanel(models, ui, config, dialogConfig) {
let imgFilesize;
let resolutions;
let fileTypes;
+ let debugUrl;
let url = 'http://localhost:3002/api/v1/snapshot';
if (config.features.imageDownload && config.features.imageDownload.url) {
url = config.features.imageDownload.url;
}
- if (config.parameters.imageDownload) {
+ if ('imageDownload' in config.parameters) {
url = config.parameters.imageDownload;
util.warn('Redirecting image download to: ' + url);
}
@@ -105,6 +104,11 @@ export function imagePanel(models, ui, config, dialogConfig) {
htmlElements
);
models.proj.events.on('select', setProjectionGlobals);
+
+ debugUrl = document.createElement('div');
+ debugUrl.setAttribute('id', 'wv-image-download-url');
+ debugUrl.setAttribute('style', 'visbility: hidden');
+ document.querySelector('body').appendChild(debugUrl);
};
let setProjectionGlobals = function() {
let isGeoProjection = models.proj.selected.id === 'geographic';
@@ -332,9 +336,11 @@ export function imagePanel(models, ui, config, dialogConfig) {
`WIDTH=${imgWidth}`,
`HEIGHT=${imgHeight}`,
`OPACITIES=${opacities.join(',')}`,
- `WORLDFILE=${imgWorldfile}`,
`ts=${Date.now()}`
];
+ if (imgWorldfile === 'true') {
+ params.push('WORLDFILE=true');
+ }
let dlURL = url + '?' + params.join('&');
googleTagManager.pushEvent({
@@ -349,8 +355,14 @@ export function imagePanel(models, ui, config, dialogConfig) {
}
});
- util.metrics('lc=' + encodeURIComponent(dlURL));
- window.open(dlURL, '_blank');
+ debugUrl.setAttribute('url', dlURL);
+ // A blank URL is used for testing. If blank, don't open in a new window.
+ if (url) {
+ util.metrics('lc=' + encodeURIComponent(dlURL));
+ window.open(dlURL, '_blank');
+ } else {
+ console.log(url);
+ }
};
init();
diff --git a/web/js/image/util.js b/web/js/image/util.js
index e8cf94b00..bf6b93fe7 100644
--- a/web/js/image/util.js
+++ b/web/js/image/util.js
@@ -96,7 +96,14 @@ export function imageUtilGetLayers (products, proj) {
export function imageUtilGetLayerOpacities (products) {
var opacities = [];
lodashEach(products, function(product) {
- opacities.push((lodashIsUndefined(product.opacity)) ? 1 : product.opacity);
+ let opacity = '';
+ if ('opacity' in product) {
+ opacity = product.opacity;
+ }
+ if (opacity === 1) {
+ opacity = '';
+ }
+ opacities.push(opacity);
});
return opacities;
};