Skip to content

Commit

Permalink
Merge pull request #808 from geonetwork/fix-flaky-e2e-tests
Browse files Browse the repository at this point in the history
Metadata Editor: rework E2E test to avoid random failures
  • Loading branch information
jahow authored Mar 1, 2024
2 parents 2795595 + 79446c4 commit eaf94da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
6 changes: 0 additions & 6 deletions apps/datahub-e2e/src/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,6 @@ describe('datasets', () => {
'eql',
'Cartographie des sols agricoles de la plaine du Rhône'
)
cy.get('gn-ui-results-list-item')
.eq(1)
.find('[data-cy=recordTitle]')
.invoke('text')
.invoke('trim')
.should('eql', 'Alpine Convention')
})
})
})
Expand Down
35 changes: 15 additions & 20 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,27 @@ describe('dashboard', () => {
})

describe('sorting', () => {
let originalFirstItem
let newFirstItem
it('should order the result list on click', () => {
cy.visit('/records/search')
cy.get('gn-ui-results-table')
.find('.table-row-cell')
.eq(1)
.invoke('text')
.then((list) => {
originalFirstItem = list.trim()
// order by title descending
cy.get('.table-header-cell').eq(1).click()
cy.url().should('include', 'sort=resourceTitleObject.default.keyword')
cy.get('.table-header-cell').eq(1).click()
cy.url().should(
'include',
'sort=-resourceTitleObject.default.keyword'
)
cy.get('gn-ui-results-table')
.find('.table-row-cell')
.eq(1)
.invoke('text')
.then((list) => {
newFirstItem = list.trim()
expect(newFirstItem).not.to.equal(originalFirstItem)
})
.invoke('trim')
.as('originalFirstItem')

// order by title descending
cy.get('.table-header-cell').eq(1).click()
cy.url().should('include', 'sort=resourceTitleObject.default.keyword')
cy.get('.table-header-cell').eq(1).click()
cy.url().should('include', 'sort=-resourceTitleObject.default.keyword')
cy.get('gn-ui-results-table')
.find('.table-row-cell')
.eq(1)
.invoke('text')
.invoke('trim')
.then((newFirstItem) => {
expect(newFirstItem).not.to.equal(this.originalFirstItem)
})
})
})
Expand Down

0 comments on commit eaf94da

Please sign in to comment.