diff --git a/apps/datahub-e2e/src/e2e/datasets.cy.ts b/apps/datahub-e2e/src/e2e/datasets.cy.ts index d078898b9..7af19a0f1 100644 --- a/apps/datahub-e2e/src/e2e/datasets.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasets.cy.ts @@ -213,7 +213,7 @@ describe('datasets', () => { }) }) - describe('filter the list on click on options', () => { + describe.only('filter the list on click on options', () => { let filterLength beforeEach(() => { cy.visit('/home/search') @@ -241,7 +241,6 @@ describe('datasets', () => { const label = $dropdown.prev('label') if (label.text() !== '') { - cy.wrap($dropdown).select('OptionValue') cy.get('[id^=dropdown-multiselect-]') .find('label') .eq(0) @@ -443,7 +442,7 @@ describe('datasets', () => { } }) - it.only('from cross button', () => { + it('from cross button', () => { cy.visit('/home/search') cy.get('[data-cy="addMoreBtn"]').realClick() cy.get('datahub-search-filters') diff --git a/apps/datahub-e2e/src/e2e/organisations.cy.ts b/apps/datahub-e2e/src/e2e/organisations.cy.ts new file mode 100644 index 000000000..7450f2c6d --- /dev/null +++ b/apps/datahub-e2e/src/e2e/organisations.cy.ts @@ -0,0 +1,216 @@ +import 'cypress-real-events' +import { find } from 'cypress/types/lodash' +import { transformExtent } from 'ol/proj' + +describe('organisations', () => { + beforeEach(() => { + cy.visit('/home/organisations') + cy.viewport(1700, 1200) + }) + + describe('general display', () => { + it('should select the right tab', () => { + cy.get('datahub-navigation-menu') + .find('button') + .eq(2) + .invoke('attr', 'ng-reflect-ng-class') + .should('eq', 'decoration-primary') + }) + it('should display the welcome panel', () => { + cy.get('gn-ui-organisations-sort') + cy.get('gn-ui-organisations-sort') + .find('p') + .its('text') + .should('have.length.greaterThan', 0) + cy.get('gn-ui-organisations-sort') + .find('gn-ui-dropdown-selector') + .find('select') + .children('option') + .should('have.length', 4) + }) + it('should display a list of organisations', () => { + cy.get('gn-ui-organisations') + .children('div') + .first() + .children('gn-ui-content-ghost') + .eq(1) + .as('provider') + cy.get('@provider') + .find('gn-ui-thumbnail') + .find('img') + .should('be.visible') + cy.get('@provider').find('[data-cy="providerDesc"]').as('txtProvi') + cy.get('@txtProvi') + .children('span') + .its('text') + .should('have.length.above', 0) + cy.get('@txtProvi').children('div').find('mat-icon').should('be.visible') + cy.get('@txtProvi') + .children('div') + .children('span') + .should(($element) => { + const text = $element.text().trim() + expect(parseInt(text)).to.not.be.NaN + }) + cy.get('@txtProvi') + .children('div') + .children('span') + .eq(1) + .its('text') + .should('have.length.above', 0) + }) + it('should display navigation options', () => { + cy.get('gn-ui-pagination') + .children('div') + .children('div') + .first() + .find('gn-ui-button') + cy.get('gn-ui-pagination') + .children('div') + .children('div') + .eq(1) + .find('input') + cy.get('gn-ui-pagination') + .children('div') + .children('div') + .eq(1) + .find('gn-ui-button') + .should('have.length', 2) + }) + }) + + describe('list functionnalities', () => { + let providerOrg + beforeEach(() => { + cy.get('gn-ui-organisations') + .children('div') + .first() + .children('gn-ui-content-ghost') + .eq(11) + .realClick() + cy.get('[data-cy="providerDesc"]') + .eq(11) + .children('span') + .invoke('text') + .then((txt) => { + providerOrg = txt.toUpperCase().trim() + }) + }) + it('should access the related datasets on click', () => { + cy.get('gn-ui-organisations') + .children('div') + .first() + .children('gn-ui-content-ghost') + .eq(11) + .realClick() + cy.url().should('include', '/search?') + cy.get('[data-cy="recordOrg"]').each(($record) => { + const providerDataset = $record.text().toUpperCase().trim() + expect(providerDataset).to.equal(providerOrg) + }) + }) + }) + + describe.only('page toggle functionnalities', () => { + let proviList = [] + beforeEach(() => { + cy.get('gn-ui-organisations-sort') + .find('gn-ui-dropdown-selector') + .find('select') + .as('filter') + cy.get('gn-ui-pagination') + .children('div') + .children('div') + .as('pagination') + cy.get('gn-ui-organisations') + .children('div') + .first() + .children('gn-ui-content-ghost') + .as('provider') + cy.get('@provider').find('[data-cy="providerDesc"]').as('txtProvi') + }) + + it('should filter the list A to Z / Z to A', () => { + cy.get('@filter').select(1) + function isOrderedZtoA(arr) { + for (let i = 0; i < arr.length - 1; i++) { + if (arr[i].localeCompare(arr[i + 1]) < 0) { + return false + } + } + return true + } + + function isOrderedAtoZ(arr) { + for (let i = 0; i < arr.length - 1; i++) { + if (arr[i].localeCompare(arr[i + 1]) > 0) { + return false + } + } + return true + } + + cy.get('@txtProvi') + .children('span') + .each(($span) => { + proviList.push($span.text()) + }) + .then(() => { + proviList = proviList.map((elmt) => elmt.trim()) + expect(isOrderedZtoA(proviList)).to.be.true + proviList = [] + cy.get('@filter').select(0) + cy.get('@txtProvi') + .children('span') + .each(($span) => { + proviList.push($span.text()) + }) + .then(() => { + proviList = proviList.map((elmt) => elmt.trim()) + expect(isOrderedAtoZ(proviList)).to.be.true + }) + }) + }) + it.only('should filter the list by dataset count', () => { + const thirdOrder = [] + const updatedOrder = [] + const initialOrder = [] + cy.get('@filter').select(0) + cy.get('[data-cy="orgaName"]') + .each((item) => { + const text = item.text().trim() + initialOrder.push(text) + }) + .then(() => { + cy.get('@filter').select(2) + cy.get('[data-cy="orgaName"]') + .each((item) => { + const text = item.text().trim() + updatedOrder.push(text) + }) + .then(() => { + expect(initialOrder).to.not.equal(updatedOrder) + cy.get('@filter').select(3) + cy.get('[data-cy="orgaName"]') + .each((item) => { + const text = item.text().trim() + thirdOrder.push(text) + }) + .then(() => { + expect(initialOrder).to.not.equal(thirdOrder) + expect(updatedOrder).to.not.equal(thirdOrder) + }) + }) + }) + }) + it('should navigate to next page with button', () => { + cy.get('@pagination') + }) + it('should navigate between pages with arrows', () => { + cy.get('@pagination') + }) + it('should navigate between pages with number typed', () => { + cy.get('@pagination') + }) + }) +}) diff --git a/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.html b/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.html index 0d28aff94..e9dc11c8b 100644 --- a/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.html +++ b/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.html @@ -1,27 +1,15 @@ -
+
- + class="flex-shrink-0 bg-gray-100 rounded-lg w-full border border-gray-300 h-36 group-hover:shadow-xl group-hover:border-0"> +
-
- - {{ organisation.name }} -

+

+ + {{ organisation.name }} +

{{ organisation.description }}