Skip to content

Commit

Permalink
Merge pull request geonetwork#865 from geonetwork/DH/ogc-api-support
Browse files Browse the repository at this point in the history
[Datahub]: Handle OGC API in Downloads and Preview sections
  • Loading branch information
jahow authored May 6, 2024
2 parents e03215d + 737aa49 commit 287bf00
Show file tree
Hide file tree
Showing 16 changed files with 959 additions and 62 deletions.
124 changes: 79 additions & 45 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,87 @@
import 'cypress-real-events'
import path from 'path'

beforeEach(() => {
// GEOSERVER stubs
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
{
fixture: 'insee-wms-getcapabilities.xml',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
{
fixture: 'insee-wfs-getcapabilities.xml',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=&TRANSPARENT=true&LAYERS=rectangles_200m_menage_erbm*',
{
fixture: 'insee-rectangles_200m_menage_erbm.png',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=application%2Fjson*',
{
fixture: 'insee-rectangles_200m_menage_erbm.json',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=csv',
{
fixture: 'insee-rectangles_200m_menage_erbm.csv',
}
)

// OPENDATASOFT stub
cy.intercept(
'GET',
'/explore/dataset/population-millesimee-communes-francaises/download?format=csv&timezone=Europe/Berlin&use_labels_for_header=false',
{
fixture: 'population-millesimee-communes-francaises.csv',
}
)

// OGC API stubs
cy.intercept(
'GET',
'/data/ogcapi/collections/liste-des-jardins-familiaux-et-partages-de-roubaix/items?f=json',
{
fixture: 'liste-des-jardins-familiaux-et-partages-de-roubaix_items.json',
}
)
cy.intercept('GET', '/data/ogcapi/collections/covoit-mel/items?f=json', {
fixture: 'covoit-mel_items.json',
})
cy.intercept(
'GET',
'/data/ogcapi/collections/liste-des-jardins-familiaux-et-partages-de-roubaix?f=json',
{
fixture: 'liste-des-jardins-familiaux-et-partages-de-roubaix.json',
}
)
cy.intercept('GET', '/data/ogcapi/collections/covoit-mel?f=json', {
fixture: 'covoit-mel.json',
})
cy.intercept('GET', '/data/ogcapi/collections?f=json', {
fixture: 'ogcapi_collections.json',
})
cy.intercept('GET', '/data/ogcapi/conformance?f=json', {
fixture: 'ogcapi_conformance.json',
})
cy.intercept('GET', '/data/ogcapi/?f=json', {
fixture: 'ogcapi.json',
})
})

describe('dataset pages', () => {
beforeEach(() => {
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
{
fixture: 'insee-wms-getcapabilities.xml',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
{
fixture: 'insee-wfs-getcapabilities.xml',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=&TRANSPARENT=true&LAYERS=rectangles_200m_menage_erbm*',
{
fixture: 'insee-rectangles_200m_menage_erbm.png',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=application%2Fjson*',
{
fixture: 'insee-rectangles_200m_menage_erbm.json',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=csv',
{
fixture: 'insee-rectangles_200m_menage_erbm.csv',
}
)
cy.intercept(
'GET',
'/explore/dataset/population-millesimee-communes-francaises/download?format=csv&timezone=Europe/Berlin&use_labels_for_header=false',
{
fixture: 'population-millesimee-communes-francaises.csv',
}
)

// dataset without API, preview or downloads
// cy.visit('/dataset/011963da-afc0-494c-a2cc-5cbd59e122e4')
// dataset with map error
Expand Down Expand Up @@ -641,8 +677,6 @@ describe('api form', () => {
cy.get('@secondInput').clear()
cy.get('@secondInput').type('87')

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000)
cy.get('@apiForm').find('gn-ui-dropdown-selector').as('dropdown')
cy.get('@dropdown').eq(0).selectDropdownOption('geojson')

Expand Down
44 changes: 44 additions & 0 deletions apps/datahub-e2e/src/fixtures/covoit-mel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"id": "covoit-mel",
"title": "covoit-mel",
"links": [
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=geojson",
"rel": "items",
"type": "application/geo+json",
"title": "covoit-mel"
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=json&limit=-1",
"rel": "enclosure",
"type": "application/json",
"title": "Bulk download (JSON)"
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=geojson&limit=-1",
"rel": "enclosure",
"type": "application/geo+json",
"title": "Bulk download (GeoJSON)"
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=shapefile&limit=-1",
"rel": "enclosure",
"type": "application/x-shapefile",
"title": "Bulk download (Esri Shapefile)"
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=csv&limit=-1",
"rel": "enclosure",
"type": "text/csv;charset=UTF-8",
"title": "Bulk download (Comma Separated Values)"
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=ooxml&limit=-1",
"rel": "enclosure",
"type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"title": "Bulk download (Excel 2007 / OOXML)"
}
],
"itemType": "feature",
"crs": ["http://www.opengis.net/def/crs/OGC/1.3/CRS84"]
}
Loading

0 comments on commit 287bf00

Please sign in to comment.