From 6d707636332f269e29892cac6cf06c748856a967 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Fri, 25 Aug 2023 15:40:06 +0200 Subject: [PATCH] e2e: simplify orgs tests & adapt headers test The sort by combos have been slightly changed to avoid using JSON as values. This was breaking the e2e tests and doing a join(',') is also much simpler. The values for the orgs filter dropdown have been updated to show correct values. also fixed a bug when clicking on the org name in the dataset view --- apps/datahub-e2e/src/e2e/datasets.cy.ts | 6 +- apps/datahub-e2e/src/e2e/header.cy.ts | 20 +- apps/datahub-e2e/src/e2e/organisations.cy.ts | 248 ------------------ apps/datahub-e2e/src/e2e/organizations.cy.ts | 140 ++++++++++ .../lib/chart-view/chart-view.component.ts | 4 +- .../record-metadata.component.html | 2 +- .../record-metadata.component.spec.ts | 15 +- .../record-metadata.component.ts | 6 +- .../src/lib/sort-by/sort-by.component.spec.ts | 6 +- .../src/lib/sort-by/sort-by.component.ts | 12 +- .../organisation-preview.component.html | 12 +- .../organisations-sort.component.ts | 10 +- .../lib/pagination/pagination.component.html | 2 + .../dropdown-selector.component.ts | 6 +- 14 files changed, 188 insertions(+), 301 deletions(-) delete mode 100644 apps/datahub-e2e/src/e2e/organisations.cy.ts create mode 100644 apps/datahub-e2e/src/e2e/organizations.cy.ts diff --git a/apps/datahub-e2e/src/e2e/datasets.cy.ts b/apps/datahub-e2e/src/e2e/datasets.cy.ts index f772bdcd7b..67833d9677 100644 --- a/apps/datahub-e2e/src/e2e/datasets.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasets.cy.ts @@ -186,18 +186,18 @@ describe('datasets', () => { expect(dropdownOptions).to.eql([ 'Agence wallonne du Patrimoine (SPW - Territoire, Logement, Patrimoine, Énergie - Agence wallonne du Patrimoine) (1)', 'atmo Hauts-de-France (1)', - 'Bundesamt für Raumentwicklung (2)', + 'Bundesamt für Raumentwicklung (1)', "Canton du Valais - Service de l'environnement (SEN) - Protection des sols (1)", 'Cellule informatique et géomatique (SPW - Intérieur et Action sociale - Direction fonctionnelle et d’appui) (1)', "Direction de l'Action sociale (SPW - Intérieur et Action sociale - Département de l'Action sociale - Direction de l'Action sociale) (1)", 'DREAL (1)', - "DREAL HdF (Direction Régionale de l'Environnement de l'Aménagement et du Logement des Hauts de France) (54)", + "DREAL HdF (Direction Régionale de l'Environnement de l'Aménagement et du Logement des Hauts de France) (1)", 'Géo2France (1)', "Helpdesk carto du SPW (SPW - Secrétariat général - SPW Digital - Département de la Géomatique - Direction de l'Intégration des géodonnées) (2)", 'Métropole Européenne de Lille (1)', 'Région Hauts-de-France (2)', 'Service public de Wallonie (SPW) (2)', - "Société Publique de Gestion de l'Eau (SPGE) (2)", + "Société Publique de Gestion de l'Eau (SPGE) (1)", ]) }) }) diff --git a/apps/datahub-e2e/src/e2e/header.cy.ts b/apps/datahub-e2e/src/e2e/header.cy.ts index 4d4361a6bb..edb0bd6847 100644 --- a/apps/datahub-e2e/src/e2e/header.cy.ts +++ b/apps/datahub-e2e/src/e2e/header.cy.ts @@ -97,7 +97,13 @@ describe('header', () => { }) }) - describe('filter search actions', () => { + describe('filter and sort', () => { + beforeEach(() => { + cy.visit('/search') + cy.get('gn-ui-record-preview-row').as('initialList') + cy.visit('/news') + }) + it('should create two filter buttons upon loading page', () => { cy.get('gn-ui-fuzzy-search') .next() @@ -105,18 +111,12 @@ describe('header', () => { .should('have.length', 2) }) - beforeEach(() => { - cy.visit('/search') - cy.get('gn-ui-record-preview-row').as('initialList') - cy.visit('/news') - }) - - it('should filter results by latest date', () => { + it('should sort results by latest date', () => { cy.get('gn-ui-fuzzy-search').next().find('button').first().click() cy.get('gn-ui-record-preview-row').should('not.eq', '@initialList') cy.get('select#sort-by- option:selected').should( 'have.value', - '-createDate' + 'desc,createDate' ) }) it('should filter results by popularity', () => { @@ -124,7 +124,7 @@ describe('header', () => { cy.get('gn-ui-record-preview-row').should('not.eq', '@initialList') cy.get('select#sort-by- option:selected').should( 'have.value', - '-userSavedCount' + 'desc,userSavedCount' ) }) }) diff --git a/apps/datahub-e2e/src/e2e/organisations.cy.ts b/apps/datahub-e2e/src/e2e/organisations.cy.ts deleted file mode 100644 index aaaaae3f10..0000000000 --- a/apps/datahub-e2e/src/e2e/organisations.cy.ts +++ /dev/null @@ -1,248 +0,0 @@ -import 'cypress-real-events' - -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').should('be.visible') - 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').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 features', () => { - let providerOrg - beforeEach(() => { - cy.get('[data-cy="providerDesc"]') - .eq(11) - .children('span') - .invoke('text') - .then((txt) => { - providerOrg = txt.trim() - }) - }) - it('should access the related datasets on click', () => { - cy.get('gn-ui-organisations') - .children('div') - .first() - .children('gn-ui-content-ghost') - .eq(11) - .click() - cy.url() - .should('include', 'publisher=') - .and('include', encodeURIComponent(providerOrg)) - }) - }) - - describe('page toggle features', () => { - 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').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 isOrdered(arr, type) { - for (let i = 0; i < arr.length - 1; i++) { - if (arr[i].localeCompare(arr[i + 1]) < 0 && type == 'ZA') { - return false - } else if (arr[i].localeCompare(arr[i + 1]) > 0 && type == 'AZ') { - return false - } - } - return true - } - - cy.get('@txtProvi') - .children('span') - .each(($span) => { - proviList.push($span.text()) - }) - cy.then(() => { - proviList = proviList.map((elmt) => elmt.trim()) - expect(isOrdered(proviList, 'ZA')).to.be.true - proviList = [] - cy.get('@filter').select(0) - cy.get('@txtProvi') - .children('span') - .each(($span) => { - proviList.push($span.text()) - }) - cy.then(() => { - proviList = proviList.map((elmt) => elmt.trim()) - expect(isOrdered(proviList, 'AZ')).to.be.true - }) - }) - }) - it('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) - }) - cy.then(() => { - cy.get('@filter').select(2) - cy.get('[data-cy="orgaName"]').each((item) => { - const text = item.text().trim() - updatedOrder.push(text) - }) - cy.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) - }) - cy.then(() => { - expect(initialOrder).to.not.equal(thirdOrder) - expect(updatedOrder).to.not.equal(thirdOrder) - }) - }) - }) - }) - it('should navigate to next page with button', () => { - const page1 = [] - const page2 = [] - cy.get('@txtProvi') - .children('span') - .each(($span) => { - page1.push($span.text()) - }) - cy.then(() => { - cy.get('@pagination') - .children('div') - .first() - .find('gn-ui-button') - .click() - cy.get('@txtProvi') - .children('span') - .each(($span) => { - page2.push($span.text()) - }) - cy.then(() => { - expect(page1).to.not.equal(page2) - }) - }) - }) - it('should go to next page with arrow', () => { - const page1 = [] - const page2 = [] - cy.get('@txtProvi') - .children('span') - .each(($span) => { - page1.push($span.text()) - }) - cy.then(() => { - cy.get('@pagination') - .children('div') - .eq(1) - .find('gn-ui-button') - .eq(1) - .click() - cy.get('@txtProvi') - .children('span') - .each(($span) => { - page2.push($span.text()) - }) - cy.then(() => { - expect(page1).to.not.equal(page2) - }) - }) - }) - it('should navigate between pages with number typed', () => { - const page1 = [] - const page2 = [] - cy.get('@txtProvi') - .children('span') - .each(($span) => { - page1.push($span.text()) - }) - cy.then(() => { - cy.get('@pagination').children('div').eq(1).find('input').type('2') - cy.get('@txtProvi') - .children('span') - .each(($span) => { - page2.push($span.text()) - }) - cy.then(() => { - expect(page1).to.not.equal(page2) - }) - }) - }) - }) -}) diff --git a/apps/datahub-e2e/src/e2e/organizations.cy.ts b/apps/datahub-e2e/src/e2e/organizations.cy.ts new file mode 100644 index 0000000000..9ca828b647 --- /dev/null +++ b/apps/datahub-e2e/src/e2e/organizations.cy.ts @@ -0,0 +1,140 @@ +import 'cypress-real-events' + +describe('organizations', () => { + beforeEach(() => { + cy.visit('/home/organisations') + cy.viewport(1700, 1200) + + // aliases + cy.get('gn-ui-organisations-sort') + .find('gn-ui-dropdown-selector') + .find('select') + .as('sort') + cy.get('gn-ui-pagination').children('div').as('pagination') + cy.get('gn-ui-organisations') + .find('gn-ui-organisation-preview') + .as('organizations') + cy.get('@organizations') + .find('[data-cy="organizationName"]') + .as('organizationsName') + cy.get('@organizations') + .find('[data-cy="organizationDesc"]') + .as('organizationsDesc') + cy.get('@organizations') + .find('[data-cy="organizationRecordsCount"]') + .as('organizationsRecordsCount') + }) + + 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').should('be.visible') + cy.get('@sort').children('option').should('have.length', 4) + }) + it('should display organizations with thumbnail, title and description', () => { + cy.get('@organizations').find('gn-ui-thumbnail').should('be.visible') + cy.get('@organizationsName').its('text').should('have.length.above', 0) + cy.get('@organizationsDesc').its('text').should('have.length.above', 0) + cy.get('@organizationsRecordsCount') + .its('text') + .should('have.length.above', 0) + }) + it('should display organization information', () => { + cy.get('@organizationsName') + .eq(2) + .invoke('text') + .should('contain', 'Bundesamt für Raumentwicklung') + cy.get('@organizationsDesc') + .eq(2) + .invoke('text') + .should('contain', 'Bundesamt für Raumentwicklung') + cy.get('@organizationsRecordsCount') + .eq(2) + .invoke('text') + .should('contain', '1') + }) + it('should display an actual logo', () => { + cy.get('@organizations') + .eq(8) + .find('img') + .should('have.attr', 'src') + .and('contain', 'G%C3%A9o2France-4-3_decoupe.png') + }) + it('should display navigation options', () => { + cy.get('@pagination').should('be.visible') + }) + }) + + describe('list features', () => { + it('should search with a filter on the selected org on click', () => { + cy.get('@organizationsName') + .eq(11) + .then(($clickedName) => { + cy.get('@organizations').eq(11).click() + cy.url() + .should('include', 'publisher=') + .and('include', encodeURIComponent($clickedName.text().trim())) + }) + }) + }) + + describe('navigation features', () => { + const getInnerTexts = ($elts): string[] => { + return $elts.toArray().map((elt) => elt.innerText.trim()) + } + const orderBy = (array: string[], dir: -1 | 1): string[] => { + return array.sort((a, b) => dir * a.localeCompare(b)) + } + + it('should order the list alphabetically (asc)', () => { + cy.get('@sort').select('asc,name') + cy.get('@organizationsName').then(($orgsName) => { + const orderedNames = getInnerTexts($orgsName) + expect(orderedNames).to.eql(orderBy(orderedNames, 1)) + }) + }) + it('should order the list alphabetically (desc)', () => { + cy.get('@sort').select('desc,name') + cy.get('@organizationsName').then(($orgsName) => { + const orderedNames = getInnerTexts($orgsName) + expect(orderedNames).to.eql(orderBy(orderedNames, -1)) + }) + }) + it('should order the list by dataset count (asc)', () => { + cy.get('@sort').select('asc,recordCount') + cy.get('@organizationsRecordsCount').then(($orgsRecordsCount) => { + const orderedCounts = getInnerTexts($orgsRecordsCount) + expect(orderedCounts).to.eql(orderBy(orderedCounts, 1)) + }) + }) + it('should order the list by dataset count (desc)', () => { + cy.get('@sort').select('desc,recordCount') + cy.get('@organizationsRecordsCount').then(($orgsRecordsCount) => { + const orderedCounts = getInnerTexts($orgsRecordsCount) + expect(orderedCounts).to.eql(orderBy(orderedCounts, -1)) + }) + }) + it('should navigate to next page with button', () => { + cy.get('@pagination').children('div').first().find('gn-ui-button').click() + }) + it('should go to next page with arrow', () => { + cy.then(() => { + cy.get('@pagination').find('[data-cy=next-page]').click() + cy.get('@organizations').should('have.length', 2) + }) + }) + it('should go back to the first page with arrow', () => { + cy.then(() => { + cy.get('@pagination').find('[data-cy=next-page]').click() + cy.get('@pagination').find('[data-cy=prev-page]').click() + cy.get('@organizations').should('have.length', 12) + }) + }) + }) +}) diff --git a/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts b/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts index 5c215d95bb..c35fe4995f 100644 --- a/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts +++ b/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts @@ -93,7 +93,7 @@ export class ChartViewComponent { error = null errorInfo = null - typeChoices: DDChoices = [ + typeChoices: DDChoices = [ { label: 'chart.type.bar', value: 'bar' }, { label: 'chart.type.barHorizontal', value: 'bar-horizontal' }, { label: 'chart.type.line', value: 'line' }, @@ -111,7 +111,7 @@ export class ChartViewComponent { { label: 'chart.aggregation.min', value: 'min' }, { label: 'chart.aggregation.average', value: 'average' }, { label: 'chart.aggregation.count', value: 'count' }, - ] as DDChoices + ] as DDChoices } dataset$: Observable = this.currentLink$.pipe( diff --git a/libs/feature/record/src/lib/record-metadata/record-metadata.component.html b/libs/feature/record/src/lib/record-metadata/record-metadata.component.html index ff5d03a000..094cb1cf2a 100644 --- a/libs/feature/record/src/lib/record-metadata/record-metadata.component.html +++ b/libs/feature/record/src/lib/record-metadata/record-metadata.component.html @@ -25,7 +25,7 @@
diff --git a/libs/feature/record/src/lib/record-metadata/record-metadata.component.spec.ts b/libs/feature/record/src/lib/record-metadata/record-metadata.component.spec.ts index 4671533b84..b2f669fd30 100644 --- a/libs/feature/record/src/lib/record-metadata/record-metadata.component.spec.ts +++ b/libs/feature/record/src/lib/record-metadata/record-metadata.component.spec.ts @@ -485,16 +485,11 @@ describe('RecordMetadataComponent', () => { }) describe('#onContactClick', () => { it('call update search for OrgForResource', () => { - component.onContactClick({ - firstName: 'john', - role: 'point_of_contact', - email: 'joh@doe.com', - organization: { - name: 'MyOrganization', - website: new URL('https://www.my.org/info'), - logoUrl: new URL('https://www.my.org/logo.png'), - description: 'A generic organization', - }, + component.onOrganizationClick({ + name: 'MyOrganization', + website: new URL('https://www.my.org/info'), + logoUrl: new URL('https://www.my.org/logo.png'), + description: 'A generic organization', }) expect(searchService.updateFilters).toHaveBeenCalledWith({ orgs: { diff --git a/libs/feature/record/src/lib/record-metadata/record-metadata.component.ts b/libs/feature/record/src/lib/record-metadata/record-metadata.component.ts index 782917dde2..0587a5303f 100644 --- a/libs/feature/record/src/lib/record-metadata/record-metadata.component.ts +++ b/libs/feature/record/src/lib/record-metadata/record-metadata.component.ts @@ -6,7 +6,7 @@ import { BehaviorSubject, combineLatest } from 'rxjs' import { filter, map, mergeMap, pluck } from 'rxjs/operators' import { MdViewFacade } from '../state/mdview.facade' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' -import { Individual } from '@geonetwork-ui/common/domain/record' +import { Individual, Organization } from '@geonetwork-ui/common/domain/record' @Component({ selector: 'gn-ui-record-metadata', @@ -70,9 +70,9 @@ export class RecordMetadataComponent { onInfoKeywordClick(keyword: string) { this.searchService.updateFilters({ any: keyword }) } - onContactClick(contact: Individual) { + onOrganizationClick(org: Organization) { this.orgsService - .getFiltersForOrgs([contact.organization]) + .getFiltersForOrgs([org]) .subscribe((filters) => this.searchService.updateFilters(filters)) } } diff --git a/libs/feature/search/src/lib/sort-by/sort-by.component.spec.ts b/libs/feature/search/src/lib/sort-by/sort-by.component.spec.ts index 47ec1b1425..1e6b651be4 100644 --- a/libs/feature/search/src/lib/sort-by/sort-by.component.spec.ts +++ b/libs/feature/search/src/lib/sort-by/sort-by.component.spec.ts @@ -71,19 +71,19 @@ describe('SortByComponent', () => { expect(dropDownComponent.choices).toEqual(component.choices) }) it('initialized with state value (stringified)', () => { - expect(dropDownComponent.selected).toEqual('["asc","title"]') + expect(dropDownComponent.selected).toEqual('asc,title') }) it('updated from state', () => { sortBySubject.next(['desc', '_score']) fixture.detectChanges() - expect(dropDownComponent.selected).toEqual('["desc","_score"]') + expect(dropDownComponent.selected).toEqual('desc,_score') }) }) describe('#changeSortBy', () => { let sort beforeEach(() => { sort = ['desc', '_score'] - component.changeSortBy(JSON.stringify(sort)) // criteria is stringified when going through the dropdown component + component.changeSortBy('desc,_score') // criteria is stringified when going through the dropdown component }) it('dispatch search action', () => { expect(searchService.setSortBy).toHaveBeenCalledWith(sort) diff --git a/libs/feature/search/src/lib/sort-by/sort-by.component.ts b/libs/feature/search/src/lib/sort-by/sort-by.component.ts index 3945b940ac..06f897e905 100644 --- a/libs/feature/search/src/lib/sort-by/sort-by.component.ts +++ b/libs/feature/search/src/lib/sort-by/sort-by.component.ts @@ -13,20 +13,18 @@ export class SortByComponent { choices = [ { label: marker('results.sortBy.relevancy'), - value: JSON.stringify(SortByEnum.RELEVANCY), + value: SortByEnum.RELEVANCY.join(','), }, { label: marker('results.sortBy.dateStamp'), - value: JSON.stringify(SortByEnum.CREATE_DATE), + value: SortByEnum.CREATE_DATE.join(','), }, { label: marker('results.sortBy.popularity'), - value: JSON.stringify(SortByEnum.POPULARITY), + value: SortByEnum.POPULARITY.join(','), }, ] - currentSortBy$ = this.facade.sortBy$.pipe( - map((sortBy) => JSON.stringify(sortBy)) - ) + currentSortBy$ = this.facade.sortBy$.pipe(map((sortBy) => sortBy.join(','))) constructor( private facade: SearchFacade, @@ -34,6 +32,6 @@ export class SortByComponent { ) {} changeSortBy(criteriaAsString: string) { - this.searchService.setSortBy(JSON.parse(criteriaAsString) as SortByField) + this.searchService.setSortBy(criteriaAsString.split(',') as SortByField) } } 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 0f47314100..ac40465135 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 @@ -13,24 +13,24 @@ >
-
+
{{ organisation.name }}

{{ organisation.description }}

folder_open - {{ organisation.recordCount }} + {{ + organisation.recordCount + }} record.metadata.publications
diff --git a/libs/ui/catalog/src/lib/organisations-sort/organisations-sort.component.ts b/libs/ui/catalog/src/lib/organisations-sort/organisations-sort.component.ts index 5ba17e5d7a..dff069765e 100644 --- a/libs/ui/catalog/src/lib/organisations-sort/organisations-sort.component.ts +++ b/libs/ui/catalog/src/lib/organisations-sort/organisations-sort.component.ts @@ -16,25 +16,25 @@ import { SortByField } from '@geonetwork-ui/common/domain/search' export class OrganisationsSortComponent { choices: { value: string; label: string }[] = [ { - value: JSON.stringify(['asc', 'name']), + value: 'asc,name', label: marker('organisations.sortBy.nameAsc'), }, { - value: JSON.stringify(['desc', 'name']), + value: 'desc,name', label: marker('organisations.sortBy.nameDesc'), }, { - value: JSON.stringify(['asc', 'recordCount']), + value: 'asc,recordCount', label: marker('organisations.sortBy.recordCountAsc'), }, { - value: JSON.stringify(['desc', 'recordCount']), + value: 'desc,recordCount', label: marker('organisations.sortBy.recordCountDesc'), }, ] @Output() sortBy = new EventEmitter() selectOrderToDisplay(selectValue: string) { - this.sortBy.emit(JSON.parse(selectValue) as SortByField) + this.sortBy.emit(selectValue.split(',') as SortByField) } } diff --git a/libs/ui/elements/src/lib/pagination/pagination.component.html b/libs/ui/elements/src/lib/pagination/pagination.component.html index e7aa550b5c..4febda2677 100644 --- a/libs/ui/elements/src/lib/pagination/pagination.component.html +++ b/libs/ui/elements/src/lib/pagination/pagination.component.html @@ -36,6 +36,7 @@ [disabled]="currentPage === 1" [type]="'light'" extraClass="!p-[3px]" + data-cy="prev-page" > navigate_before @@ -45,6 +46,7 @@ [disabled]="currentPage === nPages" [type]="'light'" extraClass="!p-[3px]" + data-cy="next-page" > navigate_next diff --git a/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.ts b/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.ts index 2c187ebd13..8d37d2e9f5 100644 --- a/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.ts +++ b/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.ts @@ -7,9 +7,9 @@ import { Output, } from '@angular/core' -export type DDChoices = Array<{ +export type DDChoices = Array<{ label: string - value: T + value: string }> @Component({ @@ -22,7 +22,7 @@ export class DropdownSelectorComponent { @Input() title: string @Input() showTitle = true @Input() ariaName: string - @Input() choices: DDChoices + @Input() choices: DDChoices @Input() selected: any @Input() extraClass = '' @Output() selectValue = new EventEmitter()