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 16, 2024
1 parent 23e957a commit 5afa39c
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions apps/datahub-e2e/src/e2e/search.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,24 @@ describe('search', () => {
it('should display the search form', () => {
cy.get('mel-datahub-search-form').should('be.visible')
})
it('should display the search filters', () => {
cy.get('mel-datahub-search-filters').should('be.visible')
it('should display the base search filters', () => {
cy.get('[data-cy="filterExpandBtn"]').click()
cy.get('mel-datahub-search-filters')
.find('mel-datahub-filter-dropdown')
.children()
.then(($dropdowns) =>
$dropdowns
.toArray()
.map((dropdown) => dropdown.getAttribute('data-cy-field'))
)
.should('eql', [
'categoryKeyword',
'organization',
'publicationYear',
'license',
'qualityScore',
'territories',
])
})
it('should display the search results', () => {
cy.get('mel-datahub-search-results').should('be.visible')
Expand Down Expand Up @@ -179,6 +195,14 @@ describe('search', () => {
cy.get('@options').eq(2).click()
cy.get('mel-datahub-results-card-search').should('have.length', 3)
})
it('should filter by quality score', () => {
cy.get('[data-cy="filterExpandBtn"]').click()
cy.get('@filters').eq(4).click()
cy.get('gn-ui-text-input input').first().type('5')
cy.get('gn-ui-text-input input').last().type('7')
cy.get('mel-datahub-button').last().click()
cy.get('mel-datahub-results-card-search').should('have.length', 3)
})
it('should filter the results when executing a search', () => {
cy.get('mel-datahub-autocomplete input').type('velo')
cy.get('mel-datahub-autocomplete .material-symbols-outlined')
Expand Down

0 comments on commit 5afa39c

Please sign in to comment.