-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1785 from rodekruis/feat.add-e2e-test-for-default…
…-map-checkboxes-in-floods Add e2e test for default map checkboxes
- Loading branch information
Showing
4 changed files
with
135 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
tests/e2e/tests/Map/AssertAllSelectedCheckboxesLayersArePresent.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { test } from '@playwright/test'; | ||
import DashboardPage from 'Pages/DashboardPage'; | ||
import MapComponent from 'Pages/MapComponent'; | ||
import UserStateComponent from 'Pages/UserStateComponent'; | ||
import { qase } from 'playwright-qase-reporter'; | ||
import { NoTriggerDataSet } from 'testData/testData.enum'; | ||
|
||
import { FloodsScenario } from '../../../../services/API-service/src/scripts/enum/mock-scenario.enum'; | ||
import { | ||
getAccessToken, | ||
mockFloods, | ||
resetDB, | ||
} from '../../helpers/utility.helper'; | ||
import LoginPage from '../../Pages/LoginPage'; | ||
|
||
let accessToken: string; | ||
let checkedLayers; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// Login | ||
const loginPage = new LoginPage(page); | ||
accessToken = await getAccessToken(); | ||
await resetDB(accessToken); | ||
|
||
// We should maybe create one mock for all different disaster types for now we can just use floods | ||
await mockFloods( | ||
FloodsScenario.NoTrigger, | ||
NoTriggerDataSet.CountryCode, | ||
accessToken, | ||
); | ||
|
||
await page.goto('/'); | ||
await loginPage.login( | ||
NoTriggerDataSet.UserMail, | ||
NoTriggerDataSet.UserPassword, | ||
); | ||
}); | ||
|
||
test( | ||
qase(32, 'Check if (default) checked checkbox-layers show in map'), | ||
async ({ page }) => { | ||
const dashboard = new DashboardPage(page); | ||
const userState = new UserStateComponent(page); | ||
const map = new MapComponent(page); | ||
|
||
// Navigate to disaster type the data was mocked for | ||
await dashboard.navigateToFloodDisasterType(); | ||
// Assertions | ||
await userState.headerComponentIsVisible({ | ||
countryName: NoTriggerDataSet.CountryName, | ||
}); | ||
// Wait for the page to load | ||
await dashboard.waitForLoaderToDisappear(); | ||
await map.mapComponentIsVisible(); | ||
|
||
// Open the layer menu | ||
await map.isLayerMenuOpen({ layerMenuOpen: false }); | ||
await map.clickLayerMenu(); | ||
await map.isLayerMenuOpen({ layerMenuOpen: true }); | ||
|
||
// Check if the default layers are visible | ||
checkedLayers = await map.returnLayerCheckedCheckboxes(); | ||
if (checkedLayers) { | ||
await map.validateLayersAreVisibleByName({ layerNames: checkedLayers }); | ||
} else { | ||
throw new Error('No layers are visible'); | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters