Skip to content

Commit

Permalink
BGDIINF_SB-3087 : Backwards compatibility tests for external layers
Browse files Browse the repository at this point in the history
  • Loading branch information
vladyslav-tk committed Nov 5, 2023
1 parent 452ccac commit 01c889e
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
66 changes: 66 additions & 0 deletions tests/e2e-cypress/fixtures/external-wmts.fixture.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
<ows:ServiceIdentification>
<ows:Title>WMTS GIS Stadt Zuerich</ows:Title>
<ows:Abstract>WMTS GIS Stadt Zuerich</ows:Abstract>
<ows:ServiceType>OGC WMTS</ows:ServiceType>
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
<ows:Fees>None</ows:Fees>
<ows:AccessConstraints>None</ows:AccessConstraints>
</ows:ServiceIdentification>
<ows:ServiceProvider>
<ows:ProviderName>GIS-Zentrum Stadt Zuerich</ows:ProviderName>
<ows:ProviderSite xlink:href=""/>
<ows:ServiceContact>
<ows:IndividualName>Georg Andersson</ows:IndividualName>
<ows:PositionName></ows:PositionName>
<ows:ContactInfo>
<ows:Phone>
<ows:Voice>+41(44)412 46 01</ows:Voice>
<ows:Facsimile></ows:Facsimile>
</ows:Phone>
<ows:Address>
<ows:DeliveryPoint>GIS-Zentrum Stadt Zuerich</ows:DeliveryPoint>
<ows:City>Zuerich</ows:City>
<ows:PostalCode>8004</ows:PostalCode>
<ows:Country>Schweiz</ows:Country>
<ows:ElectronicMailAddress>[email protected]</ows:ElectronicMailAddress>
</ows:Address>
</ows:ContactInfo>
</ows:ServiceContact>
</ows:ServiceProvider>
<Contents>
<Layer>
<ows:Title>TestExternalWMTS</ows:Title>
<ows:Abstract></ows:Abstract>
<ows:WGS84BoundingBox>
<ows:LowerCorner>8.320060826607648 47.12881677848421</ows:LowerCorner>
<ows:UpperCorner>9.033594243299833 47.717017745636404</ows:UpperCorner>
</ows:WGS84BoundingBox>
<ows:Identifier>TestExternalWMTS</ows:Identifier>
<Style>
<ows:Identifier>default</ows:Identifier>
</Style>
<Format>image/png</Format>
<TileMatrixSetLink>
<TileMatrixSet>ktzh</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="image/png" resourceType="tile"
template="http://test.wmts.png/wmts/1.0.0/TestExternalWMTS/default/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
</Layer>
<TileMatrixSet>
<ows:Identifier>ktzh</ows:Identifier>
<ows:SupportedCRS>EPSG:2056</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>00</ows:Identifier>
<ScaleDenominator>241904.76190464283</ScaleDenominator>
<TopLeftCorner>2480237.0 1315832.0</TopLeftCorner>
<TileWidth>512</TileWidth>
<TileHeight>512</TileHeight>
<MatrixWidth>11</MatrixWidth>
<MatrixHeight>8</MatrixHeight>
</TileMatrix>
</TileMatrixSet>
</Contents>
<ServiceMetadataURL xlink:href="http://test.wmts.url/mapproxy/wmts/1.0.0/WMTSCapabilities.xml"/>
</Capabilities>
61 changes: 61 additions & 0 deletions tests/e2e-cypress/integration/legacyParamImport.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,66 @@ describe('Test on legacy param import', () => {
'be.visible'
)
})
it('External WMS layer', () => {
cy.intercept('http://wms-test.url/**', {
fixture: '256.png',
})
const layerName = 'TestExternalWMS'
const layerId = 'test-external-wms'
const url = 'http://wms-test.url/'
cy.goToMapView({
layers: `test.wms.layer,WMS||${layerName}||${url}||${layerId}||1.3.0`,
layers_opacity: '1,1',
layers_visibility: 'false,true',
layers_timestam: ',',
})
cy.readStoreValue('state.layers.activeLayers').then((activeLayers) => {
expect(activeLayers).to.be.an('Array').length(2)
const externalLayer = activeLayers[1]
expect(externalLayer.isExternal).to.be.true
expect(externalLayer.visible).to.be.true
expect(externalLayer.baseURL).to.eq(url)
expect(externalLayer.externalLayerId).to.eq(layerId)
expect(externalLayer.name).to.eq(layerName)
})
const expecrtedHash = `#/map?layers=test.wms.layer,f,1;WMS%7C${url}%7C${layerId}%7C1.3.0%7C${layerName},,1&layers_timestam=,&lang=en&center=2660013.5,1185172&z=1&bgLayer=test.background.layer2&topic=ech`
cy.location().should((location) => {
expect(location.hash).to.eq(expecrtedHash)
expect(location.search).to.eq('')
})
})
it('External WMTS layer', () => {
cy.intercept('http://wmts-test.url/**', {
fixture: 'external-wmts.fixture.xml',
})
cy.intercept(
'http://test.wmts.png/wmts/1.0.0/TestExternalWMTS/default/ktzh/**/*/*.png',
{
fixture: '256.png',
}
)
const layerName = 'TestExternalWMTS'
const url = 'http://wmts-test.url/'
cy.goToMapView({
layers: `test.wmts.layer,WMTS||${layerName}||${url}`,
layers_opacity: '1,1',
layers_visibility: 'false,true',
layers_timestam: ',',
})
cy.readStoreValue('state.layers.activeLayers').then((activeLayers) => {
expect(activeLayers).to.be.an('Array').length(2)
const externalLayer = activeLayers[1]
expect(externalLayer.isExternal).to.be.true
expect(externalLayer.visible).to.be.true
expect(externalLayer.baseURL).to.eq(url)
expect(externalLayer.externalLayerId).to.eq(layerName)
expect(externalLayer.name).to.eq(layerName)
})
const expecrtedHash = `#/map?layers=test.wmts.layer,f,1;WMTS%7C${url}%7C${layerName}%7C${layerName},,1&layers_timestam=,&lang=en&center=2660013.5,1185172&z=1&bgLayer=test.background.layer2&topic=ech`
cy.location().should((location) => {
expect(location.hash).to.eq(expecrtedHash)
expect(location.search).to.eq('')
})
})
})
})

0 comments on commit 01c889e

Please sign in to comment.