Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .cypress/cypress/e2e/greenwich.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// See bristol.js for full testing of dvla

describe('Abandoned vehicle behaviour', function() {
beforeEach(function() {
cy.server();
cy.route('/report/new/ajax*').as('report-ajax');
cy.route('/around\?ajax*').as('update-results');
cy.visit('http://greenwich.localhost:3001/');
cy.contains('Greenwich');
cy.visit('http://greenwich.localhost:3001/report/new?longitude=0.00754&latitude=51.48593');
cy.wait('@report-ajax');
cy.pickCategory('Abandoned vehicles');
cy.nextPageReporting();
});

it('selects no for reg plate', function() {
cy.get('.js-reporting-page--active').contains('No').click();
cy.nextPageReporting();
cy.get('[name=vehicle_registration]').should('have.value', 'Not known');
});

it('gave an okay reg plate', function() {
cy.route('POST', '/report/dvla', 'fixture:bucks_dvla_ok.json').as('dvla');
cy.get('.js-reporting-page--active').contains('Yes').click();
cy.get('[name=dvla_reg]').type('G00D');
cy.nextPageReporting();
cy.wait('@dvla');
cy.contains('This vehicle has a valid tax or MOT, so it does not meet the criteria for an abandoned vehicle report.');
});

it('gave a not ok reg plate', function() {
cy.route('POST', '/report/dvla', 'fixture:bucks_dvla_notok.json').as('dvla');
cy.get('.js-reporting-page--active').contains('Yes').click();
cy.get('[name=dvla_reg]').type('B4D');
cy.nextPageReporting();
cy.wait('@dvla');
cy.get('[name=vehicle_registration]').should('have.value', 'B4D');
cy.get('[name=vehicle_make]').should('have.value', 'Kawasaki');
cy.get('[name=vehicle_colour]').should('have.value', 'Black');
});

});
1 change: 1 addition & 0 deletions bin/browser-tests
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BEGIN {
fixmystreet
gloucestershire
gloucester
greenwich
hackney
highwaysengland
hounslow
Expand Down
14 changes: 14 additions & 0 deletions bin/fixmystreet.com/fixture
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ if ($opt->test_fixtures) {
{ group => 'Bus Stops and Shelters', category => 'Glass broken' },
'Mobile Crane Operation', 'Roadworks', 'Other (TfL)'
], name => 'TfL', cobrand => 'tfl' },
{ area_id => 2493, categories => [
{ group => '', category => 'Abandoned vehicles' },
], name => 'Royal Borough of Greenwich', cobrand => 'greenwich' },
{ area_id => 2237, categories => [ 'Flytipping', 'Roads', 'Parks', 'Lamp Out of Light' ], name => 'Oxfordshire County Council', cobrand => 'oxfordshire' },
{ area_id => 2551, categories => [ 'Abandoned vehicles', 'Dog fouling', 'Blocked drain' ], name => 'Bath and North East Somerset Council', cobrand => 'bathnes' },
{ area_id => 2238, categories => [
Expand Down Expand Up @@ -341,6 +344,17 @@ if ($opt->test_fixtures) {
);
$child_cat->update;

$child_cat = FixMyStreet::DB->resultset("Contact")->find({
body => $bodies->{2493},
category => 'Abandoned vehicles',
});
$child_cat->set_extra_fields(
{"code" => "vehicle_registration", "datatype" => "string", "required" => "false", "variable" => "true", "protected" => "false", "description" => "Vehicle registration number"},
{"code" => "vehicle_make", "datatype" => "string", "required" => "true", "variable" => "true", "protected" => "false", "description" => "Vehicle make"},
{"code" => "vehicle_colour", "datatype" => "string", "required" => "true", "variable" => "true", "protected" => "false", "description" => "Vehicle colour"},
);
$child_cat->update;

$child_cat = FixMyStreet::DB->resultset("Contact")->find({
body => $bodies->{53822},
category => 'Grass cutting',
Expand Down
1 change: 1 addition & 0 deletions t/Mock/MapIt.pm
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ my @PLACES = (
[ '?', 51.530133, -0.228924, 2502, 'Hammersmith and Fulham Borough Council', 'LBO' ],
[ '?', 51.530115, -0.228293, 2503, 'Kensington and Chelsea Borough Council', 'LBO' ],
[ '?', 54.2448, -1.0643, 2408, 'Ryedale District Council', 'DIS' ], # When doing gen36 lookup
[ 'SE18 6HQ', 51.48593, 0.00754, 2493, 'Royal Borough of Greenwich', 'LBO' ],
);

sub dispatch_request {
Expand Down
2 changes: 1 addition & 1 deletion templates/web/greenwich/footer_extra_js.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[% PROCESS 'footer_extra_js_base.html' highways=1 %]
[% PROCESS 'footer_extra_js_base.html' highways=1 dvla=1 %]
45 changes: 35 additions & 10 deletions web/cobrands/fixmystreet-uk-councils/dvla.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ const FIELDS = {
'yes': 'Y',
'no': 'N'
}
},
'greenwich': {
'block': true,
'categories': [
'Abandoned vehicles'
],
'reg': 'vehicle_registration',
'make': 'vehicle_make',
'colour': 'vehicle_colour',
}
};

Expand Down Expand Up @@ -64,6 +73,19 @@ const REASONS = {
}
return reasons.join(' or ');
},
},
'greenwich': {
fn: function (data) {
// There are multiple motStatuses - 'Valid', 'Not valid', 'No details held by DVLA', 'No results returned'
// Valid seemed the obvious one to use, but discovered new vehicles, pre-MOT have 'No details...'
// And possibly fully exempt vehicles (over 40 years old?) may have 'No results..'
// We will only consider vehicles that are specifically 'Not valid' as being reportable
if ( data.taxStatus == 'SORN' || (data.taxStatus == 'Taxed' && data.motStatus != 'Not valid')) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess maybe a comment here to explain the 3 year thing? Should also update the generic case further down the file too.

Do we know what "No results returned" means? I can't tell from the documentation why that would happen.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know - it looks maybe like it's vehicles that may never have been registered somewhere in some way - like old cars which are exempt, but never expected to be on the system

return 'This vehicle has a valid tax or MOT, so it does not meet the criteria for an abandoned vehicle report.';
} else {
return '';
}
}
}
};

