diff options
-rw-r--r-- | .cypress/cypress/integration/regressions.js | 14 | ||||
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | bin/browser-tests | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Test.pm | 60 | ||||
-rw-r--r-- | web/js/duplicates.js | 2 |
5 files changed, 78 insertions, 2 deletions
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js index 7bdd8f6fe..3bd208ede 100644 --- a/.cypress/cypress/integration/regressions.js +++ b/.cypress/cypress/integration/regressions.js @@ -54,7 +54,7 @@ describe('Regression tests', function() { cy.get('.content').should('not.contain', 'toddler'); }); - it.only('has the correct send-to text at all times', function() { + it('has the correct send-to text at all times', function() { cy.server(); cy.route('/report/new/ajax*').as('report-ajax'); cy.visit('/'); @@ -71,4 +71,16 @@ describe('Regression tests', function() { cy.contains(/These will be sent to Northampton Borough Council and also/); }); + it('hides everything when duplicate suggestions are shown', function() { + cy.server(); + cy.route('/report/new/ajax*').as('report-ajax'); + cy.visit('http://borsetshire.localhost:3001/_test/setup/regression-duplicate-hide'); // Server-side setup + cy.visit('http://borsetshire.localhost:3001/report/1'); + cy.contains('Report another problem here').click(); + cy.wait('@report-ajax'); + cy.get('[id=category_group]').select('Licensing'); + cy.get('[id=subcategory_Licensing]').select('Skips'); + cy.get('.extra-category-questions').should('not.be.visible'); + cy.visit('http://borsetshire.localhost:3001/_test/teardown/regression-duplicate-hide'); + }); }); diff --git a/CHANGELOG.md b/CHANGELOG.md index 170d4de5b..ded29f2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Fix front-end testing script when run with Vagrant. #2514 - Handle missing category when sending open311 reports #2502 - Fix label associations with category groups. #2541 + - Hide category extras when duplicate suggestions shown. - Front end improvements: - Set report title autocomplete to off to prevent email autocompleting - Development improvements: diff --git a/bin/browser-tests b/bin/browser-tests index 11d83d133..013c0d8d3 100755 --- a/bin/browser-tests +++ b/bin/browser-tests @@ -11,7 +11,7 @@ my ($cobrand, $coords, $area_id, $name, $mapit_url); BEGIN { $config_file = 'conf/general.yml-example'; - $cobrand = [ 'fixmystreet', 'northamptonshire', 'bathnes', 'buckinghamshire', 'hounslow' ]; + $cobrand = [ 'borsetshire', 'fixmystreet', 'northamptonshire', 'bathnes', 'buckinghamshire', 'hounslow' ]; $coords = '51.532851,-2.284277'; $area_id = 2608; $name = 'Borsetshire'; @@ -91,6 +91,7 @@ sub run { STAGING_FLAGS => { skip_checks => 1 }, COBRAND_FEATURES => { category_groups => { map { $_ => 1 } @$cobrand }, + suggest_duplicates => { map { $_ => 1 } @$cobrand }, } }); $ENV{FMS_OVERRIDE_CONFIG} = $config_out; diff --git a/perllib/FixMyStreet/App/Controller/Test.pm b/perllib/FixMyStreet/App/Controller/Test.pm new file mode 100644 index 000000000..5ec4bebf3 --- /dev/null +++ b/perllib/FixMyStreet/App/Controller/Test.pm @@ -0,0 +1,60 @@ +package FixMyStreet::App::Controller::Test; +use Moose; +use namespace::autoclean; + +use File::Basename; + +BEGIN { extends 'Catalyst::Controller'; } + +=head1 NAME + +FixMyStreet::App::Controller::Test - Catalyst Controller + +=head1 DESCRIPTION + +Test-helping Catalyst Controller. + +=head1 METHODS + +=over 4 + +=item auto + +Makes sure this controller is only available when run in test. + +=cut + +sub auto : Private { + my ($self, $c) = @_; + $c->detach( '/page_error_404_not_found' ) unless FixMyStreet->test_mode; + return 1; +} + +=item setup + +Sets up a particular browser test. + +=cut + +sub setup : Path('/_test/setup') : Args(1) { + my ( $self, $c, $test ) = @_; + if ($test eq 'regression-duplicate-hide') { + my $problem = FixMyStreet::DB->resultset("Problem")->find(1); + $problem->update({ category => 'Skips' }); + $c->response->body("OK"); + } +} + +sub teardown : Path('/_test/teardown') : Args(1) { + my ( $self, $c, $test ) = @_; + if ($test eq 'regression-duplicate-hide') { + my $problem = FixMyStreet::DB->resultset("Problem")->find(1); + $problem->update({ category => 'Potholes' }); + $c->response->body("OK"); + } +} + +__PACKAGE__->meta->make_immutable; + +1; + diff --git a/web/js/duplicates.js b/web/js/duplicates.js index 3ed7e6079..b8bb35246 100644 --- a/web/js/duplicates.js +++ b/web/js/duplicates.js @@ -64,6 +64,7 @@ $('#js-duplicate-reports').hide().removeClass('hidden').slideDown(); if ( $('#problem_form').length ) { $('.js-hide-if-invalid-category').slideUp(); + $('.js-hide-if-invalid-category_extras').slideUp(); } // Highlight map pin when hovering associated list item. @@ -137,6 +138,7 @@ }); if ($('#problem_form').length && take_effect()) { $('.js-hide-if-invalid-category').slideDown(); + $('.js-hide-if-invalid-category_extras').slideDown(); } } |