aboutsummaryrefslogtreecommitdiffstats
path: root/.cypress
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-03-23 18:09:04 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-03-26 15:08:14 +0100
commit3b82cc190589cbc712ec35e28efa1dd0af2f0d82 (patch)
treec33bdff36feda1b049769aaf33d194d5fce38110 /.cypress
parent96d6d115c68d5e0a4b23612aa630c3e0de98daa5 (diff)
Fix race condition making a new report.
If you started a new report by clicking the map before the server had responded with the map list pins, when they did arrive they would replace the new report pin.
Diffstat (limited to '.cypress')
-rw-r--r--.cypress/cypress/integration/regressions.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js
index a0d5b3fc9..209013339 100644
--- a/.cypress/cypress/integration/regressions.js
+++ b/.cypress/cypress/integration/regressions.js
@@ -1,3 +1,10 @@
+// See https://github.com/cypress-io/cypress/issues/761 - Cypress dies if we
+// go straight to the next test with an XHR in progress. So visit a 404 page
+// to cancel anything in progress.
+Cypress.Commands.add('cleanUpXHR', function() {
+ cy.visit('/404', { failOnStatusCode: false });
+});
+
describe('Regression tests', function() {
it('Shows the sub-map links after clicking Try again', function() {
cy.viewport(480, 800);
@@ -5,5 +12,12 @@ describe('Regression tests', function() {
cy.get('#map_box').click(200, 200);
cy.get('#try_again').click();
cy.get('#sub_map_links').should('be.visible');
+ cy.cleanUpXHR();
+ });
+ it('Does not hide the new report pin even if you click really quick', function() {
+ cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.get('#map_box').click(200, 200);
+ cy.get('#loading-indicator').should('be.hidden');
+ cy.get('#map_box image').should('be.visible');
});
});