Skip to content

Commit

Permalink
test(e2e): add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed Sep 20, 2024
1 parent 95e149d commit 9fdfb66
Showing 1 changed file with 47 additions and 4 deletions.
51 changes: 47 additions & 4 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,35 @@ describe('dashboard', () => {
})
})
describe('navigation', () => {
function checkDashboardFiltered() {
cy.get('gn-ui-autocomplete').type('Mat')
cy.get('mat-option').first().click()
cy.get('gn-ui-interactive-table')
.find('[data-cy="table-row"]')
.should('have.length', '1')
}
beforeEach(() => {
cy.login('admin', 'admin', false)
cy.visit('/catalog/search')
})
describe('search input', () => {
it('should filter the dashboard based on the search input', () => {
checkDashboardFiltered()
})
// TODO remove skip when handleItemSelection of autocomplete is handled correctly
it.skip('should navigate to list of all records and filter the dashboard based on the search input when on different page', () => {
cy.visit('/my-space/my-records')
checkDashboardFiltered()
})
it('should clear the search input when navigating to my records', () => {
cy.get('gn-ui-autocomplete').type('Mat')
cy.get('mat-option').first().click()
cy.get('gn-ui-interactive-table')
.find('[data-cy="table-row"]')
.should('have.length', '1')
cy.get('md-editor-dashboard-menu').find('a').eq(5).click()
cy.get('gn-ui-autocomplete').should('have.value', '')
})
it('should clear the search input when navigating to my drafts', () => {
cy.get('gn-ui-autocomplete').type('Mat')
cy.get('md-editor-dashboard-menu').find('a').eq(6).click()
cy.get('gn-ui-autocomplete').should('have.value', '')
})
})
describe('my records', () => {
Expand All @@ -236,6 +254,31 @@ describe('dashboard', () => {
.next()
.should('contain', 'admin admin')
})
it('should display the correct amount of records', () => {
cy.get('md-editor-dashboard-menu').find('a').eq(5).click()
cy.get('gn-ui-results-table')
.find('[data-cy="table-row"]')
.should('have.length', '10')
})
it('should sort the records by title', () => {
cy.get('md-editor-dashboard-menu').find('a').eq(5).click()
cy.get('gn-ui-results-table')
.find('[data-cy="table-row"]')
.first()
.invoke('text')
.then((firstRecord) => {
console.log(firstRecord)
cy.get('gn-ui-results-table')
.find('.table-header-cell')
.eq(1)
.click()
cy.get('gn-ui-results-table')
.find('[data-cy="table-row"]')
.first()
.invoke('text')
.should('not.eq', firstRecord)
})
})
})
})
})

0 comments on commit 9fdfb66

Please sign in to comment.