-
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.
- Loading branch information
Showing
11 changed files
with
434 additions
and
5 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
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 |
---|---|---|
|
@@ -7,3 +7,13 @@ export enum NoTriggerDataSet { | |
firstName = 'Uganda', | ||
lastName = 'Manager', | ||
} | ||
|
||
export enum TriggerDataSet { | ||
TriggerScenario = 'trigger', | ||
CountryCode = 'UGA', | ||
CountryName = 'Uganda', | ||
UserMail = '[email protected]', | ||
UserPassword = 'password', | ||
firstName = 'Uganda', | ||
lastName = 'Manager', | ||
} |
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
54 changes: 54 additions & 0 deletions
54
tests/e2e/tests/ChatSection/ChatPredictionButtonActive.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,54 @@ | ||
import { test } from '@playwright/test'; | ||
import ChatComponent from 'Pages/ChatComponent'; | ||
import DashboardPage from 'Pages/DashboardPage'; | ||
import UserStateComponent from 'Pages/UserStateComponent'; | ||
import { qase } from 'playwright-qase-reporter'; | ||
import { TriggerDataSet } from 'testData/testData.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( | ||
TriggerDataSet.TriggerScenario, | ||
TriggerDataSet.CountryCode, | ||
accessToken, | ||
); | ||
|
||
await page.goto('/'); | ||
await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword); | ||
}); | ||
|
||
test( | ||
qase(44, '[Trigger] Show prediction button is clickable'), | ||
async ({ page }) => { | ||
const dashboard = new DashboardPage(page); | ||
const userState = new UserStateComponent(page); | ||
const chat = new ChatComponent(page); | ||
|
||
// Navigate to disaster type the data was mocked for | ||
await dashboard.navigateToFloodDisasterType(); | ||
// Assertions | ||
await userState.headerComponentIsVisible({ | ||
countryName: TriggerDataSet.CountryName, | ||
}); | ||
await chat.chatColumnIsVisibleForTriggerState({ | ||
firstName: TriggerDataSet.firstName, | ||
lastName: TriggerDataSet.lastName, | ||
}); | ||
await chat.allDefaultButtonsArePresent(); | ||
await chat.predictionButtonsAreActive(); | ||
}, | ||
); |
File renamed without changes.
79 changes: 79 additions & 0 deletions
79
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,79 @@ | ||
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.clickLayerMenu(); | ||
await map.isLayerMenuOpen({ layerMenuOpen: true }); | ||
await map.verifyLayerCheckboxCheckedByName({ | ||
layerName: 'Flood extent', | ||
}); | ||
await map.verifyLayerRadioButtonCheckedByName({ | ||
layerName: 'Exposed population', | ||
}); | ||
// Validate legend | ||
await map.isLegendOpen({ legendOpen: true }); | ||
await map.assertLegendElementIsVisible({ | ||
legendComponentName: 'Flood extent', | ||
}); | ||
await map.assertLegendElementIsVisible({ | ||
legendComponentName: 'Exposed population', | ||
}); | ||
// Validatge that the layer checked with radio button is visible on the map in this case 'Exposed population' only one such layer can be checked at a time | ||
await map.validateAggregatePaneIsNotEmpty(); | ||
// Validate rest of the map | ||
// await map.validateLayersAreVisibleByName({ | ||
// layerNames: ['Flood extent'], | ||
// }); | ||
}, | ||
); |
81 changes: 81 additions & 0 deletions
81
tests/e2e/tests/Map/DefaultMarkersVisibleFloodsTrigger.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,81 @@ | ||
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( | ||
38, | ||
'[Trigger] At least one red/orange/yellow GloFAS station should be visible', | ||
), | ||
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.verifyLayerCheckboxCheckedByName({ | ||
layerName: 'Glofas stations', | ||
}); | ||
await map.assertLegendElementIsVisible({ | ||
legendComponentName: 'GloFAS No action', | ||
}); | ||
|
||
// At least one red/orange/yellow GloFAS station should be visible by default in trigger mode | ||
await map.gloFASMarkersAreVisibleByWarning({ | ||
glosfasStationStatus: 'glofas-station-max-trigger', | ||
isVisible: true, | ||
}); | ||
// At least one orange GloFAS station should be visible by default in trigger mode | ||
await map.gloFASMarkersAreVisibleByWarning({ | ||
glosfasStationStatus: 'glofas-station-med-trigger', | ||
isVisible: true, | ||
}); | ||
// At least one yellow GloFAS station should be visible by default in trigger mode | ||
await map.gloFASMarkersAreVisibleByWarning({ | ||
glosfasStationStatus: 'glofas-station-min-trigger', | ||
isVisible: true, | ||
}); | ||
}, | ||
); |
Oops, something went wrong.