Skip to content

Commit

Permalink
Merge pull request #1865 from rodekruis/feat.add-e2e-test-for-aggrega…
Browse files Browse the repository at this point in the history
…tes-in-trigger-mode

Add E2E for Triggered agregates
  • Loading branch information
jannisvisser authored Dec 23, 2024
2 parents 735fc78 + d20910a commit 5cf86e2
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test.beforeEach(async ({ page }) => {
// The bug is that the marker of glofas stations cannot be disabled with the first chebox click (needs several) and it is failing on flood disaster type
// https://github.com/rodekruis/IBF-system/issues/1657
// When the bug is fixed, the test should be unskipped
// https://app.qase.io/project/IBF?case=12&previewMode=side&suite=7
test.skip(
qase(
12,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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);
});

// https://app.qase.io/project/IBF?case=39&previewMode=side&suite=7
test(
qase(39, '[Trigger] Aggregated number of events should be non-zero'),
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);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=6&previewMode=side&suite=7
test(
qase(6, 'All Aggregate elements are present in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=13&previewMode=side&suite=7
test(
qase(13, 'All Aggregate info buttons show on click information'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=11&previewMode=side&suite=6
test(
qase(
11,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=5&previewMode=side&suite=6
test(
qase(5, 'All Chat section elements are present in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test.beforeEach(async ({ page }) => {
await page.goto('/');
await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword);
});

// https://app.qase.io/project/IBF?case=44&previewMode=side&suite=6
test(
qase(44, '[Trigger] Show prediction button is clickable'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test.beforeEach(async ({ page }) => {
await page.goto('/');
await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword);
});

// https://app.qase.io/project/IBF?case=43&previewMode=side&suite=6
test(
qase(43, '[Trigger] Amount of events should equal the aggregate number'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=1&previewMode=side&suite=2
test(
qase(1, 'All Dashboard elements are present in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=4&previewMode=side&suite=5
test(
qase(4, 'All Disaster Type elements are present in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test.beforeEach(async ({ page }) => {
});
// Test is skipped because it was flaky and more invastigation is needed to fix it
// Logged in PBI: https://dev.azure.com/redcrossnl/IBF/_workitems/edit/32127/
// https://app.qase.io/project/IBF?case=4&previewMode=side&suite=5
test.skip(
qase(10, 'All Disaster Types can be selected in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=29&previewMode=side&suite=3
test(
qase(29, '[No-trigger] Alert Threshold Reached is visible on the legend'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=30&previewMode=side&suite=3
test(
qase(30, '[No-trigger] No "Alert Threshold Reached" lines are visible'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=2&previewMode=side&suite=3
test(
qase(2, 'All Map elements are present in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=32&previewMode=side&suite=3
test(
qase(32, 'Check if (default) checked checkbox-layers show in map'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=7&previewMode=side&suite=3
test(
qase(7, 'Verify Map functionality for no-triggered mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=31&previewMode=side&suite=3
test(
qase(
31,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test.beforeEach(async ({ page }) => {
await page.goto('/');
await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword);
});

// https://app.qase.io/project/IBF?case=38&previewMode=side&suite=3
test(
qase(
38,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/Map/GlofasStationsVisibleNoTrigger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=28&previewMode=side&suite=3
test(
qase(
28,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=15&previewMode=side&suite=9
test(qase(15, 'Timeline present in no trigger mode'), async ({ page }) => {
const dashboard = new DashboardPage(page);
const userState = new UserStateComponent(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=14&previewMode=side&suite=9
test(
qase(14, 'Timeline is deactivated in no-trigger mode'),
async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

// https://app.qase.io/project/IBF?case=3&previewMode=side&suite=4
test(
qase(3, 'All User State elements are present in no-trigger mode'),
async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tests/UserState/SuccessfullyLogOut.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ test.beforeEach(async ({ page }) => {
NoTriggerDataSet.UserPassword,
);
});

test(qase(8, 'Log out from IBF-system'), async ({ page }) => {
// https://app.qase.io/project/IBF?case=8&previewMode=side&suite=4
test(qase(4, 'Log out from IBF-system'), async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboard = new DashboardPage(page);
const userState = new UserStateComponent(page);
Expand Down

0 comments on commit 5cf86e2

Please sign in to comment.