Skip to content

Commit

Permalink
Merge pull request #561 from geonetwork/misc-fixes-for-1.1
Browse files Browse the repository at this point in the history
Misc. fixes for 1.1 release
  • Loading branch information
fgravin authored Jul 28, 2023
2 parents 3781ae4 + fabc8e8 commit c1b52f1
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 63,261 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ Thumbs.db

docs/.vitepress/dist
docs/.vitepress/cache

apps/*-e2e/cypress/**
63,173 changes: 0 additions & 63,173 deletions apps/datahub-e2e/cypress/downloads/rectangles_200m_menage_erbm.csv

This file was deleted.

23 changes: 13 additions & 10 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('dataset pages', () => {
.children('header')
.find('gn-ui-navigation-button')
.click()
cy.url().should('include', '/home/search')
cy.url().should('include', '/search')
})
})
describe('navigation bar', () => {
Expand Down Expand Up @@ -110,18 +110,19 @@ describe('dataset pages', () => {
cy.get('gn-ui-record-metadata')
.find('[id="about"]')
.find('gn-ui-metadata-contact')
.children('div')
.children('div')
.children('div')
.should('have.length', 2)
.should('have.length', 1)
cy.get('gn-ui-record-metadata')
.find('[id="about"]')
.find('gn-ui-metadata-contact')
.children('div')
.children('p')
.children('a')
.eq(1)
.invoke('text')
.should('include', '@')
cy.get('gn-ui-record-metadata')
.find('[id="about"]')
.find('gn-ui-metadata-catalog')
.should('have.length', 1)
})
it('should display the catalog details', () => {
cy.get('gn-ui-record-metadata')
Expand Down Expand Up @@ -180,7 +181,7 @@ describe('dataset pages', () => {
.children('div')
.first()
.click()
cy.url().should('include', '/home/search?publisher=')
cy.url().should('include', '/search?publisher=')
})
it('should go to dataset search page when clicking on keyword and filter by keyword', () => {
cy.get('gn-ui-record-metadata')
Expand All @@ -197,7 +198,7 @@ describe('dataset pages', () => {
.then((key) => {
keyword = key.text().toUpperCase()
cy.get('@keyword').click()
cy.url().should('include', '/home/search?q=')
cy.url().should('include', '/search?q=')
cy.get('gn-ui-fuzzy-search')
.find('input')
.should('have.value', keyword)
Expand Down Expand Up @@ -417,8 +418,10 @@ describe('dataset pages', () => {
.find('button')
.first()
.click({ force: true })
cy.get('body')
.click()
cy.wait(500)
.get('body')
.focus()
.realClick()
.window()
.then((win) => {
win.navigator.clipboard.readText().then((text) => {
Expand Down
82 changes: 32 additions & 50 deletions apps/datahub-e2e/src/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { find } from 'cypress/types/lodash'

describe('datasets', () => {
beforeEach(() => {
cy.visit('/home/search')
cy.visit('/search')
cy.viewport(1700, 1200)
})

Expand Down Expand Up @@ -39,7 +39,7 @@ describe('datasets', () => {

describe('display of dataset previews', () => {
beforeEach(() => {
cy.get('gn-ui-record-preview-row').children('div').first().as('dataset')
cy.get('gn-ui-record-preview-row').children('a').first().as('dataset')
})
it('should display the image', () => {
cy.get('@dataset').find('gn-ui-thumbnail').should('be.visible')
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('datasets', () => {

describe('list actions', () => {
beforeEach(() => {
cy.get('gn-ui-record-preview-row').children('div').first().as('dataset')
cy.get('gn-ui-record-preview-row').children('a').first().as('dataset')
})
it('should open the dataset page on click', () => {
cy.get('@dataset').click()
Expand All @@ -95,7 +95,7 @@ describe('datasets', () => {
cy.get('@login').eq(1).type('admin', { force: true })
cy.get('@login').eq(2).type('admin', { force: true })
cy.get('[name="gnSigninForm"]').find('button').realClick()
cy.url().should('include', '/home/search')
cy.url().should('include', '/search')
cy.get('@favoriteStar').find('span').invoke('text').as('initialCount')
cy.get('@favoriteStar')
.find('gn-ui-star-toggle')
Expand All @@ -122,7 +122,7 @@ describe('datasets', () => {
.eq(1)
.find('gn-ui-button')
.click()
cy.get('@filters').filter(':visible').should('have.length', 8)
cy.get('@filters').filter(':visible').should('have.length', 6)
})
describe('have the right options in filters', () => {
beforeEach(() => {
Expand Down Expand Up @@ -176,55 +176,37 @@ describe('datasets', () => {
})
it('should have an accurate count of data per org', () => {
const dropdownOptions = []
const listOptions = []

cy.get('[id^=dropdown-multiselect-]').then((dropdown) => {
const options = dropdown.find('label')
const regex = /\(\d+\)/g
options.map((index, element) => {
dropdownOptions.push([
Cypress.$(element).text().replace(regex, '').trim(),
Number(
Cypress.$(element)
.text()
.match(regex)[0]
.replace('(', '')
.replace(')', '')
),
])
cy.get('[id^=dropdown-multiselect-]')
.find('label')
.each((element) => {
dropdownOptions.push(Cypress.$(element).text().trim())
})
})

cy.get('[data-cy="recordOrg"]')
.invoke('text')
.then((value) => {
const listProv = value.split(' ').map((item) => item.trim())
const occurrences = {}

for (let i = 0; i < listProv.length; i++) {
const str = listProv[i]
occurrences[str] = occurrences[str] ? occurrences[str] + 1 : 1
}

for (const str in occurrences) {
listOptions.push([str, Number(occurrences[str])])
}

listOptions.forEach((item) => {
expect(
dropdownOptions.find(
(opt) => opt[0] === item[0] && opt[1] === item[1]
)
).to.not.be.undefined
})
.then(() => {
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)',
"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)",
'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)",
])
})
})
})

describe('filter the list on click on options', () => {
let filterLength
beforeEach(() => {
cy.visit('/home/search')
cy.visit('/search')
cy.get('[data-cy="addMoreBtn"]').trigger('click')
cy.get('@filters')
.its('length')
Expand All @@ -234,7 +216,7 @@ describe('datasets', () => {
})
it('first option then second option', () => {
for (let i = 0; i < filterLength; i++) {
cy.visit('/home/search')
cy.visit('/search')
cy.get('[data-cy="addMoreBtn"]').trigger('click')
cy.get('datahub-search-filters')
.children('div')
Expand Down Expand Up @@ -306,7 +288,7 @@ describe('datasets', () => {
})
it('from option list', () => {
for (let i = 0; i < filterLength; i++) {
cy.visit('/home/search')
cy.visit('/search')
cy.get('[data-cy="addMoreBtn"]').trigger('click')
cy.get('datahub-search-filters')
.children('div')
Expand Down Expand Up @@ -352,7 +334,7 @@ describe('datasets', () => {
})
it('from selected options block', () => {
for (let i = 0; i < filterLength; i++) {
cy.visit('/home/search')
cy.visit('/search')
cy.get('[data-cy="addMoreBtn"]').trigger('click')
cy.get('datahub-search-filters')
.children('div')
Expand Down Expand Up @@ -402,7 +384,7 @@ describe('datasets', () => {

it('from filter clear button', () => {
for (let i = 0; i < filterLength; i++) {
cy.visit('/home/search')
cy.visit('/search')
cy.get('[data-cy="addMoreBtn"]').trigger('click')
cy.get('datahub-search-filters')
.children('div')
Expand Down Expand Up @@ -451,7 +433,7 @@ describe('datasets', () => {
})

it('from cross button', () => {
cy.visit('/home/search')
cy.visit('/search')
cy.get('[data-cy="addMoreBtn"]').realClick()
cy.get('datahub-search-filters')
.children('div')
Expand Down
26 changes: 16 additions & 10 deletions apps/datahub-e2e/src/e2e/header.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ describe('header', () => {
.find('button')
.eq(0)
.click({ force: true })
cy.url().should('include', '/home/news')
cy.url().should('include', '/news')
cy.visit('/')
cy.get('datahub-navigation-menu')
.find('button')
.eq(1)
.click({ force: true })
cy.url().should('include', '/home/search')
cy.url().should('include', '/search')
cy.visit('/')
cy.get('datahub-navigation-menu')
.find('button')
.eq(2)
.click({ force: true })
cy.url().should('include', '/home/organisations')
cy.url().should('include', '/organisations')
})
})

Expand All @@ -48,18 +48,20 @@ describe('header', () => {
})
it('should display the search results on click on icon', () => {
cy.get('gn-ui-fuzzy-search').type('velo')
cy.get('mat-icon').contains('search').trigger('click')
cy.get('mat-icon')
.contains('search')
.trigger('click', { waitForAnimations: false })
cy.get('gn-ui-record-preview-row').should('have.length', 1)
cy.get('gn-ui-record-preview-row')
.find('div')
.find('a')
.first()
.should('have.attr', 'title', 'Accroches vélos MEL')
})
it('should display the search results on enter touch', () => {
cy.get('gn-ui-fuzzy-search').type('velo{enter}')
cy.get('gn-ui-record-preview-row').should('have.length', 1)
cy.get('gn-ui-record-preview-row')
.find('div')
.find('a')
.first()
.should('have.attr', 'title', 'Accroches vélos MEL')
})
Expand All @@ -78,15 +80,19 @@ describe('header', () => {
})
it('should delete text input on click on cancel button', () => {
cy.get('gn-ui-fuzzy-search').type('velo')
cy.get('mat-icon').contains('close').trigger('click')
cy.get('mat-icon')
.contains('close')
.trigger('click', { waitForAnimations: false })
cy.get('gn-ui-autocomplete')
.find('div')
.find('input')
.should('have.value', '')
})
it('should reset search results on click on cancel button', () => {
cy.get('gn-ui-fuzzy-search').type('velo')
cy.get('mat-icon').contains('close').trigger('click')
cy.get('mat-icon')
.contains('close')
.trigger('click', { waitForAnimations: false })
cy.get('gn-ui-record-preview-row').should('have.length.gt', 1)
})
})
Expand All @@ -100,9 +106,9 @@ describe('header', () => {
})

beforeEach(() => {
cy.visit('/home/search')
cy.visit('/search')
cy.get('gn-ui-record-preview-row').as('initialList')
cy.visit('/home/news')
cy.visit('/news')
})

it('should filter results by latest date', () => {
Expand Down
8 changes: 4 additions & 4 deletions apps/datahub-e2e/src/e2e/home.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ describe('header', () => {

describe('button link actions', () => {
it('goes to the dataset page upon clicking', () => {
cy.get('[href="/home/search"]').click()
cy.url().should('include', '/home/search')
cy.get('[href="/search"]').click()
cy.url().should('include', '/search')
})
it('goes to the organisations page upon clicking', () => {
cy.get('[href="/home/organisations"]').click()
cy.url().should('include', '/home/organisations')
cy.get('[href="/organisations"]').click()
cy.url().should('include', '/organisations')
})
})
})
6 changes: 4 additions & 2 deletions apps/datahub-e2e/src/e2e/organisations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('organisations', () => {
.children('span')
.invoke('text')
.then((txt) => {
providerOrg = txt.toUpperCase().trim()
providerOrg = txt.trim()
})
})
it('should access the related datasets on click', () => {
Expand All @@ -90,7 +90,9 @@ describe('organisations', () => {
.children('gn-ui-content-ghost')
.eq(11)
.click()
cy.url().should('include', 'publisher=').and('include', providerOrg)
cy.url()
.should('include', 'publisher=')
.and('include', encodeURIComponent(providerOrg))
})
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<button
class="badge-btn bg-primary-opacity-25 hover-bg-primary-opacity-75"
class="badge-btn bg-primary-opacity-50 hover-bg-primary-opacity-100"
[class.active]="toggled"
(click)="toggle()"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class="container-lg h-full mx-auto flex flex-col-reverse justify-between sm:flex-col sm:justify-end"
>
<div
class="py-8 relative z-50 mb-[184px] sm:mb-0"
class="py-8 relative z-40 mb-[184px] sm:mb-0"
[style.transform]="'translate(0, ' + (1 - expandRatio) * 242 + 'px)'"
>
<div
Expand Down Expand Up @@ -70,7 +70,7 @@
</div>
-->
<datahub-navigation-menu
class="tabs flex justify-between font-medium -mx-5 sm:mx-0 sm:mt-32 inset-x-0 bottom-0"
class="tabs flex justify-between font-medium -mx-5 sm:mx-0 sm:mt-32 inset-x-0 bottom-0 z-50"
[style.opacity]="-0.6 + expandRatio * 5"
></datahub-navigation-menu>
</div>
Expand Down
Loading

0 comments on commit c1b52f1

Please sign in to comment.