Skip to content

Commit

Permalink
fix: fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jul 16, 2024
1 parent 4c5b8c8 commit 51bcf65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
18 changes: 11 additions & 7 deletions apps/datahub-e2e/src/e2e/search.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('search', () => {
.find('h1')
.should(
'have.text',
" Concentrations annuelles de polluants dans l'air ambiant issues du réseau permanent de mesures en région Hauts-de-France "
' Metadata for E2E testing purpose. (this title is too long and should be cut, this title is too long and should be cut, this title is too long and should be cut, this title is too long and should be cut, this title is too long and should be cut) '
)
})
it('should filter the results when selecting multiple filter values (producer)', () => {
Expand All @@ -193,7 +193,7 @@ describe('search', () => {
cy.get('@options').first().click()
cy.get('@options').eq(1).click()
cy.get('@options').eq(2).click()
cy.get('mel-datahub-results-card-search').should('have.length', 3)
cy.get('mel-datahub-results-card-search').should('have.length', 5)
})
it('should filter by quality score', () => {
cy.get('[data-cy="filterExpandBtn"]').click()
Expand Down Expand Up @@ -222,12 +222,15 @@ describe('search', () => {
cy.get('@result-cards').should('have.length', 3)
cy.get('@filters').eq(1).click()
getFilterOptions()
cy.get('@options').eq(12).click()
cy.get('@options').eq(5).click()
cy.get('@result-cards').should('have.length', 1)
cy.get('@result-cards')
.first()
.find('h1')
.should('have.text', ' Accroches vélos MEL ')
.should(
'have.text',
' SCoT (Schéma de cohérence territoriale) en région Hauts-de-France '
)
})
it('should combine search input and filters and display a message if no results found', () => {
cy.get('mel-datahub-autocomplete input').type('test')
Expand All @@ -237,7 +240,7 @@ describe('search', () => {
cy.get('@result-cards').should('have.length', 3)
cy.get('@filters').eq(1).click()
getFilterOptions()
cy.get('@options').eq(10).click()
cy.get('@options').eq(8).click()
cy.get('[data-cy=searchResults]').should(
'have.text',
' Aucune correspondance. '
Expand All @@ -257,7 +260,7 @@ describe('search', () => {
cy.get('@filters').eq(3).click()
getFilterOptions()
cy.get('@options').eq(1).click()
cy.get('@result-cards').should('have.length', 2)
cy.get('@result-cards').should('have.length', 9)
cy.get('body').click()
cy.get('[data-cy=filterResetBtn]').click()
cy.get('@result-cards').should('have.length', 14)
Expand All @@ -269,7 +272,7 @@ describe('search', () => {
cy.get('mel-datahub-filter-dropdown').should('have.length', 3)
})
})
describe('Filters from config', () => {
describe.only('Filters from config', () => {
beforeEach(() => {
// this will enable all available filters
cy.intercept('GET', '/assets/configuration/default.toml', {
Expand All @@ -278,6 +281,7 @@ describe('search', () => {
cy.visit('/search')
})
it('should display all filters', () => {
cy.get('[data-cy="filterExpandBtn"]').click()
cy.get('@filters').filter(':visible').should('have.length', 12)
cy.get('@filters')
.children()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
import { RouterFacade } from 'geonetwork-ui'
import { getOptionalSearchConfig } from 'geonetwork-ui'
import { getOptionalSearchConfig } from 'libs/util/app-config/src/lib/app-config'

marker('mel.datahub.search.filters.topic')
marker('mel.datahub.search.filters.categoryKeyword')
Expand Down Expand Up @@ -32,7 +32,7 @@ export class SearchFiltersComponent {
getOptionalSearchConfig().ADVANCED_FILTERS || [
'categoryKeyword',
'organization',
'publicationYear',
'revisionYear',
'license',
'qualityScore',
'territories',
Expand Down
2 changes: 1 addition & 1 deletion conf/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# The advanced search filters available to the user can be customized with this setting.
# The following fields can be used for filtering: 'organization', 'format', 'publicationYear', 'inspireKeyword', 'keyword', 'topic', 'isSpatial', 'license', 'resourceType', 'representationType', 'revisionYear', 'categoryKeyword', 'qualityScore', 'territories', 'publisherOrg', 'producerOrg'
# any other field will be ignored
advanced_filters = ['format', 'topic', 'resourceType', 'representationType', 'publisherOrg', 'producerOrg']
# advanced_filters = ['format', 'topic', 'resourceType', 'representationType', 'publisherOrg', 'producerOrg']

0 comments on commit 51bcf65

Please sign in to comment.