Skip to content

Commit

Permalink
test(organisations): add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed Dec 15, 2023
1 parent ba6c5d7 commit 9612c5b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions apps/datahub-e2e/src/e2e/organizations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ describe('organizations', () => {
cy.get('@organizations')
.find('[data-cy="organizationRecordsCount"]')
.as('organizationsRecordsCount')
cy.get('gn-ui-organisations-filter')
.find('gn-ui-search-input')
.as('organisationsSearch')
cy.get('gn-ui-organisations')
.find('gn-ui-organisations-result')
.as('organisationsResult')
})

describe('general display', () => {
Expand Down Expand Up @@ -135,4 +141,37 @@ describe('organizations', () => {
})
})
})

describe('search filter', () => {
it('should display filtered results ignoring accents and case', () => {
cy.get('@organisationsSearch').type('geo2france')
cy.get('@organizationsName').should('have.length', 1)
cy.get('@organisationsResult').should('contain', '1')
cy.get('@organizationsName')
.eq(0)
.invoke('text')
.should('contain', 'Géo2France')
})
it('should display filtered results containing multiple words', () => {
cy.get('@organisationsSearch').type('dreal hdf')
cy.get('@organizationsName').should('have.length', 1)
cy.get('@organisationsResult').should('contain', '1')
cy.get('@organizationsName')
.eq(0)
.invoke('text')
.should('contain', 'DREAL HdF')
})
it('should display multiple results and refine search', () => {
cy.get('@organisationsSearch').type('de')
cy.get('@organizationsName').should('have.length', 10)
cy.get('@organisationsResult').should('contain', '10')
cy.get('@organisationsSearch').type(' Lille')
cy.get('@organizationsName').should('have.length', 1)
cy.get('@organisationsResult').should('contain', '1')
})
it('should display a message for no results found', () => {
cy.get('@organisationsSearch').type('An organisation that does not exist')
cy.get('@organisationsResult').should('contain', 'No organizations found')
})
})
})

0 comments on commit 9612c5b

Please sign in to comment.