Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float the Continue button (and stopper/asset messaging) in initial steps of new report flow #5347

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .cypress/cypress/integration/bathnes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ it('uses the Curo Group housing layer correctly', function() {
cy.wait('@banes-caro-group-housing-layer-tilma');
cy.wait('@report-ajax');
cy.pickCategory('Dog fouling');
cy.contains('Maintained by Curo Group').should('be.visible');
cy.get('.pre-button-messaging').contains('Maintained by Curo Group').should('be.visible');
});

it('handles code names with spaces without error', function() {
Expand Down
7 changes: 4 additions & 3 deletions .cypress/cypress/integration/highwaysengland.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ describe('National Highways cobrand tests', function() {
cy.wait('@highways-tilma');
cy.wait('@report-ajax');
cy.contains('Report a maintenance issue').should('be.visible');
cy.contains('The selected location is not maintained by us.').should('be.visible');
cy.get('.pre-button-messaging').contains('The selected location is not maintained by us.').should('be.visible');
});
it('does not allow reporting on DBFO roads', function() {
cy.get('#map_box').click(200, 249);
cy.wait('@highways-tilma');
cy.wait('@report-ajax');
cy.contains('Report a maintenance issue').should('be.visible');
cy.contains('report on roads directly maintained').should('be.visible');
cy.get('.pre-button-messaging').contains('report on roads directly maintained').should('be.visible');
});
it('allows reporting on other HE roads', function() {
cy.get('#map_box').click(240, 249);
Expand Down Expand Up @@ -76,8 +76,9 @@ describe('National Highways litter picking test', function() {
cy.wait('@highways-tilma');
cy.wait('@highways-tilma-litter');
cy.pickCategory('Flytipping');
cy.get('#map_sidebar').scrollTo('top');
cy.contains('Report a litter issue').should('be.visible');
cy.contains('litter issues on this road are handled by the local council').should('be.visible');
cy.get('.pre-button-messaging').contains('litter issues on this road are handled by the local council').should('be.visible');
});
});

Expand Down
4 changes: 1 addition & 3 deletions .cypress/cypress/integration/lincolnshire.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ describe('Lincolnshire cobrand', function(){

it('does not display extra message when selecting a "road" category', function(){
cy.pickCategory('Damaged/missing cats eye');
cy.get(
'#category_meta_message_Damagedmissingcatseye'
).should('have.text', '');
cy.get('.pre-button-messaging').should('not.be.visible');
});

it('clicks through to photo section', function(){
Expand Down
39 changes: 16 additions & 23 deletions .cypress/cypress/integration/merton.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ describe('stoppers for park category', function() {
cy.visit('http://merton.localhost:3001/report/new?latitude=51.400975&longitude=-0.19655');
cy.wait('@report-ajax');
cy.pickCategory('Parks');
cy.contains('Please select a Merton-owned park from the map').should('be.visible');
cy.contains('To report an issue at Morden Hall Park').should('not.be.visible');
cy.contains('To report an issue at Mitcham Common').should('not.be.visible');
cy.contains('To report an issue at Wimbledon Common').should('not.be.visible');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging').contains('Please select a Merton-owned park from the map');
cy.get('.pre-button-messaging').contains('To report an issue at Morden Hall Park').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Mitcham Common').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Wimbledon Common').should('not.exist');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
});

Expand All @@ -80,7 +79,6 @@ describe('stoppers for park category', function() {
cy.wait('@report-ajax');
cy.pickCategory('Parks');
cy.wait('@merton-parks');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
});

Expand All @@ -90,11 +88,10 @@ describe('stoppers for park category', function() {
cy.wait('@report-ajax');
cy.pickCategory('Parks');
cy.wait('@merton-parks');
cy.contains('Please select a Merton-owned park from the map').should('not.be.visible');
cy.contains('To report an issue at Morden Hall Park').should('be.visible');
cy.contains('To report an issue at Mitcham Common').should('not.be.visible');
cy.contains('To report an issue at Wimbledon Common').should('not.be.visible');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging').contains('Please select a Merton-owned park from the map').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Morden Hall Park');
cy.get('.pre-button-messaging').contains('To report an issue at Mitcham Common').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Wimbledon Common').should('not.exist');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
});

Expand All @@ -104,11 +101,10 @@ describe('stoppers for park category', function() {
cy.wait('@report-ajax');
cy.pickCategory('Parks');
cy.wait('@merton-parks');
cy.contains('Please select a Merton-owned park from the map').should('not.be.visible');
cy.contains('To report an issue at Morden Hall Park').should('not.be.visible');
cy.contains('To report an issue at Mitcham Common').should('be.visible');
cy.contains('To report an issue at Wimbledon Common').should('not.be.visible');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging').contains('Please select a Merton-owned park from the map').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Morden Hall Park').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Mitcham Common');
cy.get('.pre-button-messaging').contains('To report an issue at Wimbledon Common').should('not.exist');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
});

Expand All @@ -118,12 +114,10 @@ describe('stoppers for park category', function() {
cy.wait('@report-ajax');
cy.pickCategory('Parks');
cy.wait('@merton-parks');
cy.contains('Please select a Merton-owned park from the map').should('not.be.visible');
cy.contains('To report an issue at Morden Hall Park').should('not.be.visible');
cy.contains('To report an issue at Mitcham Common').should('not.be.visible');
cy.contains('To report an issue at Wimbledon Common').should('be.visible');

cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging').contains('Please select a Merton-owned park from the map').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Morden Hall Park').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Mitcham Common').should('not.exist');
cy.get('.pre-button-messaging').contains('To report an issue at Wimbledon Common');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
});

Expand All @@ -133,7 +127,6 @@ describe('stoppers for park category', function() {
cy.wait('@report-ajax');
cy.pickCategory('Parks');
cy.wait('@merton-parks');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
cy.nextPageReporting();
cy.nextPageReporting();
Expand Down
3 changes: 1 addition & 2 deletions .cypress/cypress/integration/northamptonshire.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ it('prevents clicking unless asset selected, desktop flow', function() {
cy.pickCategory('Shelter Damaged');

cy.wait('@bus_stops-layer');
cy.contains(/Please select a.*bus stop.*from the map/).should('be.visible');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging').contains(/Please select a.*bus stop.*from the map/).should('be.visible');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
});

Expand Down
7 changes: 2 additions & 5 deletions .cypress/cypress/integration/oxfordshire.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ describe("Oxfordshire cobrand", function() {
cy.wait('@report-ajax');
cy.pickCategory('Lamp Out of Light');
cy.wait('@street-lights-layer');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
cy.get('circle').eq(1).click(); // Click a public light
cy.get("#category_meta_message_LampOutofLight").should('not.contain', 'private street light asset');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get(".pre-button-messaging").should('not.contain', 'private street light asset');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
cy.get('circle').eq(0).click(); // Click a private light
cy.get("#category_meta_message_LampOutofLight").should('contain', 'private street light asset');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get(".pre-button-messaging").should('contain', 'private street light asset');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
});

Expand Down
50 changes: 21 additions & 29 deletions .cypress/cypress/integration/peterborough.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,57 @@ describe('new report form', function() {
cy.pickCategory('Fallen branch');
cy.nextPageReporting();
cy.get('#form_emergency').select('yes');
cy.get('.js-post-category-messages:visible').should('contain', 'Please phone customer services to report this problem.');
cy.get('.pre-button-messaging:visible').should('contain', 'Please phone customer services to report this problem.');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
cy.get('#form_emergency').select('no');
cy.get('.js-post-category-messages:visible').should('not.contain', 'Please phone customer services to report this problem.');
cy.get('.pre-button-messaging:visible').should('not.contain', 'Please phone customer services to report this problem.');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
});

it('is hidden when private land option is yes', function() {
cy.pickCategory('Fallen branch');
cy.nextPageReporting();
cy.get('#form_private_land').select('yes');
cy.get('.js-post-category-messages:visible').should('contain', 'The council do not have powers to address issues on private land.');
cy.get('.pre-button-messaging:visible').should('contain', 'The council do not have powers to address issues on private land.');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
cy.get('#form_private_land').select('no');
cy.get('.js-post-category-messages:visible').should('not.contain', 'The council do not have powers to address issues on private land.');
cy.get('.pre-button-messaging:visible').should('not.contain', 'The council do not have powers to address issues on private land.');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
});

it('flytipping/graffiti categories handle land types correctly', function() {
cy.pickCategory('General fly tipping');
cy.get('.pre-button-messaging:visible').should('contain', 'You can report cases of fly-tipping on private land');
cy.nextPageReporting();
cy.get('#js-environment-message:visible');
cy.get('#form_hazardous').select('yes');
cy.get('.js-post-category-messages:visible').should('contain', 'Please phone customer services to report this problem');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging:visible').should('contain', 'Please phone customer services to report this problem');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
cy.get('#form_hazardous').select('no');
cy.get('.js-post-category-messages:visible').should('not.contain', 'Please phone customer services to report this problem');
cy.get('.pre-button-messaging:visible').should('not.contain', 'Please phone customer services to report this problem');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
cy.visit('http://peterborough.localhost:3001/report/new?longitude=-0.242007&latitude=52.571903');
cy.wait('@report-ajax');
cy.pickCategory('General fly tipping');
cy.get('#js-environment-message:hidden');
cy.get('.pre-button-messaging:visible').should('not.exist');
cy.visit('http://peterborough.localhost:3001/report/new?longitude=-0.242007&latitude=52.571903');
cy.wait('@report-ajax');
cy.pickCategory('Non offensive graffiti');
cy.get('#js-graffiti-message:hidden');
cy.get('.pre-button-messaging:visible').should('not.exist');
cy.visit('http://peterborough.localhost:3001/report/new?longitude=-0.241841&latitude=52.570792');
cy.wait('@report-ajax');
cy.pickCategory('General fly tipping');
cy.get('#map_sidebar').scrollTo('top');
cy.get('#js-environment-message:visible');
cy.get('.pre-button-messaging:visible').should('contain', 'You can report cases of fly-tipping on private land');
cy.visit('http://peterborough.localhost:3001/report/new?longitude=-0.241841&latitude=52.570792');
cy.wait('@report-ajax');
cy.pickCategory('Non offensive graffiti');
cy.get('#map_sidebar').scrollTo('top');
cy.get('#js-graffiti-message:visible');
cy.get('.pre-button-messaging:visible').should('contain', 'For graffiti on private land this would be deemed');
});

it('correctly changes the asset select message', function() {
cy.pickCategory('Street lighting');
cy.get('.category_meta_message').should('contain', 'You can pick a light from the map');
cy.get('.pre-button-messaging').should('contain', 'Please select a light from the map');
cy.pickCategory('Trees');
cy.get('.category_meta_message').should('contain', 'You can pick a tree from the map');
cy.get('.pre-button-messaging').should('contain', 'Please select a tree from the map');
});
});

Expand Down Expand Up @@ -103,7 +100,7 @@ describe('Roadworks', function() {
});

describe('National site tests', function() {
it('flytipping/graffiti categories handle land types correctly on .com', function() {
it.only('flytipping/graffiti categories handle land types correctly on .com', function() {
cy.server();
cy.route('/report/new/ajax*').as('report-ajax');
cy.route("**/peterborough.assets/4/*", 'fixture:peterborough_pcc.json').as('pcc');
Expand All @@ -114,35 +111,30 @@ describe('National site tests', function() {
cy.get('#map_box').click();
cy.wait('@report-ajax');
cy.pickCategory('General fly tipping');
cy.get('.pre-button-messaging:visible').should('contain', 'You can report cases of fly-tipping on private land');
cy.nextPageReporting();
cy.get('#js-environment-message:visible');
cy.get('#form_hazardous').select('yes');
cy.get('.js-post-category-messages:visible').should('contain', 'Please phone customer services to report this problem');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.pre-button-messaging:visible').should('contain', 'Please phone customer services to report this problem');
cy.get('.js-reporting-page--next:visible').should('be.disabled');
cy.get('#form_hazardous').select('no');
cy.get('.js-post-category-messages:hidden').should('not.contain', 'Please phone customer services to report this problem');
cy.get('.pre-button-messaging:hidden').should('not.contain', 'Please phone customer services to report this problem');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
cy.visit('http://fixmystreet.localhost:3001/report/new?longitude=-0.242007&latitude=52.571903');
cy.wait('@report-ajax');
cy.pickCategory('General fly tipping');
cy.get('#map_sidebar').scrollTo('top');
cy.get('#js-environment-message:hidden');
cy.get('.pre-button-messaging:visible').should('not.exist');
cy.visit('http://fixmystreet.localhost:3001/report/new?longitude=-0.242007&latitude=52.571903');
cy.wait('@report-ajax');
cy.pickCategory('Non offensive graffiti');
cy.get('#map_sidebar').scrollTo('top');
cy.get('#js-graffiti-message:hidden');
cy.get('.pre-button-messaging:visible').should('not.exist');
cy.visit('http://fixmystreet.localhost:3001/report/new?longitude=-0.241841&latitude=52.570792');
cy.wait('@report-ajax');
cy.pickCategory('General fly tipping');
cy.get('#map_sidebar').scrollTo('top');
cy.get('#js-environment-message:visible');
cy.get('.pre-button-messaging:visible').should('contain', 'You can report cases of fly-tipping on private land');
cy.visit('http://fixmystreet.localhost:3001/report/new?longitude=-0.241841&latitude=52.570792');
cy.wait('@report-ajax');
cy.pickCategory('Non offensive graffiti');
cy.get('#map_sidebar').scrollTo('top');
cy.get('#js-graffiti-message:visible');
cy.get('.pre-button-messaging:visible').should('contain', 'For graffiti on private land this would be deemed');
});

});
2 changes: 0 additions & 2 deletions .cypress/cypress/integration/surrey.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ describe('Reporting not on a road', function() {
cy.wait('@report-ajax');
cy.pickCategory('Abandoned vehicles');
cy.contains('You cannot send Surrey County Council a report');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.js-reporting-page--next').should('be.disabled');
cy.get('.js-reporting-page--next').should('not.be.visible');
cy.pickCategory('Flooding inside a building');
cy.contains('You cannot send Surrey County Council a report').should('not.be.visible');
cy.get('#map_sidebar').scrollTo('bottom');
cy.get('.js-reporting-page--next:visible').should('not.be.disabled');
cy.get('.js-reporting-page--next').should('be.visible');
});
Expand Down
3 changes: 1 addition & 2 deletions .cypress/cypress/integration/tfl.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ it('allows bus stop clicking outside London', function() {
// Also check a category not on a red route
cy.go('back');
cy.pickCategory('Mobile Crane Operation');
cy.get('#map_sidebar').scrollTo('top');
cy.contains('does not maintain this road').should('be.visible');
cy.get('.pre-button-messaging').contains('does not maintain this road').should('be.visible');
});

it('shows TfL roadworks', function() {
Expand Down
10 changes: 9 additions & 1 deletion bin/export-import-data
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ $usage->die unless $opt->name;
die "Please specify a file to import\n" if $opt->import && (! -e $opt->import || -d $opt->import);

my $J = JSON::MaybeXS->new(utf8 => 1, pretty => 1, canonical => 1);
my $body = FixMyStreet::DB->resultset("Body")->find({ name => $opt->name }) or die "Cannot find body " . $opt->name . "\n";
my $body = FixMyStreet::DB->resultset("Body")->find({ name => $opt->name });
if (!$body && $opt->import) {
$body = FixMyStreet::DB->resultset("Body")->new({
name => $opt->name,
});
if ($opt->commit) {
$body->insert;
}
}
my @categories = split(/\|/, ($opt->{categories} || ''));

if ($opt->import) {
Expand Down
Loading