Skip to content

Commit

Permalink
feat:adjust and add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jul 1, 2024
1 parent d744c54 commit 42737b8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 31 deletions.
82 changes: 52 additions & 30 deletions apps/datahub-e2e/src/e2e/dataset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,39 +196,61 @@ describe('datasets', () => {
})

describe('API block', () => {
beforeEach(() => cy.visit('/dataset/ee965118-2416-4d48-b07e-bbc696f002c2'))
describe('When the link is working', () => {
beforeEach(() =>
cy.visit('/dataset/04bcec79-5b25-4b16-b635-73115f7456e4')
)

it('should display the API block', () => {
cy.get('mel-datahub-dataset-apis').should('be.visible')
})
it('should have API cards', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.should('have.length.gt', 0)
})
it('should display the swagger link', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.last()
.click()
cy.window().then((win) => {
cy.get('mel-datahub-api-form')
.find('a')
.invoke('attr', 'href')
.should('eq', `${win.location.origin}/data/swagger-ui/index.html`)
it('should display the API block', () => {
cy.get('mel-datahub-dataset-apis').should('be.visible')
})
it('should have API cards', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.should('have.length.gt', 0)
})
it('should display the swagger link', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.last()
.find('button')
.eq(1)
.click()
cy.window().then((win) => {
cy.get('mel-datahub-api-form')
.find('a')
.invoke('attr', 'href')
.should('eq', `${win.location.origin}/data/swagger-ui/index.html`)
})
})
it('should open the api form', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.last()
.find('button')
.eq(1)
.click()
cy.get('mel-datahub-api-form').should('be.visible')
})
})
it('should open the api form', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.last()
.find('button')
.eq(1)
.click()
cy.get('mel-datahub-api-form').should('be.visible')
describe('When the link is failing', () => {
beforeEach(() =>
cy.visit('/dataset/ee965118-2416-4d48-b07e-bbc696f002c2')
)

it('should display the error message', () => {
cy.get('mel-datahub-dataset-apis')
.find('mel-datahub-custom-carousel')
.find('mel-datahub-api-card')
.last()
.find('button')
.eq(1)
.click()
cy.get('gn-ui-error').should('be.visible')
})
})
})

Expand Down
2 changes: 1 addition & 1 deletion apps/datahub-e2e/src/e2e/search.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('search', () => {
)
})
})
describe.only('pagination', () => {
describe('pagination', () => {
beforeEach(() => {
cy.visit('/search')
})
Expand Down

0 comments on commit 42737b8

Please sign in to comment.