From 922192ad522b9418f0d76c03a86daa1c455c34e1 Mon Sep 17 00:00:00 2001 From: piotrk39 Date: Tue, 17 Dec 2024 13:54:34 +0100 Subject: [PATCH 1/3] Add test with assertions --- ...gatesShouldNotBeZeroInTriggerState.spec.ts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts diff --git a/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts b/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts new file mode 100644 index 000000000..1d0c14c28 --- /dev/null +++ b/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts @@ -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'), + 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); + }, +); From 75abea84b46982ba3e2e9d53e5bcd60b72771626 Mon Sep 17 00:00:00 2001 From: piotrk39 Date: Wed, 18 Dec 2024 16:14:02 +0100 Subject: [PATCH 2/3] Add fixes from PR review --- .../AggregatesShouldNotBeZeroInTriggerState.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts b/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts index 1d0c14c28..a6144f8c8 100644 --- a/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts +++ b/tests/e2e/tests/AggregatesSection/AggregatesShouldNotBeZeroInTriggerState.spec.ts @@ -31,8 +31,9 @@ test.beforeEach(async ({ page }) => { await loginPage.login(TriggerDataSet.UserMail, TriggerDataSet.UserPassword); }); +// https://app.qase.io/project/IBF?case=39&previewMode=side&suite=7 test( - qase(39, '[Trigger] Aggregates values should be non-zero'), + qase(39, '[Trigger] Aggregated number of events should be non-zero'), async ({ page }) => { const aggregates = new AggregatesComponent(page); const dashboard = new DashboardPage(page); From d20910a12bd9bebdf58ada7dd106636bee4e6daf Mon Sep 17 00:00:00 2001 From: piotrk39 Date: Mon, 23 Dec 2024 10:04:03 +0100 Subject: [PATCH 3/3] Add qase links --- .../tests/AggregatesSection/AggregatesHasDynamicTitle.spec.ts | 1 + .../AllAggregatesComponentsPresentNotrigger.spec.ts | 2 +- .../AggregatesSection/ValidateAggregatesInfoButtons.spec.ts | 2 +- .../ChatSection/AllChatActionButtonsActiveInNoTrigger.spec.ts | 2 +- .../ChatSection/AllChatComponentsPresentNotrigger.spec.ts | 2 +- .../e2e/tests/ChatSection/ChatPredictionButtonActive.spec.ts | 2 +- .../ChatSection/TriggerStateShouldHaveWarningEvents.spec.ts | 2 +- tests/e2e/tests/Dashboard/AllElementsPresentNoTrigger.spec.ts | 2 +- .../AllDisasterTypeComponentsPresentNotrigger.spec.ts | 2 +- .../e2e/tests/DisasterType/SwitchBetweenDisasterType.spec.ts | 1 + tests/e2e/tests/Map/AlertThresholdIsVisibleInLegend.spec.ts | 2 +- .../Map/AlertThresholdLinesAreNotVisibleNoTrigger.spec.ts | 2 +- tests/e2e/tests/Map/AllMapComponentsPresentNotrigger.spec.ts | 2 +- .../Map/AssertAllSelectedCheckboxesLayersArePresent.spec.ts | 2 +- tests/e2e/tests/Map/AssertMapFunctionalitiesNotrigger.spec.ts | 2 +- .../tests/Map/AssertNoMaxWarningGlofasMarkersVisible.spec.ts | 2 +- .../e2e/tests/Map/DefaultMarkersVisibleFloodsTrigger.spec.ts | 2 +- tests/e2e/tests/Map/GlofasStationsVisibleNoTrigger.spec.ts | 2 +- .../tests/Timeline/TimelineComponentPresentNotrigger.spec.ts | 2 +- tests/e2e/tests/Timeline/TimelineInactiveInNotrigger.spec.ts | 2 +- .../UserState/AllUserStateComponentsPresentNotrigger.spec.ts | 2 +- tests/e2e/tests/UserState/SuccessfullyLogOut.spec.ts | 4 ++-- 22 files changed, 23 insertions(+), 21 deletions(-) diff --git a/tests/e2e/tests/AggregatesSection/AggregatesHasDynamicTitle.spec.ts b/tests/e2e/tests/AggregatesSection/AggregatesHasDynamicTitle.spec.ts index 8c2dc9a84..bc059eee9 100644 --- a/tests/e2e/tests/AggregatesSection/AggregatesHasDynamicTitle.spec.ts +++ b/tests/e2e/tests/AggregatesSection/AggregatesHasDynamicTitle.spec.ts @@ -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, diff --git a/tests/e2e/tests/AggregatesSection/AllAggregatesComponentsPresentNotrigger.spec.ts b/tests/e2e/tests/AggregatesSection/AllAggregatesComponentsPresentNotrigger.spec.ts index 1611c0e7e..232a459b7 100644 --- a/tests/e2e/tests/AggregatesSection/AllAggregatesComponentsPresentNotrigger.spec.ts +++ b/tests/e2e/tests/AggregatesSection/AllAggregatesComponentsPresentNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/AggregatesSection/ValidateAggregatesInfoButtons.spec.ts b/tests/e2e/tests/AggregatesSection/ValidateAggregatesInfoButtons.spec.ts index 5472f41aa..792465020 100644 --- a/tests/e2e/tests/AggregatesSection/ValidateAggregatesInfoButtons.spec.ts +++ b/tests/e2e/tests/AggregatesSection/ValidateAggregatesInfoButtons.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/ChatSection/AllChatActionButtonsActiveInNoTrigger.spec.ts b/tests/e2e/tests/ChatSection/AllChatActionButtonsActiveInNoTrigger.spec.ts index 9d65d0e10..c07dfa888 100644 --- a/tests/e2e/tests/ChatSection/AllChatActionButtonsActiveInNoTrigger.spec.ts +++ b/tests/e2e/tests/ChatSection/AllChatActionButtonsActiveInNoTrigger.spec.ts @@ -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, diff --git a/tests/e2e/tests/ChatSection/AllChatComponentsPresentNotrigger.spec.ts b/tests/e2e/tests/ChatSection/AllChatComponentsPresentNotrigger.spec.ts index f012356aa..db60209c4 100644 --- a/tests/e2e/tests/ChatSection/AllChatComponentsPresentNotrigger.spec.ts +++ b/tests/e2e/tests/ChatSection/AllChatComponentsPresentNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/ChatSection/ChatPredictionButtonActive.spec.ts b/tests/e2e/tests/ChatSection/ChatPredictionButtonActive.spec.ts index 78bcf7fb7..19ea98a38 100644 --- a/tests/e2e/tests/ChatSection/ChatPredictionButtonActive.spec.ts +++ b/tests/e2e/tests/ChatSection/ChatPredictionButtonActive.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/ChatSection/TriggerStateShouldHaveWarningEvents.spec.ts b/tests/e2e/tests/ChatSection/TriggerStateShouldHaveWarningEvents.spec.ts index 91d9d8583..1f90a702b 100644 --- a/tests/e2e/tests/ChatSection/TriggerStateShouldHaveWarningEvents.spec.ts +++ b/tests/e2e/tests/ChatSection/TriggerStateShouldHaveWarningEvents.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Dashboard/AllElementsPresentNoTrigger.spec.ts b/tests/e2e/tests/Dashboard/AllElementsPresentNoTrigger.spec.ts index 618e1f7d1..b9cba9303 100644 --- a/tests/e2e/tests/Dashboard/AllElementsPresentNoTrigger.spec.ts +++ b/tests/e2e/tests/Dashboard/AllElementsPresentNoTrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/DisasterType/AllDisasterTypeComponentsPresentNotrigger.spec.ts b/tests/e2e/tests/DisasterType/AllDisasterTypeComponentsPresentNotrigger.spec.ts index 58a393eda..d27b663fe 100644 --- a/tests/e2e/tests/DisasterType/AllDisasterTypeComponentsPresentNotrigger.spec.ts +++ b/tests/e2e/tests/DisasterType/AllDisasterTypeComponentsPresentNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/DisasterType/SwitchBetweenDisasterType.spec.ts b/tests/e2e/tests/DisasterType/SwitchBetweenDisasterType.spec.ts index 4d07b11c0..1e0cd157b 100644 --- a/tests/e2e/tests/DisasterType/SwitchBetweenDisasterType.spec.ts +++ b/tests/e2e/tests/DisasterType/SwitchBetweenDisasterType.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Map/AlertThresholdIsVisibleInLegend.spec.ts b/tests/e2e/tests/Map/AlertThresholdIsVisibleInLegend.spec.ts index 6817f9779..9efc16e1e 100644 --- a/tests/e2e/tests/Map/AlertThresholdIsVisibleInLegend.spec.ts +++ b/tests/e2e/tests/Map/AlertThresholdIsVisibleInLegend.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Map/AlertThresholdLinesAreNotVisibleNoTrigger.spec.ts b/tests/e2e/tests/Map/AlertThresholdLinesAreNotVisibleNoTrigger.spec.ts index bc36c047b..d864a74aa 100644 --- a/tests/e2e/tests/Map/AlertThresholdLinesAreNotVisibleNoTrigger.spec.ts +++ b/tests/e2e/tests/Map/AlertThresholdLinesAreNotVisibleNoTrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Map/AllMapComponentsPresentNotrigger.spec.ts b/tests/e2e/tests/Map/AllMapComponentsPresentNotrigger.spec.ts index 08d45e1ee..bae95fc96 100644 --- a/tests/e2e/tests/Map/AllMapComponentsPresentNotrigger.spec.ts +++ b/tests/e2e/tests/Map/AllMapComponentsPresentNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Map/AssertAllSelectedCheckboxesLayersArePresent.spec.ts b/tests/e2e/tests/Map/AssertAllSelectedCheckboxesLayersArePresent.spec.ts index af1b75a86..d58e844f3 100644 --- a/tests/e2e/tests/Map/AssertAllSelectedCheckboxesLayersArePresent.spec.ts +++ b/tests/e2e/tests/Map/AssertAllSelectedCheckboxesLayersArePresent.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Map/AssertMapFunctionalitiesNotrigger.spec.ts b/tests/e2e/tests/Map/AssertMapFunctionalitiesNotrigger.spec.ts index 8565a8b5e..b1da139e8 100644 --- a/tests/e2e/tests/Map/AssertMapFunctionalitiesNotrigger.spec.ts +++ b/tests/e2e/tests/Map/AssertMapFunctionalitiesNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/Map/AssertNoMaxWarningGlofasMarkersVisible.spec.ts b/tests/e2e/tests/Map/AssertNoMaxWarningGlofasMarkersVisible.spec.ts index c7560c908..b901d59b4 100644 --- a/tests/e2e/tests/Map/AssertNoMaxWarningGlofasMarkersVisible.spec.ts +++ b/tests/e2e/tests/Map/AssertNoMaxWarningGlofasMarkersVisible.spec.ts @@ -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, diff --git a/tests/e2e/tests/Map/DefaultMarkersVisibleFloodsTrigger.spec.ts b/tests/e2e/tests/Map/DefaultMarkersVisibleFloodsTrigger.spec.ts index 74f69a452..6aec51d1c 100644 --- a/tests/e2e/tests/Map/DefaultMarkersVisibleFloodsTrigger.spec.ts +++ b/tests/e2e/tests/Map/DefaultMarkersVisibleFloodsTrigger.spec.ts @@ -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, diff --git a/tests/e2e/tests/Map/GlofasStationsVisibleNoTrigger.spec.ts b/tests/e2e/tests/Map/GlofasStationsVisibleNoTrigger.spec.ts index 4f5b99979..77ca2f439 100644 --- a/tests/e2e/tests/Map/GlofasStationsVisibleNoTrigger.spec.ts +++ b/tests/e2e/tests/Map/GlofasStationsVisibleNoTrigger.spec.ts @@ -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, diff --git a/tests/e2e/tests/Timeline/TimelineComponentPresentNotrigger.spec.ts b/tests/e2e/tests/Timeline/TimelineComponentPresentNotrigger.spec.ts index f5dfaf317..ca10e333e 100644 --- a/tests/e2e/tests/Timeline/TimelineComponentPresentNotrigger.spec.ts +++ b/tests/e2e/tests/Timeline/TimelineComponentPresentNotrigger.spec.ts @@ -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); diff --git a/tests/e2e/tests/Timeline/TimelineInactiveInNotrigger.spec.ts b/tests/e2e/tests/Timeline/TimelineInactiveInNotrigger.spec.ts index b04df880c..9b1d1fa3a 100644 --- a/tests/e2e/tests/Timeline/TimelineInactiveInNotrigger.spec.ts +++ b/tests/e2e/tests/Timeline/TimelineInactiveInNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/UserState/AllUserStateComponentsPresentNotrigger.spec.ts b/tests/e2e/tests/UserState/AllUserStateComponentsPresentNotrigger.spec.ts index 2d7582dd7..0f20ce9bd 100644 --- a/tests/e2e/tests/UserState/AllUserStateComponentsPresentNotrigger.spec.ts +++ b/tests/e2e/tests/UserState/AllUserStateComponentsPresentNotrigger.spec.ts @@ -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 }) => { diff --git a/tests/e2e/tests/UserState/SuccessfullyLogOut.spec.ts b/tests/e2e/tests/UserState/SuccessfullyLogOut.spec.ts index 3848aec16..002719b88 100644 --- a/tests/e2e/tests/UserState/SuccessfullyLogOut.spec.ts +++ b/tests/e2e/tests/UserState/SuccessfullyLogOut.spec.ts @@ -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);