Expand Down Expand Up @@ -136,7 +158,8 @@ function dvla_lookup(e) {
if (data.taxStatus == 'Taxed') {
reason_msgs.push('are taxed');
}
if (data.motStatus == 'Valid') {
// See note on greenwich above
if (data.motStatus != 'Not valid') {
reason_msgs.push('have a valid MOT');
}
if (reason_msgs.length) {
Expand All @@ -156,16 +179,18 @@ function dvla_lookup(e) {

const type = data.typeApproval || '';
const wheelplan = data.wheelplan || '';
let types = TYPES[fixmystreet.cobrand];
let types = TYPES[fixmystreet.cobrand] || '';
let vehicle_type = '';
if (type.match(/L[1-7]|motorcycle/i) || wheelplan.match(/motorcycle|moped|2 wheel/i)) {
vehicle_type = types.Motorbike;
} else if (type.match(/N1|commercial/i) || wheelplan.match(/van|commercial/i)) {
vehicle_type = types.Van;
} else if (type.match(/M1/i)) {
vehicle_type = types.Car;
} else if (type.match(/M[23]|N[23]/i) || wheelplan.match(/& artic|3 axle rigid|multi-axle rigid/i)) {
vehicle_type = types.Other;
if (types) {
if (type.match(/L[1-7]|motorcycle/i) || wheelplan.match(/motorcycle|moped|2 wheel/i)) {
vehicle_type = types.Motorbike;
} else if (type.match(/N1|commercial/i) || wheelplan.match(/van|commercial/i)) {
vehicle_type = types.Van;
} else if (type.match(/M1/i)) {
vehicle_type = types.Car;
} else if (type.match(/M[23]|N[23]/i) || wheelplan.match(/& artic|3 axle rigid|multi-axle rigid/i)) {
vehicle_type = types.Other;
}
}

const config = FIELDS[fixmystreet.cobrand] || {};
Expand Down