Skip to content

Commit

Permalink
Merge pull request #171 from Geoportail-Luxembourg/GSLUX-756-feature-…
Browse files Browse the repository at this point in the history
…info

GSLUX-756: Display feature info in info panel
  • Loading branch information
tkohr authored Dec 11, 2024
2 parents 5d4a990 + b786317 commit 19aa9fa
Show file tree
Hide file tree
Showing 40 changed files with 2,460 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="/ogcproxywms"
VITE_PROXYURL_REMOTE="/httpsproxy"

# Urls for metadata, metadata links and legends
# Urls for metadata, metadata links, legends, feature info
VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv"
VITE_GET_LEGENDS_URL="/legends/get_html"
VITE_GET_METADATA_URL="/getMetadata"
VITE_GET_INFO_SERVICE_URL="/getfeatureinfo"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="/mymaps"
Expand Down
3 changes: 2 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="https://migration.geoportail.lu/ogcproxywms"
VITE_PROXYURL_REMOTE="https://migration.geoportail.lu/httpsproxy"

# Urls for metadata, metadata links and legends
# Urls for metadata, metadata links, legends, feature info
VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv"
VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html"
VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata"
VITE_GET_INFO_SERVICE_URL="https://migration.geoportail.lu/getfeatureinfo"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" # !!! use prod because of CORS
Expand Down
3 changes: 2 additions & 1 deletion .env.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="https://map.geoportail.lu/ogcproxywms"
VITE_PROXYURL_REMOTE="https://map.geoportail.lu/httpsproxy"

# Urls for metadata, metadata links and legends
# Urls for metadata, metadata links, legends, feature info
VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv"
VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html"
VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata"
VITE_GET_INFO_SERVICE_URL="https://migration.geoportail.lu/getfeatureinfo"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" # !!! use prod because of CORS
Expand Down
3 changes: 2 additions & 1 deletion .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="https://migration.geoportail.lu/ogcproxywms"
VITE_PROXYURL_REMOTE="https://migration.geoportail.lu/httpsproxy"

# Urls for metadata, metadata links and legends
# Urls for metadata, metadata links, legends, feature info
VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv"
VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html"
VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata"
VITE_GET_INFO_SERVICE_URL="https://migration.geoportail.lu/getfeatureinfo"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="https://migration.geoportail.lu/mymaps"
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/background-selection.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { noMapLayerRegex } from './layers.utils'
import type { AUTWindowOlMap } from '../types'

describe('Background selector', () => {
Expand All @@ -22,7 +23,7 @@ describe('Background selector', () => {
const layers = (<AUTWindowOlMap>window).olMap
.getLayers()
.getArray()
.filter((l: any) => !/feature(Edit)?Layer/.exec(l.get('cyLayerType')))
.filter((l: any) => !noMapLayerRegex.exec(l.get('cyLayerType')))

Check warning on line 26 in cypress/e2e/background-selection.cy.ts

View workflow job for this annotation

GitHub Actions / build-lint-test

Unexpected any. Specify a different type
expect(layers[0].get('id')).to.eq(556)
})

Expand Down Expand Up @@ -52,7 +53,7 @@ describe('Background selector', () => {
const layers = (<AUTWindowOlMap>window).olMap
.getLayers()
.getArray()
.filter((l: any) => !/feature(Edit)?Layer/.exec(l.get('cyLayerType')))
.filter((l: any) => !noMapLayerRegex.exec(l.get('cyLayerType')))

Check warning on line 56 in cypress/e2e/background-selection.cy.ts

View workflow job for this annotation

GitHub Actions / build-lint-test

Unexpected any. Specify a different type
expect(layers[0].get('id')).to.eq(502)
})
})
Expand Down
16 changes: 11 additions & 5 deletions cypress/e2e/draw/draw-feat-line.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,19 @@ describe('Draw "Line"', () => {
})

