Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2829 Outage Notifications (#4672)

Tom Carielloddc2267aea59
diff --git a/e2e/features/animation/animation-test.spec.js b/e2e/features/animation/animation-test.spec.js
index 32247a824..bfcaaae38 100644
--- a/e2e/features/animation/animation-test.spec.js
+++ b/e2e/features/animation/animation-test.spec.js
@@ -18,8 +18,9 @@ test.afterAll(async () => {
})
test('Clicking the animation widget button opens the widget', async () => {
- const { dragger, animationWidget, animationButton } = selectors
+ const { dragger, animationWidget, animationButton, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(dragger).toBeVisible()
await expect(animationWidget).not.toBeVisible()
await animationButton.click()
@@ -27,7 +28,9 @@ test('Clicking the animation widget button opens the widget', async () => {
})
test('Opening custom interval widget', async () => {
+ const { modalCloseButton } = selectors
await page.goto(activeAnimationWidget)
+ await modalCloseButton.click()
await page.locator('.wv-animation-widget-header #timeline-interval-btn-container #current-interval').hover()
const yearInterval = page.locator('.wv-animation-widget-header .timeline-interval .interval-years')
await expect(yearInterval).toBeVisible()
@@ -42,8 +45,9 @@ test('Opening custom interval widget', async () => {
})
test('Changing animation time interval', async () => {
- const { animationButton } = selectors
+ const { animationButton, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await animationButton.click()
await page.locator('.wv-animation-widget-header #timeline-interval-btn-container #current-interval').hover()
const yearInterval = page.locator('.wv-animation-widget-header .timeline-interval .interval-years')
@@ -57,8 +61,9 @@ test('Changing animation time interval', async () => {
})
test('Disable playback when max frames exceeded', async () => {
- const { playButton, yearStartInput } = selectors
+ const { modalCloseButton, playButton, yearStartInput } = selectors
await page.goto(animationGeostationary)
+ await modalCloseButton.click()
const animateYearDown = page.locator('.wv-date-range-selector > div > div > div:nth-child(3) > svg > .downarrow').first()
const animateYearUp = page.locator('.wv-date-range-selector > div > div > div > svg > .uparrow').first()
await animateYearDown.click()
diff --git a/e2e/features/animation/gif-test.spec.js b/e2e/features/animation/gif-test.spec.js
index 824c25e91..4d391eae6 100644
--- a/e2e/features/animation/gif-test.spec.js
+++ b/e2e/features/animation/gif-test.spec.js
@@ -23,8 +23,9 @@ test.afterAll(async () => {
})
test('Clicking the animation widget button opens the widget', async () => {
- const { createGifIcon, arcticRotationResetButton, rotationDialogOkButton } = selectors
+ const { createGifIcon, arcticRotationResetButton, modalCloseButton, rotationDialogOkButton } = selectors
await page.goto(animationProjectionRotated)
+ await modalCloseButton.click()
await createGifIcon.click()
await expect(arcticRotationResetButton).toHaveText('-18')
await rotationDialogOkButton.click()
@@ -38,9 +39,11 @@ test('GIF selection preview is Accurate and selections that are too high disable
gifPreviewEndDate,
gifPreviewFrameRateValue,
gifPreviewEndResolutionSelector,
- gifDownloadButton
+ gifDownloadButton,
+ modalCloseButton
} = selectors
await page.goto(activeAnimationWidget)
+ await modalCloseButton.click()
await createGifIcon.click()
await expect(gifPreviewStartDate).toHaveText('2018 MAR 28')
await expect(gifPreviewEndDate).toHaveText('2018 APR 04')
@@ -57,13 +60,17 @@ test('GIF selection preview is Accurate and selections that are too high disable
})
test('GIF download is disabled when too many frames would be requested with standard interval', async () => {
+ const { modalCloseButton } = selectors
await page.goto(animationTooManyFramesGif)
+ await modalCloseButton.click()
const createGif = page.locator('#create-gif-button')
await expect(createGif).toHaveClass(/disabled/)
})
test('GIF download is disabled when too many frames would be requested with custom interval', async () => {
+ const { modalCloseButton } = selectors
await page.goto(animationTooManyFramesGifCustomInterval)
+ await modalCloseButton.click()
const createGif = page.locator('#create-gif-button')
await expect(createGif).toHaveClass(/disabled/)
})
diff --git a/e2e/features/animation/mobile-animation-test.spec.js b/e2e/features/animation/mobile-animation-test.spec.js
index 9624bbbbc..a97581d85 100644
--- a/e2e/features/animation/mobile-animation-test.spec.js
+++ b/e2e/features/animation/mobile-animation-test.spec.js
@@ -20,8 +20,9 @@ test.afterAll(async () => {
})
test('Clicking the animation widget button opens the widget', async () => {
- const { mobileAnimateButton } = selectors
+ const { mobileAnimateButton, modalCloseButton } = selectors
await page.goto(knownDate)
+ await modalCloseButton.click()
await mobileAnimateButton.click()
const customIntervalInput = page.locator('.custom-interval-delta-input')
await expect(customIntervalInput).toHaveValue('1')
diff --git a/e2e/features/compare/compare-mobile-test.spec.js b/e2e/features/compare/compare-mobile-test.spec.js
index bea4b3353..dc472067a 100644
--- a/e2e/features/compare/compare-mobile-test.spec.js
+++ b/e2e/features/compare/compare-mobile-test.spec.js
@@ -20,7 +20,9 @@ test.afterAll(async () => {
})
test('Mobile comparison A|B toggle buttons are visible and only A is selected by default', async () => {
+ const { modalCloseButton } = selectors
await page.goto(swipeAndAIsActive)
+ await modalCloseButton.click()
const aMobileCompareButton = page.locator('.comparison-mobile-select-toggle > div:nth-child(1)')
const bMobileCompareButton = page.locator('.comparison-mobile-select-toggle > div:nth-child(2)')
await expect(aMobileCompareButton).toHaveClass(/compare-btn-selected/)
diff --git a/e2e/features/compare/compare-test.spec.js b/e2e/features/compare/compare-test.spec.js
index 8d4647a02..e0979759a 100644
--- a/e2e/features/compare/compare-test.spec.js
+++ b/e2e/features/compare/compare-test.spec.js
@@ -18,8 +18,9 @@ test.afterAll(async () => {
})
test('Animation is disabled when compare mode active', async () => {
- const { animationButtonCase, animationWidget } = selectors
+ const { animationButtonCase, animationWidget, modalCloseButton } = selectors
await page.goto(swipeAndAIsActive)
+ await modalCloseButton.click()
await expect(animationButtonCase).toHaveClass(/wv-disabled-button/)
const disableMessage = 'Animation feature is deactivated when Compare feature is active'
await expect(animationButtonCase).toHaveAttribute('aria-label', disableMessage)
@@ -82,8 +83,9 @@ test('Removing layer removes correct layer from correct layer group', async () =
})
test('Collapse layer list with B state and test label shows correct number of layers', async () => {
- const { toggleButton, collapsedToggleButton } = selectors
+ const { toggleButton, collapsedToggleButton, modalCloseButton } = selectors
await page.goto(spyAndBIsActive)
+ await modalCloseButton.click()
await expect(collapsedToggleButton).not.toBeVisible()
await toggleButton.click()
await expect(collapsedToggleButton).toBeVisible()
diff --git a/e2e/features/compare/layer-dialog-test.spec.js b/e2e/features/compare/layer-dialog-test.spec.js
index 272260d7b..1c54acaf3 100644
--- a/e2e/features/compare/layer-dialog-test.spec.js
+++ b/e2e/features/compare/layer-dialog-test.spec.js
@@ -28,7 +28,9 @@ test.afterAll(async () => {
})
test('Layer option features work in A|B mode', async () => {
+ const { modalCloseButton } = selectors
await page.goto(swipeAOD)
+ await modalCloseButton.click()
await expect(AodOptionsPanelBody).not.toBeVisible()
await aerosolLayer.hover()
await page.locator('#active-MODIS_Terra_Aerosol .wv-layers-options').click()
diff --git a/e2e/features/compare/layer-sidebar-test.spec.js b/e2e/features/compare/layer-sidebar-test.spec.js
index f14d3223f..320c7abf8 100644
--- a/e2e/features/compare/layer-sidebar-test.spec.js
+++ b/e2e/features/compare/layer-sidebar-test.spec.js
@@ -25,9 +25,11 @@ test('Add AOD Layer to Layer Group A', async () => {
const {
addLayers,
aerosolOpticalDepth,
- layersModalCloseButton
+ layersModalCloseButton,
+ modalCloseButton
} = selectors
await page.goto(swipeAndAIsActive)
+ await modalCloseButton.click()
await addLayers.click()
await aerosolOpticalDepth.click()
await aodCheckBox.click()
diff --git a/e2e/features/compare/permalinks-test.spec.js b/e2e/features/compare/permalinks-test.spec.js
index 3976e4985..ebd8c024b 100644
--- a/e2e/features/compare/permalinks-test.spec.js
+++ b/e2e/features/compare/permalinks-test.spec.js
@@ -22,31 +22,36 @@ test.afterAll(async () => {
})
test('Swipe mode and A|B state A are active and date is correct', async () => {
- const { swipeButton, aTab } = selectors
+ const { modalCloseButton, swipeButton, aTab } = selectors
await page.goto(swipeAndAIsActive)
+ await modalCloseButton.click()
await expect(swipeButton).not.toBeEnabled()
await expect(aTab).toHaveClass(/active/)
await expect(aTab).toContainText('A: 2018 AUG 17')
})
test('Opacity mode and A|B state B are active and date is correct', async () => {
- const { opacityButton, bTab } = selectors
+ const { modalCloseButton, opacityButton, bTab } = selectors
await page.goto(opacityAndBIsActive)
+ await modalCloseButton.click()
await expect(opacityButton).not.toBeEnabled()
await expect(bTab).toHaveClass(/active/)
await expect(bTab).toContainText('B: 2018 AUG 16')
})
test('Spy mode is active in B state', async () => {
- const { spyButton, bTab } = selectors
+ const { modalCloseButton, spyButton, bTab } = selectors
await page.goto(spyAndBIsActive)
+ await modalCloseButton.click()
await expect(spyButton).not.toBeEnabled()
await expect(bTab).toHaveClass(/active/)
await expect(bTab).toContainText('B: 2018 AUG 16')
})
test('A|B loaded with only one layer in A section -- Corrected Reflectance (True Color)', async () => {
+ const { modalCloseButton } = selectors
await page.goto(swipeAndAIsActive)
+ await modalCloseButton.click()
const overlayLayer = page.locator('.ab-tabs-case .tab-pane.active ul#overlays .item')
const correctedReflectance = page.locator('#active-MODIS_Terra_CorrectedReflectance_TrueColor')
await expect(overlayLayer).not.toBeVisible()
diff --git a/e2e/features/compare/timeline-test.spec.js b/e2e/features/compare/timeline-test.spec.js
index 12db39410..e3fda9f69 100644
--- a/e2e/features/compare/timeline-test.spec.js
+++ b/e2e/features/compare/timeline-test.spec.js
@@ -19,8 +19,9 @@ test.afterAll(async () => {
})
test('Verify that A|B draggers are visible', async () => {
- const { draggerA, draggerB } = selectors
+ const { draggerA, draggerB, modalCloseButton } = selectors
await page.goto(swipeAndAIsActive)
+ await modalCloseButton.click()
await expect(draggerA).toBeVisible()
await expect(draggerB).toBeVisible()
})
diff --git a/e2e/features/events/event-filter-test.spec.js b/e2e/features/events/event-filter-test.spec.js
index a0da916fe..4609dc070 100644
--- a/e2e/features/events/event-filter-test.spec.js
+++ b/e2e/features/events/event-filter-test.spec.js
@@ -38,8 +38,9 @@ test.afterAll(async () => {
})
test('Default filtering includes last 120 days and all categories', async () => {
- const { eventsTab, filterIcons, filterDates } = selectors
+ const { eventsTab, filterIcons, filterDates, modalCloseButton } = selectors
await page.goto(fixedAppNow)
+ await modalCloseButton.click()
await eventsTab.click()
await expect(filterIcons).toHaveCount(8)
await expect(filterDates).toContainText('2011 SEP 02 - 2011 DEC 31')
@@ -81,21 +82,23 @@ test('URL params for categories, dates, and extent filtering are present', async
test('Loading from permalink sets all criteria properly', async () => {
const {
- filterButton,
dustSwitch,
+ filterButton,
+ filterDates,
+ filterIcons,
manmadeSwitch,
+ mapExtentFilterCheckbox,
+ modalCloseButton,
seaLakeIceSwitch,
severeStormsSwitch,
snowSwitch,
volcanoesSwitch,
watercolorSwitch,
wildfiresSwitch,
- mapExtentFilterCheckbox,
- filterIcons,
- wildfiresIcon,
- filterDates
+ wildfiresIcon
} = selectors
await page.goto(wildfiresWithDates)
+ await modalCloseButton.click()
const currentUrl = await page.url()
@@ -123,19 +126,21 @@ test('Loading from permalink sets all criteria properly', async () => {
test('Changing criteria in modal DOES NOT update summary of criteria in sidebar on CANCEL', async () => {
const {
- startInputYear,
- startInputMonth,
- startInputDay,
- endInputYear,
- endInputMonth,
endInputDay,
+ endInputMonth,
+ endInputYear,
filterButton,
- filterModalCancel,
filterDates,
filterIcons,
+ filterModalCancel,
+ modalCloseButton,
+ startInputYear,
+ startInputMonth,
+ startInputDay,
wildfiresIcon
} = selectors
await page.goto(wildfiresWithDates)
+ await modalCloseButton.click()
await filterButton.click()
await startInputYear.fill('2000')
await startInputMonth.fill('APR')
@@ -211,8 +216,15 @@ test('Changing criteria in modal DOES update summary of criteria in sidebar on A
})
test('Event Selected, No Filter Params: Shows only day of event, all categories, checkbox unchecked', async () => {
- const { filterDates, filterButton, filterIcons, mapExtentFilterCheckbox } = selectors
+ const {
+ filterDates,
+ filterButton,
+ filterIcons,
+ mapExtentFilterCheckbox,
+ modalCloseButton
+ } = selectors
await page.goto(backwardsCompatibleEventUrl)
+ await modalCloseButton.click()
await expect(filterDates).toContainText('2005 DEC 31 - 2005 DEC 31')
await filterButton.click()
await assertDateInputValues('2005-DEC-31', '2005-DEC-31')
@@ -222,8 +234,9 @@ test('Event Selected, No Filter Params: Shows only day of event, all categories,
})
test('No extent search checkbox in polar projections', async () => {
- const { filterButton, mapExtentFilterCheckbox } = selectors
+ const { filterButton, mapExtentFilterCheckbox, modalCloseButton } = selectors
await page.goto(extentsUrl)
+ await modalCloseButton.click()
await filterButton.click()
await expect(mapExtentFilterCheckbox).toBeVisible()
await expect(mapExtentFilterCheckbox).toBeChecked()
diff --git a/e2e/features/events/event-test.spec.js b/e2e/features/events/event-test.spec.js
index 9b9edf8aa..dfb319b51 100644
--- a/e2e/features/events/event-test.spec.js
+++ b/e2e/features/events/event-test.spec.js
@@ -18,9 +18,9 @@ test.afterAll(async () => {
})
test('Make sure that 4 fire layers are not present in layer list: use mock', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { sidebarEvent, thermAnomSNPPday, thermAnomSNPPnight, thermAnomVIIRSday, thermAnomVIIRSnight } = selectors
+ const { modalCloseButton, sidebarEvent, thermAnomSNPPday, thermAnomSNPPnight, thermAnomVIIRSday, thermAnomVIIRSnight } = selectors
await page.goto(mockEvents)
+ await modalCloseButton.click()
await expect(sidebarEvent).toBeVisible()
await expect(thermAnomSNPPday).not.toBeVisible()
await expect(thermAnomSNPPnight).not.toBeVisible()
@@ -29,8 +29,10 @@ test('Make sure that 4 fire layers are not present in layer list: use mock', asy
})
test('Check that 4 fire layers are now present', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { sidebarEvent, thermAnomSNPPday, thermAnomSNPPnight, thermAnomVIIRSday, thermAnomVIIRSnight, layersTab } = selectors
+ // // test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
+ const { layersTab, modalCloseButton, sidebarEvent, thermAnomSNPPday, thermAnomSNPPnight, thermAnomVIIRSday, thermAnomVIIRSnight } = selectors
+ await page.goto(mockEvents)
+ await modalCloseButton.click()
await sidebarEvent.click()
await layersTab.click()
await expect(thermAnomSNPPday).toBeVisible()
@@ -40,16 +42,17 @@ test('Check that 4 fire layers are now present', async ({ browserName }) => {
})
test('Use Mock to make sure appropriate number of event markers are appended to map', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { listOfEvents, eventIcons } = selectors
+ const { eventIcons, listOfEvents, modalCloseButton } = selectors
await page.goto(mockEvents)
+ await modalCloseButton.click()
await expect(listOfEvents).toBeVisible()
await expect(eventIcons).toHaveCount(8)
})
test('Selecting event shows track points and markers which are not visible when switched to layer tab', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { secondEvent, trackMarker, eventIcons, eventsTab, layersTab } = selectors
+ const { eventIcons, eventsTab, layersTab, modalCloseButton, secondEvent, trackMarker } = selectors
+ await page.goto(mockEvents)
+ await modalCloseButton.click()
await page.waitForTimeout(1000)
await secondEvent.click()
await page.waitForTimeout(5000)
@@ -65,9 +68,7 @@ test('Selecting event shows track points and markers which are not visible when
})
test('Clicking an event in the list selects the event', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
const { firstEvent, selectedFirstEvent } = selectors
- await page.goto(mockEvents)
await page.waitForLoadState('networkidle')
await firstEvent.click()
await page.waitForTimeout(5000)
@@ -75,8 +76,10 @@ test('Clicking an event in the list selects the event', async ({ browserName })
})
test('Verify that Url is updated', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
+ const { modalCloseButton } = selectors
await page.waitForTimeout(5000)
+ await page.goto(mockEvents)
+ await modalCloseButton.click()
const currentUrl = await page.url()
expect(currentUrl).toContain('efs=true')
expect(currentUrl).toContain('efa=false')
@@ -84,8 +87,11 @@ test('Verify that Url is updated', async ({ browserName }) => {
})
test('Verify Events message and clicking message opens dialog', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { notifyMessage, modalCloseButton } = selectors
+ const { firstEvent, notifyMessage, modalCloseButton } = selectors
+ await page.goto(mockEvents)
+ await modalCloseButton.click()
+ await page.waitForLoadState('networkidle')
+ await firstEvent.click()
await expect(notifyMessage).toBeVisible()
await expect(notifyMessage).toContainText('Events may not be visible at all times.')
await notifyMessage.click()
@@ -97,8 +103,10 @@ test('Verify Events message and clicking message opens dialog', async ({ browser
})
test('Clicking selected event deselects event', async ({ browserName }) => {
- test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { selectedFirstEvent, eventsTab } = selectors
+ const { firstEvent, selectedFirstEvent, eventsTab, modalCloseButton } = selectors
+ await page.goto(mockEvents)
+ await modalCloseButton.click()
+ await firstEvent.click()
await selectedFirstEvent.click()
await eventsTab.hover()
await page.waitForTimeout(5000)
diff --git a/e2e/features/events/events-mobile-test.spec.js b/e2e/features/events/events-mobile-test.spec.js
index 2e8cb4bd0..f0ab48dc2 100644
--- a/e2e/features/events/events-mobile-test.spec.js
+++ b/e2e/features/events/events-mobile-test.spec.js
@@ -24,8 +24,9 @@ test.afterAll(async () => {
test('Events populated in sidebar', async ({ browserName }) => {
test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { sidebarButton, sidebarContent, eventsTab, icebergEvent } = selectors
+ const { modalCloseButton, sidebarButton, sidebarContent, eventsTab, icebergEvent } = selectors
await page.goto(mockEvents)
+ await modalCloseButton.click()
await page.waitForLoadState('networkidle')
await sidebarButton.click()
await expect(sidebarContent).toBeVisible()
@@ -45,8 +46,9 @@ test('Clicking event in list closes sidebar and selects marker for event on map'
test('Events load when arriving via permalink', async ({ browserName }) => {
test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
- const { sidebarButton, sidebarContent, selectedMarker } = selectors
+ const { modalCloseButton, sidebarButton, sidebarContent, selectedMarker } = selectors
await page.goto(stormEventSelected)
+ await modalCloseButton.click()
await expect(selectedMarker).toBeVisible()
await expect(sidebarContent).not.toBeVisible()
await expect(sidebarButton).toBeVisible()
diff --git a/e2e/features/global-unit/coordinate-format-test.spec.js b/e2e/features/global-unit/coordinate-format-test.spec.js
index d3a09a184..842081d89 100644
--- a/e2e/features/global-unit/coordinate-format-test.spec.js
+++ b/e2e/features/global-unit/coordinate-format-test.spec.js
@@ -1,10 +1,12 @@
// @ts-check
const { test, expect } = require('@playwright/test')
+const createSelectors = require('../../test-utils/global-variables/selectors')
const url = 'http://localhost:3000/?v=-78.52435703125,37.8608744140625,-75.56244296875,39.7483255859375&l=Reference_Labels_15m,Reference_Features_15m(hidden),Coastlines_15m,VIIRS_NOAA20_CorrectedReflectance_TrueColor(hidden),VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&lg=false&s=-77.0434,38.8046&t=2023-02-15-T19%3A53%3A41Z'
let page
let dmButton
let marker
+let selectors
test.describe.configure({ mode: 'serial' })
@@ -12,6 +14,7 @@ test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
dmButton = page.getByRole('button', { name: 'Set latlon-dm Format' })
marker = page.locator('.tooltip-coordinates')
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -19,7 +22,9 @@ test.afterAll(async () => {
})
test('Open page', async () => {
+ const { modalCloseButton } = selectors
await page.goto(url)
+ await modalCloseButton.click()
await expect(page).toHaveTitle('@OFFICIAL_NAME@')
})
diff --git a/e2e/features/global-unit/global-unit-test.spec.js b/e2e/features/global-unit/global-unit-test.spec.js
index 701ed1091..92a1c9fc2 100644
--- a/e2e/features/global-unit/global-unit-test.spec.js
+++ b/e2e/features/global-unit/global-unit-test.spec.js
@@ -1,5 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test')
+const createSelectors = require('../../test-utils/global-variables/selectors')
const SSTQueryString = 'http://localhost:3000/?l=GHRSST_L4_MUR_Sea_Surface_Temperature,Reference_Labels_15m(hidden),Reference_Features_15m(hidden),Coastlines_15m,VIIRS_NOAA20_CorrectedReflectance_TrueColor(hidden),VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&lg=false&t=2020-09-28-T20%3A40%3A53Z'
@@ -9,6 +10,7 @@ let settingContainer
let SSTMinPalette
let SSTMaxPalette
let kelvinButton
+let selectors
test.describe.configure({ mode: 'serial' })
@@ -19,6 +21,7 @@ test.beforeAll(async ({ browser }) => {
SSTMinPalette = page.locator('#GHRSST_L4_MUR_Sea_Surface_Temperature_GHRSST_Sea_Surface_Temperature_0_legend_0 > div.wv-palettes-min')
SSTMaxPalette = page.locator('#GHRSST_L4_MUR_Sea_Surface_Temperature_GHRSST_Sea_Surface_Temperature_0_legend_0 > div.wv-palettes-max')
kelvinButton = page.getByRole('button', { name: 'Kelvin' })
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -26,7 +29,9 @@ test.afterAll(async () => {
})
test('Global settings menu item opens global settings modal', async () => {
+ const { modalCloseButton } = selectors
await page.goto(SSTQueryString)
+ await modalCloseButton.click()
await page.getByRole('button', { name: 'Information' }).click()
await page.getByRole('button', { name: 'Settings' }).click()
await expect(globalSettingsModal).toBeVisible()
@@ -45,7 +50,9 @@ test('Selecting Kelvin unit changes unit being used in layer palette legend', as
})
test('Kelvin global unit is retained via localStorage and active on new url', async () => {
+ const { modalCloseButton } = selectors
await page.goto(SSTQueryString)
+ await modalCloseButton.click()
await page.getByRole('button', { name: 'Information' }).click()
await page.getByRole('button', { name: 'Settings' }).click()
await expect(kelvinButton).toHaveClass(/active/)
diff --git a/e2e/features/image-download/crosses-dateline-test.spec.js b/e2e/features/image-download/crosses-dateline-test.spec.js
index 5d8558613..6b64eb901 100644
--- a/e2e/features/image-download/crosses-dateline-test.spec.js
+++ b/e2e/features/image-download/crosses-dateline-test.spec.js
@@ -1,7 +1,9 @@
// @ts-check
const { test, expect } = require('@playwright/test')
+const createSelectors = require('../../test-utils/global-variables/selectors')
let page
+let selectors
const withinMapURLParams = 'http://localhost:3000/?v=-67.80916012733559,-56.052180562072095,-30.50743102883792,-30.873513420586164&t=2021-08-08-T0'
const crossesPrevDayURLParams = 'http://localhost:3000/?v=161.16767164758798,-54.46571918482002,198.46940074608565,-29.287052043334096&t=2021-08-08-T0'
@@ -11,6 +13,7 @@ test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -18,14 +21,18 @@ test.afterAll(async () => {
})
test('No dateline alert notification with message if not crossing dateline(s)', async () => {
+ const { modalCloseButton } = selectors
await page.goto(withinMapURLParams)
+ await modalCloseButton.click()
await page.locator('#wv-image-button').click()
const datelineAlert = page.locator('#snapshot-dateline-alert')
await expect(datelineAlert).not.toBeVisible()
})
test('Dateline alert notification with previous day message if crosses previous day dateline', async () => {
+ const { modalCloseButton } = selectors
await page.goto(crossesPrevDayURLParams)
+ await modalCloseButton.click()
await page.locator('#wv-image-button').click()
const datelineAlert = page.locator('#snapshot-dateline-alert')
const datelineAlertMessage = page.locator('#snapshot-dateline-alert .wv-alert-message')
@@ -34,7 +41,9 @@ test('Dateline alert notification with previous day message if crosses previous
})
test('Dateline alert notification with next day message if crosses next day dateline', async () => {
+ const { modalCloseButton } = selectors
await page.goto(crossesNextDayURLParams)
+ await modalCloseButton.click()
await page.locator('#wv-image-button').click()
const datelineAlert = page.locator('#snapshot-dateline-alert')
const datelineAlertMessage = page.locator('#snapshot-dateline-alert .wv-alert-message')
diff --git a/e2e/features/image-download/formats-test.spec.js b/e2e/features/image-download/formats-test.spec.js
index d0159d996..f56b84471 100644
--- a/e2e/features/image-download/formats-test.spec.js
+++ b/e2e/features/image-download/formats-test.spec.js
@@ -11,8 +11,10 @@ const {
joinUrl,
selectOption
} = require('../../test-utils/hooks/basicHooks')
+const createSelectors = require('../../test-utils/global-variables/selectors')
let page
+let selectors
const startParams = [
'l=MODIS_Terra_CorrectedReflectance_TrueColor',
@@ -25,6 +27,7 @@ test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -32,8 +35,10 @@ test.afterAll(async () => {
})
test('JPEG is the default', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, null)
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
diff --git a/e2e/features/image-download/global-select-test.spec.js b/e2e/features/image-download/global-select-test.spec.js
index a1649cde6..19df4f780 100644
--- a/e2e/features/image-download/global-select-test.spec.js
+++ b/e2e/features/image-download/global-select-test.spec.js
@@ -30,9 +30,10 @@ test.afterAll(async () => {
})
test('Verify that global select is present and not selected', async () => {
- const { globalSelectInput } = selectors
+ const { globalSelectInput, modalCloseButton } = selectors
const url = await joinUrl(startParams, null)
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await expect(globalSelectInput).toBeVisible()
await expect(globalSelectInput).not.toBeChecked()
diff --git a/e2e/features/image-download/initial-state-test.spec.js b/e2e/features/image-download/initial-state-test.spec.js
index 6fe411d7a..e84ab1775 100644
--- a/e2e/features/image-download/initial-state-test.spec.js
+++ b/e2e/features/image-download/initial-state-test.spec.js
@@ -29,8 +29,9 @@ test.afterAll(async () => {
})
test('Check resolutions', async () => {
- const { imageResolution } = selectors
+ const { imageResolution, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await expect(imageResolution).toContainText(expectedResolutions)
})
diff --git a/e2e/features/image-download/layers-test.spec.js b/e2e/features/image-download/layers-test.spec.js
index 1481a0ded..8ab1b050c 100644
--- a/e2e/features/image-download/layers-test.spec.js
+++ b/e2e/features/image-download/layers-test.spec.js
@@ -2,8 +2,10 @@
const { test, expect } = require('@playwright/test')
const { openImageDownloadPanel, clickDownload } = require('../../test-utils/hooks/wvHooks')
const { joinUrl, getAttribute } = require('../../test-utils/hooks/basicHooks')
+const createSelectors = require('../../test-utils/global-variables/selectors')
let page
+let selectors
const startParams = [
'v=-180,-90,180,90',
@@ -13,26 +15,34 @@ const startParams = [
test.describe.configure({ mode: 'serial' })
-test.beforeAll(async ({ browser }) => {
+test.beforeEach(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
-test.afterAll(async () => {
+test.afterEach(async () => {
await page.close()
})
test('List layers in draw order', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&l=MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Features_15m,MODIS_Terra_Aerosol')
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
expect(urlAttribute).toContain('LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor')
})
-test('Move AOD over the reference features', async () => {
+test('Move AOD over the reference features', async ({ browserName }) => {
+ test.skip(browserName === 'firefox', 'firefox fails this test for unknown reasons')
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&l=MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Aerosol,Reference_Features_15m')
await page.goto(url)
+ await page.waitForTimeout(1000)
+ await modalCloseButton.click()
+ await page.waitForTimeout(1000)
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
@@ -40,8 +50,10 @@ test('Move AOD over the reference features', async () => {
})
test('Do not include obscured layers', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&l=MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Aerosol,Reference_Features_15m')
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
@@ -49,8 +61,10 @@ test('Do not include obscured layers', async () => {
})
test('Multiple base layers when one is semi-transparent', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&l=MODIS_Terra_CorrectedReflectance_TrueColor(opacity=0.5),MODIS_Aqua_CorrectedReflectance_TrueColor')
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
diff --git a/e2e/features/image-download/projection-test.spec.js b/e2e/features/image-download/projection-test.spec.js
index af662d749..ac634bba1 100644
--- a/e2e/features/image-download/projection-test.spec.js
+++ b/e2e/features/image-download/projection-test.spec.js
@@ -7,8 +7,11 @@ const {
} = require('../../test-utils/hooks/wvHooks')
const { joinUrl, getAttribute } = require('../../test-utils/hooks/basicHooks')
const { switchProjections } = require('../../test-utils/hooks/wvHooks')
+const createSelectors = require('../../test-utils/global-variables/selectors')
let page
+let selectors
+
const startParams = [
'l=MODIS_Terra_CorrectedReflectance_TrueColor',
't=2018-06-01',
@@ -19,6 +22,7 @@ test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -26,8 +30,10 @@ test.afterAll(async () => {
})
test('Geographic is EPSG:4326', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, null)
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
diff --git a/e2e/features/image-download/resolutions3413-test.spec.js b/e2e/features/image-download/resolutions3413-test.spec.js
index f63d46d21..2f410c06b 100644
--- a/e2e/features/image-download/resolutions3413-test.spec.js
+++ b/e2e/features/image-download/resolutions3413-test.spec.js
@@ -32,9 +32,10 @@ test.afterAll(async () => {
})
test('In the arctic, top zoom levels is 5km', async () => {
- const { imageResolution } = selectors
+ const { imageResolution, modalCloseButton } = selectors
const url = await joinUrl(startParams, null)
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await expect(imageResolution).toHaveValue('20')
await closeImageDownloadPanel(page)
diff --git a/e2e/features/image-download/resolutions4326-test.spec.js b/e2e/features/image-download/resolutions4326-test.spec.js
index c7c83cae9..ac30a7515 100644
--- a/e2e/features/image-download/resolutions4326-test.spec.js
+++ b/e2e/features/image-download/resolutions4326-test.spec.js
@@ -32,9 +32,10 @@ test.afterAll(async () => {
})
test('In geographic, top two zoom levels are 10km', async () => {
- const { imageResolution } = selectors
+ const { imageResolution, modalCloseButton } = selectors
const url = await joinUrl(startParams, null)
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await expect(imageResolution).toHaveValue('40')
await closeImageDownloadPanel(page)
diff --git a/e2e/features/image-download/time-test.spec.js b/e2e/features/image-download/time-test.spec.js
index 4aadfe3dd..85a4c3e04 100644
--- a/e2e/features/image-download/time-test.spec.js
+++ b/e2e/features/image-download/time-test.spec.js
@@ -6,8 +6,10 @@ const {
clickDownload
} = require('../../test-utils/hooks/wvHooks')
const { joinUrl, getAttribute } = require('../../test-utils/hooks/basicHooks')
+const createSelectors = require('../../test-utils/global-variables/selectors')
let page
+let selectors
const startParams = [
'imageDownload='
@@ -17,6 +19,7 @@ test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -24,8 +27,10 @@ test.afterAll(async () => {
})
test('Image for today', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&now=2018-06-01T3')
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
@@ -34,8 +39,10 @@ test('Image for today', async () => {
})
test('Image for yesterday', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&now=2018-06-01T0')
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
@@ -44,8 +51,10 @@ test('Image for yesterday', async () => {
})
test('Image for 2018-05-15', async () => {
+ const { modalCloseButton } = selectors
const url = await joinUrl(startParams, '&t=2018-05-15')
await page.goto(url)
+ await modalCloseButton.click()
await openImageDownloadPanel(page)
await clickDownload(page)
const urlAttribute = await getAttribute(page, '#wv-image-download-url', 'url')
diff --git a/e2e/features/image-download/unsupported-test.spec.js b/e2e/features/image-download/unsupported-test.spec.js
index e5ac2d3fa..4c168ba24 100644
--- a/e2e/features/image-download/unsupported-test.spec.js
+++ b/e2e/features/image-download/unsupported-test.spec.js
@@ -29,9 +29,10 @@ test.afterAll(async () => {
})
test('Custom palettes are not supported dialog', async () => {
- const { snapshotToolbarButton } = selectors
+ const { modalCloseButton, snapshotToolbarButton } = selectors
const url = await joinUrl(startParams, '&l=MODIS_Terra_Aerosol(palette=red_1)')
await page.goto(url)
+ await modalCloseButton.click()
await snapshotToolbarButton.click()
await expect(notify).toBeVisible()
})
@@ -53,9 +54,10 @@ test('Custom palettes: OK button brings up download panel', async () => {
})
test('Rotation is not supported dialog', async () => {
- const { snapshotToolbarButton } = selectors
+ const { modalCloseButton, snapshotToolbarButton } = selectors
const url = await joinUrl(startParams, '&p=arctic&r=18')
await page.goto(url)
+ await modalCloseButton.click()
await snapshotToolbarButton.click()
await expect(notify).toBeVisible()
})
diff --git a/e2e/features/layers/layer-picker-mobile-test.spec.js b/e2e/features/layers/layer-picker-mobile-test.spec.js
index c3fe2a588..cc867ad12 100644
--- a/e2e/features/layers/layer-picker-mobile-test.spec.js
+++ b/e2e/features/layers/layer-picker-mobile-test.spec.js
@@ -23,8 +23,9 @@ test.afterAll(async () => {
})
test('Initial state indicates layer count', async () => {
- const { layerCount } = selectors
+ const { layerCount, modalCloseButton } = selectors
await page.goto(url)
+ await modalCloseButton.click()
await expect(layerCount).toBeVisible()
await expect(layerCount).toContainText('7')
})
diff --git a/e2e/features/layers/layer-picker-test.spec.js b/e2e/features/layers/layer-picker-test.spec.js
index 502aa494a..b9c315a0a 100644
--- a/e2e/features/layers/layer-picker-test.spec.js
+++ b/e2e/features/layers/layer-picker-test.spec.js
@@ -20,8 +20,9 @@ test.afterAll(async () => {
})
test('Layer picker shows categories when first opened', async () => {
- const { addLayers } = selectors
+ const { addLayers, modalCloseButton } = selectors
await page.goto(url)
+ await modalCloseButton.click()
await addLayers.click()
await assertCategories(page)
})
diff --git a/e2e/features/layers/layers-sidebar-test.spec.js b/e2e/features/layers/layers-sidebar-test.spec.js
index 797801770..56f36d52a 100644
--- a/e2e/features/layers/layers-sidebar-test.spec.js
+++ b/e2e/features/layers/layers-sidebar-test.spec.js
@@ -49,9 +49,11 @@ test('Toggle layer Info', async () => {
const {
firesLayer,
infoButton,
- infoDialog
+ infoDialog,
+ modalCloseButton
} = selectors
await page.goto(twoGroupsQueryString)
+ await modalCloseButton.click()
await firesLayer.hover()
await infoButton.click()
await infoButton.click()
@@ -74,13 +76,15 @@ test('Layer groups are enabled by default', async () => {
test('Adding a layer causes it to appear in the appropriate group', async () => {
const {
addLayers,
- layersSearchField,
- viirsFiresCheckbox,
- layersModalCloseButton,
firesGroup,
- firesLayer
+ firesLayer,
+ layersModalCloseButton,
+ layersSearchField,
+ modalCloseButton,
+ viirsFiresCheckbox
} = selectors
await page.goto(someGroupsQueryString)
+ await modalCloseButton.click()
await addLayers.click()
await layersSearchField.fill('fires')
await viirsFiresCheckbox.click()
@@ -124,8 +128,9 @@ test('Removing the last layer in a group removes the group', async () => {
})
test('Removing a group removes all layers and the group header', async () => {
- const { aodGroupHeader, aodGroup } = selectors
+ const { aodGroupHeader, aodGroup, modalCloseButton } = selectors
await page.goto(twoGroupsQueryString)
+ await modalCloseButton.click()
await aodGroupHeader.hover()
await page.locator('#active-Aerosol_Optical_Depth .layer-group-more-options > button').click()
await page.locator('#active-Aerosol_Optical_Depth .layer-group-more-options #remove-group').click()
@@ -134,12 +139,14 @@ test('Removing a group removes all layers and the group header', async () => {
test('Load with groups disabled from permalink', async () => {
const {
- groupCheckbox,
- firesGroup,
aodGroup,
+ firesGroup,
+ groupCheckbox,
+ modalCloseButton,
overlaysGroup
} = selectors
await page.goto(mixedLayersGroupsDisabledQueryString)
+ await modalCloseButton.click()
await expect(groupCheckbox).toBeVisible()
await expect(groupCheckbox).not.toBeChecked()
await expect(firesGroup).not.toBeVisible()
@@ -151,11 +158,13 @@ test('Load with groups disabled from permalink', async () => {
test('Load multiple groups from permalink', async () => {
const {
- groupCheckbox,
+ aodGroup,
firesGroup,
- aodGroup
+ groupCheckbox,
+ modalCloseButton
} = selectors
await page.goto(twoGroupsQueryString)
+ await modalCloseButton.click()
await expect(groupCheckbox).toBeVisible()
await expect(groupCheckbox).toBeChecked()
await expect(firesGroup).toBeVisible()
@@ -211,9 +220,11 @@ test('Re-ordering groups, then disabling groups keeps individual layer order', a
const {
aodGroupHeader,
firesGroupHeader,
- groupCheckbox
+ groupCheckbox,
+ modalCloseButton
} = selectors
await page.goto(twoGroupsQueryString)
+ await modalCloseButton.click()
const aodBoundingBox = await aodGroupHeader.boundingBox()
const firesBoundingBox = await firesGroupHeader.boundingBox()
// this 'steps' option is important for making the drag action work with the 'react-draggable' library
@@ -237,9 +248,11 @@ test('Enabling groups re-orders layers into their groups', async () => {
const {
aodGroup,
firesGroup,
- groupCheckbox
+ groupCheckbox,
+ modalCloseButton
} = selectors
await page.goto(mixedLayersGroupsDisabledQueryString)
+ await modalCloseButton.click()
const layersContainer = '#active-overlays li'
await assertLayerOrdering(page, layersContainer, mixedLayerIdOrder)
await groupCheckbox.click()
@@ -263,8 +276,9 @@ test('Immediately disabling groups restores mixed ordering', async () => {
})
test('Making a change to grouped layers causes group ordering to be retained when ungrouped', async () => {
- const { groupCheckbox, aodGroupHeader } = selectors
+ const { groupCheckbox, aodGroupHeader, modalCloseButton } = selectors
await page.goto(mixedLayersGroupsDisabledQueryString)
+ await modalCloseButton.click()
await groupCheckbox.click()
await aodGroupHeader.hover()
await page.locator('#active-Aerosol_Optical_Depth .layer-group-more-options > button').click()
@@ -275,7 +289,9 @@ test('Making a change to grouped layers causes group ordering to be retained whe
})
test('Vector layer has pointer icon & clicking vector layer pointer shows modal', async () => {
+ const { modalCloseButton } = selectors
await page.goto(vectorsQueryString)
+ await modalCloseButton.click()
const handPointer = await page.locator('#active-GRanD_Dams .fa-hand-pointer')
await expect(handPointer).toBeVisible()
await handPointer.click()
diff --git a/e2e/features/layers/layers-vector-test.spec.js b/e2e/features/layers/layers-vector-test.spec.js
index 759f88936..af0afc6c2 100644
--- a/e2e/features/layers/layers-vector-test.spec.js
+++ b/e2e/features/layers/layers-vector-test.spec.js
@@ -20,8 +20,9 @@ test.afterAll(async () => {
})
test('Vector layer click does not show alert when all vector layers are clickable', async () => {
- const { geographicMap, notifyMessage } = selectors
+ const { geographicMap, modalCloseButton, notifyMessage } = selectors
await page.goto(damsLayerUrl)
+ await modalCloseButton.click()
const pointerIcon = await page.locator('#active-GRanD_Dams .fa-hand-pointer')
await expect(pointerIcon).toBeVisible()
await geographicMap.click()
@@ -30,8 +31,9 @@ test('Vector layer click does not show alert when all vector layers are clickabl
test('Vectors show alert when not clickable', async ({ browserName }) => {
test.skip(browserName === 'firefox', 'issue identifying pointer')
- const { geographicMap, notifyMessage } = selectors
+ const { geographicMap, modalCloseButton, notifyMessage } = selectors
await page.goto(damsLayerWMSZoomLevelUrl)
+ await modalCloseButton.click()
const pointerIcon = await page.locator('#active-GRanD_Dams .fa-hand-pointer')
await expect(pointerIcon).toBeVisible()
await geographicMap.click()
diff --git a/e2e/features/layers/options-test.spec.js b/e2e/features/layers/options-test.spec.js
index 6a8bc1f46..80ed0ba5d 100644
--- a/e2e/features/layers/options-test.spec.js
+++ b/e2e/features/layers/options-test.spec.js
@@ -19,8 +19,9 @@ test.afterAll(async () => {
})
test('Verify that settings button opens settings modal', async () => {
- const { aodSidebarLayer } = selectors
+ const { aodSidebarLayer, modalCloseButton } = selectors
await page.goto(customsSquashedQuerystring)
+ await modalCloseButton.click()
await aodSidebarLayer.hover()
const thresholdMinLabel = await page.locator('#wv-layer-options-threshold0 .wv-label-range-min')
const combinedAodSettingsButton = await page.locator('#active-MODIS_Combined_Value_Added_AOD .wv-layers-options')
diff --git a/e2e/features/layers/recent-layers-mobile-test.spec.js b/e2e/features/layers/recent-layers-mobile-test.spec.js
index fc897b9c9..c42e0ca7c 100644
--- a/e2e/features/layers/recent-layers-mobile-test.spec.js
+++ b/e2e/features/layers/recent-layers-mobile-test.spec.js
@@ -23,8 +23,9 @@ test.afterAll(async () => {
})
test('Layer picker shows categories when first opened', async () => {
- const { collapsedLayerButton, addLayers } = selectors
+ const { addLayers, collapsedLayerButton, modalCloseButton } = selectors
await page.goto(url)
+ await modalCloseButton.click()
await collapsedLayerButton.click()
await addLayers.click()
await assertCategories(page)
diff --git a/e2e/features/layers/recent-layers-test.spec.js b/e2e/features/layers/recent-layers-test.spec.js
index 2f89803b0..fa684b1be 100644
--- a/e2e/features/layers/recent-layers-test.spec.js
+++ b/e2e/features/layers/recent-layers-test.spec.js
@@ -20,8 +20,9 @@ test.afterAll(async () => {
})
test('Layer picker shows categories when first opened', async () => {
- const { addLayers } = selectors
+ const { addLayers, modalCloseButton } = selectors
await page.goto(url)
+ await modalCloseButton.click()
await addLayers.click()
await assertCategories(page)
})
diff --git a/e2e/features/location-search/location-search-mobile-test.spec.js b/e2e/features/location-search/location-search-mobile-test.spec.js
index 4b6573895..b6271dc45 100644
--- a/e2e/features/location-search/location-search-mobile-test.spec.js
+++ b/e2e/features/location-search/location-search-mobile-test.spec.js
@@ -21,8 +21,9 @@ test.afterAll(async () => {
})
test('Location Search component is visible by default', async () => {
- const { locationSearchMobileDialog } = selectors
+ const { locationSearchMobileDialog, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(locationSearchMobileDialog).not.toBeVisible()
})
diff --git a/e2e/features/location-search/location-search-test.spec.js b/e2e/features/location-search/location-search-test.spec.js
index 18a7a716f..8608e75ab 100644
--- a/e2e/features/location-search/location-search-test.spec.js
+++ b/e2e/features/location-search/location-search-test.spec.js
@@ -22,8 +22,9 @@ test.afterAll(async () => {
})
test('Location Search component is visible by default', async () => {
- const { locationSearchComponent } = selectors
+ const { locationSearchComponent, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(locationSearchComponent).toBeVisible()
})
@@ -34,8 +35,9 @@ test('Clicking the minimize button minimizes the Location Search component', asy
})
test('Location Search component remains hidden on subsequent page loads per user preference', async () => {
- const { locationSearchComponent } = selectors
+ const { locationSearchComponent, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(locationSearchComponent).not.toBeVisible()
})
@@ -46,8 +48,10 @@ test('Clicking Location Search toolbar button expands the Location Search compon
})
test('Coordinates dialog for permalink marker is visible by default on page load', async () => {
+ const { modalCloseButton } = selectors
const testMarkerEncodedID = await page.locator('.coordinates-map-marker_-77__2E__032__2C__38__2E__8904')
await page.goto(markerUrl)
+ await modalCloseButton.click()
await expect(testMarkerEncodedID).toBeVisible()
})
@@ -64,8 +68,9 @@ test('Clicking minimize tooltip hides the coordinates dialog', async () => {
})
test('Clicking close tooltip removes the marker and coordinates dialog', async () => {
- const { coordinatesMapMarker, tooltipCoordinatesCloseButton } = selectors
+ const { coordinatesMapMarker, modalCloseButton, tooltipCoordinatesCloseButton } = selectors
await page.goto(removeMarkerUrl)
+ await modalCloseButton.click()
await tooltipCoordinatesCloseButton.click()
await expect(coordinatesMapMarker).not.toBeVisible()
const url = await page.url()
@@ -73,8 +78,9 @@ test('Clicking close tooltip removes the marker and coordinates dialog', async (
})
test('Invalid marker query string parameter prevents state update', async () => {
- const { coordinatesMapMarker } = selectors
+ const { coordinatesMapMarker, modalCloseButton } = selectors
await page.goto(invalidMarkerQuery)
+ await modalCloseButton.click()
await expect(coordinatesMapMarker).not.toBeVisible()
const url = await page.url()
expect(url).not.toContain('s=')
diff --git a/e2e/features/measure/measure-test.spec.js b/e2e/features/measure/measure-test.spec.js
index 248a8245f..e4c8b19e6 100644
--- a/e2e/features/measure/measure-test.spec.js
+++ b/e2e/features/measure/measure-test.spec.js
@@ -27,9 +27,11 @@ test.afterAll(async () => {
})
test('Clicking the measure button opens the menu', async ({ browserName }) => {
+ const { modalCloseButton } = selectors
test.skip(browserName === 'firefox', 'firefox pointer issue')
const { measureMenu, measureBtn } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(measureMenu).not.toBeVisible()
await measureBtn.click()
})
diff --git a/e2e/features/modal/about-modal-test.spec.js b/e2e/features/modal/about-modal-test.spec.js
index 89ebbd08d..afe125517 100644
--- a/e2e/features/modal/about-modal-test.spec.js
+++ b/e2e/features/modal/about-modal-test.spec.js
@@ -22,7 +22,9 @@ test.afterAll(async () => {
})
test('About modal not open when URL param not present', async () => {
+ const { modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(aboutPage).not.toBeVisible()
})
@@ -36,6 +38,8 @@ test('Opening about modal from menu sets URL param', async () => {
})
test('About modal is open when URL param is present', async () => {
+ const { modalCloseButton } = selectors
await page.goto(aboutOpenURL)
+ await modalCloseButton.click()
await expect(aboutPage).toBeVisible()
})
diff --git a/e2e/features/notifications/notify-test.spec.js b/e2e/features/notifications/notify-test.spec.js
index 7e9463c25..205950d9c 100644
--- a/e2e/features/notifications/notify-test.spec.js
+++ b/e2e/features/notifications/notify-test.spec.js
@@ -40,9 +40,11 @@ test('No visible notifications with mockAlert parameter set to no_types', async
})
test('Outage takes precedence when all three notifications are present', async () => {
+ const { modalCloseButton } = selectors
const url = `${layerNoticesQuery}&mockAlerts=all_types`
const statusOutage = await page.locator('#wv-info-button.wv-status-outage')
await page.goto(url)
+ await modalCloseButton.click()
await expect(statusOutage).toBeVisible()
await infoButtonIcon.click()
await expect(infoMenu).toContainText('Notifications')
@@ -52,7 +54,7 @@ test('Outage takes precedence when all three notifications are present', async (
test('Verify that layer notices don\'t show up in the notification list or contribute to the count', async () => {
const badge = await page.locator('span.badge')
await expect(badge).toBeVisible()
- await expect(badge).toContainText('3')
+ await expect(badge).toContainText('2')
})
test('Alert, outage, and message content is highlighted and found in modal', async () => {
@@ -72,6 +74,10 @@ test('Verify that the user is only alerted if they have not already stored all i
})
test('Verify that zots show for the layers that have notices', async () => {
+ const { modalCloseButton } = selectors
+ const url = `${layerNoticesQuery}&mockAlerts=all_types`
+ await page.goto(url)
+ await modalCloseButton.click()
const aquaZot = await page.locator('#MODIS_Aqua_CorrectedReflectance_TrueColor-zot')
const particulateZot = await page.locator('#Particulate_Matter_Below_2__2E__5micrometers_2001-2010-zot')
await expect(aquaZot).toBeVisible()
diff --git a/e2e/features/palettes/disable-test.spec.js b/e2e/features/palettes/disable-test.spec.js
index d605527f4..3756337b8 100644
--- a/e2e/features/palettes/disable-test.spec.js
+++ b/e2e/features/palettes/disable-test.spec.js
@@ -1,6 +1,9 @@
// @ts-check
const { test, expect } = require('@playwright/test')
+const createSelectors = require('../../test-utils/global-variables/selectors')
+
let page
+let selectors
const enabledPermalink = 'http://localhost:3000/?l=Last_of_the_Wild_1995-2004'
const disabledPermalink = 'http://localhost:3000/?l=Last_of_the_Wild_1995-2004(disabled=0-13-12-1-2-6)'
@@ -9,6 +12,7 @@ test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -16,7 +20,9 @@ test.afterAll(async () => {
})
test('Verify that toggling class updates permalink and layer-legend', async () => {
+ const { modalCloseButton } = selectors
await page.goto(enabledPermalink)
+ await modalCloseButton.click()
const disabledClassification = await page.locator('#active-Last_of_the_Wild_1995-2004 .disabled-classification')
await expect(disabledClassification).not.toBeVisible()
await page.locator('#active-Last_of_the_Wild_1995-2004').hover()
@@ -47,7 +53,9 @@ test('Verify that toggling class-all on updates permalink and layer-legend', asy
})
test('Verify that loaded permalink disables classes', async () => {
+ const { modalCloseButton } = selectors
await page.goto(disabledPermalink)
+ await modalCloseButton.click()
const colorBoxDisabledZero = await page.locator('#Last_of_the_Wild_1995-2004_0_legend-color-Last_of_the_Wild_1995-2004-active0.disabled-classification')
const colorBoxDisabledThirteen = await page.locator('#Last_of_the_Wild_1995-2004_0_legend-color-Last_of_the_Wild_1995-2004-active13.disabled-classification')
const colorBoxDisabledSix = await page.locator('#Last_of_the_Wild_1995-2004_0_legend-color-Last_of_the_Wild_1995-2004-active6.disabled-classification')
diff --git a/e2e/features/projections/projections-test.spec.js b/e2e/features/projections/projections-test.spec.js
index 75aa43d72..17b7f7b70 100644
--- a/e2e/features/projections/projections-test.spec.js
+++ b/e2e/features/projections/projections-test.spec.js
@@ -19,8 +19,9 @@ test.afterAll(async () => {
})
test('Verify default page shows projection toolbar button in geographic projection map', async () => {
- const { projToolbarButton, geographicMap } = selectors
+ const { geographicMap, modalCloseButton, projToolbarButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(projToolbarButton).toBeVisible()
await expect(geographicMap).toBeVisible()
})
diff --git a/e2e/features/share/share-test.spec.js b/e2e/features/share/share-test.spec.js
index 7f25dd390..b787dc8b7 100644
--- a/e2e/features/share/share-test.spec.js
+++ b/e2e/features/share/share-test.spec.js
@@ -21,8 +21,9 @@ test.afterAll(async () => {
})
test('Clicking the share link button opens the share dialog', async () => {
- const { shareToolbarButton, shareToolbar } = selectors
+ const { modalCloseButton, shareToolbarButton, shareToolbar } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await shareToolbarButton.click()
await expect(shareToolbar).toBeVisible()
})
@@ -37,9 +38,10 @@ test('Share tabs link and social are visible and enabled', async () => {
})
test('Share link clipboard with existing time query string param in the page url will have the same serialized time', async () => {
- const { shareToolbarButton, shareLinkInput } = selectors
+ const { modalCloseButton, shareToolbarButton, shareLinkInput } = selectors
const queryString = 'http://localhost:3000/?t=2018-12-31'
await page.goto(queryString)
+ await modalCloseButton.click()
await shareToolbarButton.click()
const url = await page.url()
expect(url).toContain('t=')
@@ -47,9 +49,10 @@ test('Share link clipboard with existing time query string param in the page url
})
test('Share link clipboard with no time query string param in the page url will have the same serialized time (partial YYYY-MM-DD)', async () => {
- const { shareToolbarButton } = selectors
+ const { modalCloseButton, shareToolbarButton } = selectors
const queryString = 'http://localhost:3000/'
await page.goto(queryString)
+ await modalCloseButton.click()
await page.getByRole('button', { name: '×' }).click()
await shareToolbarButton.click()
const minutesOffset = 40 * 60000 // 40 minutes
@@ -83,9 +86,10 @@ test('Clicking the social tab displays social share buttons', async () => {
})
test('Clicking Shorten link works with links less than 2049 characters', async () => {
- const { shareToolbarButton } = selectors
+ const { modalCloseButton, shareToolbarButton } = selectors
const shortQueryString = 'http://localhost:3000/?l=Reference_Labels_15m,Reference_Features_15m,Coastlines_15m,VIIRS_NOAA20_CorrectedReflectance_TrueColor(hidden),VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&lg=true&t=2022-08-10-T15%3A15%3A05Z'
await page.goto(shortQueryString)
+ await modalCloseButton.click()
const linkShortenCase = await page.locator('#wv-link-shorten-case')
await shareToolbarButton.click()
await linkShortenCase.click()
@@ -93,9 +97,10 @@ test('Clicking Shorten link works with links less than 2049 characters', async (
})
test('Clicking Shorten link is refused with links greater than 2048 characters', async () => {
- const { shareToolbarButton } = selectors
+ const { modalCloseButton, shareToolbarButton } = selectors
const longQueryString = 'http://localhost:3000/?l=MODIS_Terra_AOD_Deep_Blue_Combined,MODIS_Terra_AOD_Deep_Blue_Land,MODIS_Terra_Angstrom_Exponent_Ocean,MODIS_Terra_Angstrom_Exponent_Land,MODIS_Terra_Aerosol_Optical_Depth_3km,MODIS_Terra_Aerosol,MISR_Aerosol_Optical_Depth_Avg_Green_Monthly,VIIRS_SNPP_Angstrom_Exponent_Dark_Target_Ocean,VIIRS_SNPP_AOT_Dark_Target_Land_Ocean,VIIRS_SNPP_Angstrom_Exponent_Deep_Blue_Best_Estimate,VIIRS_SNPP_AOT_Deep_Blue_Best_Estimate,SWDB_Aerosol_Angstrom_Exponent_Monthly,SWDB_Aerosol_Optical_Thickness_550nm_Monthly,SWDB_Aerosol_Angstrom_Exponent_Daily,SWDB_Aerosol_Optical_Thickness_550nm_Daily,MERRA2_Total_Aerosol_Optical_Thickness_550nm_Extinction_Monthly,MERRA2_Total_Aerosol_Optical_Thickness_550nm_Scattering_Monthly,OMI_Absorbing_Aerosol_Optical_Thickness_MW_388,OMI_Absorbing_Aerosol_Optical_Depth,OMI_Aerosol_Optical_Depth,MODIS_Aqua_AOD_Deep_Blue_Combined,MODIS_Aqua_AOD_Deep_Blue_Land,MODIS_Aqua_Angstrom_Exponent_Ocean,MODIS_Aqua_Angstrom_Exponent_Land,MODIS_Aqua_Aerosol_Optical_Depth_3km,MODIS_Aqua_Aerosol,MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth,MODIS_Combined_Value_Added_AOD,MLS_CO_215hPa_Night,MLS_CO_215hPa_Day,AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Monthly_Night,AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Monthly_Day,AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Night,AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day,AIRS_L2_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Night,AIRS_L2_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Day,OrbitTracks_Aura_Descending,OrbitTracks_Aura_Ascending,OrbitTracks_Aqua_Ascending,OrbitTracks_Suomi_NPP_Ascending,VIIRS_SNPP_Aerosol_Type_Deep_Blue_Best_Estimate,Reference_Labels_15m,Reference_Features_15m,Coastlines_15m,MODIS_Combined_L3_Nadir-BRDF_Daily,MODIS_Combined_MAIAC_L2G_BidirectionalReflectance_Bands143,VIIRS_NOAA20_CorrectedReflectance_TrueColor(hidden),VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&lg=true&t=2022-08-10-T15%3A15%3A05Z'
await page.goto(longQueryString)
+ await modalCloseButton.click()
const linkShortenCase = await page.locator('#wv-link-shorten-case')
await shareToolbarButton.click()
await linkShortenCase.click()
diff --git a/e2e/features/smart-handoff/smart-handoff-test.spec.js b/e2e/features/smart-handoff/smart-handoff-test.spec.js
index e1a1c3087..fa13c1311 100644
--- a/e2e/features/smart-handoff/smart-handoff-test.spec.js
+++ b/e2e/features/smart-handoff/smart-handoff-test.spec.js
@@ -17,10 +17,11 @@ test.afterAll(async () => {
})
test('Data tab is available and in default state when clicked', async () => {
- const { dataDownloadTabButton } = selectors
+ const { dataDownloadTabButton, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?l=Reference_Labels_15m(hidden),Reference_Features_15m(hidden),Coastlines_15m&t=2019-12-01'
const handoffTitle = await page.locator('.smart-handoff-side-panel > h1')
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(dataDownloadTabButton).toBeVisible()
await dataDownloadTabButton.click()
await page.waitForTimeout(5000)
@@ -52,9 +53,10 @@ test('Select "Cloud Effective Radius" layer and check that it is available for d
})
test('Arriving via permalink, data tab selected and granule count shows', async () => {
- const { dataDownloadTabButton } = selectors
+ const { dataDownloadTabButton, modalCloseButton } = selectors
const permalinkParams = 'http://localhost:3000/?l=GHRSST_L4_MUR_Sea_Surface_Temperature,MODIS_Aqua_Aerosol_Optical_Depth_3km&lg=true&sh=MODIS_Aqua_Aerosol_Optical_Depth_3km,C1443528505-LAADS&t=2020-02-06-T06%3A00%3A00Z'
await page.goto(permalinkParams)
+ await modalCloseButton.click()
await dataDownloadTabButton.click()
const granuleCountInfo = await page.locator('.granule-count-info')
await expect(granuleCountInfo).not.toHaveText('NONE')
@@ -67,17 +69,20 @@ test('Changing collection updates URL', async () => {
})
test('Layers outside of their coverage date range are hidden from layers available for download', async () => {
- const { dataDownloadTabButton } = selectors
+ const { dataDownloadTabButton, modalCloseButton } = selectors
const permalinkParams1980 = 'http://localhost:3000/?l=GHRSST_L4_MUR_Sea_Surface_Temperature,MODIS_Aqua_Aerosol_Optical_Depth_3km&lg=true&sh=MODIS_Aqua_Aerosol_Optical_Depth_3km,C1443528505-LAADS&t=1980-02-06-T06%3A00%3A00Z'
await page.goto(permalinkParams1980)
+ await modalCloseButton.click()
await expect(dataDownloadTabButton).toBeVisible()
const smartHandoffTitle = await page.locator('.smart-handoff-side-panel > h1')
await expect(smartHandoffTitle).toContainText('None of your current layers are available for download.')
})
test('Map extent entirely across dateline disables download button and displays warning for user to zoom out to see available map', async () => {
+ const { modalCloseButton } = selectors
const extentCrossedDateline = 'http://localhost:3000/?v=226.32336353630282,-35.84415340249873,233.47009302183025,-31.309041515170094&l=VIIRS_NOAA20_Thermal_Anomalies_375m_All,Coastlines_15m,MODIS_Terra_CorrectedReflectance_TrueColor&lg=false&sh=VIIRS_NOAA20_Thermal_Anomalies_375m_All,C1355615368-LANCEMODIS&t=2021-08-29-T17%3A56%3A03Z'
await page.goto(extentCrossedDateline)
+ await modalCloseButton.click()
const downloadButton = await page.locator('.download-btn')
await expect(downloadButton).toBeVisible()
await expect(downloadButton).toHaveClass(/wv-disabled/)
@@ -86,8 +91,10 @@ test('Map extent entirely across dateline disables download button and displays
})
test('Download via Earthdata Search', async () => {
+ const { modalCloseButton } = selectors
const permalinkParams = 'http://localhost:3000/?l=GHRSST_L4_MUR_Sea_Surface_Temperature,MODIS_Aqua_Aerosol_Optical_Depth_3km&lg=true&sh=MODIS_Aqua_Aerosol_Optical_Depth_3km,C1443528505-LAADS&t=2020-02-06-T06%3A00%3A00Z'
await page.goto(permalinkParams)
+ await modalCloseButton.click()
await page.locator('.download-btn').click()
const transferring = await page.locator('#transferring-to-earthdata-search')
await expect(transferring).toBeVisible()
diff --git a/e2e/features/timeline/date-selector-test.spec.js b/e2e/features/timeline/date-selector-test.spec.js
index 5f499b6b4..1c89500a1 100644
--- a/e2e/features/timeline/date-selector-test.spec.js
+++ b/e2e/features/timeline/date-selector-test.spec.js
@@ -23,9 +23,11 @@ test('Verify subdaily default year, month, day, hour, minute date selector input
dateSelectorHourInput,
dateSelectorDayInput,
dateSelectorMonthInput,
- dateSelectorYearInput
+ dateSelectorYearInput,
+ modalCloseButton
} = selectors
await page.goto(subdailyLayerIntervalTimescale)
+ await modalCloseButton.click()
await expect(dateSelectorMinuteInput).toBeVisible()
await expect(dateSelectorHourInput).toBeVisible()
await expect(dateSelectorDayInput).toBeVisible()
@@ -34,8 +36,9 @@ test('Verify subdaily default year, month, day, hour, minute date selector input
})
test('Change date using left/right arrows', async () => {
- const { dateSelectorDayInput } = selectors
+ const { dateSelectorDayInput, modalCloseButton } = selectors
await page.goto(knownDate)
+ await modalCloseButton.click()
await expect(dateSelectorDayInput).toHaveValue('22')
await page.locator('#left-arrow-group').click()
await expect(dateSelectorDayInput).toHaveValue('21')
@@ -44,8 +47,10 @@ test('Change date using left/right arrows', async () => {
})
test('Left timeline arrow will not be disabled by default', async () => {
+ const { modalCloseButton } = selectors
const queryString = 'http://localhost:3000/'
await page.goto(queryString)
+ await modalCloseButton.click()
await page.getByRole('button', { name: '×' }).click()
const leftArrow = await page.locator('#left-arrow-group')
await expect(leftArrow).not.toHaveClass(/button-disabled/)
@@ -70,13 +75,17 @@ test('Left timeline arrow will not be disabled by default', async () => {
// })
test('Right timeline arrow will not be disabled', async () => {
+ const { modalCloseButton } = selectors
await page.goto(knownDate)
+ await modalCloseButton.click()
const rightArrow = await page.locator('#right-arrow-group')
await expect(rightArrow).not.toHaveClass(/button-disabled/)
})
test('Now button will not be disabled if date is not on now', async () => {
+ const { modalCloseButton } = selectors
await page.goto(knownDate)
+ await modalCloseButton.click()
const nowButton = await page.locator('#now-button-group')
await expect(nowButton).not.toHaveClass(/button-disabled/)
})
@@ -85,10 +94,12 @@ test('Verify date selector is populated with date YYYY-MON-DD', async () => {
const {
dateSelectorDayInput,
dateSelectorMonthInput,
- dateSelectorYearInput
+ dateSelectorYearInput,
+ modalCloseButton
} = selectors
const queryString = 'http://localhost:3000/?t=2019-02-22'
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(dateSelectorDayInput).toHaveValue('22')
await expect(dateSelectorMonthInput).toHaveValue('FEB')
await expect(dateSelectorYearInput).toHaveValue('2019')
@@ -100,9 +111,11 @@ test('Verify subdaily date selector is populated with date YYYY-MON-DD-HH-MM', a
dateSelectorMonthInput,
dateSelectorYearInput,
dateSelectorHourInput,
- dateSelectorMinuteInput
+ dateSelectorMinuteInput,
+ modalCloseButton
} = selectors
await page.goto(subdailyLayerIntervalTimescale)
+ await modalCloseButton.click()
await expect(dateSelectorMinuteInput).toHaveValue('46')
await expect(dateSelectorHourInput).toHaveValue('09')
await expect(dateSelectorDayInput).toHaveValue('04')
@@ -111,9 +124,10 @@ test('Verify subdaily date selector is populated with date YYYY-MON-DD-HH-MM', a
})
test('Allow invalid day values in date selector', async () => {
- const { dateSelectorDayInput } = selectors
+ const { dateSelectorDayInput, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?t=2019-02-22'
await page.goto(queryString)
+ await modalCloseButton.click()
await dateSelectorDayInput.fill('31')
await page.keyboard.press('Enter')
await expect(dateSelectorDayInput).toHaveClass(/invalid-input/)
@@ -123,10 +137,12 @@ test('Allow invalid year to valid year values in date selector', async () => {
const {
dateSelectorDayInput,
dateSelectorMonthInput,
- dateSelectorYearInput
+ dateSelectorYearInput,
+ modalCloseButton
} = selectors
const queryString = 'http://localhost:3000/?t=2019-02-22'
await page.goto(queryString)
+ await modalCloseButton.click()
await dateSelectorYearInput.fill('2020')
await dateSelectorMonthInput.fill('MAR')
await dateSelectorDayInput.fill('31')
@@ -140,10 +156,12 @@ test('Verify invalid days are rolled over', async () => {
const {
dateSelectorDayInput,
dateSelectorMonthInput,
- dateSelectorYearInput
+ dateSelectorYearInput,
+ modalCloseButton
} = selectors
const queryString = 'http://localhost:3000/?t=2013-02-29'
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(dateSelectorDayInput).toHaveValue('01')
await expect(dateSelectorMonthInput).toHaveValue('MAR')
await expect(dateSelectorYearInput).toHaveValue('2013')
@@ -155,10 +173,12 @@ test('Date selector up arrow rolls over from Feb 28 to 1 (non leap year) and the
dayDown,
dateSelectorDayInput,
dateSelectorMonthInput,
- dateSelectorYearInput
+ dateSelectorYearInput,
+ modalCloseButton
} = selectors
const queryString = 'http://localhost:3000/?t=2013-02-28'
await page.goto(queryString)
+ await modalCloseButton.click()
await dayUp.click()
await expect(dateSelectorDayInput).toHaveValue('01')
await expect(dateSelectorMonthInput).toHaveValue('FEB')
@@ -170,8 +190,10 @@ test('Date selector up arrow rolls over from Feb 28 to 1 (non leap year) and the
})
test('Added future layer and right timeline arrow is not disabled', async () => {
+ const { modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?mockFutureLayer=VIIRS_SNPP_CorrectedReflectance_TrueColor,3D'
await page.goto(queryString)
+ await modalCloseButton.click()
const rightArrow = await page.locator('#right-arrow-group')
await expect(rightArrow).not.toHaveClass(/button-disabled/)
await rightArrow.click()
diff --git a/e2e/features/timeline/layer-coverage-panel-test.spec.js b/e2e/features/timeline/layer-coverage-panel-test.spec.js
index 07fbaf89d..a53ed019f 100644
--- a/e2e/features/timeline/layer-coverage-panel-test.spec.js
+++ b/e2e/features/timeline/layer-coverage-panel-test.spec.js
@@ -1,13 +1,16 @@
// @ts-check
const { test, expect } = require('@playwright/test')
const { skipTour, referenceLayersOnly } = require('../../test-utils/global-variables/querystrings')
+const createSelectors = require('../../test-utils/global-variables/selectors')
let page
+let selectors
test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
+ selectors = createSelectors(page)
})
test.afterAll(async () => {
@@ -15,13 +18,17 @@ test.afterAll(async () => {
})
test('Layer coverage is shown by default', async () => {
+ const { modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
const layerCoverageAxisLine = await page.locator('.axis-matching-layer-coverage-line')
await expect(layerCoverageAxisLine).toBeVisible()
})
test('No layer coverage is shown by default', async () => {
+ const { modalCloseButton } = selectors
await page.goto(referenceLayersOnly)
+ await modalCloseButton.click()
const layerCoverageAxisLine = await page.locator('.axis-matching-layer-coverage-line')
const layerCoverageHandle = await page.locator('#timeline-layer-coverage-panel-handle')
await expect(layerCoverageHandle).toBeVisible()
@@ -29,7 +36,9 @@ test('No layer coverage is shown by default', async () => {
})
test('Panel opens on handle click', async () => {
+ const { modalCloseButton } = selectors
await page.goto(referenceLayersOnly)
+ await modalCloseButton.click()
const layerCoverageContainer = await page.locator('.timeline-layer-coverage-container')
const layerCoverageHandle = await page.locator('#timeline-layer-coverage-panel-handle')
await layerCoverageHandle.click()
diff --git a/e2e/features/timeline/timeline-mobile-test.spec.js b/e2e/features/timeline/timeline-mobile-test.spec.js
index 56402dd24..7f4f86060 100644
--- a/e2e/features/timeline/timeline-mobile-test.spec.js
+++ b/e2e/features/timeline/timeline-mobile-test.spec.js
@@ -20,9 +20,10 @@ test.afterAll(async () => {
})
test('date.mob.init.2a: Before 3:00 UTC: load yesterdays date', async () => {
- const { mobileDatePickerSelectBtn } = selectors
+ const { mobileDatePickerSelectBtn, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?now=2013-03-15T0'
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(mobileDatePickerSelectBtn).toContainText('2013 MAR 14')
})
@@ -35,9 +36,10 @@ test('date.mob.init.2b: Before 3:00 UTC: right button is not disabled', async ()
})
test('date.mob.init.3a: After 3:00 UTC: load todays date', async () => {
- const { mobileDatePickerSelectBtn } = selectors
+ const { mobileDatePickerSelectBtn, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?now=2013-03-15T4'
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(mobileDatePickerSelectBtn).toContainText('2013 MAR 15')
})
@@ -48,9 +50,10 @@ test('date.mob.init.3b:After 3:00 UTC: right button is disabled', async () => {
})
test('date.mob.range.1: Date label should show 2013-03-15', async () => {
- const { mobileDatePickerSelectBtn } = selectors
+ const { mobileDatePickerSelectBtn, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?now=2013-03-15T12'
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(mobileDatePickerSelectBtn).toContainText('2013 MAR 15')
})
@@ -103,9 +106,10 @@ test('date.mob.range.6: Click okay button verify date has updated', async ({ bro
})
test('date.mob.nav.1: Date label should show 2013 JUL 20', async () => {
- const { mobileDatePickerSelectBtn } = selectors
+ const { mobileDatePickerSelectBtn, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?now=2014-03-15&t=2013-07-20T12'
await page.goto(queryString)
+ await modalCloseButton.click()
await expect(mobileDatePickerSelectBtn).toContainText('2013 JUL 20')
})
diff --git a/e2e/features/timeline/timeline-test.spec.js b/e2e/features/timeline/timeline-test.spec.js
index 4b4c409f8..b0bb2839a 100644
--- a/e2e/features/timeline/timeline-test.spec.js
+++ b/e2e/features/timeline/timeline-test.spec.js
@@ -22,8 +22,9 @@ test.afterAll(async () => {
})
test('Dragger is visible', async () => {
- const { dragger } = selectors
+ const { dragger, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await expect(dragger).toBeVisible()
})
@@ -70,7 +71,9 @@ test('Change to year zoom level and axis changes', async () => {
})
test('Interval state of HOUR restored from permalink', async () => {
+ const { modalCloseButton } = selectors
await page.goto(subdailyLayerIntervalTimescale)
+ await modalCloseButton.click()
const currentInteval = await page.locator('#current-interval')
await page.locator('#timeline-interval-btn-container').hover()
await expect(currentInteval).toContainText('1 hour')
@@ -98,9 +101,10 @@ test('Custom interval widget opens on selecting custom', async () => {
})
test('Select custom interval changes current interval and changes date by current interval', async () => {
- const { dateSelectorDayInput } = selectors
+ const { dateSelectorDayInput, modalCloseButton } = selectors
const customInterval = await page.locator('#current-interval')
await page.goto(knownDate)
+ await modalCloseButton.click()
await expect(dateSelectorDayInput).toHaveValue('22')
await page.locator('#timeline-interval-btn-container').hover()
await page.locator('#interval-custom-static').click()
@@ -113,18 +117,22 @@ test('Select custom interval changes current interval and changes date by curren
})
test('Timescale zoom level defaults to DAY', async () => {
+ const { modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
const currentZoom = await page.locator('#current-zoom')
await expect(currentZoom).toContainText('day')
})
test('Timescale zoom subdaily default year, month, day, hour, minute, and custom intervals', async () => {
+ const { modalCloseButton } = selectors
const zoomYears = await page.locator('#zoom-years')
const zoomMonths = await page.locator('#zoom-months')
const zoomDays = await page.locator('#zoom-days')
const zoomHours = await page.locator('#zoom-hours')
const zoomMinutes = await page.locator('#zoom-minutes')
await page.goto(subdailyLayerIntervalTimescale)
+ await modalCloseButton.click()
await page.locator('#current-zoom').hover()
await expect(zoomYears).toBeVisible()
await expect(zoomMonths).toBeVisible()
@@ -139,14 +147,18 @@ test('Timescale zoom HOUR restored from permalink', async () => {
})
test('Date tooltip date present load', async () => {
+ const { modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?t=2019-02-22'
await page.goto(queryString)
+ await modalCloseButton.click()
const dateTooltip = await page.locator('.date-tooltip')
await expect(dateTooltip).toContainText('2019 FEB 22 (DOY 053)')
})
test('Date subdaily tooltip date present on load', async () => {
+ const { modalCloseButton } = selectors
await page.goto(subdailyLayerIntervalTimescale)
+ await modalCloseButton.click()
const dateTooltip = await page.locator('.date-tooltip')
await expect(dateTooltip).toContainText('2019 OCT 04 09:46Z (DOY 277)')
})
diff --git a/e2e/features/tour/tour-test.spec.js b/e2e/features/tour/tour-test.spec.js
index ab19d4137..0054599f3 100644
--- a/e2e/features/tour/tour-test.spec.js
+++ b/e2e/features/tour/tour-test.spec.js
@@ -18,8 +18,9 @@ test.afterAll(async () => {
})
test('Verify that all tour modals are present when the page is loaded', async () => {
- const { infoToolbarButton } = selectors
+ const { infoToolbarButton, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
await infoToolbarButton.click()
await page.locator('#start_tour_info_item').click()
})
diff --git a/e2e/features/ui/distraction-free-mode-test.spec.js b/e2e/features/ui/distraction-free-mode-test.spec.js
index 7ce1d9d5a..d2daf6409 100644
--- a/e2e/features/ui/distraction-free-mode-test.spec.js
+++ b/e2e/features/ui/distraction-free-mode-test.spec.js
@@ -71,9 +71,10 @@ const distractionFreeModeValidElsRemoved = async (proj, isActive) => {
}
test('Enabling distraction free mode with shortcut key hides UI elements', async () => {
- const { locationSearchMinimizeButton, infoToolbarButton } = selectors
+ const { locationSearchMinimizeButton, infoToolbarButton, modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?p=arctic'
await page.goto(queryString)
+ await modalCloseButton.click()
await locationSearchMinimizeButton.click()
await infoToolbarButton.click()
await page.locator('#distraction_free_info_item').click()
@@ -87,7 +88,9 @@ test('Disabling distraction free mode with shortcut key returns UI elements', as
})
test('Enabling distraction free mode activates query string parameter df', async () => {
+ const { modalCloseButton } = selectors
const queryString = 'http://localhost:3000/?df=true'
await page.goto(queryString)
+ await modalCloseButton.click()
await distractionFreeModeValidElsRemoved('geographic', true)
})
diff --git a/e2e/features/ui/info-mobile-test.spec.js b/e2e/features/ui/info-mobile-test.spec.js
index d3ac3aaaf..942cf1af0 100644
--- a/e2e/features/ui/info-mobile-test.spec.js
+++ b/e2e/features/ui/info-mobile-test.spec.js
@@ -21,8 +21,9 @@ test.afterAll(async () => {
})
test('Mobile info toolbar is visible and contains valid mobile menu items', async () => {
- const { infoToolbarButton } = selectors
+ const { infoToolbarButton, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
const sendFeedback = await page.locator('#send_feedback_info_item')
const settingsInfo = await page.locator('#settings_info_item')
const aboutInfo = await page.locator('#about_info_item')
diff --git a/e2e/features/ui/info-test.spec.js b/e2e/features/ui/info-test.spec.js
index c44478b17..51daee1ec 100644
--- a/e2e/features/ui/info-test.spec.js
+++ b/e2e/features/ui/info-test.spec.js
@@ -18,8 +18,9 @@ test.afterAll(async () => {
})
test('Info toolbar is visible and contains valid menu items', async () => {
- const { infoToolbarButton } = selectors
+ const { infoToolbarButton, modalCloseButton } = selectors
await page.goto(skipTour)
+ await modalCloseButton.click()
const sendFeedback = await page.locator('#send_feedback_info_item')
const startTour = await page.locator('#start_tour_info_item')
const settingsInfo = await page.locator('#settings_info_item')
diff --git a/playwright.config.js b/playwright.config.js
index 662921344..cd88abfa1 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -17,7 +17,7 @@ module.exports = defineConfig({
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
- workers: process.env.CI ? 1 : undefined,
+ workers: process.env.CI ? 1 : 3,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
use: {
diff --git a/web/js/app.js b/web/js/app.js
index e436d3cb4..8de628b84 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -14,6 +14,7 @@ import Toolbar from './containers/toolbar';
import Sidebar from './containers/sidebar/sidebar';
// Modal
import Modal from './containers/modal';
+import { openCustomContent } from './modules/modal/actions';
// Location Search
import LocationSearch from './components/location-search/location-search';
@@ -34,7 +35,9 @@ import ErrorBoundary from './containers/error-boundary';
import Debug from './components/util/debug';
import keyPress from './modules/key-press/actions';
import setScreenInfo from './modules/screen-size/actions';
-
+// Notifications
+import Notifications from './containers/notifications';
+import { outageNotificationsSeenAction } from './modules/notifications/actions';
// Dependency CSS
import 'bootstrap/dist/css/bootstrap.min.css';
import 'ol/ol.css';
@@ -62,12 +65,23 @@ class App extends React.Component {
window.addEventListener('orientationchange', this.setVhCSSProperty);
}
+ componentDidUpdate(prevProps) {
+ // Check if the numberUnseen prop has changed
+ const { numberOutagesUnseen, object } = this.props;
+ if (numberOutagesUnseen !== prevProps.numberOutagesUnseen) {
+ if (numberOutagesUnseen > 0) {
+ this.openNotification(object, numberOutagesUnseen);
+ }
+ }
+ }
+
componentWillUnmount() {
document.removeEventListener('keydown', this.handleKeyPress);
window.removeEventListener('resize', this.setVhCSSProperty);
window.removeEventListener('orientationchange', this.setVhCSSProperty);
}
+
// https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
setVhCSSProperty = () => {
const vh = window.innerHeight * 0.01;
@@ -86,6 +100,11 @@ class App extends React.Component {
setScreenInfoAction();
};
+ openNotification = (obj, numberOutagesUnseen) => {
+ const { notificationClick } = this.props;
+ notificationClick(obj, numberOutagesUnseen);
+ };
+
onload() {
const self = this;
const state = self.props.parameters;
@@ -129,6 +148,7 @@ class App extends React.Component {
isEmbedModeActive,
isMobile,
isTourActive,
+ numberOutagesUnseen,
locationKey,
modalId,
parameters,
@@ -143,7 +163,7 @@ class App extends React.Component {
<div id="wv-alert-container" className="wv-alert-container">
<FeatureAlert />
<Alerts />
- {(!isMobile && isTourActive) || (isEmbedModeActive && isTourActive) ? <Tour /> : null}
+ {isTourActive && numberOutagesUnseen === 0 && (!isMobile || isEmbedModeActive) ? <Tour /> : null}
</div>
<Sidebar />
<div id="layer-modal" className="layer-modal" />
@@ -166,13 +186,21 @@ class App extends React.Component {
}
function mapStateToProps(state) {
+ const { notifications } = state;
+ const {
+ numberOutagesUnseen, numberUnseen, type, object,
+ } = notifications;
return {
state,
isAnimationWidgetActive: state.animation.isActive,
isEmbedModeActive: state.embed.isEmbedModeActive,
isMobile: state.screenSize.isMobileDevice,
isTourActive: state.tour.active,
+ numberOutagesUnseen,
+ numberUnseen,
+ object,
tour: state.tour,
+ type,
config: state.config,
parameters: state.parameters,
locationKey: state.location.key,
@@ -186,6 +214,19 @@ const mapDispatchToProps = (dispatch) => ({
setScreenInfoAction: () => {
dispatch(setScreenInfo());
},
+ notificationClick: (obj, numberOutagesUnseen) => {
+ dispatch(
+ openCustomContent('NOTIFICATION_LIST_MODAL', {
+ headerText: 'Notifications',
+ bodyComponent: Notifications,
+ onClose: () => {
+ if (numberOutagesUnseen > 0) {
+ dispatch(outageNotificationsSeenAction());
+ }
+ },
+ }),
+ );
+ },
});
export default connect(
@@ -199,8 +240,10 @@ App.propTypes = {
isMobile: PropTypes.bool,
isTourActive: PropTypes.bool,
keyPressAction: PropTypes.func,
- setScreenInfoAction: PropTypes.func,
locationKey: PropTypes.string,
modalId: PropTypes.string,
+ notificationClick: PropTypes.func,
+ numberOutagesUnseen: PropTypes.number,
parameters: PropTypes.object,
+ setScreenInfoAction: PropTypes.func,
};
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index 6046583fd..3468f1674 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -101,6 +101,15 @@ class toolbarContainer extends Component {
}
}
+ componentDidUpdate(prevProps, prevState) {
+ const { isAboutOpen, openAboutModal, modalIsOpen } = this.props;
+ if (modalIsOpen !== prevProps.modalIsOpen) {
+ if (isAboutOpen) {
+ openAboutModal();
+ }
+ }
+ }
+
getPromise(bool, type, action, title) {
const { visibleLayersForProj } = this.props;
const { notify } = this.props;
@@ -441,38 +450,40 @@ const mapStateToProps = (state) => {
const { isAnimatingToEvent } = events;
const { activeTab } = sidebar;
const isDataDownloadTabActive = activeTab === 'download';
+ const { isOpen: modalIsOpen } = modal;
// Collapse when Image download / GIF / is open or measure tool active
- const snapshotModalOpen = modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT';
+ const snapshotModalOpen = modalIsOpen && modal.id === 'TOOLBAR_SNAPSHOT';
const shouldBeCollapsed = snapshotModalOpen || measure.isActive || animation.gifActive;
const visibleLayersForProj = lodashFilter(activeLayersForProj, 'visible');
return {
- proj,
- faSize,
- notificationType: type,
- notificationContentNumber: number,
- config: state.config,
- rotation: map.rotation,
activePalettes,
+ config: state.config,
+ faSize,
+ hasNonDownloadableLayer: hasNonDownloadableVisibleLayer(visibleLayersForProj),
+ isAnimatingToEvent,
+ isAboutOpen: modalAbout.isOpen,
+ isCompareActive,
+ isDistractionFreeModeActive,
isImageDownloadActive: Boolean(
lodashGet(state, 'map.ui.selected')
&& !isCompareActive && !isDataDownloadTabActive,
),
- isAnimatingToEvent,
- hasNonDownloadableLayer: hasNonDownloadableVisibleLayer(visibleLayersForProj),
- isCompareActive,
+ isKioskModeActive,
isLocationSearchExpanded,
isMobile,
- isAboutOpen: modalAbout.isOpen,
- shouldBeCollapsed,
+ isRotated: Boolean(map.rotation !== 0),
hasCustomPalette: hasCustomPaletteInActiveProjection(
activeLayersForProj,
activePalettes,
),
+ modalIsOpen,
+ notificationType: type,
+ notificationContentNumber: number,
+ proj,
+ rotation: map.rotation,
+ shouldBeCollapsed,
visibleLayersForProj,
- isRotated: Boolean(map.rotation !== 0),
- isDistractionFreeModeActive,
- isKioskModeActive,
};
};
@@ -558,7 +569,6 @@ export default connect(
toolbarContainer.propTypes = {
activePalettes: PropTypes.object,
hasNonDownloadableLayer: PropTypes.bool,
- visibleLayersForProj: PropTypes.array,
config: PropTypes.object,
faSize: PropTypes.string,
hasCustomPalette: PropTypes.bool,
@@ -571,6 +581,7 @@ toolbarContainer.propTypes = {
isImageDownloadActive: PropTypes.bool,
isMobile: PropTypes.bool,
isRotated: PropTypes.bool,
+ modalIsOpen: PropTypes.bool,
notificationContentNumber: PropTypes.number,
notificationType: PropTypes.string,
notify: PropTypes.func,
@@ -583,4 +594,5 @@ toolbarContainer.propTypes = {
toggleDialogVisible: PropTypes.func,
toggleDistractionFreeModeAction: PropTypes.func,
toggleShowLocationSearch: PropTypes.func,
+ visibleLayersForProj: PropTypes.array,
};
diff --git a/web/js/modules/notifications/actions.js b/web/js/modules/notifications/actions.js
index 176c67d8b..f64e027e8 100644
--- a/web/js/modules/notifications/actions.js
+++ b/web/js/modules/notifications/actions.js
@@ -3,6 +3,7 @@ import {
REQUEST_NOTIFICATIONS,
SET_NOTIFICATIONS,
NOTIFICATIONS_SEEN,
+ OUTAGE_NOTIFICATIONS_SEEN,
} from './constants';
export function requestNotifications(location) {
@@ -19,3 +20,8 @@ export function notificationsSeen() {
type: NOTIFICATIONS_SEEN,
};
}
+export function outageNotificationsSeenAction() {
+ return {
+ type: OUTAGE_NOTIFICATIONS_SEEN,
+ };
+}
diff --git a/web/js/modules/notifications/constants.js b/web/js/modules/notifications/constants.js
index 4f2580832..45558b193 100644
--- a/web/js/modules/notifications/constants.js
+++ b/web/js/modules/notifications/constants.js
@@ -4,6 +4,7 @@ export const REQUEST_NOTIFICATIONS_SUCCESS = 'NOTIFICATIONS/REQUEST_APP_NOTIFICA
export const REQUEST_NOTIFICATIONS_FAILURE = 'NOTIFICATIONS/REQUEST_APP_NOTIFICATIONS_FAILURE';
export const SET_NOTIFICATIONS = 'NOTIFICATIONS/SET_NOTIFICATION_RESPONSE';
export const NOTIFICATIONS_SEEN = 'NOTIFICATIONS/NOTIFICATIONS_HAVE_BEEN_SEEN';
+export const OUTAGE_NOTIFICATIONS_SEEN = 'NOTIFICATIONS/OUTAGE_NOTIFICATIONS_HAVE_BEEN_SEEN';
export const STATUS_REQUEST_URL = 'https://status.earthdata.nasa.gov/api/v1/notifications?domain=https%3A%2F%2Fworldview.earthdata.nasa.gov';
diff --git a/web/js/modules/notifications/reducers.js b/web/js/modules/notifications/reducers.js
index fbc0827b0..3d921c418 100644
--- a/web/js/modules/notifications/reducers.js
+++ b/web/js/modules/notifications/reducers.js
@@ -8,6 +8,7 @@ import {
REQUEST_NOTIFICATIONS,
SET_NOTIFICATIONS,
NOTIFICATIONS_SEEN,
+ OUTAGE_NOTIFICATIONS_SEEN,
} from './constants';
export const notificationReducerState = {
@@ -28,10 +29,13 @@ export function notificationsReducer(state = notificationReducerState, action) {
if (action.array.length > 0) {
const notificationsByType = separateByType(action.array);
+ const { layerNotices } = notificationsByType;
+ const numberOutagesUnseen = layerNotices.filter((notice) => notice.notification_type === 'outage').length;
return {
...state,
number: getCount(notificationsByType),
numberUnseen: getCount(notificationsByType, true),
+ numberOutagesUnseen,
type: getPriority(notificationsByType),
isActive: true,
object: notificationsByType,
@@ -46,6 +50,11 @@ export function notificationsReducer(state = notificationReducerState, action) {
type: '',
isActive: true,
};
+ case OUTAGE_NOTIFICATIONS_SEEN:
+ return {
+ ...state,
+ numberOutagesUnseen: 0,
+ };
default:
return state;
}
diff --git a/web/js/modules/notifications/reducers.test.js b/web/js/modules/notifications/reducers.test.js
index 0269b4ed1..830de32f8 100644
--- a/web/js/modules/notifications/reducers.test.js
+++ b/web/js/modules/notifications/reducers.test.js
@@ -53,7 +53,8 @@ describe('notificationsReducer', () => {
}),
).toEqual({
number: 1,
- numberUnseen: 1,
+ numberOutagesUnseen: 0,
+ numberUnseen: 0,
type: 'outage',
isActive: true,
object: constants.MOCK_SORTED_NOTIFICATIONS,
diff --git a/web/js/modules/notifications/util.js b/web/js/modules/notifications/util.js
index 14527d59c..67e08da74 100644
--- a/web/js/modules/notifications/util.js
+++ b/web/js/modules/notifications/util.js
@@ -154,9 +154,9 @@ export function getCount(notifications, unseenOnly) {
} = notifications;
if (unseenOnly) {
- const messageCount = getNumberOfTypeNotSeen(NOTIFICATION_MSG, messages);
- const alertCount = getNumberOfTypeNotSeen(NOTIFICATION_ALERT, alerts);
- const outageCount = getNumberOfTypeNotSeen(NOTIFICATION_OUTAGE, outages);
+ const messageCount = getNumberOfTypeNotSeen(NOTIFICATION_MSG, notifications.layerNotices.filter((obj) => obj.notification_type === 'message'));
+ const alertCount = getNumberOfTypeNotSeen(NOTIFICATION_ALERT, notifications.layerNotices.filter((obj) => obj.notification_type === 'alert'));
+ const outageCount = getNumberOfTypeNotSeen(NOTIFICATION_OUTAGE, notifications.layerNotices.filter((obj) => obj.notification_type === 'outage'));
return messageCount + outageCount + alertCount;
}