From 0192cd999541e312d049f480ae58f5ef8ef79f98 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Tue, 26 Dec 2023 17:49:02 +0100 Subject: [PATCH] feat: add e2e tests for qality widget and add it in docker comp fix: CI fix: CI fix: CI add pipeline fix: CI add pipeline --- .github/workflows/checks.yml | 5 +- apps/datahub-e2e/src/e2e/datasets.cy.ts | 55 +++++++++++++++++++ .../config-with-metadata-quality.toml | 12 ++++ support-services/docker-compose.yml | 9 +++ 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 apps/datahub-e2e/src/fixtures/config-with-metadata-quality.toml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3c22b0b84b..08d12bd34e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -154,8 +154,11 @@ jobs: node-version: ${{ env.NODE_VERSION }} cache: 'npm' + - name: Create pipeline docker image + run: cd tools && docker build . -f pipelines/Dockerfile -t geonetwork/geonetwork-ui-tools-pipelines:latest + - name: Build the backend - run: sudo docker-compose -f support-services/docker-compose.yml up -d init + run: sudo docker-compose -f support-services/docker-compose.yml up -d init tools-pipelines - name: Install dependencies run: | diff --git a/apps/datahub-e2e/src/e2e/datasets.cy.ts b/apps/datahub-e2e/src/e2e/datasets.cy.ts index d90c807231..9152ace7ef 100644 --- a/apps/datahub-e2e/src/e2e/datasets.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasets.cy.ts @@ -456,4 +456,59 @@ describe('datasets', () => { }) }) }) + + describe('metadata quality', () => { + describe('metadata quality widget not enabled', () => { + it('should not show quality score sorting', () => { + cy.get('@sortBy').find('button').click() + cy.get('.cdk-overlay-container') + .find('[role=listbox]') + .find('button') + .should('have.length', 3) + }) + }) + + describe('metadata quality widget enabled', () => { + beforeEach(() => { + // this will enable spatial filtering + cy.intercept('GET', '/assets/configuration/default.toml', { + fixture: 'config-with-metadata-quality.toml', + }) + cy.visit('/search') + }) + it('should not display widget', () => { + cy.get('@results') + .eq(2) + .get('gn-ui-metadata-quality') + .should('not.exist') + }) + + it('should reindex records', () => { + cy.login('admin', 'admin', false) + cy.visit( + `http://localhost:8080/geonetwork/srv/eng/admin.console#/tools` + ) + cy.intercept({ + method: 'PUT', + url: 'http://localhost:8080/geonetwork/srv/api/site/index?reset=false&asynchronous=true', + }).as('indexingRecordsXHR') + cy.get('[class=panel-body]').find('button').first().click() + cy.wait('@indexingRecordsXHR') + }) + + it('should display quality widget', () => { + cy.visit('/search') + cy.get('gn-ui-progress-bar') + .eq(2) + .should('have.attr', 'ng-reflect-value', 87) + }) + + it('should display results sorted by quality score', () => { + cy.get('@sortBy').selectDropdownOption('desc,qualityScore') + cy.get('gn-ui-progress-bar') + .eq(2) + .should('have.attr', 'ng-reflect-value', 100) + }) + }) + }) }) diff --git a/apps/datahub-e2e/src/fixtures/config-with-metadata-quality.toml b/apps/datahub-e2e/src/fixtures/config-with-metadata-quality.toml new file mode 100644 index 0000000000..c1e8e6509f --- /dev/null +++ b/apps/datahub-e2e/src/fixtures/config-with-metadata-quality.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" + +[metadata-quality] +enabled = true diff --git a/support-services/docker-compose.yml b/support-services/docker-compose.yml index 340c104943..330455c0df 100644 --- a/support-services/docker-compose.yml +++ b/support-services/docker-compose.yml @@ -140,3 +140,12 @@ services: condition: service_healthy ports: - '8081:8080' + + tools-pipelines: + image: geonetwork/geonetwork-ui-tools-pipelines:latest + environment: + ES_HOST: http://elasticsearch:9200 + RECORDS_INDEX: gn-records + depends_on: + init: + condition: service_completed_successfully