Skip to content
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 flood extent present in the legend #1813

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/e2e/testData/testData.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
60 changes: 60 additions & 0 deletions tests/e2e/tests/Map/FloodExtentVisibleInLegend.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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=35
test(
qase(
35,
'[Trigger] Flood extent legend is visible when flood extent 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.assertLegendElementIsVisible({
legendComponentName: 'Flood extent',
});
},
);