aboutsummaryrefslogtreecommitdiffstats
path: root/.cypress/cypress/integration/simple_spec.js
diff options
context:
space:
mode:
Diffstat (limited to '.cypress/cypress/integration/simple_spec.js')
-rw-r--r--.cypress/cypress/integration/simple_spec.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/.cypress/cypress/integration/simple_spec.js b/.cypress/cypress/integration/simple_spec.js
index 7040681a3..48c80840b 100644
--- a/.cypress/cypress/integration/simple_spec.js
+++ b/.cypress/cypress/integration/simple_spec.js
@@ -11,8 +11,8 @@ describe('Clicking the map', function() {
cy.get('#map_box').click(200, 200);
cy.get('[name=title]').type('Title');
cy.get('[name=detail]').type('Detail');
- cy.get('#js-new-report-user-show').click();
- cy.get('#js-new-report-show-sign-in').click();
+ cy.get('.js-new-report-user-show').click();
+ cy.get('.js-new-report-show-sign-in').should('be.visible').click();
cy.get('#form_username_sign_in').type('user@example.org');
cy.get('[name=password_sign_in]').type('password');
cy.get('[name=password_sign_in]').parents('form').submit();
@@ -22,6 +22,39 @@ describe('Clicking the map', function() {
});
});
+describe('Leaving updates', function() {
+ function leave_update() {
+ cy.get('[name=update]').type('Update');
+ cy.get('.js-new-report-user-show:last').click();
+ cy.get('.js-new-report-show-sign-in:last').should('be.visible').click();
+ // [id=]:last due to #2341
+ cy.get('[id=form_username_sign_in]:last').type('user@example.org');
+ cy.get('[name=password_sign_in]:last').type('password');
+ cy.get('[name=password_sign_in]:last').parents('form:first').submit();
+ cy.get('#map_sidebar').should('contain', 'check and confirm your details');
+ cy.get('.js-new-report-user-show').click(); // Should not have to do this, #2340
+ cy.get('[name=submit_register]').parents('form').submit();
+ cy.get('body').should('contain', 'Thank you for updating this issue');
+ }
+
+ it('works when visited directly', function() {
+ cy.visit('/report/15');
+ leave_update();
+ });
+
+ it('works when pulled in via JS', function() {
+ cy.server();
+ 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');
+ // 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');
+ leave_update();
+ });
+});
+
describe('Clicking the "big green banner" on a map page', function() {
before(function() {
cy.visit('/');