Interactive interface for browsing global, full-resolution satellite imagery
Add check for url values
Josiah Spraguec75a125eea1f
diff --git a/e2e/custom-assertions/urlParameterEquals.js b/e2e/custom-assertions/urlParameterEquals.jsnew file mode 100644index 000000000..088f5b8f0--- /dev/null+++ b/e2e/custom-assertions/urlParameterEquals.js@@ -0,0 +1,23 @@+const { URL, URLSearchParams } = require('url');++exports.assertion = function(parameter, value) {+ this.message = 'Testing if URL parameter "' + parameter + '" has value: ' + value;+ this.expected = `${parameter}=${value}`;+ this.pass = function(value) {+ const expected = this.expected.split('=');+ const expectedParam = expected[0];+ const expectedValue = expected[1];+ if (expectedValue == 'true') {+ return value.get(expectedParam)?true:false;+ }+ return value.get(expectedParam) == expectedValue;+ };+ this.value = function(result) {+ const url = new URL(result.value);+ return url.searchParams;+ };+ this.command = function(cb) {+ this.api.url(cb);+ return this;+ };+};diff --git a/e2e/features/events/events.feature b/e2e/features/events/events.featureindex cbcf2001a..bd60ddb0a 100644--- a/e2e/features/events/events.feature+++ b/e2e/features/events/events.feature@@ -21,6 +21,12 @@ Scenario: Selecting an Event from the ListWhen I click the "first event"Then I see the "selected marker"And I see the "selected first event"+ And the url has these values:+ | l | true |+ | t | true |+ | z | true |+ | v | true |+ | e | true |And I see "Events may not be visible at all times" within 4 secondsWhen I click "Events may not be visible at all times"Then I see "Why can’t I see an event?"diff --git a/e2e/step_definitions/utility.js b/e2e/step_definitions/utility.jsindex 4e836f4c2..af0ba0e28 100644--- a/e2e/step_definitions/utility.js+++ b/e2e/step_definitions/utility.js@@ -49,6 +49,14 @@ defineSupportCode(({Given, Then, When}) => {return client.pause(seconds*1000);});+ // Check the url+ Then('the url has these values:', (table) => {+ table.rawTable.forEach(function(row){+ client.assert.urlParameterEquals(row[0], row[1]);+ });+ return client;+ });+// Check for a stringThen('I see {string}', (text) => {return client.useCss().assert.containsText('body', text);