Skip to content

Commit

Permalink
feat: add e2e testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jul 11, 2024
1 parent 02dacab commit 6ac1813
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
35 changes: 34 additions & 1 deletion apps/datahub-e2e/src/e2e/search.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down
12 changes: 12 additions & 0 deletions apps/datahub-e2e/src/fixtures/config-with-all-filters.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"

[search]
advanced_filters = ['publisher', 'format', 'publicationYear', 'inspireKeyword', 'keyword', 'topic', 'isSpatial', 'license', 'resourceType', 'representationType', 'revisionYear', 'categoryKeyword']
2 changes: 1 addition & 1 deletion conf/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6ac1813

Please sign in to comment.