Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

update mock event data and basic tests

Jason Kentb30d1c3fe9ea
diff --git a/doc/testing.md b/doc/testing.md
index cd6acc366..49e4842f3 100644
--- a/doc/testing.md
+++ b/doc/testing.md
@@ -66,15 +66,12 @@ To run tests for both browsers in sequence: `npm run e2e`.
| Parameter | Type | Value | Description |
| --------- | ----- | ----- | ----------- |
-| `mockCMR` | string | example:*`modis_grid` (X mock CMR to use)* | Do not query CMR and fetch the static JSON file found at mock/cmr.cgi-X |
-| `timeoutCMR` | ms | *`N`* | Override the CMR timeout value in milliseconds |
| `mockEvents` | String | *`20170530`* | Use the static JSON file with event feeds found at mock/events\_data.json-X |
-| `mockEvents` | String | *`20170530`*| Use the static JSON file with categories feeds found at mock/categories\_data.json-X |
| `mockFutureLayer` | String | *`VIIRS_NOAA20_CorrectedReflectance_TrueColor,5D`*| Pass layer `id` and `futureTime` to be parsed and added to that layer on page load |
| `mockSources` | String | *`20170530`* | Use the static JSON file with sources feeds found at mock/sources\_data.json-X |
| `mockAlerts` | string | *`alert`*, *`message`*, *`outage`*, *`no_types`*, or *`all_types`* | Use a static JSON file by passing the notification type. Local sources can be found at mock/notify_{string}.json |
| `modalView` | string | *`categories`*, *`measurements`*, or *`layers`* | Forces the 'Add Layers' modal to display categories, measurements, or layers. By default Arctic/Antarctic shows measurements and Geographic shows categories. |
-| `now` | date | *`YYYY-MM-DDThh:mm:ssZ`* | Overrides the current date and time. This only works when using the `now()` function from `js/util/util.js`. |
+| `now` | date | *`YYYY-MM-DDThh:mm:ssZ`* | Overrides the current date and time. This can be accessed on `config.initialDate` or `state.date.appNow`. |
| `showError` | boolean | *`true` or `false`* | If any value is specified, an error dialog will be shown on startup. |
| `showSubdaily` | boolean | *`true` or `false`* | If any value is specified, the hour input, minute input and "minutes" timeline zoom option will be shown. |
| `notificationURL` | string | `https://testing.url.com` | Overrides the notification URL found in the features.json configuration file. |
diff --git a/e2e/features/events/events-test.js b/e2e/features/events/events-test.js
index 6d9aafb29..b1ed2c240 100644
--- a/e2e/features/events/events-test.js
+++ b/e2e/features/events/events-test.js
@@ -2,9 +2,7 @@ const reuseables = require('../../reuseables/skip-tour.js');
const localQueryStrings = require('../../reuseables/querystrings.js');
const TIME_LIMIT = 10000;
-/**
- * Selectors
- */
+
const listOfEvents = '#wv-events ul.map-item-list';
const eventIcons = '.marker .event-icon';
const firstEvent = '#wv-events ul.map-item-list .item:first-child h4';
@@ -19,16 +17,6 @@ module.exports = {
before(c) {
reuseables.loadAndSkipTour(c, TIME_LIMIT);
},
- 'Loading an inactive event shows an alert': (c) => {
- const inactiveEventAlert = '#event-unavailable-alert';
- const inactiveAlertMsgContainer = `${inactiveEventAlert} .wv-alert-message`;
- const inactiveEventMsg = 'The event with an id of EONET_5133 is no longer active.';
-
- c.url(c.globals.url + localQueryStrings.closedEvent);
- c.waitForElementVisible(inactiveEventAlert, TIME_LIMIT);
- c.expect.element(inactiveEventAlert).to.be.present;
- c.assert.containsText(inactiveAlertMsgContainer, inactiveEventMsg);
- },
'Make sure that 4 fire layers are not present in layer list: use mock': (c) => {
c.url(c.globals.url + localQueryStrings.mockEvents);
c.waitForElementVisible(
@@ -64,17 +52,19 @@ module.exports = {
},
);
},
+
'Use Mock to make sure appropriate number of event markers are appended to map': (c) => {
c.url(c.globals.url + localQueryStrings.mockEvents);
c.waitForElementVisible(listOfEvents, TIME_LIMIT, () => {
- c.expect.elements(eventIcons).count.to.equal(9);
+ c.expect.elements(eventIcons).count.to.equal(8);
});
},
- 'On events tab click events list is loaded': (c) => {
+
+ 'On events tab click, events list is loaded': (c) => {
c.url(c.globals.url + localQueryStrings.mockEvents);
c.waitForElementVisible(listOfEvents, TIME_LIMIT);
},
- 'Use Mock to ensure number of event track points is correct and event markers and tabs are not visible when layer tab is clicked': (c) => {
+ 'Selecting event shows track points and markers which are not visible when switched to layer tab': (c) => {
const globalSelectors = c.globals.selectors;
c.click(secondEvent);
c.waitForElementVisible(trackMarker, TIME_LIMIT, () => {
@@ -87,7 +77,8 @@ module.exports = {
c.expect.element(eventIcons).to.be.present;
});
},
- 'Click Events tab and select an Event from the List': (c) => {
+
+ 'Clicking an event in the list selects the event': (c) => {
c.url(c.globals.url + localQueryStrings.mockEvents);
c.waitForElementVisible(listOfEvents, TIME_LIMIT, () => {
c.click(firstEvent);
@@ -127,8 +118,7 @@ module.exports = {
c.click('#event_visibility_info .close').pause(500);
c.expect.element('#event_visibility_info').to.not.be.present;
c.click(globalSelectors.notificationDismissButton).pause(500);
- c.expect.element(globalSelectors.notificationDismissButton).to.not.be
- .present;
+ c.expect.element(globalSelectors.notificationDismissButton).to.not.be.present;
},
'Clicking selected event deselects event': (c) => {
c.click(selectedFirstEvent).pause(500);
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index 7bbb88cb0..4cd9e36cc 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -134,11 +134,10 @@ class Sidebar extends React.Component {
}
if (mockSources) {
// eslint-disable-next-line no-console
- console.warn(`Using mock categories data: ${mockSources}`);
- sourcesURL = `mock/categories_data.json-${mockSources}`;
+ console.warn(`Using mock sources data: ${mockSources}`);
+ sourcesURL = `mock/sources_data.json-${mockSources}`;
}
-
if (initialLoad) {
requestEvents(eventsURL);
requestSources(sourcesURL);
diff --git a/web/mock/categories_data.json-20170530 b/web/mock/categories_data.json-20170530
deleted file mode 100644
index 011261097..000000000
--- a/web/mock/categories_data.json-20170530
+++ /dev/null
@@ -1,106 +0,0 @@
-
-{
- "title": "EONET Event Categories",
- "description": "List of all the available event categories in the EONET system",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories",
- "categories": [
- {
- "id": 6,
- "title": "Drought",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/6",
- "description": "Long lasting absence of precipitation affecting agriculture and livestock, and the overall availability of food and water.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/6"
- },
- {
- "id": 7,
- "title": "Dust and Haze",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/7",
- "description": "Related to dust storms, air pollution and other non-volcanic aerosols. Volcano-related plumes shall be included with the originating eruption event.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/7"
- },
- {
- "id": 16,
- "title": "Earthquakes",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/16",
- "description": "Related to all manner of shaking and displacement. Certain aftermath of earthquakes may also be found under landslides and floods.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/16"
- },
- {
- "id": 9,
- "title": "Floods",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/9",
- "description": "Related to aspects of actual flooding--e.g., inundation, water extending beyond river and lake extents.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/9"
- },
- {
- "id": 14,
- "title": "Landslides",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/14",
- "description": "Related to landslides and variations thereof: mudslides, avalanche.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/14"
- },
- {
- "id": 19,
- "title": "Manmade",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/19",
- "description": "Events that have been human-induced and are extreme in their extent.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/19"
- },
- {
- "id": 15,
- "title": "Sea and Lake Ice",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/15",
- "description": "Related to all ice that resides on oceans and lakes, including sea and lake ice (permanent and seasonal) and icebergs.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/15"
- },
- {
- "id": 10,
- "title": "Severe Storms",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/10",
- "description": "Related to the atmospheric aspect of storms (hurricanes, cyclones, tornadoes, etc.). Results of storms may be included under floods, landslides, etc.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/10"
- },
- {
- "id": 17,
- "title": "Snow",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/17",
- "description": "Related to snow events, particularly extreme/anomalous snowfall in either timing or extent/depth.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/17"
- },
- {
- "id": 18,
- "title": "Temperature Extremes",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/18",
- "description": "Related to anomalous land temperatures, either heat or cold.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/18"
- },
- {
- "id": 12,
- "title": "Volcanoes",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/12",
- "description": "Related to both the physical effects of an eruption (rock, ash, lava) and the atmospheric (ash and gas plumes). ",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/12"
- },
- {
- "id": 13,
- "title": "Water Color",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/13",
- "description": "Related to events that alter the appearance of water: phytoplankton, red tide, algae, sediment, whiting, etc.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/13"
- },
- {
- "id": 8,
- "title": "Wildfires",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/8",
- "description": "Wildfires includes all nature of fire, including forest and plains fires, as well as urban and industrial fire events. Fires may be naturally caused or manmade.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/8"
- },
- {
- "id": 99,
- "title": "Testing",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/99",
- "description": "This is strictly for testing and can be used in conjunction with other test data files.",
- "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/99"
- }
- ]
-}
diff --git a/web/mock/events_data.json b/web/mock/events_data.json
index f3662c5cf..5f9d46887 100644
--- a/web/mock/events_data.json
+++ b/web/mock/events_data.json
@@ -7,11 +7,11 @@
{
"id": "EONET_2793",
"title": "Elm Fire, California",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2793",
"categories": [
{
- "id": 8,
+ "id": "wildfires",
"title": "Wildfires"
}
],
@@ -37,11 +37,11 @@
{
"id": "EONET_2792",
"title": "Santiago, Chile Flooding",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2792",
"categories": [
{
- "id": 9,
+ "id": "floods",
"title": "Floods"
}
],
@@ -67,11 +67,11 @@
{
"id": "EONET_2781",
"title": "Langila Volcano, Papua New Guinea",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2781",
"categories": [
{
- "id": 12,
+ "id": "volcanoes",
"title": "Volcanoes"
}
],
@@ -97,11 +97,11 @@
{
"id": "EONET_2733",
"title": "Iceberg B30",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2733",
"categories": [
{
- "id": 15,
+ "id": "seaLakeIce",
"title": "Sea and Lake Ice"
}
],
@@ -110,7 +110,6 @@
"id": "NATICE",
"url": ""
}
-
],
"geometry": [
{
@@ -239,11 +238,11 @@
{
"id": "EONET_2733",
"title": "Iceberg B30-TEST",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2733",
"categories": [
{
- "id": 15,
+ "id": "seaLakeIce",
"title": "Sea and Lake Ice"
}
],
@@ -385,11 +384,11 @@
{
"id": "EONET_0001",
"title": "Example id 1",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_0001",
"categories": [
{
- "id": 1,
+ "id": "seaLakeIce",
"title": "Sea and Lake Ice"
}
],
@@ -398,7 +397,6 @@
"id": "NATICE",
"url": ""
}
-
],
"geometry": [
{
diff --git a/web/mock/events_data.json-20170530 b/web/mock/events_data.json-20170530
index 4cd4936ac..0d1c182bf 100644
--- a/web/mock/events_data.json-20170530
+++ b/web/mock/events_data.json-20170530
@@ -11,7 +11,7 @@
"link": "http://www.example.com",
"categories": [
{
- "id": 10,
+ "id": "severeStorms",
"title": "Severe Storms"
}
],
@@ -81,7 +81,7 @@
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2804",
"categories": [
{
- "id": 10,
+ "id": "severeStorms",
"title": "Severe Storms"
}
],
@@ -138,7 +138,7 @@
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2804",
"categories": [
{
- "id": 10,
+ "id": "severeStorms",
"title": "Severe Storms"
}
],
@@ -175,7 +175,7 @@
"link": "https://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_3931",
"categories": [
{
- "id": 8,
+ "id": "wildfires",
"title": "Wildfires"
}
],
@@ -193,36 +193,6 @@
}
]
},
- {
- "id": "EONET_2792",
- "title": "Santiago, Chile Flooding",
- "description": "",
- "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2792",
- "categories": [
- {
- "id": 9,
- "title": "Floods"
- }
- ],
- "sources": [
- {
- "id": "IDC",
- "url": "https://www.disasterscharter.org/web/guest/-/flood-in-chile-call-609-"
- }
-
- ],
- "geometry": [
- {
- "date": "2017-05-13T00:00:00Z",
- "type": "Point", "coordinates": [ -70.6640625, -33.45894275368763 ]
- },
- {
- "date": "2017-06-13T00:00:00Z",
- "type": "Point", "coordinates": [ -70.6640625, -33.45894275368763 ]
- }
-
- ]
- },
{
"id": "EONET_2781",
"title": "Langila Volcano, Papua New Guinea",
@@ -230,7 +200,7 @@
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2781",
"categories": [
{
- "id": 12,
+ "id": "volcanoes",
"title": "Volcanoes"
}
],
@@ -260,7 +230,7 @@
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2733",
"categories": [
{
- "id": 15,
+ "id": "seaLakeIce",
"title": "Sea and Lake Ice"
}
],
@@ -398,11 +368,11 @@
{
"id": "EONET_2733",
"title": "Iceberg B30-TEST",
- "description": "",
+ "description": "",
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2733",
"categories": [
{
- "id": 15,
+ "id": "seaLakeIce",
"title": "Sea and Lake Ice"
}
],
@@ -548,7 +518,7 @@
"link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_0001",
"categories": [
{
- "id": 1,
+ "id": "seaLakeIce",
"title": "Sea and Lake Ice"
}
],