Skip to content

Commit

Permalink
feat: add e2e tests for qality widget and add it in docker comp
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Dec 26, 2023
1 parent 0d4cf0d commit 7857e57
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Create pipeline docker image
run: docker build . -f tools/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

Expand Down
55 changes: 55 additions & 0 deletions apps/datahub-e2e/src/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
})
12 changes: 12 additions & 0 deletions apps/datahub-e2e/src/fixtures/config-with-metadata-quality.toml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions support-services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7857e57

Please sign in to comment.