Interactive interface for browsing global, full-resolution satellite imagery
// @ts-check
const { test, expect } = require('@playwright/test')
const createSelectors = require('../../test-utils/global-variables/selectors')
const { mockEvents, malformedMockEvents } = require('../../test-utils/global-variables/querystrings')
const { closeModal } = require('../../test-utils/hooks/wvHooks')
/** @type {import('@playwright/test').Page} */
let page
/** @type {Record<string, import('@playwright/test').Locator>} */
let selectors
test.describe.configure({ mode: 'serial' })
test.beforeAll(async ({ browser }) => {
page = await browser.newPage()
selectors = createSelectors(page)
})
test.afterAll(async () => {
await page.close()
})
test('Make sure that 4 fire layers are not present in layer list: use mock', async () => {
const { sidebarEvent, thermAnomNOAA21day, thermAnomNOAA21night, thermAnomVIIRSday, thermAnomVIIRSnight } = selectors
await page.goto(mockEvents)
await closeModal(page)
await page.waitForTimeout(500)
await expect(sidebarEvent).toBeVisible()
await expect(thermAnomNOAA21day).not.toBeVisible()
await expect(thermAnomNOAA21night).not.toBeVisible()
await expect(thermAnomVIIRSday).not.toBeVisible()
await expect(thermAnomVIIRSnight).not.toBeVisible()
})
test('Check that 4 fire layers are now present', async ({ browserName }) => {
test.skip(browserName === 'firefox', 'firefox cant find iceberg event sometimes')
const { layersTab, sidebarEvent, thermAnomNOAA21day, thermAnomNOAA21night, thermAnomVIIRSday, thermAnomVIIRSnight } = selectors
await page.goto(mockEvents)
await closeModal(page)
await page.waitForTimeout(1000)
await sidebarEvent.click()
await layersTab.click()
await expect(thermAnomNOAA21day).toBeVisible({ timeout: 10000 })
await expect(thermAnomNOAA21night).toBeVisible({ timeout: 10000 })
await expect(thermAnomVIIRSday).toBeVisible({ timeout: 10000 })
await expect(thermAnomVIIRSnight).toBeVisible({ timeout: 10000 })
})
test('Use Mock to make sure appropriate number of event markers are appended to map', async () => {
const { eventIcons, listOfEvents } = selectors
await page.goto(mockEvents)
await closeModal(page)
await expect(listOfEvents).toBeVisible()
await expect(eventIcons).toHaveCount(8)
})
test('Gracefully handle malformed EONET mock data without crashing', async () => {
const { eventIcons, listOfEvents } = selectors;
await page.goto(malformedMockEvents);
await closeModal(page);
await expect(listOfEvents).toBeVisible();
await expect(eventIcons).toHaveCount(6);
});