diff options
author | Struan Donald <struan@exo.org.uk> | 2018-11-13 11:26:30 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-11-19 13:27:44 +0000 |
commit | b35552138fd66673df46747549989d545bbcfa9f (patch) | |
tree | ff0d0edf05b94d587e715e3bc37e57d287e3b502 /.cypress | |
parent | c0c553a862dfb7de74c1e2dd9548bf1c0231c6f6 (diff) |
[UK] Front end tests for Highways England layer
Diffstat (limited to '.cypress')
-rw-r--r-- | .cypress/cypress/fixtures/highways.xml | 31 | ||||
-rw-r--r-- | .cypress/cypress/integration/highways.js | 25 |
2 files changed, 56 insertions, 0 deletions
diff --git a/.cypress/cypress/fixtures/highways.xml b/.cypress/cypress/fixtures/highways.xml new file mode 100644 index 000000000..0ee421d92 --- /dev/null +++ b/.cypress/cypress/fixtures/highways.xml @@ -0,0 +1,31 @@ +<?xml version='1.0' encoding="UTF-8" ?> +<wfs:FeatureCollection + xmlns:ms="http://mapserver.gis.umn.edu/mapserver" + xmlns:gml="http://www.opengis.net/gml" + xmlns:wfs="http://www.opengis.net/wfs" + xmlns:ogc="http://www.opengis.net/ogc" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver https://tilma.mysociety.org:80/mapserver/highways?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=Highways&OUTPUTFORMAT=text/xml;%20subtype=gml/3.1.1 http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> + <gml:boundedBy> + <gml:Envelope srsName="EPSG:3857"> + <gml:lowerCorner>-290458.39994864 6708826.7261869</gml:lowerCorner> + <gml:upperCorner>-289178.07972504 6710250.3658385</gml:upperCorner> + </gml:Envelope> + </gml:boundedBy> + <gml:featureMember> + <ms:Highways> + <gml:boundedBy> + <gml:Envelope srsName="EPSG:3857"> + <gml:lowerCorner>-290458.39994864 6708826.7261869</gml:lowerCorner> + <gml:upperCorner>-289178.07972504 6710250.3658385</gml:upperCorner> + </gml:Envelope> + </gml:boundedBy> + <ms:msGeometry> + <gml:LineString srsName="EPSG:3857"> + <gml:posList srsDimension="2">-289674.87858928 6709851.5161992 -289916.13295977 6709311.679687 -289885.08041704 6709302.1250585 -289636.66007514 6709882.5687419</gml:posList> + </gml:LineString> + </ms:msGeometry> + <ms:ROA_NUMBER>M6</ms:ROA_NUMBER> + </ms:Highways> + </gml:featureMember> +</wfs:FeatureCollection> diff --git a/.cypress/cypress/integration/highways.js b/.cypress/cypress/integration/highways.js new file mode 100644 index 000000000..8494259c8 --- /dev/null +++ b/.cypress/cypress/integration/highways.js @@ -0,0 +1,25 @@ +describe('Highways England tests', function() { + it('report as defaults to body', function() { + cy.server(); + cy.fixture('highways.xml'); + cy.route('**/mapserver/highways*', 'fixture:highways.xml').as('highways-tilma'); + cy.route('/report/new/ajax*').as('report-ajax'); + cy.visit('/'); + cy.contains('Go'); + cy.get('[name=pc]').type(Cypress.env('postcode')); + cy.get('[name=pc]').parents('form').submit(); + cy.url().should('include', '/around'); + cy.get('#map_box').click(210, 200); + cy.wait('@report-ajax'); + cy.wait('@highways-tilma'); + cy.get('#highways').should('contain', 'M6'); + cy.get('#js-councils_text').should('contain', 'Highways England'); + cy.get('#single_body_only').should('have.value', 'Highways England'); + cy.get('#js-not-highways').click(); + cy.get('#js-councils_text').should('contain', 'Borsetshire'); + cy.get('#single_body_only').should('have.value', ''); + cy.get('#js-highways').click({ force: true }); + cy.get('#js-councils_text').should('contain', 'Highways England'); + cy.get('#single_body_only').should('have.value', 'Highways England'); + }); +}); |