Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add Compare layer dialog E2E tests #1119

Benjamin King6b05f5da5f15
diff --git a/e2e/features/compare/layer-dialog-test.js b/e2e/features/compare/layer-dialog-test.js
new file mode 100644
index 000000000..27d9aff5f
--- /dev/null
+++ b/e2e/features/compare/layer-dialog-test.js
@@ -0,0 +1,144 @@
+const reuseables = require('../../reuseables/skip-tour.js');
+const localSelectors = require('./selectors.js');
+const localQuerystrings = require('./querystrings.js');
+const TIME_LIMIT = 10000;
+const aerosolLayer = '#active-MODIS_Terra_Aerosol';
+const aerosolLayerB = '#activeB-MODIS_Terra_Aerosol';
+const AodOptionsPanel = '.wv-options-panel-MODIS_Terra_Aerosol';
+const AodInfoPanel = '.wv-info-panel-MODIS_Terra_Aerosol';
+const correctedReflectanceBLayer =
+ '#activeB-MODIS_Terra_CorrectedReflectance_TrueColor';
+const correctedReflectanceOptionsPanel =
+ '.wv-options-panel-MODIS_Terra_CorrectedReflectance_TrueColor';
+const correctedReflectanceInfoPanel =
+ '.wv-info-panel-MODIS_Terra_CorrectedReflectance_TrueColor';
+
+module.exports = {
+ before: function(client) {
+ reuseables.loadAndSkipTour(client, TIME_LIMIT);
+ },
+ 'Layer option features work in A|B mode': function(client) {
+ client.url(client.globals.url + localQuerystrings.swipeAOD);
+
+ client.waitForElementVisible(aerosolLayer, TIME_LIMIT, function() {
+ client.expect.element(AodOptionsPanel).to.not.be.present;
+ client.click(aerosolLayer + ' .wv-layers-options');
+ client.waitForElementVisible(
+ '#wv-layers-options-dialog',
+ TIME_LIMIT,
+ function() {
+ client
+ .useCss()
+ .assert.containsText(
+ AodOptionsPanel + ' .ui-dialog-title',
+ 'Aerosol Optical Depth'
+ );
+ client.expect.element(AodOptionsPanel + ' #wv-palette-selector').to.be
+ .visible;
+ }
+ );
+ });
+ },
+ 'Layer info dialog works in A|B mode': function(client) {
+ client.click(aerosolLayer + ' .wv-layers-info');
+ client.waitForElementVisible(
+ AodInfoPanel + ' .layer-metadata',
+ TIME_LIMIT,
+ function() {
+ client
+ .useCss()
+ .assert.containsText(
+ AodInfoPanel,
+ 'The Aerosol Optical Depth layer is useful for studying aerosol optical depth'
+ );
+ }
+ );
+ },
+ 'expect clicking A|B button to close options dialog': function(client) {
+ client.click(localSelectors.compareButton);
+ client.waitForElementVisible(aerosolLayer, TIME_LIMIT, function() {
+ client.expect.element(AodOptionsPanel).to.not.be.present;
+ });
+ },
+ 'Layer option features after exiting A|B mode': function(client) {
+ client.click(aerosolLayer + ' .wv-layers-options');
+ client.waitForElementVisible(AodOptionsPanel, TIME_LIMIT, function() {
+ client
+ .useCss()
+ .assert.containsText(
+ AodOptionsPanel + ' .ui-dialog-title',
+ 'Aerosol Optical Depth'
+ );
+ client.expect.element(
+ AodOptionsPanel + ' #wv-palette-selector'
+ ).to.be.visible;
+ });
+ },
+ 'Layer info dialog works after exiting A|B mode': function(client) {
+ client.click(aerosolLayer + ' .wv-layers-info');
+ client.waitForElementVisible(
+ AodInfoPanel + ' .layer-metadata',
+ TIME_LIMIT,
+ function() {
+ client
+ .useCss()
+ .assert.containsText(
+ AodInfoPanel,
+ 'The Aerosol Optical Depth layer is useful for studying aerosol optical depth'
+ );
+ }
+ );
+ },
+ 'expect reactivating A|B to close options dialog and activate B state': function(
+ client
+ ) {
+ client.click(localSelectors.compareButton);
+ client.waitForElementVisible(aerosolLayer, TIME_LIMIT, function() {
+ client.expect.element(AodOptionsPanel).to.not.be.present;
+ client.click(localSelectors.bTab);
+ });
+ },
+ 'Layer option features work in B state': function(client) {
+ client.waitForElementVisible(
+ correctedReflectanceBLayer,
+ TIME_LIMIT,
+ function() {
+ client.expect.element(AodOptionsPanel).to.not.be.present;
+ client.click(correctedReflectanceBLayer + ' .wv-layers-options');
+ client.waitForElementVisible(
+ '#wv-layers-options-dialog',
+ TIME_LIMIT,
+ function() {
+ client
+ .useCss()
+ .assert.containsText(
+ correctedReflectanceOptionsPanel + ' .ui-dialog-title',
+ 'Corrected Reflectance (True Color)'
+ );
+ client.expect.element(
+ correctedReflectanceOptionsPanel + ' #wv-palette-selector'
+ ).to.not.be.present;
+ }
+ );
+ }
+ );
+ },
+ 'Layer info dialog works after clicking into B mode': function(client) {
+ client.click(correctedReflectanceBLayer + ' .wv-layers-info');
+ client.waitForElementVisible(
+ correctedReflectanceInfoPanel + ' .layer-metadata',
+ TIME_LIMIT,
+ function() {
+ client
+ .useCss()
+ .assert.containsText(
+ correctedReflectanceInfoPanel,
+ 'These images are called true-color or natural color because this combination of wavelengths is similar to what the human eye'
+ );
+ }
+ );
+ },
+ after: function(client) {
+ client.end();
+ }
+};
diff --git a/e2e/features/compare/querystrings.js b/e2e/features/compare/querystrings.js
index ebe4394ab..fd758e915 100644
--- a/e2e/features/compare/querystrings.js
+++ b/e2e/features/compare/querystrings.js
@@ -1,5 +1,10 @@
module.exports = {
- swipeAndAIsActive: '?ca=true&cm=swipe&cv=51&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625',
- opacityAndBIsActive: '?ca=false&cm=opacity&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625',
- spyAndBIsActive: '?ca=false&cm=spy&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625'
+ swipeAndAIsActive:
+ '?ca=true&cm=swipe&cv=51&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625',
+ opacityAndBIsActive:
+ '?ca=false&cm=opacity&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625',
+ spyAndBIsActive:
+ '?ca=false&cm=spy&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625',
+ swipeAOD:
+ '?ca=true&cm=swipe&cv=51&p=geographic&l=MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Aerosol&l1=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2018-08-17-T00%3A00%3A00Z&z=3&t1=2018-08-16-T00%3A00%3A00Z&v=-127.6171875,-46.5556640625,31.7109375,53.0244140625'
};
diff --git a/e2e/features/compare/selectors.js b/e2e/features/compare/selectors.js
index 986d01130..d36e60ac4 100644
--- a/e2e/features/compare/selectors.js
+++ b/e2e/features/compare/selectors.js
@@ -4,5 +4,6 @@ module.exports = {
spyButton: '#compare-spy-button',
aTab: '.ab-tabs-case .ab-tab.first-tab',
bTab: '.ab-tabs-case .ab-tab.second-tab',
- swipeDragger: '.ab-swipe-line .ab-swipe-dragger'
+ swipeDragger: '.ab-swipe-line .ab-swipe-dragger',
+ compareButton: '#compare-toggle-button'
};
diff --git a/web/js/layers/info.js b/web/js/layers/info.js
index c3fdfbb40..94bf4a88b 100644
--- a/web/js/layers/info.js
+++ b/web/js/layers/info.js
@@ -24,7 +24,7 @@ export function layersInfo(config, models, layer) {
renderDescription($dialog);
names = models.layers.getTitles(layer.id);
$dialog.dialog({
- dialogClass: 'wv-panel',
+ dialogClass: 'wv-panel wv-info-panel wv-info-panel-' + layer.id,
title: names.title,
show: {
effect: 'slide',
diff --git a/web/js/layers/options.js b/web/js/layers/options.js
index e546876a2..cb8ee3e03 100644
--- a/web/js/layers/options.js
+++ b/web/js/layers/options.js
@@ -67,7 +67,7 @@ export function layersOptions(config, models, layer, layerGroupStr) {
}
var names = models.layers.getTitles(layer.id);
$dialog.dialog({
- dialogClass: 'wv-panel',
+ dialogClass: 'wv-panel wv-options-panel wv-options-panel-' + layer.id,
title: names.title,
show: {
effect: 'slide',