From 86de1c9b5c3528c88e088f36c207b4af3c9d27ab Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Thu, 10 Nov 2022 14:33:24 +0100 Subject: [PATCH] feat: Add E2E test to test for hierachy in published chart interactive filter --- app/charts/shared/chart-data-filters.tsx | 1 + .../int/bathing-water-quality-hierarchie.json | 74 +++++++++++++++++++ app/test/__fixtures/config/int/configs.ts | 5 ++ e2e/interactive-filters.spec.ts | 17 +++++ e2e/selectors.ts | 4 + 5 files changed, 101 insertions(+) create mode 100644 app/test/__fixtures/config/int/bathing-water-quality-hierarchie.json create mode 100644 e2e/interactive-filters.spec.ts diff --git a/app/charts/shared/chart-data-filters.tsx b/app/charts/shared/chart-data-filters.tsx index 4b8f69634..9dd781baa 100644 --- a/app/charts/shared/chart-data-filters.tsx +++ b/app/charts/shared/chart-data-filters.tsx @@ -99,6 +99,7 @@ export const ChartDataFilters = ({ {componentIris.length > 0 && ( { + 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(); +}); diff --git a/e2e/selectors.ts b/e2e/selectors.ts index 5c092efca..d7a0eaf8f 100644 --- a/e2e/selectors.ts +++ b/e2e/selectors.ts @@ -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),