-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add e2e test for default flood trigger layers #1832
Merged
Piotrk39
merged 5 commits into
master
from
feat.add-e2e-test-for-default-flood-trigger-layers
Dec 16, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
63 changes: 63 additions & 0 deletions
63
tests/e2e/tests/Map/DefaultLegendLayersInTriggeredFlood.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,63 @@ | ||
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 { TriggerDataSet } 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; | ||
|
||
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.Trigger, | ||
TriggerDataSet.CountryCode, | ||
accessToken, | ||
); | ||
|
||
await page.goto('/'); | ||
await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword); | ||
}); | ||
// https://app.qase.io/project/IBF?previewMode=side&suite=3&tab=&case=37 | ||
test( | ||
qase( | ||
37, | ||
'[Trigger] Map layer: "Flood extent" and "Exposed population" should be active by default', | ||
), | ||
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: TriggerDataSet.CountryName, | ||
}); | ||
// Wait for the page to load | ||
await dashboard.waitForLoaderToDisappear(); | ||
|
||
await map.mapComponentIsVisible(); | ||
await map.isLegendOpen({ legendOpen: true }); | ||
await map.assertLegendElementIsVisible({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now only legend is tested. test also layer overview and map (proxy via radio-btn being active) |
||
legendComponentName: 'Flood extent', | ||
}); | ||
await map.assertLegendElementIsVisible({ | ||
legendComponentName: 'Exposed population', | ||
}); | ||
}, | ||
); |
69 changes: 69 additions & 0 deletions
69
tests/e2e/tests/Map/ExposedPopulationVisibleInTrigger.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 { TriggerDataSet } 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; | ||
|
||
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.Trigger, | ||
TriggerDataSet.CountryCode, | ||
accessToken, | ||
); | ||
|
||
await page.goto('/'); | ||
await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword); | ||
}); | ||
|
||
test( | ||
qase( | ||
36, | ||
Piotrk39 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'[Trigger] Exposed population legend is visible when exposed population layer is active', | ||
), | ||
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: TriggerDataSet.CountryName, | ||
}); | ||
// Wait for the page to load | ||
await dashboard.waitForLoaderToDisappear(); | ||
|
||
await map.mapComponentIsVisible(); | ||
await map.isLegendOpen({ legendOpen: true }); | ||
await map.isLayerMenuOpen({ layerMenuOpen: false }); | ||
await map.clickLayerMenu(); | ||
await map.isLayerMenuOpen({ layerMenuOpen: true }); | ||
await map.verifyLayerRadioButtonCheckedByName({ | ||
layerName: 'Exposed population', | ||
}); | ||
await map.assertLegendElementIsVisible({ | ||
legendComponentName: 'Exposed population', | ||
}); | ||
// Exposed population layer should be visible by default in trigger mode | ||
// Validate that the aggregate pane is not empty after the layer is checked and loaded | ||
await map.validateAggregatePaneIsNotEmpty(); | ||
}, | ||
); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the exact purpose of this test. I often get mixed up by filenames vs test descriptions here vs full test cases in Qase. Is in this case the test just about the layers being present in the legend? And with legend do you mean the lower-left thing or the lower-right thing?
Either way, I think it makes sense to test all together. So test (1) are the layers in the layer overview (lower-right), (2) are they in the legend (lower-left), and (3) are they in the map? I'm not clear on if this is happening now either in this test or in multiple tests.