describe('When editing the line', () => {
beforeEach(() => {
cy.intercept('POST', '/profile.json', { fixture: 'profile.json' })
})
it('refreshes the elevation profile for Line', () => {
cy.dragVertexOnMap(320, 223, 305, 305)

cy.get('[data-cy="featItemProfileCumul"]').should(
'contain.text',
'Δ+429 m Δ-489 m Δ-61 m'
)
cy.get('[data-cy="featItemProfileCumul"]').should($el => {
const text = $el.text()
const validValues = [
' Δ+429 m Δ-490 m Δ-61 m',
' Δ+429 m Δ-489 m Δ-61 m',
]
expect(validValues).to.include(text)
})

cy.get('[data-cy="featItemProfile"] svg g.y.axis > g.tick')
.eq(6)
Expand Down
196 changes: 196 additions & 0 deletions cypress/e2e/info/feature-info.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
describe('Feature Info', () => {
beforeEach(() => {
cy.intercept('GET', 'getfeatureinfo*').as('getFeatureInfo')
})

describe('Default template', () => {
/**
* Note: The following permalink path includes all types of layers displayed via the default template for manual testing:
* /theme/main?version=3&lang=fr&X=702429&Y=6396653&zoom=16&rotation=0&features=&layers=655-2842-808-1713-1714-269-302-1813&opacities=1-0-1-1-1-1-1-1&time=--------------&bgLayer=basemap_2015_global
*/
describe('Display basic feature info for multiple layers', () => {
beforeEach(() => {
cy.visit(
'/?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=302-269&opacities=1&bgLayer=orthogr_2013_global'
)
cy.get('div.ol-viewport').click(300, 300, { force: true })
cy.wait('@getFeatureInfo')
})
it('should display title, attributes, link in the infoPanel when clicking on a layer feature (first layer)', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="defaultTemplateTitle"]')
.first()
.should('contain.text', 'Communes (Noms)')
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.children('div')
.should('have.length', '3')
cy.get('[data-cy="defaultTemplateLink"]')
.first()
.should('contain.text', 'Lien direct vers cet objet')
.should('have.attr', 'href')
.and(
'include',
'/theme/main?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=302-269&opacities=1-1&bgLayer=orthogr_2013_global&rotation=0&features=&time=--&fid=269_0709'
)
})
it('should display title, attributes, link in the infoPanel when clicking on a layer feature (second layer)', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="defaultTemplateTitle"]')
.eq(1)
.should('contain.text', 'Communes')
cy.get('[data-cy="defaultTemplateAttributes"]')
.eq(1)
.children('div')
.should('have.length', '3')
cy.get('[data-cy="defaultTemplateLink"]')
.eq(1)
.should('contain.text', 'Lien direct vers cet objet')
.should('have.attr', 'href')
.and(
'include',
'/theme/main?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=302-269&opacities=1-1&bgLayer=orthogr_2013_global&rotation=0&features=&time=--&fid=269_0402'
)
})
})
describe('Display profile and exports in feature info', () => {
beforeEach(() => {
cy.visit(
'/?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=808&opacities=1&bgLayer=orthogr_2013_global'
)
cy.get('div.ol-viewport').click(320, 330, { force: true })
cy.wait('@getFeatureInfo')
})
it('should display title, attributes, link in the infoPanel when clicking on a layer feature', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="defaultTemplateTitle"]')
.first()
.should('contain.text', 'Pistes cyclables nationales')
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.children('div')
.should('have.length', '3')
cy.get('[data-cy="defaultTemplateLink"]')
.first()
.should('contain.text', 'Lien direct vers cet objet')
.should('have.attr', 'href')
.and(
'include',
'/theme/main?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=808&opacities=1&bgLayer=orthogr_2013_global&rotation=0&features=&time=&fid=808_5447'
)
})
it('should display profile besides basic feature info', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="featItemProfile"]').should('exist')
cy.get('[data-cy="featItemProfileCumul"]').should(
'contain.text',
'Δ+33 m Δ-77 m Δ-44 m'
)
cy.get('[data-cy="featItemProfile"] svg').should('exist')
cy.get('[data-cy="featItemProfile"] svg g.grid-y > g.tick').should(
'have.length',
12
)
cy.get('[data-cy="featItemProfile"] svg g.x.axis > g.tick').should(
'have.length',
8
)
cy.get('[data-cy="featItemProfile"] svg g.y.axis > g.tick')
.eq(5)
.find('text')
.should('have.text', '250')
})
})
describe('Display iframe in feature info (for water level graph)', () => {
beforeEach(() => {
cy.visit(
'/?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=655&opacities=1&bgLayer=orthogr_2013_global'
)
cy.get('div.ol-viewport').click(355, 320, { force: true })
cy.wait('@getFeatureInfo')
})
it('should display title, attributes, link in the infoPanel when clicking on a layer feature', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="defaultTemplateTitle"]')
.first()
.should('contain.text', "Niveau d'eau")
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.children('div')
.should('have.length', '4')
cy.get('[data-cy="defaultTemplateLink"]')
.first()
.should('contain.text', 'Lien direct vers cet objet')
.should('have.attr', 'href')
.and(
'include',
'/theme/main?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=655&opacities=1&bgLayer=orthogr_2013_global&rotation=0&features=&time=&fid=655_256'
)
})
it('should display iframe besides basic feature info', () => {
cy.get('[data-cy="infoPanel"]').find('iframe').should('exist')
})
})
describe('Display feature info solar potential', () => {
beforeEach(() => {
cy.visit(
'/?lang=fr&X=678664&Y=6412182&version=3&zoom=16&layers=1813&opacities=1&bgLayer=orthogr_2013_global'
)
cy.get('div.ol-viewport').click(300, 300, { force: true })
cy.wait('@getFeatureInfo')
})
it('should display title, attributes and a calculator link button in the infoPanel when clicking on a layer feature', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="defaultTemplateTitle"]')
.first()
.should('contain.text', 'Potentiel solaire')
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.children('div')
.should('have.length', '6')
cy.get('[data-cy="defaultTemplateSolarLink"]')
.first()
.find('button')
.should(
'contain.text',
"Lien direct vers le calculateur d'efficacité économique"
)
cy.get('[data-cy="defaultTemplateSolarLink"]')
.first()
.should('have.attr', 'href')
.and(
'include',
'https://maps.tetraeder.solar/st_luxemburg_22/2d/6726'
)
})
})
describe('Display audio in feature info', () => {
beforeEach(() => {
cy.visit(
'/?lang=fr&X=672676&Y=6412435&version=3&zoom=11&layers=2842&opacities=1&bgLayer=orthogr_2013_global'
)
cy.get('div.ol-viewport').click(355, 320, { force: true })
cy.wait('@getFeatureInfo')
})
it('should display title, attributes and a calculator link button in the infoPanel when clicking on a layer feature', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="defaultTemplateTitle"]')
.first()
.should('contain.text', 'test_sproochatlas_audio')
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.children('div')
.should('have.length', '2')
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.find('a')
.should('have.attr', 'href')
.and('include', 'https://lod.lu/uploads/LSA/WAV/ABC_001_ab_01.wav')
cy.get('[data-cy="defaultTemplateAttributes"]')
.first()
.find('audio')
.should('exist')
})
})
})
})
5 changes: 3 additions & 2 deletions cypress/e2e/layers-selection/layers-selection-catalog.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { noMapLayerRegex } from '../layers.utils'
import type { AUTWindowOlMap } from '../../types'

