From fff77131767fcef30a1d9bf2b8f9a945d1280b4a Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Tue, 9 Jan 2024 14:13:40 +0100 Subject: [PATCH] feat(DH): Fix unit test and some e2e tests --- .../datahub-e2e/src/e2e/datasetDetailPage.cy.ts | 17 +++-------------- .../metadata-contact.component.html | 2 ++ .../metadata-contact.component.spec.ts | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts b/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts index 26d431145b..935afb3c83 100644 --- a/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts @@ -120,12 +120,7 @@ describe('dataset pages', () => { .find('[id="about"]') .find('gn-ui-metadata-contact') .should('have.length', 1) - cy.get('datahub-record-metadata') - .find('[id="about"]') - .find('gn-ui-metadata-contact') - .children('div') - .children('a') - .eq(0) + cy.get('[data-cy="contact-email"]') .invoke('text') .should('include', '@') cy.get('datahub-record-metadata') @@ -174,6 +169,7 @@ describe('dataset pages', () => { .children('div') .children('div') .find('a') + .first() .as('proviLink') cy.get('@proviLink') @@ -185,14 +181,7 @@ describe('dataset pages', () => { }) }) it('should go to dataset search page when clicking on org name and filter by org', () => { - cy.get('datahub-record-metadata') - .find('[id="about"]') - .find('gn-ui-metadata-contact') - .children('div') - .children('div') - .children('div') - .first() - .click() + cy.get('[data-cy="organization-name"]').click() cy.url().should('include', '/search?publisher=') }) it('should go to dataset search page when clicking on keyword and filter by keyword', () => { diff --git a/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html b/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html index aa15482692..f46c51c0a9 100644 --- a/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html +++ b/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html @@ -15,6 +15,7 @@
{{ shownOrganization.name }}
@@ -55,6 +56,7 @@ [href]="'mailto:' + contacts[0].email" class="text-sm hover:underline ml-2" target="_blank" + data-cy="contact-email" >{{ contacts[0].email }} diff --git a/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.spec.ts b/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.spec.ts index e854e1d548..60a878c845 100644 --- a/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.spec.ts +++ b/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.spec.ts @@ -89,7 +89,7 @@ describe('MetadataContactComponent', () => { describe('content', () => { let email beforeEach(() => { - email = fixture.debugElement.query(By.css('a')) + email = fixture.debugElement.queryAll(By.css('a'))[1] }) it('displays the contact name', () => { const el = fixture.debugElement.query(