From e0b4efa8f41ae61f86a0681f63f86e155875f3b8 Mon Sep 17 00:00:00 2001 From: piotrk39 Date: Wed, 27 Nov 2024 14:03:06 +0100 Subject: [PATCH] Add test without final assertion --- .../components/matrix/matrix.component.html | 1 + tests/e2e/Pages/MapComponent.ts | 21 ++++++ .../ExposedPopulationVisibleInTrigger.spec.ts | 68 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 tests/e2e/tests/Map/ExposedPopulationVisibleInTrigger.spec.ts diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html index b0c08570e..5b20af8ca 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html @@ -36,6 +36,7 @@ } @if (isRadioButton(layer.group)) { { + // 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, + '[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.verifyLayerRadioButtonCheckedByName({ + layerName: 'Exposed population', + }); + await map.assertLegendElementIsVisible({ + legendComponentName: 'Exposed population', + }); + + // Exposed population layer should be visible by default in trigger mode + console.log('Exposed population layer is visible'); + }, +);