aboutsummaryrefslogtreecommitdiffstats
path: root/.cypress
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-11-01 15:19:53 +0000
committerStruan Donald <struan@exo.org.uk>2018-11-19 13:29:49 +0000
commit3d7523690accf22af95704394832d8e675472a4b (patch)
treec5e70860c89cbaf362c81e27cb8cf04c67a413b3 /.cypress
parentb4618c61ff5ddf6db9662b06bc55a0f74b43c903 (diff)
add report_prefill user permission
If set then when the user creates a new body report it will prefill the report title and description with some basic text. For mysociety/freshdesk#23
Diffstat (limited to '.cypress')
-rw-r--r--.cypress/cypress/integration/staff.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/.cypress/cypress/integration/staff.js b/.cypress/cypress/integration/staff.js
new file mode 100644
index 000000000..88afb5490
--- /dev/null
+++ b/.cypress/cypress/integration/staff.js
@@ -0,0 +1,46 @@
+Cypress.Commands.add('cleanUpXHR', function() {
+ cy.visit('/404', { failOnStatusCode: false });
+});
+
+describe('Staff user tests', function() {
+ it('report as defaults to body', function() {
+ cy.server();
+ cy.route('/report/new/ajax*').as('report-ajax');
+ cy.request({
+ method: 'POST',
+ url: '/auth?r=/',
+ form: true,
+ body: { username: 'cs_full@example.org', password_sign_in: 'password' }
+ });
+ cy.visit('/');
+ cy.contains('Go');
+ cy.get('[name=pc]').type(Cypress.env('postcode'));
+ cy.get('[name=pc]').parents('form').submit();
+ cy.url().should('include', '/around');
+ cy.get('#map_box').click(210, 200);
+ cy.get('[name=form_as]').should('have.value', 'body');
+ cy.cleanUpXHR();
+ });
+
+ it('report title and detail are correctly prefilled', function() {
+ cy.server();
+ cy.route('/report/new/ajax*').as('report-ajax');
+ cy.request({
+ method: 'POST',
+ url: '/auth?r=/',
+ form: true,
+ body: { username: 'cs_full@example.org', password_sign_in: 'password' }
+ });
+ cy.visit('/');
+ cy.contains('Go');
+ cy.get('[name=pc]').type(Cypress.env('postcode'));
+ cy.get('[name=pc]').parents('form').submit();
+ cy.url().should('include', '/around');
+ cy.get('#map_box').click(210, 200);
+ cy.wait('@report-ajax');
+ cy.get('select:eq(3)').select('Graffiti');
+ cy.get('[name=title]').should('have.value', 'A Graffiti problem has been found');
+ cy.get('[name=detail]').should('have.value', 'A Graffiti problem has been found by Borsetshire');
+ cy.cleanUpXHR();
+ });
+});