Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Migrate sidebar tests to Cucumber

Josiah Sprague23358012a978
diff --git a/e2e/features/layers.feature b/e2e/features/layers.feature
new file mode 100644
index 000000000..c41c1a4f7
--- /dev/null
+++ b/e2e/features/layers.feature
@@ -0,0 +1,21 @@
+Feature: Layers
+ The layers sidebar tab
+
+Background:
+ Given Worldview is in initial state
+ And I click "Skip Tour"
+
+Scenario: Layer Info Links
+
+ When I click the "info button"
+ Then I should see the "info dialog" element
+ When I click the "info button"
+ Then I should not see the "info dialog" element
+ When I click the "info button"
+ Then I should see the "info dialog" element
+
+ Scenario: Layer Options Links
+
+ When I click the "options button"
+ Then I should not see the "info dialog" element
+ Then I should see the "options dialog" element
diff --git a/e2e/step_definitions/app.js b/e2e/step_definitions/app.js
index da54eaeb2..c6cfecf4c 100644
--- a/e2e/step_definitions/app.js
+++ b/e2e/step_definitions/app.js
@@ -1,22 +1,34 @@
const {client} = require('nightwatch-cucumber');
const {defineSupportCode} = require('cucumber');
+var labels = {
+ 'info button': '.wv-layers-info',
+ 'options button': '.wv-layers-options',
+ 'info dialog': '[aria-describedby="wv-layers-info-dialog"]',
+ 'options dialog': '[aria-describedby="wv-layers-options-dialog"]'
+}
+
defineSupportCode(({Given, Then, When}) => {
Given('Worldview is in initial state', () => {
return client.url(client.globals.url).waitForElementVisible('body', 1000);
});
- // Select any element that contains the string
+ // Click any element that contains the string
When('I click {string}', function (string) {
return client.useXpath().click('//*[contains(text(),"' + string + '")]');
});
- // Select a link by link text
- When('I click on the {string} link', function (text) {
+ // Click a link by link text
+ When('I click the {string} link', function (text) {
return client.useXpath().click('//a[text()="'+ text +'"]');
});
- // Select a Worldview tab
+ // Click a button by predefined label
+ When('I click the {string}', function (label) {
+ return client.useCss().click(labels[label]);
+ });
+
+ // Click a Worldview tab
When('I click the {string} tab', function(name) {
return client.useCss().click('[data-tab="' + name + '"]');
});
@@ -31,4 +43,14 @@ defineSupportCode(({Given, Then, When}) => {
return client.useCss().expect.element('body').text.not.contains(text);
});
+ // Click for an element by predefined label
+ Then('I should see the {string} element', function (label) {
+ return client.useCss().expect.element(labels[label]).to.be.visible;
+ });
+
+ // Click for abscense of an element by predefined label
+ Then('I should not see the {string} element', function (label) {
+ return client.useCss().expect.element(labels[label]).to.not.be.present;
+ });
+
});
diff --git a/e2e/tests/events/events.js b/e2e/tests/events/events.js
deleted file mode 100644
index 48ae99567..000000000
--- a/e2e/tests/events/events.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// module.exports = {
-// 'Test Natural Events': function(browser) {
-// browser.url(browser.globals.url + '?p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels(hidden),Reference_Features(hidden),Coastlines&t=2017-03-20&z=3&v=-175.359375,-47.671875,27.140625,54.140625')
-// .pause(1000);
-// /*
-// * see if anim widget is loaded
-// */
-// browser.expect.element('#wv-eventscontent');
-// browser.end();
-// }
-// };
\ No newline at end of file
diff --git a/e2e/tests/layer-descriptions/sidebar.js b/e2e/tests/layer-descriptions/sidebar.js
deleted file mode 100644
index f2c0d31ea..000000000
--- a/e2e/tests/layer-descriptions/sidebar.js
+++ /dev/null
@@ -1,35 +0,0 @@
-module.exports = {
- 'Layer Descriptions - Sidebar': function(browser) {
- browser.url(browser.globals.url)
- .pause(1000);
- browser.waitForElementVisible('#skipTour', 10000, function(el) {
- browser.click('#skipTour');
-
- // Check to see if info link is present
- browser.expect.element('#overlays li:first-child .wv-layers-info').to.be.present;
-
- // Check if info dialog has opened after icon is clicked.
- browser.click('#overlays li:first-child .wv-layers-info')
- .pause(1000);
- browser.expect.element('.ui-widget-content #wv-layers-info-dialog').to.be.present;
-
- // Check if info dialog has closed after icon is clicked again.
- browser.click('#overlays li:first-child .wv-layers-info')
- .pause(1000);
- browser.expect.element('.ui-widget-content #wv-layers-info-dialog').to.not.be.present;
-
- // Check if info dialog has opened after icon is clicked.
- browser.click('#overlays li:first-child .wv-layers-info')
- .pause(1000);
- browser.expect.element('.ui-widget-content #wv-layers-info-dialog').to.be.present;
-
- // Check to see if info dialog widget is closed after options icon is clicked
- // Check to see if options dialog widget is present after options icon is clicked
- browser.click('#overlays li:first-child .wv-layers-options')
- .pause(1000);
- browser.expect.element('.ui-widget-content #wv-layers-info-dialog').to.not.be.present;
- browser.expect.element('.ui-widget-content #wv-layers-options-dialog').to.be.present;
- });
- browser.end();
- }
-};