Interactive interface for browsing global, full-resolution satellite imagery
WV-2944: Updating to OL v8.2.0 & remove NASA Logo for static maps in EIC Mode (#4804)
Ryan Weiler826e7f7d62cd
diff --git a/doc/e2e_testing.md b/doc/e2e_testing.mdindex ef4d601b2..a6e786271 100644--- a/doc/e2e_testing.md+++ b/doc/e2e_testing.md@@ -4,7 +4,7 @@ End-to-end tests are integrated into our CI and are required to pass before a su## Scripts-- `e2e` : Builds WV and runs the end-to-end tests for Firefox & Chromium in a Docker container+- `e2e` : Builds WV and runs the end-to-end tests for Firefox & Chromium in a Docker containerSee the [Docker](docker.md) page for more information.@@ -23,7 +23,7 @@ To run Playwright tests locally you will need to run `npx playwright install` whPlaywright commands can be used to run the entire test suite, individual tests and launch different features.- `npx playwright test` : Runs all tests headless-- `npx playwright test --headed` : Runs all tests headless+- `npx playwright test --headed` : Runs all tests in an open browser- `npx playwright test --project=firefox` : Run all tests headless for specific browser- `npx playwright test --headed --project=firefox` : Run all tests headed for specific browser- `npx playwright test compare-test.spec.js` : Run individual test headless@@ -88,6 +88,7 @@ let selectorsconst url = 'http://localhost:3000/?t=2020-07-04'```+- Each test file must import `test` & `expect` from the `@playwright/test` library- `createSelectors` is how we import the global selectors from the `selectors.js` file- `assertCategories` is a Worldview specific hook. We can import any hooks we need for our test here@@ -107,6 +108,7 @@ test.afterAll(async () => {await page.close()})```+- The `test.describe` property must be configured with `'serial'` to make the tests run in the order that they are written- The `beforeAll` hook is where we will define our `page` and `selectors` variable before all of our tests run. The `page` variable represents the current state of the browser- The `afterAll` hook is crucial to make sure the next test file is run properly. We close the page after all the tests in the file have run@@ -133,8 +135,9 @@ test('Recent tab shows layers that were selected', async () => {await expect(aodSearchRow).toBeVisible()})```+- Each test is an async function that requires a description parameter- We can destructure the variables we need from the selectors object- For elements that are not defined in the `selectors.js` file you can use `page.locator()` or any other locator. A full list can be found in the [Playwright Locators docs](https://playwright.dev/docs/locators)- If you are only performing an action on an element such as `click()` you do not need to define the element as a variable. You can simply write `await page.locator('.recent-tab').click()`-- If you are performing an assertion on an element, you will need to define the element as a variable first `const aquaAerosolRow = await page.locator('#MODIS_Aqua_Aerosol-search-row')` `await expect(aquaAerosolRow).toBeVisible()`\ No newline at end of file+- If you are performing an assertion on an element, you will need to define the element as a variable first `const aquaAerosolRow = await page.locator('#MODIS_Aqua_Aerosol-search-row')` `await expect(aquaAerosolRow).toBeVisible()`diff --git a/e2e/features/notifications/notify-test.spec.js b/e2e/features/notifications/notify-test.spec.jsindex b0c7ff699..7d001cc56 100644--- a/e2e/features/notifications/notify-test.spec.js+++ b/e2e/features/notifications/notify-test.spec.js@@ -45,7 +45,7 @@ test('Verify that layer notices don\'t show up in the notification list or contrawait page.goto(url)await modalCloseButton.click()await infoButtonIcon.click()- const badge = await page.locator('span.badge')+ const badge = await page.getByRole('button', { name: 'Notifications 2' })await expect(badge).toBeVisible()await expect(badge).toContainText('2')})diff --git a/jest.config.js b/jest.config.jsindex 9dc4aa4b2..aec12650b 100644--- a/jest.config.js+++ b/jest.config.js@@ -10,7 +10,7 @@ module.exports = {'^googleTagManager$': '<rootDir>/web/js/components/util/google-tag-manager.js'},transformIgnorePatterns: [- 'node_modules/(?!(ol|ol-mapbox-style|quick-lru|geotiff|@mapbox|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill)/)'+ 'node_modules/(?!(ol|ol-mapbox-style|quick-lru|geotiff|@mapbox|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill|color-space|color-rgba|color-parse)/)'],testPathIgnorePatterns: ['<rootDir>/e2e/'diff --git a/package-lock.json b/package-lock.jsonindex 6a1e3dc83..75f8d51c6 100644--- a/package-lock.json+++ b/package-lock.json@@ -40,7 +40,7 @@"moment": "^2.29.4","moment-locales-webpack-plugin": "^1.2.0","node-dir": "^0.1.17",- "ol": "^8.1.0",+ "ol": "^8.2.0","ol-mapbox-style": "^12.1.0","p-queue": "^7.4.1","proj4": "^2.9.2",@@ -5505,6 +5505,28 @@"version": "1.1.3","license": "MIT"},+ "node_modules/color-parse": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/color-parse/-/color-parse-2.0.0.tgz",+ "integrity": "sha512-g2Z+QnWsdHLppAbrpcFWo629kLOnOPtpxYV69GCqm92gqSgyXbzlfyN3MXs0412fPBkFmiuS+rXposgBgBa6Kg==",+ "dependencies": {+ "color-name": "^1.0.0"+ }+ },+ "node_modules/color-rgba": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/color-rgba/-/color-rgba-3.0.0.tgz",+ "integrity": "sha512-PPwZYkEY3M2THEHHV6Y95sGUie77S7X8v+h1r6LSAPF3/LL2xJ8duUXSrkic31Nzc4odPwHgUbiX/XuTYzQHQg==",+ "dependencies": {+ "color-parse": "^2.0.0",+ "color-space": "^2.0.0"+ }+ },+ "node_modules/color-space": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/color-space/-/color-space-2.0.1.tgz",+ "integrity": "sha512-nKqUYlo0vZATVOFHY810BSYjmCARrG7e5R3UE3CQlyjJTvv5kSSmPG1kzm/oDyyqjehM+lW1RnEt9It9GNa5JA=="+ },"node_modules/colord": {"version": "2.9.3","dev": true,@@ -12485,9 +12507,12 @@"license": "MIT"},"node_modules/ol": {- "version": "8.1.0",- "license": "BSD-2-Clause",+ "version": "8.2.0",+ "resolved": "https://registry.npmjs.org/ol/-/ol-8.2.0.tgz",+ "integrity": "sha512-/m1ddd7Jsp4Kbg+l7+ozR5aKHAZNQOBAoNZ5pM9Jvh4Etkf0WGkXr9qXd7PnhmwiC1Hnc2Toz9XjCzBBvexfXw==","dependencies": {+ "color-rgba": "^3.0.0",+ "color-space": "^2.0.1","earcut": "^2.2.3","geotiff": "^2.0.7","pbf": "3.2.1",diff --git a/package.json b/package.jsonindex b9ae78271..0142ad1e8 100644--- a/package.json+++ b/package.json@@ -176,7 +176,7 @@"moment": "^2.29.4","moment-locales-webpack-plugin": "^1.2.0","node-dir": "^0.1.17",- "ol": "^8.1.0",+ "ol": "^8.2.0","ol-mapbox-style": "^12.1.0","p-queue": "^7.4.1","proj4": "^2.9.2",diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.jsindex 63ce2cca0..6bc69dcbf 100644--- a/web/js/containers/sidebar/sidebar.js+++ b/web/js/containers/sidebar/sidebar.js@@ -266,6 +266,7 @@ class Sidebar extends React.Component {activeTab,changeTab,config,+ displayStaticMap,eventsData,eventsSources,hasEventRequestError,@@ -322,7 +323,7 @@ class Sidebar extends React.Component {return (<ErrorBoundary><section id="wv-sidebar" style={mobileWVSidebarStyle}>- {this.renderSidebarLogo()}+ {!displayStaticMap && this.renderSidebarLogo()}{!isDistractionFreeModeActive && isCollapsed && (<CollapsedButtonisMobile={isMobile}@@ -419,7 +420,7 @@ const mapStateToProps = (state) => {const eventsData = getFilteredEvents(state);const eventsSources = lodashGet(requestedEventSources, 'response');const { screenHeight } = screenSize;- const { isDistractionFreeModeActive, isKioskModeActive } = ui;+ const { isDistractionFreeModeActive, isKioskModeActive, displayStaticMap } = ui;const { isEmbedModeActive } = embed;const { activeTab, isCollapsed, mobileCollapsed } = sidebar;const { activeString } = compare;@@ -440,6 +441,7 @@ const mapStateToProps = (state) => {activeString,chartingModeAccessible,config,+ displayStaticMap,eventsData,eventsSources,numberOfLayers,diff --git a/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js b/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.jsindex 7226484ad..e8472ca3d 100644--- a/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js+++ b/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js@@ -33,7 +33,7 @@ function TileMeasurement({ ui }) {// #2 Filter all of the active layers that are also in the layersToMeasure arrayconst findLayersToMeasure = () => {const measurementLayersExtra = activeLayers.filter((layer) => layersToMeasure.includes(layer.id));- // condense this step into the above filter later+const measurementLayers = measurementLayersExtra.map((layer) => ({ id: layer.id, period: layer.period }));if (measurementLayers.length) console.log(`${measurementLayers.length} EIC layer(s) found to measure...`);return measurementLayers;@@ -128,8 +128,10 @@ function TileMeasurement({ ui }) {const verifyTilesAndHandleErrors = (abortProceedure) => {console.log('Verifying tiles on map...');+const tileCount = countTilesForSpecifiedLayers(ui, layersToMeasure);const loadedTiles = tileCount.totalLoadedTileCount > 0;+ console.log(`Total tiles loaded: ${tileCount.totalLoadedTileCount} and abortProceedure === ${abortProceedure}}`);if ((eic === 'da' || eic === 'sa') && !abortProceedure) {setEICMeasurementComplete();}@@ -139,7 +141,7 @@ function TileMeasurement({ ui }) {} else if (loadedTiles && abortProceedure) {console.log('EIC measure process aborted... Loaded map tiles found... Leaving map as is...');setEICMeasurementAborted();- } else if (!loadedTiles && abortProceedure) {+ } else if (!loadedTiles) {console.log('EIC measure process aborted... No tiles found on map... Displaying static map...');toggleStaticMap(true);const activeLayerIds = activeLayers.map((layer) => layer.id);@@ -156,7 +158,7 @@ function TileMeasurement({ ui }) {setMeasurementsStarted(true);const measurementLayers = findLayersToMeasure();- if (!measurementLayers) {+ if (!measurementLayers.length) {console.error('No layers found to be measured... Aborting...');return verifyTilesAndHandleErrors(true);}@@ -176,10 +178,9 @@ function TileMeasurement({ ui }) {// Format date based on period and dispatch redux actionupdateDate(fullImageryDate, layerPeriod);- verifyTilesAndHandleErrors();+ verifyTilesAndHandleErrors(false);} catch (error) {console.error('Error calculating measurements:', error);- verifyTilesAndHandleErrors(true);}};diff --git a/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.js b/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.jsindex bb0d687d0..6806befe4 100644--- a/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.js+++ b/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.js@@ -17,6 +17,8 @@ export const layersToMeasure = ['AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Night','AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day','VIIRS_NOAA20_CorrectedReflectance_TrueColor',+ 'CERES_EBAF_TOA_Shortwave_Flux_All_Sky_Monthly',+];// Object that contains the black pixel % threshold for each layer@@ -39,6 +41,7 @@ export const layerPixelData = {AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Night: { threshold: 0.20 },AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day: { threshold: 0.20 },VIIRS_NOAA20_CorrectedReflectance_TrueColor: { threshold: 0.65 },+ CERES_EBAF_TOA_Shortwave_Flux_All_Sky_Monthly: { threshold: 0.01 },};// Back-up dates for each layer in case no date is found that satisfies the full imagery threshold@@ -60,4 +63,5 @@ export const bestDates = {AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Night: { date: '2023-10-17' },AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day: { date: '2023-10-17' },VIIRS_NOAA20_CorrectedReflectance_TrueColor: { date: '2023-10-30' },+ CERES_EBAF_TOA_Shortwave_Flux_All_Sky_Monthly: { date: '2023-10-30' },};diff --git a/web/js/mapUI/components/kiosk/tile-measurement/utils/verify-map-tiles.js b/web/js/mapUI/components/kiosk/tile-measurement/utils/verify-map-tiles.jsindex 7a70df60d..1dc17dc67 100644--- a/web/js/mapUI/components/kiosk/tile-measurement/utils/verify-map-tiles.js+++ b/web/js/mapUI/components/kiosk/tile-measurement/utils/verify-map-tiles.js@@ -40,10 +40,14 @@ export default function countTilesForSpecifiedLayers (ui, layersToCheck) {const view = map.getView();const layers = map.getLayers().getArray();const matchingLayers = layers.filter((layer) => {- const layerId = layer.wv.id;- return layersToCheck.includes(layerId);+ if (layer.wv && layer.wv.id) {+ const layerId = layer.wv.id;+ return layersToCheck.includes(layerId);+ }+ return false;});+let totalExpectedTileCount = 0;let totalLoadedTileCount = 0;