From 2148ed11aab7a3f3dc1afe5a9d51fd9adbf9f0e8 Mon Sep 17 00:00:00 2001 From: Florent Hernandez Date: Fri, 1 Sep 2023 16:40:17 +0200 Subject: [PATCH] PLANET-7191: Fix search action and content toggles (#2110) Ref: https://jira.greenpeace.org/browse/PLANET-7191 --- templates/search.twig | 4 +-- .../tickets/PLANET-7191/PLANET-7191.test.js | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/e2e/tickets/PLANET-7191/PLANET-7191.test.js diff --git a/templates/search.twig b/templates/search.twig index eb9e6d491d..4a6bbf3aeb 100644 --- a/templates/search.twig +++ b/templates/search.twig @@ -259,10 +259,10 @@ {% endif %} {% if ( action_types|length > 0 ) %}
- -
+
    {% for id, action_type in action_types %} {% if ( action_type.results > 0 ) %} diff --git a/tests/e2e/tickets/PLANET-7191/PLANET-7191.test.js b/tests/e2e/tickets/PLANET-7191/PLANET-7191.test.js new file mode 100644 index 0000000000..070eb38b02 --- /dev/null +++ b/tests/e2e/tickets/PLANET-7191/PLANET-7191.test.js @@ -0,0 +1,29 @@ +import {test, expect} from '../../tools/lib/test-utils.js'; + +test('check search filters toggles', async ({page}) => { + await page.goto('./?s='); + + const actionLink = await page.getByRole('link', {name: 'Action Type'}); + const contentLink = await page.getByRole('link', {name: 'Content Type'}); + const actionList = await page.locator('.filteritem').filter({has: actionLink}).getByRole('tabpanel'); + const contentList = await page.locator('.filteritem').filter({has: contentLink}).getByRole('tabpanel'); + + await expect(actionList).toBeVisible(); + await expect(contentList).toBeVisible(); + + await actionLink.click(); + await expect(actionList).toBeHidden(); + await expect(contentList).toBeVisible(); + + await contentLink.click(); + await expect(actionList).toBeHidden(); + await expect(contentList).toBeHidden(); + + await contentLink.click(); + await expect(actionList).toBeHidden(); + await expect(contentList).toBeVisible(); + + await actionLink.click(); + await expect(actionList).toBeVisible(); + await expect(contentList).toBeVisible(); +});