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 for Triggered agregates #1865

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { expect, test } from '@playwright/test';
import AggregatesComponent from 'Pages/AggregatesComponent';
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(39, '[Trigger] Aggregates values should be non-zero'),
Piotrk39 marked this conversation as resolved.
Show resolved Hide resolved
async ({ page }) => {
const aggregates = new AggregatesComponent(page);
const dashboard = new DashboardPage(page);
const userState = new UserStateComponent(page);

// Navigate to disaster type the data was mocked for
await dashboard.navigateToFloodDisasterType();
// Assertions
await userState.headerComponentIsVisible({
countryName: TriggerDataSet.CountryName,
});

// get the number of warning events and aggregated events
const aggregatesEventCount = await aggregates.getNumberOfPredictedEvents();

// check if the number of warning events is equal to the number of aggregated events
expect(aggregatesEventCount).toBeGreaterThan(0);
jannisvisser marked this conversation as resolved.
Show resolved Hide resolved
},
);
Loading