feat(broker): redirect to Choose What to Sync on newer versions of Firefox for iOS (#5640) r=shane-tomlinson
This commit is contained in:
Родитель
4a77b2f468
Коммит
2b403d6621
|
@ -23,6 +23,7 @@ define(function (require, exports, module) {
|
|||
const FxiOSV1AuthenticationBroker = FxDesktopV1AuthenticationBroker.extend({
|
||||
defaultCapabilities: _.extend({}, proto.defaultCapabilities, {
|
||||
chooseWhatToSyncCheckbox: false,
|
||||
chooseWhatToSyncWebV1: true,
|
||||
convertExternalLinksToText: true,
|
||||
immediateUnverifiedLogin: false
|
||||
}),
|
||||
|
@ -30,7 +31,17 @@ define(function (require, exports, module) {
|
|||
initialize (options = {}) {
|
||||
proto.initialize.call(this, options);
|
||||
|
||||
if (this._supportsImmediateUnverifiedLogin()) {
|
||||
const userAgent = new UserAgent(this._getUserAgentString());
|
||||
const version = userAgent.parseVersion();
|
||||
|
||||
// We enable then disable this capability if necessary and not the opposite,
|
||||
// because initialize() sets chooseWhatToSyncWebV1Engines and
|
||||
// new UserAgent() can't be called before initialize().
|
||||
if (! this._supportsChooseWhatToSync(version)) {
|
||||
this.setCapability('chooseWhatToSyncWebV1', false);
|
||||
}
|
||||
|
||||
if (this._supportsImmediateUnverifiedLogin(version)) {
|
||||
this.setCapability('immediateUnverifiedLogin', true);
|
||||
|
||||
// Fx for iOS allows the user to see the "confirm your email" screen,
|
||||
|
@ -61,16 +72,27 @@ define(function (require, exports, module) {
|
|||
* Check if the browser supports immediate login
|
||||
* for unverified accounts.
|
||||
*
|
||||
* @param {Object} version
|
||||
* @returns {Boolean}
|
||||
* @private
|
||||
*/
|
||||
_supportsImmediateUnverifiedLogin () {
|
||||
const userAgent = new UserAgent(this._getUserAgentString());
|
||||
const version = userAgent.parseVersion();
|
||||
_supportsImmediateUnverifiedLogin (version) {
|
||||
return version.major > 6 ||
|
||||
(version.major === 6 && version.minor >= 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the browser supports Choose What To Sync
|
||||
* for newly created accounts.
|
||||
*
|
||||
* @param {Object} version
|
||||
* @returns {Boolean}
|
||||
* @private
|
||||
*/
|
||||
_supportsChooseWhatToSync (version) {
|
||||
return version.major >= 11;
|
||||
},
|
||||
|
||||
/**
|
||||
* Notify the relier of login. This contains a bit of a hack.
|
||||
* Fx for iOS < 6.1 takes over the UI as soon as it receives a `login`
|
||||
|
|
|
@ -17,6 +17,7 @@ define(function (require, exports, module) {
|
|||
|
||||
const NO_IMMEDIATE_UNVERIFIED_LOGIN_UA_STRING = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/6.0 Mobile/12F69 Safari/600.1.4'; //eslint-disable-line max-len
|
||||
const IMMEDIATE_UNVERIFIED_LOGIN_UA_STRING = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/6.1 Mobile/12F69 Safari/600.1.4'; //eslint-disable-line max-len
|
||||
const CHOOSE_WHAT_TO_SYNC_UA_STRING = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/11.0 Mobile/12F69 Safari/600.1.4'; //eslint-disable-line max-len
|
||||
|
||||
describe('models/auth_brokers/fx-ios-v1', () => {
|
||||
let broker;
|
||||
|
@ -71,6 +72,23 @@ define(function (require, exports, module) {
|
|||
assert.equal(broker.getBehavior('afterSignUpConfirmationPoll').endpoint, 'signup_confirmed');
|
||||
});
|
||||
});
|
||||
|
||||
describe('supports chooseWhatToSyncWebV1', () => {
|
||||
it('has the expected capabilities and behaviors', () => {
|
||||
initializeBroker(CHOOSE_WHAT_TO_SYNC_UA_STRING);
|
||||
|
||||
assert.isTrue(broker.hasCapability('signup'));
|
||||
assert.isTrue(broker.hasCapability('handleSignedInNotification'));
|
||||
assert.isTrue(broker.hasCapability('emailVerificationMarketingSnippet'));
|
||||
assert.isTrue(broker.hasCapability('immediateUnverifiedLogin'));
|
||||
assert.isTrue(broker.hasCapability('chooseWhatToSyncWebV1'));
|
||||
|
||||
assert.equal(broker.getBehavior('afterSignInConfirmationPoll').type, 'navigate');
|
||||
assert.equal(broker.getBehavior('afterSignInConfirmationPoll').endpoint, 'signin_confirmed');
|
||||
assert.equal(broker.getBehavior('afterSignUpConfirmationPoll').type, 'navigate');
|
||||
assert.equal(broker.getBehavior('afterSignUpConfirmationPoll').endpoint, 'signup_confirmed');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('`broker.fetch` is called', () => {
|
||||
|
|
|
@ -20,6 +20,7 @@ define([
|
|||
const PASSWORD = '12345678';
|
||||
|
||||
const {
|
||||
click,
|
||||
clearBrowserState,
|
||||
closeCurrentWindow,
|
||||
fillOutSignUp,
|
||||
|
@ -92,6 +93,45 @@ define([
|
|||
// page after verification.
|
||||
.then(testElementExists(selectors.SIGNUP_COMPLETE.HEADER))
|
||||
|
||||
// A post-verification email should be sent, this is Sync.
|
||||
.then(testEmailExpected(email, 1));
|
||||
},
|
||||
|
||||
'Fx iOS >= 11.0 sign up, verify same browser': function () {
|
||||
return this.remote
|
||||
.then(openPage(PAGE_URL, selectors.SIGNUP.HEADER, {
|
||||
query: {
|
||||
forceUA: UA_STRINGS['ios_firefox_11_0']
|
||||
}
|
||||
}))
|
||||
.execute(listenForFxaCommands)
|
||||
.then(noSuchElement(selectors.SIGNUP.CUSTOMIZE_SYNC_CHECKBOX))
|
||||
.then(fillOutSignUp(email, PASSWORD))
|
||||
|
||||
// In Fx for iOS >= 11.0, user should be transitioned to the
|
||||
// choose what to Sync page
|
||||
.then(testElementExists(selectors.CHOOSE_WHAT_TO_SYNC.HEADER))
|
||||
|
||||
// uncheck the passwords and history engines
|
||||
.then(click(selectors.CHOOSE_WHAT_TO_SYNC.ENGINE_PASSWORDS))
|
||||
.then(click(selectors.CHOOSE_WHAT_TO_SYNC.ENGINE_HISTORY))
|
||||
.then(click(selectors.CHOOSE_WHAT_TO_SYNC.SUBMIT))
|
||||
|
||||
// user should be transitioned to the "go confirm your address" page
|
||||
.then(testElementExists(selectors.CONFIRM_SIGNUP.HEADER))
|
||||
|
||||
// the login message is only sent after the sync preferences screen
|
||||
// has been cleared.
|
||||
.then(testIsBrowserNotifiedOfLogin(email))
|
||||
|
||||
// verify the user
|
||||
.then(openVerificationLinkInNewTab(email, 0))
|
||||
.then(switchToWindow(1))
|
||||
|
||||
.then(testElementExists(selectors.CONNECT_ANOTHER_DEVICE.HEADER))
|
||||
|
||||
.then(closeCurrentWindow())
|
||||
.then(testElementExists(selectors.SIGNUP_COMPLETE.HEADER))
|
||||
// A post-verification email should be sent, this is Sync.
|
||||
.then(testEmailExpected(email, 1));
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ define([], function () {
|
|||
'desktop_firefox_57': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0',
|
||||
'desktop_firefox_58': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:58.0) Gecko/20100101 Firefox/58.0',
|
||||
'ios_firefox': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4',
|
||||
'ios_firefox_11_0': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/11.0 Mobile/12F69 Safari/600.1.4',
|
||||
'ios_firefox_6_0': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/6.0 Mobile/12F69 Safari/600.1.4',
|
||||
'ios_firefox_6_1': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/6.1 Mobile/12F69 Safari/600.1.4',
|
||||
'ios_firefox_9': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/9.0 Mobile/12F69 Safari/600.1.4',
|
||||
|
|
Загрузка…
Ссылка в новой задаче