Skip to content

Commit

Permalink
update e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Romuald Caplier committed Jul 24, 2024
1 parent 0adaf9e commit 8ddb832
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'cypress-real-events'
import { tile } from 'ol/loadingstrategy'
import path from 'path'

beforeEach(() => {
Expand Down Expand Up @@ -94,6 +93,13 @@ describe('dataset pages', () => {
})

describe('GENERAL : display & functions', () => {
describe('no-link-error block', () => {
it("shouldn't be there until metadata is fully loaded", () => {
cy.visit('/dataset/a3774ef6-809d-4dd1-984f-9254f49cbd0a')
cy.get('[data-test=dataset-has-no-link-block]').should('not.exist')
})
})

describe('header', () => {
it('should display the title, favorite star group and arrow back', () => {
cy.get('datahub-header-record')
Expand Down Expand Up @@ -590,11 +596,25 @@ describe('dataset pages', () => {
})
})

describe('When there is no link', () => {
beforeEach(() => {
cy.visit('/dataset/a3774ef6-809d-4dd1-984f-9254f49cbd0a')
})
describe.only('When there is no link', () => {
it('display the error datasetHasNoLink error block', () => {
cy.login()

cy.intercept(
'GET',
'/geonetwork/srv/api/userfeedback?metadataUuid=a3774ef6-809d-4dd1-984f-9254f49cbd0a',
(req) => {
// Test if the error block is not shown before the metadata is fully loaded
cy.get('[data-test="dataset-has-no-link-block"]').should(
'not.exist'
)
}
).as('getData')

cy.visit('/dataset/a3774ef6-809d-4dd1-984f-9254f49cbd0a')

cy.wait('@getData')

cy.get('[data-test="dataset-has-no-link-block"]').should('exist')
})
})
Expand Down

0 comments on commit 8ddb832

Please sign in to comment.