Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
17
gaia/apps/costcontrol/test/marionette/.jshintrc
Executable file
17
gaia/apps/costcontrol/test/marionette/.jshintrc
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../.jshintrc",
|
||||
"predef": [
|
||||
"suite",
|
||||
"test",
|
||||
"setup",
|
||||
"teardown",
|
||||
"suiteSetup",
|
||||
"suiteTeardown",
|
||||
"marionette",
|
||||
"marionetteScriptFinished",
|
||||
"require",
|
||||
"define",
|
||||
"requireApp",
|
||||
"sinon"
|
||||
]
|
||||
}
|
||||
130
gaia/apps/costcontrol/test/marionette/fte_test.js
Executable file
130
gaia/apps/costcontrol/test/marionette/fte_test.js
Executable file
|
|
@ -0,0 +1,130 @@
|
|||
/* global require, marionette, setup, suite, test, __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('chai').assert;
|
||||
|
||||
var CostControl = require('./lib/costcontrol.js');
|
||||
|
||||
marionette('First Time Experience View', function() {
|
||||
var client = marionette.client({
|
||||
profile: {
|
||||
prefs: {
|
||||
'focusmanager.testmode': true
|
||||
}
|
||||
},
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
|
||||
var costControlApp;
|
||||
|
||||
function assertIsNotDisplayed(element) {
|
||||
assert.isFalse(element.displayed(), 'Element should not be displayed');
|
||||
}
|
||||
|
||||
setup(function() {
|
||||
costControlApp = CostControl.create(client);
|
||||
|
||||
client.contentScript.inject(
|
||||
__dirname + '/mocks/navigator_moz_icc_manager.js'
|
||||
);
|
||||
client.contentScript.inject(
|
||||
__dirname + '/mocks/navigator_moz_mobile_connections.js'
|
||||
);
|
||||
client.contentScript.inject(
|
||||
__dirname + '/mocks/navigator_moz_network_stats.js'
|
||||
);
|
||||
});
|
||||
|
||||
suite('Non-configured SIM flow', function() {
|
||||
setup(function() {
|
||||
costControlApp.launch();
|
||||
});
|
||||
|
||||
test('Should lead to DataUsage Tab', function() {
|
||||
var fte = costControlApp.FirstTimeExperience;
|
||||
|
||||
fte.switchTo();
|
||||
client.helper.waitForElement(fte.Welcome.main);
|
||||
|
||||
// Go next to Data Report view
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.DataReport.main);
|
||||
|
||||
// Go next to Data Alert view
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.DataAlert.main);
|
||||
|
||||
// Go next to DataUsageTab
|
||||
fte.finish();
|
||||
costControlApp.switchTo();
|
||||
|
||||
// Verify that DataUsage tab is active
|
||||
client.helper.waitForElement(costControlApp.DataUsageTab.main);
|
||||
assertIsNotDisplayed(fte.frame);
|
||||
});
|
||||
});
|
||||
|
||||
suite('Pre-configured SIM flow', function() {
|
||||
setup(function() {
|
||||
// Make current SIM as pre-configured
|
||||
client.contentScript.inject(__dirname + '/mocks/configure_icc.js');
|
||||
costControlApp.launch();
|
||||
});
|
||||
|
||||
test('Should lead to Balance Tab for Prepaid plan', function() {
|
||||
var fte = costControlApp.FirstTimeExperience;
|
||||
|
||||
fte.switchTo();
|
||||
client.helper.waitForElement(fte.Welcome.main);
|
||||
|
||||
// Go next to plan selection
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.TypeOfContract.main);
|
||||
fte.TypeOfContract.prepaidPlanOption.click();
|
||||
|
||||
// Go next to Prepaid low balance alert
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.PrepaidLowBalanceAlert.main);
|
||||
|
||||
// Go next to Data Report and Alert
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.PrepaidDataReportAndAlert.main);
|
||||
|
||||
// Go to Balance Tab
|
||||
fte.finish();
|
||||
costControlApp.switchTo();
|
||||
|
||||
// Verify that Balance tab is active
|
||||
client.helper.waitForElement(costControlApp.BalanceTab.main);
|
||||
assertIsNotDisplayed(fte.frame);
|
||||
});
|
||||
|
||||
test('Should lead to Telephony Tab for Postpaid plan', function() {
|
||||
var fte = costControlApp.FirstTimeExperience;
|
||||
|
||||
fte.switchTo();
|
||||
client.helper.waitForElement(fte.Welcome.main);
|
||||
|
||||
// Go next to plan selection
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.TypeOfContract.main);
|
||||
fte.TypeOfContract.postpaidPlanOption.click();
|
||||
|
||||
// Go next to Postpaid Phone and Data Report
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.PostPaidPhoneAndDataReport.main);
|
||||
|
||||
// Go next to Data Alert
|
||||
fte.next();
|
||||
client.helper.waitForElement(fte.PostPaidDataAlert.main);
|
||||
|
||||
// Go to Balance Tab
|
||||
fte.finish();
|
||||
costControlApp.switchTo();
|
||||
|
||||
// Verify that Telephony tab is active
|
||||
client.helper.waitForElement(costControlApp.TelephonyTab.main);
|
||||
assertIsNotDisplayed(fte.frame);
|
||||
});
|
||||
});
|
||||
});
|
||||
225
gaia/apps/costcontrol/test/marionette/lib/costcontrol.js
Executable file
225
gaia/apps/costcontrol/test/marionette/lib/costcontrol.js
Executable file
|
|
@ -0,0 +1,225 @@
|
|||
/* global module */
|
||||
(function(module) {
|
||||
'use strict';
|
||||
|
||||
var ORIGIN_URL = 'app://costcontrol.gaiamobile.org';
|
||||
|
||||
var SELECTORS = Object.freeze({
|
||||
DataUsageTab: {
|
||||
main: '#datausage-tab'
|
||||
},
|
||||
|
||||
BalanceTab: {
|
||||
main: '#balance-tab'
|
||||
},
|
||||
|
||||
TelephonyTab: {
|
||||
main: '#telephony-tab'
|
||||
},
|
||||
|
||||
FirstTimeExperience: {
|
||||
frame: '#fte_view',
|
||||
main: '#firsttime-view',
|
||||
|
||||
nextButton: 'button[data-navigation=next]:not([disabled])',
|
||||
backButton: 'button[data-navigation=back]',
|
||||
finishButton: 'button[data-navigation=finish]',
|
||||
|
||||
Welcome: {
|
||||
main: '#step-1'
|
||||
},
|
||||
|
||||
TypeOfContract: {
|
||||
main: '#step-2',
|
||||
prepaidPlanOption: '#prepaid-plan',
|
||||
postpaidPlanOption: '#postpaid-plan'
|
||||
},
|
||||
|
||||
PrepaidLowBalanceAlert: {
|
||||
main: '#prepaid-step-2'
|
||||
},
|
||||
|
||||
PrepaidDataReportAndAlert: {
|
||||
main: '#prepaid-step-3'
|
||||
},
|
||||
|
||||
PostpaidPhoneAndDataReport: {
|
||||
main: '#postpaid-step-2'
|
||||
},
|
||||
|
||||
PostpaidDataAlert: {
|
||||
main: '#postpaid-step-3'
|
||||
},
|
||||
|
||||
DataReport: {
|
||||
main: '#non-vivo-step-1'
|
||||
},
|
||||
|
||||
DataAlert: {
|
||||
main: '#non-vivo-step-2'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
create: function(client) {
|
||||
return {
|
||||
BalanceTab: {
|
||||
get main() {
|
||||
return client.findElement(SELECTORS.BalanceTab.main);
|
||||
}
|
||||
},
|
||||
|
||||
DataUsageTab: {
|
||||
get main() {
|
||||
return client.findElement(SELECTORS.DataUsageTab.main);
|
||||
}
|
||||
},
|
||||
|
||||
TelephonyTab: {
|
||||
get main() {
|
||||
return client.findElement(SELECTORS.TelephonyTab.main);
|
||||
}
|
||||
},
|
||||
|
||||
FirstTimeExperience: {
|
||||
get frame() {
|
||||
return client.findElement(SELECTORS.FirstTimeExperience.frame);
|
||||
},
|
||||
|
||||
switchTo: function() {
|
||||
client.switchToFrame(this.frame);
|
||||
client.helper.waitForElement(SELECTORS.FirstTimeExperience.main);
|
||||
},
|
||||
|
||||
Welcome: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.Welcome.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
TypeOfContract: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.TypeOfContract.main
|
||||
);
|
||||
},
|
||||
|
||||
get prepaidPlanOption() {
|
||||
return client.helper.waitForElement(
|
||||
SELECTORS.FirstTimeExperience.TypeOfContract.prepaidPlanOption
|
||||
);
|
||||
},
|
||||
|
||||
get postpaidPlanOption() {
|
||||
return client.helper.waitForElement(
|
||||
SELECTORS.FirstTimeExperience.TypeOfContract.postpaidPlanOption
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
PrepaidLowBalanceAlert: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.PrepaidLowBalanceAlert.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
PrepaidDataReportAndAlert: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.PrepaidDataReportAndAlert.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
PostPaidPhoneAndDataReport: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.PostpaidPhoneAndDataReport.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
PostPaidDataAlert: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.PostpaidDataAlert.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
DataReport: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.DataReport.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
DataAlert: {
|
||||
get main() {
|
||||
return client.findElement(
|
||||
SELECTORS.FirstTimeExperience.DataAlert.main
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
getCurrentViewSelector: function() {
|
||||
var viewSelectors = [
|
||||
SELECTORS.FirstTimeExperience.Welcome.main,
|
||||
SELECTORS.FirstTimeExperience.TypeOfContract.main,
|
||||
SELECTORS.FirstTimeExperience.PrepaidLowBalanceAlert.main,
|
||||
SELECTORS.FirstTimeExperience.PrepaidDataReportAndAlert.main,
|
||||
SELECTORS.FirstTimeExperience.PostpaidPhoneAndDataReport.main,
|
||||
SELECTORS.FirstTimeExperience.PostpaidDataAlert.main,
|
||||
SELECTORS.FirstTimeExperience.DataReport.main,
|
||||
SELECTORS.FirstTimeExperience.DataAlert.main
|
||||
];
|
||||
|
||||
for(var i = 0; i < viewSelectors.length; i++) {
|
||||
if (client.findElement(viewSelectors[i]).displayed()) {
|
||||
return viewSelectors[i];
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('First Time Experience view is not displayed!');
|
||||
},
|
||||
|
||||
go: function(directionButtonSelector) {
|
||||
client.helper.waitForElement(
|
||||
this.getCurrentViewSelector() + ' ' + directionButtonSelector
|
||||
).tap();
|
||||
},
|
||||
|
||||
next: function() {
|
||||
this.go(SELECTORS.FirstTimeExperience.nextButton);
|
||||
},
|
||||
|
||||
back: function() {
|
||||
this.go(SELECTORS.FirstTimeExperience.backButton);
|
||||
},
|
||||
|
||||
finish: function() {
|
||||
this.go(SELECTORS.FirstTimeExperience.finishButton);
|
||||
}
|
||||
},
|
||||
|
||||
launch: function() {
|
||||
client.switchToFrame();
|
||||
client.apps.launch(ORIGIN_URL);
|
||||
client.apps.switchToApp(ORIGIN_URL);
|
||||
},
|
||||
|
||||
switchTo: function() {
|
||||
client.switchToFrame();
|
||||
|
||||
client.apps.switchToApp(ORIGIN_URL);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
})(module);
|
||||
22
gaia/apps/costcontrol/test/marionette/mocks/configure_icc.js
Executable file
22
gaia/apps/costcontrol/test/marionette/mocks/configure_icc.js
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
/* global Components, Services */
|
||||
'use strict';
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
Services.obs.addObserver(function(document) {
|
||||
if (!document || !document.location) {
|
||||
return;
|
||||
}
|
||||
|
||||
var window = document.defaultView;
|
||||
|
||||
Object.defineProperty(window.wrappedJSObject, 'MockIccInfo', {
|
||||
writable: true,
|
||||
value: Components.utils.cloneInto({
|
||||
mcc: '724',
|
||||
mnc: '6'
|
||||
}, window)
|
||||
});
|
||||
}, 'document-element-inserted', false);
|
||||
|
||||
33
gaia/apps/costcontrol/test/marionette/mocks/navigator_moz_icc_manager.js
Executable file
33
gaia/apps/costcontrol/test/marionette/mocks/navigator_moz_icc_manager.js
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
/* global Components, Services */
|
||||
'use strict';
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
Services.obs.addObserver(function(document) {
|
||||
if (!document || !document.location) {
|
||||
return;
|
||||
}
|
||||
|
||||
var window = document.defaultView;
|
||||
|
||||
Object.defineProperty(window.wrappedJSObject.navigator, 'mozIccManager', {
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: Components.utils.cloneInto({
|
||||
iccIds: ['1234575100210522938'],
|
||||
|
||||
getIccById: function(id) {
|
||||
return Cu.waiveXrays(Cu.cloneInto({
|
||||
cardState: 'ready',
|
||||
iccInfo: window.wrappedJSObject.MockIccInfo || {
|
||||
mcc: '0',
|
||||
mnc: '0'
|
||||
},
|
||||
addEventListener: function() {}
|
||||
}, window, { cloneFunctions: true }));
|
||||
}
|
||||
}, window, { cloneFunctions: true })
|
||||
});
|
||||
}, 'document-element-inserted', false);
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/* global Components, Services */
|
||||
'use strict';
|
||||
|
||||
Components.utils.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
Services.obs.addObserver(function(document) {
|
||||
if (!document || !document.location) {
|
||||
return;
|
||||
}
|
||||
|
||||
var window = document.defaultView;
|
||||
var navigator = window.wrappedJSObject.navigator;
|
||||
|
||||
Object.defineProperty(navigator, 'mozMobileConnections', {
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: Components.utils.cloneInto(
|
||||
navigator.mozIccManager.iccIds.map(function(id) {
|
||||
return { iccId: id };
|
||||
}),
|
||||
window
|
||||
)
|
||||
});
|
||||
}, 'document-element-inserted', false);
|
||||
|
||||
159
gaia/apps/costcontrol/test/marionette/mocks/navigator_moz_network_stats.js
Executable file
159
gaia/apps/costcontrol/test/marionette/mocks/navigator_moz_network_stats.js
Executable file
|
|
@ -0,0 +1,159 @@
|
|||
/* global Components, Services */
|
||||
'use strict';
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
Services.obs.addObserver(function(document) {
|
||||
if (!document || !document.location) {
|
||||
return;
|
||||
}
|
||||
|
||||
var window = document.defaultView;
|
||||
var navigator = window.wrappedJSObject.navigator;
|
||||
|
||||
var Today = new Date();
|
||||
|
||||
var NetworkInterfaceType = {
|
||||
WIFI: 0,
|
||||
MOBILE: 1
|
||||
};
|
||||
|
||||
var Networks = new Map([
|
||||
['0', {
|
||||
type: NetworkInterfaceType.WIFI,
|
||||
id: '0'
|
||||
}]
|
||||
].concat(navigator.mozIccManager.iccIds.map(function(id) {
|
||||
return [id, {
|
||||
type: NetworkInterfaceType.MOBILE,
|
||||
id: id
|
||||
}];
|
||||
})));
|
||||
|
||||
var appManifestURLs = ['app://system.gaiamobile.org/manifest.webapp'];
|
||||
|
||||
function generateSample(interfaceId, manifestURL, startValueInMb) {
|
||||
return {
|
||||
appManifestURL: manifestURL,
|
||||
network: Networks.get(interfaceId),
|
||||
start: new Date('2014-08-14T05:00:00.000Z'),
|
||||
end: new Date('2014-08-31T05:00:00.000Z'),
|
||||
data: [{
|
||||
rxBytes: startValueInMb * 100000,
|
||||
txBytes: (startValueInMb + 100) * 100000,
|
||||
date: new Date(
|
||||
Today.getFullYear(),
|
||||
Today.getMonth(),
|
||||
Today.getDate() - 15
|
||||
)
|
||||
}, {
|
||||
rxBytes: startValueInMb * 200000,
|
||||
txBytes: (startValueInMb + 100) * 200000,
|
||||
date: Today
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
const Samples = new Map([
|
||||
['0', new Map([
|
||||
[null, generateSample('0', null, 457)],
|
||||
[appManifestURLs[0], generateSample('0', appManifestURLs[0], 457)]
|
||||
])],
|
||||
[navigator.mozIccManager.iccIds[0], new Map([
|
||||
[null, generateSample(navigator.mozIccManager.iccIds[0], null, 257)],
|
||||
[
|
||||
appManifestURLs[0],
|
||||
generateSample(
|
||||
navigator.mozIccManager.iccIds[0],
|
||||
appManifestURLs[0],
|
||||
257
|
||||
)
|
||||
]
|
||||
])]
|
||||
]);
|
||||
|
||||
var Alarms = new Map();
|
||||
|
||||
Object.defineProperty(navigator, 'mozNetworkStats', {
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: Components.utils.cloneInto({
|
||||
WIFI: NetworkInterfaceType.WIFI,
|
||||
|
||||
getAvailableNetworks: function() {
|
||||
var returnResult = Cu.waiveXrays(Cu.cloneInto({}, window));
|
||||
|
||||
window.setTimeout(function() {
|
||||
var result = [];
|
||||
|
||||
Networks.forEach(function(network) {
|
||||
result.push(network);
|
||||
});
|
||||
|
||||
returnResult.result = Cu.waiveXrays(Cu.cloneInto(result, window));
|
||||
|
||||
if (typeof returnResult.onsuccess === 'function') {
|
||||
returnResult.onsuccess.call(returnResult);
|
||||
}
|
||||
});
|
||||
|
||||
return returnResult;
|
||||
},
|
||||
|
||||
getSamples: function getSamples(networkInterface, start, end, options) {
|
||||
var networkSamples = Samples.get(networkInterface.id);
|
||||
var returnResult = Cu.waiveXrays(Cu.cloneInto({}, window));
|
||||
|
||||
window.setTimeout(function() {
|
||||
var samples = networkSamples.get(
|
||||
(options && options.appManifestURL) || null
|
||||
) || { data: [] };
|
||||
|
||||
returnResult.result = Cu.waiveXrays(Cu.cloneInto(
|
||||
samples, window, { cloneFunctions: true }
|
||||
));
|
||||
|
||||
if (typeof returnResult.onsuccess === 'function') {
|
||||
returnResult.onsuccess.call(returnResult);
|
||||
}
|
||||
});
|
||||
|
||||
return returnResult;
|
||||
},
|
||||
|
||||
getAllAlarms: function(interfaceId) {
|
||||
var returnResult = Cu.waiveXrays(Cu.cloneInto({}, window));
|
||||
|
||||
window.setTimeout(function() {
|
||||
returnResult.result = Cu.waiveXrays(Cu.cloneInto(
|
||||
Alarms.get(interfaceId) || [], window
|
||||
));
|
||||
|
||||
if (typeof returnResult.onsuccess === 'function') {
|
||||
returnResult.onsuccess.call(returnResult);
|
||||
}
|
||||
});
|
||||
|
||||
return returnResult;
|
||||
},
|
||||
|
||||
addAlarm: function(interfaceId, alarm) {
|
||||
var returnResult = Cu.waiveXrays(Cu.cloneInto({}, window));
|
||||
|
||||
window.setTimeout(() => {
|
||||
var interfaceAlarms = Alarms.get(interfaceId) || [];
|
||||
|
||||
interfaceAlarms.push(alarm);
|
||||
Alarms.set(interfaceId, interfaceAlarms);
|
||||
|
||||
if (typeof returnResult.onsuccess === 'function') {
|
||||
returnResult.onsuccess.call(returnResult);
|
||||
}
|
||||
});
|
||||
|
||||
return returnResult;
|
||||
}
|
||||
}, window, { cloneFunctions: true })
|
||||
});
|
||||
}, 'document-element-inserted', false);
|
||||
Loading…
Reference in a new issue