From c8062c8ae0bdb3d2fd7342fa51294a2f40e0e420 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Fri, 1 Mar 2024 09:55:32 +0100 Subject: [PATCH 1/2] e2e(ME): rework test to avoid random failures --- .../src/e2e/dashboard.cy.ts | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts index fc9fd6155e..2442fd91aa 100644 --- a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts +++ b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts @@ -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) }) }) }) From 79446c4f6b8e651225b67ead8462aa11a3811c28 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Fri, 1 Mar 2024 13:06:50 +0100 Subject: [PATCH 2/2] e2e(DH): fix expected result for geom boost Two records are showing up randomly in second place; only check first one --- apps/datahub-e2e/src/e2e/datasets.cy.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/datasets.cy.ts b/apps/datahub-e2e/src/e2e/datasets.cy.ts index 5069453670..c4ecfc8c89 100644 --- a/apps/datahub-e2e/src/e2e/datasets.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasets.cy.ts @@ -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') }) }) })