From 9cac8015bb065c7a08afa24ae5da914439f13776 Mon Sep 17 00:00:00 2001 From: Camille Moinier Date: Thu, 11 Jul 2024 16:46:41 +0200 Subject: [PATCH] feat: add e2e testing --- apps/datahub-e2e/src/e2e/search.cy.ts | 35 ++++++++++++++++++- .../src/fixtures/config-with-all-filters.toml | 12 +++++++ conf/default.toml | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 apps/datahub-e2e/src/fixtures/config-with-all-filters.toml diff --git a/apps/datahub-e2e/src/e2e/search.cy.ts b/apps/datahub-e2e/src/e2e/search.cy.ts index 6d5c097d..23d0552c 100644 --- a/apps/datahub-e2e/src/e2e/search.cy.ts +++ b/apps/datahub-e2e/src/e2e/search.cy.ts @@ -223,8 +223,41 @@ describe('search', () => { ' Aucune correspondance. ' ) }) + describe('Filters from config', () => { + beforeEach(() => { + // this will enable all available filters + cy.intercept('GET', '/assets/configuration/default.toml', { + fixture: 'config-with-all-filters.toml', + }) + cy.visit('/search') + }) + it('should display all filters', () => { + cy.get('@filters').filter(':visible').should('have.length', 12) + cy.get('@filters') + .children() + .then(($dropdowns) => + $dropdowns + .toArray() + .map((dropdown) => dropdown.getAttribute('data-cy-field')) + ) + .should('eql', [ + 'publisher', + 'format', + 'publicationYear', + 'inspireKeyword', + 'keyword', + 'topic', + 'isSpatial', + 'license', + 'resourceType', + 'representationType', + 'revisionYear', + 'categoryKeyword' + ]) + }) + }) }) - describe.only('pagination', () => { + describe('pagination', () => { beforeEach(() => { cy.visit('/search') }) diff --git a/apps/datahub-e2e/src/fixtures/config-with-all-filters.toml b/apps/datahub-e2e/src/fixtures/config-with-all-filters.toml new file mode 100644 index 00000000..7e99d9bc --- /dev/null +++ b/apps/datahub-e2e/src/fixtures/config-with-all-filters.toml @@ -0,0 +1,12 @@ +[global] +geonetwork4_api_url = "/geonetwork/srv/api" +proxy_path = "" + +[theme] +primary_color = "#c82850" +secondary_color = "#001638" +main_color = "#212029" # All-purpose text color +background_color = "#fdfbff" + +[search] +advanced_filters = ['publisher', 'format', 'publicationYear', 'inspireKeyword', 'keyword', 'topic', 'isSpatial', 'license', 'resourceType', 'representationType', 'revisionYear', 'categoryKeyword'] diff --git a/conf/default.toml b/conf/default.toml index 8871ca65..11b56375 100644 --- a/conf/default.toml +++ b/conf/default.toml @@ -9,7 +9,7 @@ # The advanced search filters available to the user can be customized with this setting. # The following fields can be used for filtering: 'publisher', 'format', 'publicationYear', 'inspireKeyword', 'keyword', 'topic', 'isSpatial', 'license', 'resourceType', 'representationType', 'revisionYear', 'categoryKeyword', 'qualityScore', 'territories' # any other field will be ignored -advanced_filters = ['format', 'topic', 'resourceType', 'representationType'] +# advanced_filters = ['format', 'topic', 'resourceType', 'representationType'] ### GLOBAL SETTINGS