describe('Catalogue', () => {
Expand Down Expand Up @@ -67,7 +68,7 @@ describe('Catalogue', () => {
const layers = (<AUTWindowOlMap>window).olMap
.getLayers()
.getArray()
.filter((l: any) => !/feature(Edit)?Layer/.exec(l.get('cyLayerType')))
.filter((l: any) => !noMapLayerRegex.exec(l.get('cyLayerType')))
expect(layers[0].get('id')).to.eq(556)
})
cy.get('[data-cy="catalog"]')
Expand All @@ -81,7 +82,7 @@ describe('Catalogue', () => {
const layers = (<AUTWindowOlMap>window).olMap
.getLayers()
.getArray()
.filter((l: any) => !/feature(Edit)?Layer/.exec(l.get('cyLayerType')))
.filter((l: any) => !noMapLayerRegex.exec(l.get('cyLayerType')))
expect(layers[0].get('id')).to.eq(359)
expect(layers[1].get('id')).to.eq(353)
})
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/layers.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const noMapLayerRegex =
/((info)|(sv))?[fF]eature(Edit|Position|Info)?Layer/
16 changes: 11 additions & 5 deletions cypress/e2e/legends/legends.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
describe('Legends', () => {
beforeEach(() => {
cy.intercept(
'GET',
'/legends/get_html?lang=fr&name=pcn_parcelles%3Ashow&id=359',
{ fixture: 'legends_parcelles.html' }
)
cy.intercept(
'GET',
'/legends/get_html?lang=fr&name=energie%3Apotentiel_solaire&id=1813',
{ fixture: 'legends_potentiel_solaire.html' }
)
cy.visit('/')
})

Expand Down Expand Up @@ -73,12 +83,8 @@ describe('Legends', () => {
cy.get('[data-cy="legendsOpenClose"] > button').click()
})

// add a longer timeout here because web request for the layers proved to be unstable in CI
it('displays the legends for both layers having legend', () => {
cy.get('[data-cy="legendLayer"]', { timeout: 15000 }).should(
'have.length',
2
)
cy.get('[data-cy="legendLayer"]').should('have.length', 2)
})
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/style-selection.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Style selector', () => {
describe('Style panel', () => {
describe('When closing the style panel', () => {
beforeEach(() => {
cy.get('[data-cy="panelClose"]').click()
cy.get('[data-cy="stylePanel"]').find('[data-cy="panelClose"]').click()
})

it('closes the style panel', () => {
Expand Down
Loading

0 comments on commit 19aa9fa

Please sign in to comment.