Skip to content

Commit

Permalink
feat: Add E2E test to test for hierachy in published chart interactiv…
Browse files Browse the repository at this point in the history
…e filter
  • Loading branch information
ptbrowne committed Nov 10, 2022
1 parent f5823d7 commit bbd52b8
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/charts/shared/chart-data-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const ChartDataFilters = ({

{componentIris.length > 0 && (
<Box
data-testid="published-chart-interactive-filters"
sx={{
display: filtersVisible ? "grid" : "none",
columnGap: 3,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"key": "nI6X4V_EcK2c",
"data": {
"meta": {
"title": {
"de": "",
"en": "",
"fr": "",
"it": ""
},
"description": {
"de": "",
"en": "",
"fr": "",
"it": ""
}
},
"dataSet": "https://environment.ld.admin.ch/foen/ubd0104/11",
"dataSource": {
"url": "https://int.lindas.admin.ch/query",
"type": "sparql"
},
"chartConfig": {
"fields": {
"x": {
"sorting": {
"sortingType": "byAuto",
"sortingOrder": "asc"
},
"componentIri": "https://environment.ld.admin.ch/foen/ubd0104/dateofprobing"
},
"y": {
"componentIri": "https://environment.ld.admin.ch/foen/ubd0104/value"
}
},
"filters": {
"https://environment.ld.admin.ch/foen/ubd0104/location": {
"type": "single",
"value": "https://ld.admin.ch/dimension/bgdi/inlandwaters/bathingwater/CH19007"
},
"https://environment.ld.admin.ch/foen/ubd0104/parametertype": {
"type": "single",
"value": "E.coli"
}
},
"version": "1.3.0",
"chartType": "column",
"interactiveFiltersConfig": {
"legend": {
"active": false,
"componentIri": ""
},
"timeRange": {
"active": false,
"presets": {
"to": "",
"from": "",
"type": "range"
},
"componentIri": ""
},
"timeSlider": {
"componentIri": ""
},
"dataFilters": {
"active": true,
"componentIris": [
"https://environment.ld.admin.ch/foen/ubd0104/location"
]
}
}
}
}
}
5 changes: 5 additions & 0 deletions app/test/__fixtures/config/int/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const configs: TestConfig[] = [
name: "Map - Waldfläsche (areas)",
slug: "map-waldflasche",
},
{
chartId: "nI6X4V_EcK2c",
name: "Bathing water quality (interactive filters hierarchie)",
slug: "bathing-water-quality-hierarchie",
},
];

export default configs;
17 changes: 17 additions & 0 deletions e2e/interactive-filters.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test } from "./common";

test("it should display values in interactive filters as hierarchie", async ({
page,
selectors,
within,
}) => {
await page.goto("/en/__test/int/bathing-water-quality-hierarchie");
await selectors.chart.loaded();
await page.locator('text="Show Filters"').click();
await within(selectors.published.interactiveFilters())
.getByText("Seerose")
.click();
await selectors.mui.popover().getByText("BAQUA_FR");
await selectors.mui.popover().getByText("Nouvelle plage").click();
await selectors.chart.loaded();
});
4 changes: 4 additions & 0 deletions e2e/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export const createSelectors = ({ screen, page, within }: Ctx) => {
has: page.locator(`h5:text-is("${title}")`),
}),
},
published: {
interactiveFilters: () =>
screen.getByTestId("published-chart-interactive-filters"),
},
chart: {
colorLegend: (options?, waitForOptions?) =>
screen.findByTestId("colorLegend", options, waitForOptions),
Expand Down

0 comments on commit bbd52b8

Please sign in to comment.