aboutsummaryrefslogtreecommitdiffstats
path: root/.cypress/cypress/integration
diff options
context:
space:
mode:
Diffstat (limited to '.cypress/cypress/integration')
-rw-r--r--.cypress/cypress/integration/around_filters.js2
-rw-r--r--.cypress/cypress/integration/bathnes.js2
-rw-r--r--.cypress/cypress/integration/borsetshire.js23
-rw-r--r--.cypress/cypress/integration/duplicates.js31
-rw-r--r--.cypress/cypress/integration/hackney.js19
-rw-r--r--.cypress/cypress/integration/isleofwight.js13
-rw-r--r--.cypress/cypress/integration/northamptonshire.js14
-rw-r--r--.cypress/cypress/integration/oxfordshire.js25
-rw-r--r--.cypress/cypress/integration/peterborough.js7
-rw-r--r--.cypress/cypress/integration/regressions.js2
-rw-r--r--.cypress/cypress/integration/simple_spec.js5
11 files changed, 126 insertions, 17 deletions
diff --git a/.cypress/cypress/integration/around_filters.js b/.cypress/cypress/integration/around_filters.js
index 46d1f8477..c79359574 100644
--- a/.cypress/cypress/integration/around_filters.js
+++ b/.cypress/cypress/integration/around_filters.js
@@ -112,7 +112,7 @@ describe('Around page filtering and push state', function() {
cy.route('/report/*').as('show-report');
cy.route('/reports/*').as('show-all');
cy.route('/mapit/area/*').as('get-geometry');
- cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=6');
+ cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=0');
// get the second image which is the pin, first is the shadow
cy.get('image[title="Lights out in tunnel"]:last').invoke('attr', 'xlink:href').should('contain', 'small');
// force to hopefully work around apparent Cypress SVG issue
diff --git a/.cypress/cypress/integration/bathnes.js b/.cypress/cypress/integration/bathnes.js
index 1acbd3602..5598409d9 100644
--- a/.cypress/cypress/integration/bathnes.js
+++ b/.cypress/cypress/integration/bathnes.js
@@ -19,7 +19,7 @@ it('loads the staff layer correctly', function() {
cy.window().then(function(win){
var llpg = 0;
win.fixmystreet.map.layers.forEach(function(lyr) {
- if (lyr.fixmystreet && lyr.fixmystreet.http_options.params.TYPENAME === 'LLPG') {
+ if (lyr.fixmystreet && lyr.fixmystreet.http_options && lyr.fixmystreet.http_options.params && lyr.fixmystreet.http_options.params.TYPENAME === 'LLPG') {
llpg++;
}
});
diff --git a/.cypress/cypress/integration/borsetshire.js b/.cypress/cypress/integration/borsetshire.js
new file mode 100644
index 000000000..e3529a9aa
--- /dev/null
+++ b/.cypress/cypress/integration/borsetshire.js
@@ -0,0 +1,23 @@
+it('loads the right front page', function() {
+ cy.visit('http://borsetshire.localhost:3001/');
+ cy.contains('Borsetshire');
+});
+
+it('logs in without fuss', function() {
+ cy.contains('Sign in').click();
+ cy.contains('Customer service').click();
+ cy.url().should('include', '/reports');
+
+ cy.contains('Your account').click();
+ cy.contains('Sign out').click();
+ cy.contains('Sign in').click();
+ cy.contains('Inspector').click();
+ cy.url().should('include', '/my/planned');
+
+ cy.visit('http://borsetshire.localhost:3001/auth');
+ cy.get('[name=username]').type('super@example.org');
+ cy.contains('Sign in with a password').click();
+ cy.get('[name=password_sign_in]').type('password');
+ cy.get('[name=sign_in_by_password]').last().click();
+ cy.url().should('include', '/admin');
+});
diff --git a/.cypress/cypress/integration/duplicates.js b/.cypress/cypress/integration/duplicates.js
index 406b3fb67..c014e0593 100644
--- a/.cypress/cypress/integration/duplicates.js
+++ b/.cypress/cypress/integration/duplicates.js
@@ -51,12 +51,12 @@ describe('Duplicate tests', function() {
});
it('lets an inspector see duplicate reports coming from /reports', function() {
- cy.request({
- method: 'POST',
- url: 'http://borsetshire.localhost:3001/auth?r=/reports',
- form: true,
- body: { username: 'admin@example.org', password_sign_in: 'password' }
- });
+ cy.visit('http://borsetshire.localhost:3001/auth');
+ cy.get('[name=username]').type('admin@example.org');
+ cy.contains('Sign in with a password').click();
+ cy.get('[name=password_sign_in]').type('password');
+ cy.get('[name=sign_in_by_password]').last().click();
+ cy.url().should('include', '/my');
cy.visit('http://borsetshire.localhost:3001/reports');
cy.get('[href$="/report/1"]:last').click();
cy.get('#report_inspect_form #state').select('Duplicate');
@@ -77,4 +77,23 @@ describe('Duplicate tests', function() {
cy.get('#js-duplicate-reports li h3 a').should('have.attr', 'href', '/report/1');
});
+ it('does not redisplay duplicates when stopper questions are changed', function() {
+ cy.server();
+ cy.route('/report/new/ajax*').as('report-ajax');
+ cy.visit('http://borsetshire.localhost:3001/_test/setup/regression-duplicate-stopper'); // 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('Flytipping');
+ cy.get('.extra-category-questions').should('not.be.visible');
+ cy.get('.js-hide-duplicate-suggestions:first').click();
+ cy.get('.js-hide-duplicate-suggestions:first').should('not.be.visible');
+ cy.get('.extra-category-questions').should('be.visible');
+ cy.get('[id=form_hazardous]').select('No');
+ cy.wait(500);
+ cy.get('.extra-category-questions').should('be.visible');
+ cy.get('.js-hide-duplicate-suggestions:first').should('not.be.visible');
+ cy.visit('http://borsetshire.localhost:3001/_test/teardown/regression-duplicate-stopper'); // Server-side setup
+ });
+
});
diff --git a/.cypress/cypress/integration/hackney.js b/.cypress/cypress/integration/hackney.js
new file mode 100644
index 000000000..a4293b028
--- /dev/null
+++ b/.cypress/cypress/integration/hackney.js
@@ -0,0 +1,19 @@
+describe('When you look at the Hackney site', function() {
+
+ beforeEach(function() {
+ cy.server();
+ cy.route('/report/new/ajax*').as('report-ajax');
+ cy.visit('http://hackney.localhost:3001/');
+ cy.contains('Hackney Council');
+ cy.should('not.contain', 'Hackney Borough');
+ cy.get('[name=pc]').type('E8 1DY');
+ cy.get('[name=pc]').parents('form').submit();
+ });
+
+ it('uses the correct name', function() {
+ cy.get('#map_box').click();
+ cy.wait('@report-ajax');
+ cy.get('select:eq(4)').select('Potholes');
+ cy.contains('sent to Hackney Council');
+ });
+});
diff --git a/.cypress/cypress/integration/isleofwight.js b/.cypress/cypress/integration/isleofwight.js
index ab7039a5f..7cfb21c82 100644
--- a/.cypress/cypress/integration/isleofwight.js
+++ b/.cypress/cypress/integration/isleofwight.js
@@ -20,4 +20,17 @@ describe('When you look at the Island Roads site', function() {
cy.get('select:eq(4)').select('Extra');
cy.contains('Help Island Roads');
});
+
+ it('displays nearby roadworks', function() {
+ cy.fixture('iow_roadworks.json');
+ cy.route('/streetmanager.php**', 'fixture:iow_roadworks.json').as('roadworks');
+ cy.visit('http://isleofwight.localhost:3001/');
+ cy.get('[name=pc]').type('PO30 5XJ');
+ cy.get('[name=pc]').parents('form').submit();
+ cy.get('#map_box').click();
+ cy.wait('@report-ajax');
+ cy.wait('@roadworks');
+ cy.contains('Roadworks are scheduled near this location');
+ cy.contains('Parapet improvement');
+ });
});
diff --git a/.cypress/cypress/integration/northamptonshire.js b/.cypress/cypress/integration/northamptonshire.js
index 76ce8ff44..0de02d8c3 100644
--- a/.cypress/cypress/integration/northamptonshire.js
+++ b/.cypress/cypress/integration/northamptonshire.js
@@ -7,8 +7,8 @@ it('prevents clicking unless asset selected', function() {
cy.server();
cy.fixture('bus_stops.json');
cy.fixture('bus_stops_none.json');
- cy.route('**/render-layer/**', 'fixture:bus_stops_none.json').as('empty-bus_stops-layer');
- cy.route('**/16301/10787**', 'fixture:bus_stops.json').as('bus_stops-layer');
+ cy.route('**/northants.staging/**', 'fixture:bus_stops_none.json').as('empty-bus_stops-layer');
+ cy.route('**/32602/21575/**', 'fixture:bus_stops.json').as('bus_stops-layer');
cy.route('/report/new/ajax*').as('report-ajax');
cy.visit('http://northamptonshire.localhost:3001/');
cy.get('[name=pc]').type('NN1 1NS');
@@ -29,8 +29,8 @@ it('selecting an asset allows a report', function() {
cy.server();
cy.fixture('bus_stops.json');
cy.fixture('bus_stops_none.json');
- cy.route('**/render-layer/**', 'fixture:bus_stops_none.json').as('empty-bus_stops-layer');
- cy.route('**/16301/10787**', 'fixture:bus_stops.json').as('bus_stops-layer');
+ cy.route('**/northants.staging/**', 'fixture:bus_stops_none.json').as('empty-bus_stops-layer');
+ cy.route('**/32602/21575/**', 'fixture:bus_stops.json').as('bus_stops-layer');
cy.route('/report/new/ajax*').as('report-ajax');
cy.visit('http://northamptonshire.localhost:3001/');
cy.get('[name=pc]').type('NN1 2NS');
@@ -51,9 +51,9 @@ it('detects multiple assets at same location', function() {
cy.server();
cy.fixture('bus_stops.json');
cy.fixture('bus_stops_none.json');
- cy.route('**/render-layer/**', 'fixture:bus_stops_none.json').as('empty-bus_stops-layer');
- cy.route('**/16301/10787**', 'fixture:bus_stops.json').as('bus_stops-layer');
- cy.route('**/16301/10788**', 'fixture:bus_stops.json').as('bus_stops-layer2');
+ cy.route('**/northants.staging/**', 'fixture:bus_stops_none.json').as('empty-bus_stops-layer');
+ cy.route('**/32602/21575/**', 'fixture:bus_stops.json').as('bus_stops-layer');
+ cy.route('**/32602/21576/**', 'fixture:bus_stops.json').as('bus_stops-layer2');
cy.route('/report/new/ajax*').as('report-ajax');
cy.visit('http://northamptonshire.localhost:3001/');
cy.get('[name=pc]').type('NN1 2NS');
diff --git a/.cypress/cypress/integration/oxfordshire.js b/.cypress/cypress/integration/oxfordshire.js
new file mode 100644
index 000000000..f235802e6
--- /dev/null
+++ b/.cypress/cypress/integration/oxfordshire.js
@@ -0,0 +1,25 @@
+describe("Oxfordshire cobrand", function() {
+ it("allows inspectors to instruct defects", function() {
+ cy.server();
+ cy.request({
+ method: 'POST',
+ url: 'http://oxfordshire.localhost:3001/auth',
+ form: true,
+ body: { username: 'inspector-instructor@example.org', password_sign_in: 'password' }
+ });
+ cy.visit('http://oxfordshire.localhost:3001/report/1');
+ cy.contains('Oxfordshire');
+
+ cy.get('#report_inspect_form').should('be.visible');
+ cy.get('#js-inspect-action-scheduled').should('not.be.visible');
+ cy.get('#raise_defect_yes').should('not.have.attr', 'required');
+
+ cy.get('#report_inspect_form select[name=state]').select('Action scheduled');
+ cy.get('#js-inspect-action-scheduled').should('be.visible');
+ cy.get('#raise_defect_yes').should('have.attr', 'required', 'required');
+
+ cy.get('#report_inspect_form select[name=state]').select('No further action');
+ cy.get('#js-inspect-action-scheduled').should('not.be.visible');
+ cy.get('#raise_defect_yes').should('not.have.attr', 'required');
+ });
+});
diff --git a/.cypress/cypress/integration/peterborough.js b/.cypress/cypress/integration/peterborough.js
index 67c468be8..452795d8c 100644
--- a/.cypress/cypress/integration/peterborough.js
+++ b/.cypress/cypress/integration/peterborough.js
@@ -31,4 +31,11 @@ describe('new report form', function() {
cy.get('.js-hide-if-invalid-category').should('be.visible');
});
+ it('correctly changes the asset select message', function() {
+ cy.get('select:eq(4)').select('Street lighting');
+ cy.get('.category_meta_message').should('contain', 'You can pick a light from the map');
+ cy.get('select:eq(4)').select('Trees');
+ cy.get('.category_meta_message').should('contain', 'You can pick a tree from the map');
+ });
+
});
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js
index f1f557219..57176223f 100644
--- a/.cypress/cypress/integration/regressions.js
+++ b/.cypress/cypress/integration/regressions.js
@@ -46,7 +46,7 @@ describe('Regression tests', function() {
it('hides the report when going from around to report to form', function() {
cy.server();
cy.route('/report/*').as('show-report');
- cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=6');
+ cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=0');
// force to hopefully work around apparent Cypress SVG issue
cy.get('image[title="Lights out in tunnel"]:last').click({force: true});
cy.wait('@show-report');
diff --git a/.cypress/cypress/integration/simple_spec.js b/.cypress/cypress/integration/simple_spec.js
index 8b658b21b..074bf72bd 100644
--- a/.cypress/cypress/integration/simple_spec.js
+++ b/.cypress/cypress/integration/simple_spec.js
@@ -20,6 +20,9 @@ describe('Clicking the map', function() {
cy.get('#map_sidebar').should('contain', 'check and confirm your details');
cy.get('#map_sidebar').parents('form').submit();
cy.get('body').should('contain', 'Thank you for reporting this issue');
+ cy.visit('http://fixmystreet.localhost:3001/_test/setup/simple-service-check').then(function(w) {
+ expect(w.document.documentElement.innerText).to.equal('desktop');
+ });
});
});
@@ -47,7 +50,7 @@ describe('Leaving updates', function() {
cy.route('/report/*').as('show-report');
cy.route('/reports/*').as('show-all');
cy.route('/mapit/area/*').as('get-geometry');
- cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=6');
+ cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=0');
// force to hopefully work around apparent Cypress SVG issue
cy.get('image[title="Lights out in tunnel"]:last').click({force: true});
cy.wait('@show-report');