Skip to content

Commit

Permalink
e2e(datahub): mock ogc-api responses, remove wait
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed May 6, 2024
1 parent 10ef669 commit 5ed600d
Show file tree
Hide file tree
Showing 8 changed files with 690 additions and 2 deletions.
37 changes: 35 additions & 2 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path'

describe('dataset pages', () => {
beforeEach(() => {
// GEOSERVER stubs
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
Expand Down Expand Up @@ -38,6 +39,8 @@ describe('dataset pages', () => {
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',
Expand All @@ -46,6 +49,38 @@ describe('dataset pages', () => {
}
)

// 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=jsonn', {
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',
})

// dataset without API, preview or downloads
// cy.visit('/dataset/011963da-afc0-494c-a2cc-5cbd59e122e4')
// dataset with map error
Expand Down Expand Up @@ -641,8 +676,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"]
}
248 changes: 248 additions & 0 deletions apps/datahub-e2e/src/fixtures/covoit-mel_items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
{
"numberMatched": 10,
"numberReturned": 10,
"records": [
{
"@id": "1",
"id_lieu": "97412-C-774",
"id_local": 15578,
"nom_lieu": "1 Chemin Auguste Boyer",
"ad_lieu": null,
"com_lieu": "Saint-Joseph",
"insee": 97412,
"type": "Auto-stop",
"date_maj": "2022-04-25",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "2",
"id_lieu": "97422-C-290",
"id_local": 19545,
"nom_lieu": "1 Chemin Commerson",
"ad_lieu": null,
"com_lieu": "Le Tampon",
"insee": 97422,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "3",
"id_lieu": "97422-C-291",
"id_local": 19546,
"nom_lieu": "1 Chemin Commerson",
"ad_lieu": null,
"com_lieu": "Le Tampon",
"insee": 97422,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "4",
"id_lieu": "97404-C-058",
"id_local": 17935,
"nom_lieu": "1 Chemin Neuf",
"ad_lieu": null,
"com_lieu": "L'Étang-Salé",
"insee": 97404,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "5",
"id_lieu": "97404-C-089",
"id_local": 17966,
"nom_lieu": "1 Chemin Neuf",
"ad_lieu": null,
"com_lieu": "L'Étang-Salé",
"insee": 97404,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "6",
"id_lieu": "97422-C-233",
"id_local": 19488,
"nom_lieu": "1 Chemin Notre Dame De La Paix",
"ad_lieu": null,
"com_lieu": "Le Tampon",
"insee": 97422,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "7",
"id_lieu": "97422-C-282",
"id_local": 19537,
"nom_lieu": "1 Chemin Notre Dame De La Paix",
"ad_lieu": null,
"com_lieu": "Le Tampon",
"insee": 97422,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "8",
"id_lieu": "97422-C-560",
"id_local": 15648,
"nom_lieu": "1 Chemin Notre Dame De La Paix",
"ad_lieu": null,
"com_lieu": "Le Tampon",
"insee": 97422,
"type": "Auto-stop",
"date_maj": "2022-04-25",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "9",
"id_lieu": "97422-C-564",
"id_local": 15652,
"nom_lieu": "1 Chemin Notre Dame De La Paix",
"ad_lieu": null,
"com_lieu": "Le Tampon",
"insee": 97422,
"type": "Auto-stop",
"date_maj": "2022-04-25",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
},
{
"@id": "10",
"id_lieu": "97416-C-175",
"id_local": 17037,
"nom_lieu": "1 Chemin Terre Des Chênes",
"ad_lieu": null,
"com_lieu": "Saint-Pierre",
"insee": 97416,
"type": "Auto-stop",
"date_maj": "2022-04-26",
"ouvert": "true",
"source": 810157982,
"nbre_pl": null,
"nbre_pmr": null,
"duree": null,
"horaires": null,
"proprio": null,
"lumiere": "false",
"comm": null
}
],
"links": [
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=json",
"rel": "self",
"type": "application/json",
"hreflang": null,
"title": "This document",
"length": null
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=geojson",
"rel": "alternate",
"type": "application/geo+json",
"hreflang": null,
"title": "This document as GeoJSON",
"length": null
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=shapefile",
"rel": "alternate",
"type": "application/x-shapefile",
"hreflang": null,
"title": "This document as Esri Shapefile",
"length": null
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=csv",
"rel": "alternate",
"type": "text/csv;charset=UTF-8",
"hreflang": null,
"title": "This document as Comma Separated Values",
"length": null
},
{
"href": "https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/ogcapi/collections/covoit-mel/items?f=ooxml",
"rel": "alternate",
"type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hreflang": null,
"title": "This document as Excel 2007 / OOXML",
"length": null
}
]
}
Loading

0 comments on commit 5ed600d

Please sign in to comment.