aboutsummaryrefslogtreecommitdiffstats
path: root/.cypress
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2018-03-14 16:36:04 +0000
committerZarino Zappia <mail@zarino.co.uk>2018-03-20 14:52:13 +0000
commitd3872acb28212e8ab7a3c018a3152bd68d891528 (patch)
tree4b91f2800f6e70d0046334f74e999898c40394f5 /.cypress
parent8737dc0d6805072ea9024cee067b0bf0648a0443 (diff)
[UK] Dual submit buttons on homepage postcode form
Present "report" vs "browse" choice at time of postcode entry, so we can track intent, as part of a temporary experiment into what people expect to see on the fixmystreet.com/around page. Google Analytics will be able detect which button was pressed by looking for the `intent=report` or `intent=report` query string param in the resulting pageview location. We supply a *third* submit button, immediately before the other two, and hidden from visual users and assistive devices, to prevent either of the "intent" submit values being sent when the user submits the form via the Return/Enter key. Part of #2021.
Diffstat (limited to '.cypress')
-rw-r--r--.cypress/cypress/integration/simple_spec.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/.cypress/cypress/integration/simple_spec.js b/.cypress/cypress/integration/simple_spec.js
index 39000a022..a1adbd06f 100644
--- a/.cypress/cypress/integration/simple_spec.js
+++ b/.cypress/cypress/integration/simple_spec.js
@@ -1,16 +1,21 @@
-describe('My First Test', function() {
- it('Visits the home page', function() {
+describe('Clicking the map', function() {
+ before(function(){
cy.visit('/');
cy.contains('Go');
cy.get('[name=pc]').type('BS10 5EE');
- cy.get('#postcodeForm').submit();
+ cy.get('[name=pc]').parents('form').submit();
+ });
+
+ it('allows me to report a new problem', function() {
cy.url().should('include', '/around');
cy.get('#map_box').click(200, 200);
cy.get('[name=title]').type('Title');
cy.get('[name=detail]').type('Detail');
cy.get('[name=username]').type('user@example.org');
cy.get('[name=password_sign_in]').type('password');
- cy.get('form').submit();
- cy.get('form').submit();
+ cy.get('[name=password_sign_in]').parents('form').submit();
+ 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');
});
});