From 3ba5372020c32fb0eace40e8530137f70c77da56 Mon Sep 17 00:00:00 2001 From: Shane Tomlinson Date: Fri, 14 Nov 2014 12:34:48 +0000 Subject: [PATCH] fix(client): The Sync flow should not notify the browser of login after the signup confirmation poll completes. The browser polls in the background for the status of the sign up completion itself, the client does not need to notify it of completion. In addition, the /confirm screen should not transition to the /signup_complete screen, this causes a jerky UI. fixes #1881 --- app/scripts/models/auth_brokers/fx-desktop.js | 2 +- .../spec/models/auth_brokers/fx-desktop.js | 10 +- tests/functional/sync_sign_up.js | 99 ++++--------------- 3 files changed, 21 insertions(+), 90 deletions(-) diff --git a/app/scripts/models/auth_brokers/fx-desktop.js b/app/scripts/models/auth_brokers/fx-desktop.js index 024a1badef..e444a28a09 100644 --- a/app/scripts/models/auth_brokers/fx-desktop.js +++ b/app/scripts/models/auth_brokers/fx-desktop.js @@ -62,7 +62,7 @@ define([ }, afterSignUpConfirmationPoll: function () { - return this._notifyRelierOfLogin(); + return p({ halt: true }); }, afterResetPasswordConfirmationPoll: function () { diff --git a/app/tests/spec/models/auth_brokers/fx-desktop.js b/app/tests/spec/models/auth_brokers/fx-desktop.js index 6638008e41..d02c268161 100644 --- a/app/tests/spec/models/auth_brokers/fx-desktop.js +++ b/app/tests/spec/models/auth_brokers/fx-desktop.js @@ -138,14 +138,10 @@ define([ }); describe('afterSignUpConfirmationPoll', function () { - it('notifies the channel of login', function () { - sinon.stub(broker, '_notifyRelierOfLogin', function () { - return p(); - }); - + it('halts', function () { return broker.afterSignUpConfirmationPoll() - .then(function () { - assert.isTrue(broker._notifyRelierOfLogin.called); + .then(function (result) { + assert.isTrue(result.halt); }); }); }); diff --git a/tests/functional/sync_sign_up.js b/tests/functional/sync_sign_up.js index 3b1ecdb0da..5f4a6e373c 100644 --- a/tests/functional/sync_sign_up.js +++ b/tests/functional/sync_sign_up.js @@ -28,7 +28,6 @@ define([ var PASSWORD = '12345678'; var listenForFxaCommands = FxDesktopHelpers.listenForFxaCommands; - var testIsBrowserNotifiedOfLogin = FxDesktopHelpers.testIsBrowserNotifiedOfLogin; registerSuite({ name: 'Firefox Desktop Sync sign_up', @@ -59,28 +58,11 @@ define([ .findByCssSelector('#fxa-signup-header') .end() - .findByCssSelector('form input.email') - .click() - .type(email) - .end() - - .findByCssSelector('form input.password') - .click() - .type(PASSWORD) - .end() - - .findByCssSelector('#fxa-age-year') - .click() - .end() - - .findById('fxa-' + (TOO_YOUNG_YEAR - 1)) - .pressMouseButton() - .releaseMouseButton() - .click() - .end() + .then(function () { + return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, TOO_YOUNG_YEAR - 1); + }) - .findByCssSelector('button[type="submit"]') - .click() + .findByCssSelector('#fxa-confirm-header') .end() // verify the user @@ -105,16 +87,13 @@ define([ .end() .closeCurrentWindow() - // switch to the original window - .switchToWindow('') - .end() - .findByCssSelector('#fxa-sign-up-complete-header') + // switch to the original window, it should not transition. + .switchToWindow('') .end() - .then(function () { - return testIsBrowserNotifiedOfLogin(self); - }); + .findByCssSelector('#fxa-confirm-header') + .end(); }, 'signup, verify different browser - from original tab\'s P.O.V.': function () { @@ -128,30 +107,9 @@ define([ .findByCssSelector('#fxa-signup-header') .end() - .findByCssSelector('form input.email') - .clearValue() - .click() - .type(email) - .end() - - .findByCssSelector('form input.password') - .click() - .type(PASSWORD) - .end() - - .findByCssSelector('#fxa-age-year') - .click() - .end() - - .findById('fxa-' + (TOO_YOUNG_YEAR - 1)) - .pressMouseButton() - .releaseMouseButton() - .click() - .end() - - .findByCssSelector('button[type="submit"]') - .click() - .end() + .then(function () { + return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, TOO_YOUNG_YEAR - 1); + }) .findByCssSelector('#fxa-confirm-header') .end() @@ -160,12 +118,9 @@ define([ return FunctionalHelpers.openVerificationLinkDifferentBrowser(client, email); }) - .findByCssSelector('#fxa-sign-up-complete-header') - .end() - - .then(function () { - return testIsBrowserNotifiedOfLogin(self); - }); + // The original tab should not transition + .findByCssSelector('#fxa-confirm-header') + .end(); }, 'signup, verify different browser - from new browser\'s P.O.V.': function () { @@ -179,29 +134,9 @@ define([ .findByCssSelector('#fxa-signup-header') .end() - .findByCssSelector('form input.email') - .click() - .type(email) - .end() - - .findByCssSelector('form input.password') - .click() - .type(PASSWORD) - .end() - - .findByCssSelector('#fxa-age-year') - .click() - .end() - - .findById('fxa-' + (TOO_YOUNG_YEAR - 1)) - .pressMouseButton() - .releaseMouseButton() - .click() - .end() - - .findByCssSelector('button[type="submit"]') - .click() - .end() + .then(function () { + return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, TOO_YOUNG_YEAR - 1); + }) // clear local/sessionStorage to synthesize continuing in // a separate browser.