aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cypress/cypress.json2
-rw-r--r--.cypress/cypress/fixtures/roads.xml47
-rw-r--r--.cypress/cypress/integration/buckinghamshire.js33
-rwxr-xr-xbin/browser-tests4
-rwxr-xr-xbin/fixmystreet.com/fixture32
-rw-r--r--t/Mock/MapIt.pm2
6 files changed, 112 insertions, 8 deletions
diff --git a/.cypress/cypress.json b/.cypress/cypress.json
index 9b424ef69..8d25b96b6 100644
--- a/.cypress/cypress.json
+++ b/.cypress/cypress.json
@@ -1,7 +1,7 @@
{
"baseUrl": "http://fixmystreet.localhost:3001",
"projectId": "y8vvs1",
- "blacklistHosts": ["gaze.mysociety.org", "*.openstreetmap.org"],
+ "blacklistHosts": ["gaze.mysociety.org", "*.openstreetmap.org", "portal.roadworks.org", "tilma.mysociety.org"],
"env": {
"postcode": "BS10 5EE"
},
diff --git a/.cypress/cypress/fixtures/roads.xml b/.cypress/cypress/fixtures/roads.xml
new file mode 100644
index 000000000..fc3bce1bf
--- /dev/null
+++ b/.cypress/cypress/fixtures/roads.xml
@@ -0,0 +1,47 @@
+<?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/bucks?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=Whole_Street&amp;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:27700">
+ <gml:lowerCorner>499000.030000 189992.860000</gml:lowerCorner>
+ <gml:upperCorner>501833.770000 193639.230000</gml:upperCorner>
+ </gml:Envelope>
+ </gml:boundedBy>
+ <gml:featureMember>
+ <ms:Whole_Street gml:id="Whole_Street.HWSA7300268">
+ <gml:boundedBy>
+ <gml:Envelope srsName="EPSG:27700">
+ <gml:lowerCorner>499991.980000 191715.960000</gml:lowerCorner>
+ <gml:upperCorner>500040.010000 191858.080000</gml:upperCorner>
+ </gml:Envelope>
+ </gml:boundedBy>
+ <ms:msGeometry>
+ <gml:MultiCurve srsName="EPSG:27700">
+ <gml:curveMember>
+ <gml:LineString>
+ <gml:posList srsDimension="2">499991.980000 191715.960000 500000.000000 191720.020000 500004.960000 191721.000000 500008.960000 191721.970000 500019.990000 191724.970000 500028.010000 191729.030000 500032.990000 191733.020000 500035.030000 191734.950000 500039.020000 191743.030000 500039.990000 191746.950000 500040.000000 191749.950000 500040.010000 191755.960000 500035.180000 191772.660000 </gml:posList>
+ </gml:LineString>
+ </gml:curveMember>
+ <gml:curveMember>
+ <gml:LineString>
+ <gml:posList srsDimension="2">500035.180000 191772.660000 500025.070000 191769.020000 </gml:posList>
+ </gml:LineString>
+ </gml:curveMember>
+ <gml:curveMember>
+ <gml:LineString>
+ <gml:posList srsDimension="2">500035.180000 191772.660000 500027.000000 191800.990000 500019.980000 191819.980000 500008.590000 191849.680000 500005.380000 191858.080000 </gml:posList>
+ </gml:LineString>
+ </gml:curveMember>
+ </gml:MultiCurve>
+ </ms:msGeometry>
+ <ms:site_code>7300268</ms:site_code>
+ <ms:feature_ty>4B</ms:feature_ty>
+ </ms:Whole_Street>
+ </gml:featureMember>
+</wfs:FeatureCollection>
+
diff --git a/.cypress/cypress/integration/buckinghamshire.js b/.cypress/cypress/integration/buckinghamshire.js
new file mode 100644
index 000000000..92426e0d4
--- /dev/null
+++ b/.cypress/cypress/integration/buckinghamshire.js
@@ -0,0 +1,33 @@
+describe('flytipping', function() {
+
+ beforeEach(function() {
+ cy.server();
+ cy.fixture('roads.xml');
+ cy.route('**mapserver/bucks*Whole_Street*', 'fixture:roads.xml').as('roads-layer');
+ cy.route('/report/new/ajax*').as('report-ajax');
+ cy.visit('http://buckinghamshire.localhost:3001/');
+ cy.contains('Buckinghamshire');
+ cy.get('[name=pc]').type('SL9 0NX');
+ cy.get('[name=pc]').parents('form').submit();
+ });
+
+ it('handles flytipping on a road correctly', function() {
+ cy.get('.olMapViewport #fms_pan_zoom_zoomin').click();
+ cy.wait('@roads-layer');
+ cy.get('#map_box').click(290, 307);
+ cy.wait('@report-ajax');
+ cy.get('select:eq(4)').select('Flytipping');
+ cy.get('#form_road-placement').select('off-road');
+ cy.contains('sent to Chiltern District Council and also');
+ cy.get('#form_road-placement').select('road');
+ cy.contains('sent to Buckinghamshire County Council and also');
+ });
+
+ it('handles flytipping off a road correctly', function() {
+ cy.get('#map_box').click(200, 307);
+ cy.wait('@report-ajax');
+ cy.get('select:eq(4)').select('Flytipping');
+ cy.contains('sent to Chiltern District Council and also');
+ });
+
+});
diff --git a/bin/browser-tests b/bin/browser-tests
index 6950c651d..37f542c92 100755
--- a/bin/browser-tests
+++ b/bin/browser-tests
@@ -14,7 +14,7 @@ use Getopt::Long ':config' => qw(pass_through auto_help);
my ($run_server, $run_cypress, $vagrant);
my $config_file = 'conf/general.yml-example';
-my $cobrand = [ 'fixmystreet', 'northamptonshire', 'bathnes' ];
+my $cobrand = [ 'fixmystreet', 'northamptonshire', 'bathnes', 'buckinghamshire' ];
my $coords = '51.532851,-2.284277';
my $area_id = 2608;
my $name = 'Borsetshire';
@@ -129,7 +129,7 @@ browser-tests [running options] [fixture options] [cypress options]
--help this help message
Fixture option:
- --cobrand Cobrand(s) to use, default is fixmystreet,northamptonshire,bathnes
+ --cobrand Cobrand(s) to use, default is fixmystreet,northamptonshire,bathnes,buckinghamshire
--coords Default co-ordinates for created reports
--area_id Area ID to use for created body
--name Name to use for created body
diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture
index 4a5bd3aed..8332bbe17 100755
--- a/bin/fixmystreet.com/fixture
+++ b/bin/fixmystreet.com/fixture
@@ -92,12 +92,34 @@ for my $cat ('Dropped Kerbs', 'Skips') {
}
if ($opt->test_fixtures) {
- my $ncc = FixMyStreet::DB::Factory::Body->find_or_create({
- area_id => 2234,
- categories => [ 'Fallen Tree' ],
- name => 'Northamptonshire County Council',
+ my $bodies;
+ foreach (
+ { area_id => 2234, categories => ['Fallen Tree'], name => 'Northamptonshire County Council' },
+ { area_id => 2217, categories => ['Flytipping', 'Roads'], name => 'Buckinghamshire County Council' },
+ { area_id => 2257, categories => ['Flytipping', 'Graffiti'], name => 'Chiltern District Council' },
+ ) {
+ $bodies->{$_->{area_id}} = FixMyStreet::DB::Factory::Body->find_or_create($_);
+ my $cats = join(', ', @{$_->{categories}});
+ say "Created body $_->{name} for MapIt area ID $_->{area_id}, categories $cats";
+ }
+
+ my $child_cat = FixMyStreet::DB->resultset("Contact")->find({
+ body => $bodies->{2217},
+ category => 'Flytipping',
});
- say "Created body " . $ncc->name . " for MapIt area ID 2234, categories Fallen Tree";
+ $child_cat->set_extra_fields({
+ code => 'road-placement',
+ datatype => 'singlevaluelist',
+ description => 'Is the fly-tip located on',
+ order => 100,
+ required => 'true',
+ variable => 'true',
+ values => [
+ { key => 'road', name => 'The road' },
+ { key => 'off-road', name => 'Off the road/on a verge' },
+ ],
+ });
+ $child_cat->update;
}
FixMyStreet::DB::Factory::ResponseTemplate->create({
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index c255c916a..57174a799 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -28,6 +28,8 @@ my @PLACES = (
[ 'BS10 5EE', 51.494885, -2.602237, 2561, 'Bristol City Council', 'UTA', 148646, 'Bedminster', 'UTW' ],
[ 'BS20 5EE', 51.496194, -2.603439, 2608, 'Borsetshire County Council', 'CTY', 148646, 'Bedminster', 'UTW' ],
[ 'SL9 0NX', 51.615559, -0.556903, 2217, 'Buckinghamshire County Council', 'CTY', 2257, 'Chiltern District Council', 'DIS' ],
+ [ '?', 51.615499, -0.556667, 2217, 'Buckinghamshire County Council', 'CTY', 2257, 'Chiltern District Council', 'DIS' ],
+ [ '?', 51.615439, -0.558362, 2217, 'Buckinghamshire County Council', 'CTY', 2257, 'Chiltern District Council', 'DIS' ],
[ 'SW1A 1AA', 51.501009, -0.141588, 2504, 'Westminster City Council', 'LBO' ],
[ 'GL50 2PR', 51.896268, -2.093063, 2226, 'Gloucestershire County Council', 'CTY', 2326, 'Cheltenham Borough Council', 'DIS', 4544, 'Lansdown', 'DIW', 143641, 'Lansdown and Park', 'CED' ],
[ 'OX20 1SZ', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],