Skip to content

Commit

Permalink
Add feature validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrk39 committed Dec 3, 2024
1 parent e0b4efa commit 9022be6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions tests/e2e/Pages/MapComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class MapComponent extends DashboardPage {
readonly alerThresholdLines: Locator;
readonly closeButtonIcon: Locator;
readonly layerInfoContent: Locator;
readonly ibfAggregatePane: Locator;

constructor(page: Page) {
super(page);
Expand Down Expand Up @@ -56,6 +57,9 @@ class MapComponent extends DashboardPage {
);
this.closeButtonIcon = this.page.getByTestId('close-matrix-icon');
this.layerInfoContent = this.page.getByTestId('layer-info-content');
this.ibfAggregatePane = this.page.locator(
'.leaflet-pane.leaflet-ibf-aggregate-pane',
);
}

async mapComponentIsVisible() {
Expand Down Expand Up @@ -377,5 +381,16 @@ class MapComponent extends DashboardPage {
expect(await glofasMarker.count()).toBe(0);
}
}

// This method checks that when radio button is checked then the layer is visible in leaflet-ibf-aggregate-pane
// Only one radio button can be checked at a time
// It valdates the functionality not data displayed
async validateAggregatePaneIsNotEmpty() {
const aggregatePaneContent = this.ibfAggregatePane.locator(
'.leaflet-interactive',
);
const aggregatePaneContentCount = await aggregatePaneContent.count();
expect(aggregatePaneContentCount).toBeGreaterThan(0);
}
}
export default MapComponent;
5 changes: 3 additions & 2 deletions tests/e2e/tests/Map/ExposedPopulationVisibleInTrigger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ test(
await map.isLegendOpen({ legendOpen: true });
await map.isLayerMenuOpen({ layerMenuOpen: false });
await map.clickLayerMenu();
await map.isLayerMenuOpen({ layerMenuOpen: true });
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');
// Validate that the aggregate pane is not empty after the layer is checked and loaded
await map.validateAggregatePaneIsNotEmpty();
},
);

0 comments on commit 9022be6

Please sign in to comment.