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
87 changed files with 9982925 additions and 369 deletions
27
gaia/apps/verticalhome/test/build/integration/verticalhome_test.js
Executable file
27
gaia/apps/verticalhome/test/build/integration/verticalhome_test.js
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
/* jshint node: true, mocha: true */
|
||||
/* global suiteSetup */
|
||||
|
||||
var helper = require('helper');
|
||||
|
||||
suite('Verticalhome tests', function() {
|
||||
suiteSetup(helper.cleanupWorkspace);
|
||||
teardown(helper.cleanupWorkspace);
|
||||
|
||||
test('APP=verticalhome make', function(done) {
|
||||
helper.exec('APP=verticalhome make', function(error, stdout, stderr) {
|
||||
helper.checkError(error, stdout, stderr);
|
||||
|
||||
var zipPath = process.cwd() +
|
||||
'/profile/webapps/verticalhome.gaiamobile.org/application.zip';
|
||||
var checkList = ['manifest.webapp'];
|
||||
|
||||
checkList.forEach(function(filePath) {
|
||||
helper.checkFilePathInZip(zipPath, filePath);
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
19
gaia/apps/verticalhome/test/marionette/.jshintrc
Executable file
19
gaia/apps/verticalhome/test/marionette/.jshintrc
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"extends": "../../../../.jshintrc",
|
||||
"predef": [
|
||||
"__dirname",
|
||||
"module",
|
||||
"suite",
|
||||
"test",
|
||||
"setup",
|
||||
"teardown",
|
||||
"suiteSetup",
|
||||
"suiteTeardown",
|
||||
"marionette",
|
||||
"marionetteScriptFinished",
|
||||
"require",
|
||||
"define",
|
||||
"requireApp",
|
||||
"sinon"
|
||||
]
|
||||
}
|
||||
70
gaia/apps/verticalhome/test/marionette/app_appcache_pending_test.js
Executable file
70
gaia/apps/verticalhome/test/marionette/app_appcache_pending_test.js
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
|
||||
marionette('Vertical Home - Hosted app failed icon fetch', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/appcache';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('shows spinner while downloading', function() {
|
||||
// correctly install the app...
|
||||
client.switchToFrame();
|
||||
|
||||
// ensure appcache path is delayed
|
||||
server.cork(server.manifest.appcache_path);
|
||||
appInstall.install(server.manifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame();
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var icon = subject.getIcon(server.manifestURL);
|
||||
|
||||
// wait until we see the nice spinner thing
|
||||
client.waitFor(function() {
|
||||
return iconAppState(icon) === 'loading';
|
||||
});
|
||||
|
||||
// let the rest of the app come through
|
||||
server.uncork(server.manifest.appcache_path);
|
||||
// wait until it is no longer loading
|
||||
client.waitFor(function() {
|
||||
return iconAppState(icon) !== 'loading';
|
||||
});
|
||||
|
||||
// ensure the app launches!
|
||||
subject.launchAndSwitchToApp(server.manifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
65
gaia/apps/verticalhome/test/marionette/app_failed_icon_fetch_test.js
Executable file
65
gaia/apps/verticalhome/test/marionette/app_failed_icon_fetch_test.js
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconSrc = require('./lib/icon_src');
|
||||
|
||||
marionette('Vertical Home - Hosted app failed icon fetch', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('fallback to default icon', function() {
|
||||
var iconURL = server.manifest.icons['128'];
|
||||
// correctly install the app...
|
||||
client.switchToFrame();
|
||||
|
||||
// ensure the icon fails to download!
|
||||
server.fail(iconURL);
|
||||
appInstall.install(server.manifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame();
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var icon = subject.getIcon(server.manifestURL);
|
||||
|
||||
// ensure the default icon is shown
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(icon);
|
||||
return src && src.indexOf('default') !== -1;
|
||||
});
|
||||
|
||||
// ensure the icon can be launched!
|
||||
subject.launchAndSwitchToApp(server.manifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
67
gaia/apps/verticalhome/test/marionette/app_hosted_failed_icon_fetch_test.js
Executable file
67
gaia/apps/verticalhome/test/marionette/app_hosted_failed_icon_fetch_test.js
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
var iconSrc = require('./lib/icon_src');
|
||||
|
||||
marionette('Vertical Home - Hosted app failed icon fetch', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('fallback to default icon', function() {
|
||||
var iconURL = server.manifest.icons['128'];
|
||||
// correctly install the app...
|
||||
client.switchToFrame();
|
||||
|
||||
// ensure the icon fails to download!
|
||||
server.fail(iconURL);
|
||||
appInstall.install(server.manifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame();
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var icon = subject.getIcon(server.manifestURL);
|
||||
|
||||
// ensure the default icon is shown
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(icon);
|
||||
return src && src.indexOf('default') !== -1;
|
||||
});
|
||||
|
||||
// ensure the icon can be launched!
|
||||
subject.launchAndSwitchToApp(server.manifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
45
gaia/apps/verticalhome/test/marionette/app_hosted_install_test.js
Executable file
45
gaia/apps/verticalhome/test/marionette/app_hosted_install_test.js
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
marionette('Vertical Home - Hosted App Install', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('install app', function() {
|
||||
client.switchToFrame();
|
||||
appInstall.install(server.manifestURL);
|
||||
subject.launchAndSwitchToApp(server.manifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
|
||||
93
gaia/apps/verticalhome/test/marionette/app_hosted_use_cached_icon_test.js
Executable file
93
gaia/apps/verticalhome/test/marionette/app_hosted_use_cached_icon_test.js
Executable file
|
|
@ -0,0 +1,93 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconSrc = require('./lib/icon_src');
|
||||
var iconCached = require('./lib/icon_cached');
|
||||
|
||||
marionette('Vertical Home - Hosted app cached icon fetch', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('fallback to default icon', function() {
|
||||
var iconURL = server.manifest.icons['128'];
|
||||
// correctly install the app...
|
||||
client.switchToFrame();
|
||||
appInstall.install(server.manifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame();
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
var icon = subject.getIcon(server.manifestURL);
|
||||
|
||||
// ensure it is cached
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(icon);
|
||||
|
||||
if (!src) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var hasSource = src.indexOf(iconURL) !== -1;
|
||||
var isCached = iconCached(icon);
|
||||
|
||||
return hasSource && isCached;
|
||||
});
|
||||
|
||||
// ensure http falls so we use the cached icon
|
||||
server.fail(iconURL);
|
||||
|
||||
// kill the window
|
||||
subject.restart();
|
||||
icon = subject.getIcon(server.manifestURL);
|
||||
|
||||
// check for the cached icon...
|
||||
client.waitFor(function() {
|
||||
return iconSrc(icon) === 'blobcache';
|
||||
});
|
||||
|
||||
// allow the request to succeed
|
||||
server.unfail(iconURL);
|
||||
|
||||
// trigger the download of a new icon
|
||||
client.executeScript(function() {
|
||||
window.dispatchEvent(new CustomEvent('online'));
|
||||
});
|
||||
|
||||
// now shows the freshly redownloaded icon
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(icon);
|
||||
return src && src.indexOf(iconURL) !== -1;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
73
gaia/apps/verticalhome/test/marionette/app_packaged_fail_test.js
Executable file
73
gaia/apps/verticalhome/test/marionette/app_packaged_fail_test.js
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var launchIcon = require('./lib/launch_icon');
|
||||
|
||||
marionette('Vertical Home - Packaged App Failed Download', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
function expectAppState(icon, state) {
|
||||
client.waitFor(function() {
|
||||
var currentState = iconAppState(icon);
|
||||
return currentState === state;
|
||||
});
|
||||
}
|
||||
|
||||
test('failed state then retry and launch', function() {
|
||||
client.switchToFrame();
|
||||
|
||||
server.fail(server.applicationZipUri);
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var icon = subject.getIcon(server.packageManifestURL);
|
||||
expectAppState(icon, 'error');
|
||||
|
||||
server.unfail(server.applicationZipUri);
|
||||
|
||||
// helps marionette finding the icon: Bug 1046706
|
||||
subject.moveIconToIndex(icon, 0);
|
||||
|
||||
launchIcon(icon);
|
||||
subject.confirmDialog('resume');
|
||||
expectAppState(icon, 'ready');
|
||||
|
||||
subject.launchAndSwitchToApp(server.packageManifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
|
||||
54
gaia/apps/verticalhome/test/marionette/app_packaged_install_test.js
Executable file
54
gaia/apps/verticalhome/test/marionette/app_packaged_install_test.js
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
marionette('Vertical Home - Packaged App Install', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('install app', function() {
|
||||
client.switchToFrame();
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
// ensure the app is ready
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'ready';
|
||||
});
|
||||
|
||||
subject.launchAndSwitchToApp(server.packageManifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
67
gaia/apps/verticalhome/test/marionette/app_packaged_pending_test.js
Executable file
67
gaia/apps/verticalhome/test/marionette/app_packaged_pending_test.js
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
|
||||
marionette('Vertical Home - Packaged App Pending', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('app loading spinner', function() {
|
||||
// go to the system app
|
||||
client.switchToFrame();
|
||||
|
||||
// don't let the server send the zip archive
|
||||
server.cork(server.applicationZipUri);
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
// wait until the icon is spinning!
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'loading';
|
||||
});
|
||||
|
||||
// let the rest of the app come through
|
||||
server.uncork(server.applicationZipUri);
|
||||
|
||||
// wait until it is no longer loading
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) !== 'loading';
|
||||
});
|
||||
});
|
||||
});
|
||||
90
gaia/apps/verticalhome/test/marionette/app_packaged_resume_test.js
Executable file
90
gaia/apps/verticalhome/test/marionette/app_packaged_resume_test.js
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var launchIcon = require('./lib/launch_icon');
|
||||
|
||||
marionette('Vertical Home - Packaged App Resuming Downloads', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
|
||||
var server;
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
function expectAppState(icon, state) {
|
||||
client.waitFor(function() {
|
||||
var currentState = iconAppState(icon);
|
||||
return currentState === state;
|
||||
});
|
||||
}
|
||||
|
||||
test('failed state then retry and launch', function() {
|
||||
client.switchToFrame();
|
||||
|
||||
server.cork(server.applicationZipUri);
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
// pause the download
|
||||
var icon = subject.getIcon(server.packageManifestURL);
|
||||
// this helps marionette finding the icon: Bug 1046706
|
||||
subject.moveIconToIndex(icon, 0);
|
||||
launchIcon(icon);
|
||||
|
||||
subject.confirmDialog('pause');
|
||||
expectAppState(icon, 'paused');
|
||||
|
||||
// resume the download
|
||||
launchIcon(icon);
|
||||
subject.confirmDialog('resume');
|
||||
expectAppState(icon, 'loading');
|
||||
|
||||
// pause it again!
|
||||
launchIcon(icon);
|
||||
subject.confirmDialog('pause');
|
||||
expectAppState(icon, 'paused');
|
||||
|
||||
// uncork so next resume works...
|
||||
server.uncork(server.applicationZipUri);
|
||||
|
||||
// finally download the entire app
|
||||
launchIcon(icon);
|
||||
subject.confirmDialog('resume');
|
||||
expectAppState(icon, 'ready');
|
||||
|
||||
// now it should work!
|
||||
subject.launchAndSwitchToApp(server.packageManifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
106
gaia/apps/verticalhome/test/marionette/app_packaged_resume_update_test.js
Executable file
106
gaia/apps/verticalhome/test/marionette/app_packaged_resume_update_test.js
Executable file
|
|
@ -0,0 +1,106 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var launchIcon = require('./lib/launch_icon');
|
||||
|
||||
marionette('Vertical Home - Packaged App Update', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
// wait for the system app to be running
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
|
||||
// install the app
|
||||
client.switchToFrame();
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
function expectAppState(icon, state) {
|
||||
client.waitFor(function() {
|
||||
var currentState = iconAppState(icon);
|
||||
return currentState === state;
|
||||
});
|
||||
}
|
||||
|
||||
test('resume update', function() {
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
|
||||
// helps marionette finding the icon: Bug 1046706
|
||||
subject.moveIconToIndex(appIcon, 0);
|
||||
|
||||
// ensure the app is installed before updating it
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'ready';
|
||||
});
|
||||
|
||||
// Cork the zip so we can see the loading spinner.
|
||||
server.cork('/app.zip');
|
||||
|
||||
// Update the manifests.
|
||||
server.setRoot(__dirname + '/fixtures/template_app_updated');
|
||||
|
||||
// Ensure we have an update.
|
||||
appInstall.update(server.packageManifestURL);
|
||||
|
||||
// Ensure we see the loading signs...
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'loading';
|
||||
});
|
||||
|
||||
// pause the update
|
||||
launchIcon(appIcon);
|
||||
subject.confirmDialog('pause');
|
||||
expectAppState(appIcon, 'paused');
|
||||
|
||||
// resume the update
|
||||
launchIcon(appIcon);
|
||||
subject.confirmDialog('resume');
|
||||
expectAppState(appIcon, 'loading');
|
||||
|
||||
// Wait for the download to be complete.
|
||||
server.uncork('/app.zip');
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'ready';
|
||||
});
|
||||
|
||||
// verify the app was really updated
|
||||
subject.launchAndSwitchToApp(server.packageManifestURL);
|
||||
assert.equal(client.title(), 'updatedwow');
|
||||
});
|
||||
});
|
||||
|
||||
65
gaia/apps/verticalhome/test/marionette/app_packaged_role_hidden_test.js
Executable file
65
gaia/apps/verticalhome/test/marionette/app_packaged_role_hidden_test.js
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
|
||||
marionette('Vertical Home - Packaged App Pending', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/role_homescreen';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('app is displayed until determined role=homescreen', function() {
|
||||
// go to the system app
|
||||
client.switchToFrame();
|
||||
|
||||
// don't let the server send the zip archive
|
||||
server.cork(server.applicationZipUri);
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
// wait until the icon is spinning!
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'loading';
|
||||
});
|
||||
|
||||
// let the rest of the app come through
|
||||
server.uncork(server.applicationZipUri);
|
||||
|
||||
// wait until the icon is hidden
|
||||
client.helper.waitForElementToDisappear(appIcon);
|
||||
});
|
||||
});
|
||||
102
gaia/apps/verticalhome/test/marionette/app_packaged_update_test.js
Executable file
102
gaia/apps/verticalhome/test/marionette/app_packaged_update_test.js
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var iconSrc = require('./lib/icon_src');
|
||||
|
||||
marionette('Vertical Home - Packaged App Update', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
// wait for the system app to be running
|
||||
system.waitForFullyLoaded();
|
||||
|
||||
// Launch the homescreen first, then go to the system app.
|
||||
// Make sure we do this before installing an application.
|
||||
subject.waitForLaunch();
|
||||
client.switchToFrame();
|
||||
|
||||
// install the app
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('update an installed app', function() {
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
|
||||
// ensure the app is installed before updating it
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'ready';
|
||||
});
|
||||
|
||||
var iconTitle = appIcon.findElement('.title').text();
|
||||
|
||||
// Cork the zip so we can see the loading spinner.
|
||||
server.cork('/app.zip');
|
||||
|
||||
// Update the manifests.
|
||||
server.setRoot(__dirname + '/fixtures/template_app_updated');
|
||||
|
||||
// Ensure we have an update.
|
||||
appInstall.update(server.packageManifestURL);
|
||||
|
||||
// Ensure we see the loading signs...
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'loading';
|
||||
});
|
||||
|
||||
// Wait for the download to be complete.
|
||||
server.uncork('/app.zip');
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'ready';
|
||||
});
|
||||
|
||||
// See bug 826555 for rationale for the title not changing.
|
||||
assert.equal(
|
||||
appIcon.findElement('.title').text(),
|
||||
iconTitle,
|
||||
'app name should not be updated'
|
||||
);
|
||||
|
||||
// Ensure the icon is updated
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(appIcon);
|
||||
return src.indexOf(server.manifest.icons[128]) !== -1;
|
||||
});
|
||||
|
||||
// verify the app was really updated
|
||||
subject.launchAndSwitchToApp(server.packageManifestURL);
|
||||
assert.equal(client.title(), 'updatedwow');
|
||||
});
|
||||
});
|
||||
71
gaia/apps/verticalhome/test/marionette/app_pending_update_test.js
Executable file
71
gaia/apps/verticalhome/test/marionette/app_pending_update_test.js
Executable file
|
|
@ -0,0 +1,71 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
|
||||
marionette('Vertical Home - Packaged App Update', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js')
|
||||
});
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
// wait for the system app to be running
|
||||
system.waitForFullyLoaded();
|
||||
client.apps.launch(subject.URL);
|
||||
subject.waitForLaunch();
|
||||
|
||||
// install the app
|
||||
client.switchToFrame();
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
test('update an installed app', function() {
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
|
||||
// ensure the app is installed before updating it
|
||||
client.waitFor(function() {
|
||||
return iconAppState(appIcon) === 'ready';
|
||||
});
|
||||
|
||||
// Update the manifests.
|
||||
server.setRoot(__dirname + '/fixtures/template_app_updated');
|
||||
|
||||
// Stage the update
|
||||
appInstall.stageUpdate(server.packageManifestURL);
|
||||
|
||||
// ensure we can still launch an app in the older version
|
||||
subject.launchAndSwitchToApp(server.packageManifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
|
||||
128
gaia/apps/verticalhome/test/marionette/app_retry_icon_fetch_test.js
Executable file
128
gaia/apps/verticalhome/test/marionette/app_retry_icon_fetch_test.js
Executable file
|
|
@ -0,0 +1,128 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var iconSrc = require('./lib/icon_src');
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var launchIcon = require('./lib/launch_icon');
|
||||
|
||||
marionette('Vertical Home - Hosted app failed icon fetch', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
function expectAppState(icon, state) {
|
||||
client.waitFor(function() {
|
||||
var currentState = iconAppState(icon);
|
||||
return currentState === state;
|
||||
});
|
||||
}
|
||||
|
||||
test('shows icon after a restart', function() {
|
||||
// go to the system app
|
||||
client.switchToFrame();
|
||||
|
||||
// don't let the server send the zip archive
|
||||
server.cork(server.applicationZipUri);
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var appIcon = subject.getIcon(server.packageManifestURL);
|
||||
expectAppState(appIcon, 'loading');
|
||||
|
||||
// this helps marionette finding the icon: Bug 1046706
|
||||
subject.moveIconToIndex(appIcon, 0);
|
||||
|
||||
// stop the download
|
||||
launchIcon(appIcon);
|
||||
subject.confirmDialog('pause');
|
||||
expectAppState(appIcon, 'paused');
|
||||
|
||||
// Restart the download
|
||||
server.uncork(server.applicationZipUri);
|
||||
|
||||
// resume the download from the ui
|
||||
launchIcon(appIcon);
|
||||
subject.confirmDialog('resume');
|
||||
|
||||
// wait until we are showing our desired icon
|
||||
var iconURL = server.manifest.icons['128'];
|
||||
client.waitFor(function() {
|
||||
appIcon = subject.getIcon(server.packageManifestURL);
|
||||
var src = iconSrc(appIcon);
|
||||
return src && src.indexOf(iconURL) !== -1;
|
||||
});
|
||||
});
|
||||
|
||||
test('fallback to default icon when icon fails', function() {
|
||||
var iconURL = server.manifest.icons['128'];
|
||||
// correctly install the app...
|
||||
client.switchToFrame();
|
||||
|
||||
// ensure the icon fails to download!
|
||||
server.fail(iconURL);
|
||||
appInstall.install(server.manifestURL);
|
||||
|
||||
// switch back to the homescreen
|
||||
client.switchToFrame();
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
var icon = subject.getIcon(server.manifestURL);
|
||||
|
||||
// ensure the default icon is shown
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(icon);
|
||||
return src && src.indexOf('default') !== -1;
|
||||
});
|
||||
|
||||
server.unfail(iconURL);
|
||||
|
||||
// XXX: We don't have real network access but we can sorta emulate it by
|
||||
// failing then switching back to an online state.
|
||||
client.executeScript(function() {
|
||||
window.dispatchEvent(new CustomEvent('online'));
|
||||
});
|
||||
|
||||
// wait until we are showing our desired icon
|
||||
client.waitFor(function() {
|
||||
var src = iconSrc(icon);
|
||||
return src && src.indexOf(iconURL) !== -1;
|
||||
});
|
||||
|
||||
// ensure the icon can be launched!
|
||||
subject.launchAndSwitchToApp(server.manifestURL);
|
||||
assert.equal(client.title(), 'iwrotethis');
|
||||
});
|
||||
});
|
||||
|
||||
33
gaia/apps/verticalhome/test/marionette/app_short_name_test.js
Executable file
33
gaia/apps/verticalhome/test/marionette/app_short_name_test.js
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('Vertical Home - App manifest', function() {
|
||||
var manifestName = 'shortnameapp.gaiamobile.org';
|
||||
var manifestUrl = 'app://' + manifestName + '/manifest.webapp';
|
||||
|
||||
var clientOptions = require(__dirname + '/client_options.js');
|
||||
clientOptions.apps = {};
|
||||
clientOptions.apps[manifestName] = __dirname + '/fixtures/short_name_app';
|
||||
var client = marionette.client({
|
||||
profile: clientOptions
|
||||
});
|
||||
|
||||
var home, system;
|
||||
|
||||
setup(function() {
|
||||
home = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
system.waitForFullyLoaded();
|
||||
|
||||
client.apps.launch(home.URL);
|
||||
home.waitForLaunch();
|
||||
});
|
||||
|
||||
test('short_name', function() {
|
||||
var title = home.getIcon(manifestUrl).findElement('.title');
|
||||
assert.equal(title.text(), 'Short name');
|
||||
});
|
||||
});
|
||||
|
||||
89
gaia/apps/verticalhome/test/marionette/app_uninstall_pending_test.js
Executable file
89
gaia/apps/verticalhome/test/marionette/app_uninstall_pending_test.js
Executable file
|
|
@ -0,0 +1,89 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var getIconId = require('./lib/icon_id');
|
||||
|
||||
marionette('Vertical - App uninstall while pending', function() {
|
||||
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var actions, home, system, appInstall;
|
||||
var selectors;
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
setup(function() {
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
actions = client.loader.getActions();
|
||||
home = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
selectors = home.Selectors;
|
||||
|
||||
// ensure that the zip file does not get sent
|
||||
server.cork(server.applicationZipUri);
|
||||
|
||||
// wait for the system app to be running
|
||||
system.waitForFullyLoaded();
|
||||
client.apps.launch(home.URL);
|
||||
home.waitForLaunch();
|
||||
|
||||
// install the app
|
||||
client.switchToFrame();
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
// switch to the homescreen
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
// this helps marionette finding the icon: Bug 1046706
|
||||
var icon = home.getIcon(server.packageManifestURL);
|
||||
home.moveIconToIndex(icon, 0);
|
||||
|
||||
home.enterEditMode();
|
||||
});
|
||||
|
||||
test('use edit mode to uninstall the app', function() {
|
||||
var icon = home.getIcon(server.packageManifestURL);
|
||||
var iconId = getIconId(icon);
|
||||
var remove = icon.findElement('.remove');
|
||||
|
||||
// XXX: work around issues where the icon is hidden by other
|
||||
// status messages on the system app.
|
||||
icon.scriptWith(function(el) {
|
||||
// effectively scroll to the bottom of the screen.
|
||||
el.scrollIntoView(false);
|
||||
});
|
||||
|
||||
// remove the icon
|
||||
remove.tap();
|
||||
// confirm the dialog to ensure it was removed.
|
||||
client.switchToFrame();
|
||||
home.confirmDialog('remove');
|
||||
// ensure the icon disappears
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
client.helper.waitForElementToDisappear(icon);
|
||||
|
||||
home.restart();
|
||||
|
||||
var allIconIds = home.getIconIdentifiers();
|
||||
assert.ok(allIconIds.indexOf(iconId) === -1, 'app was removed');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
75
gaia/apps/verticalhome/test/marionette/app_uninstall_test.js
Executable file
75
gaia/apps/verticalhome/test/marionette/app_uninstall_test.js
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
|
||||
var createAppServer = require('./server/parent');
|
||||
var getIconId = require('./lib/icon_id');
|
||||
|
||||
marionette('Vertical - App Uninstall', function() {
|
||||
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var actions, home, system, appInstall;
|
||||
var selectors;
|
||||
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
setup(function() {
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
actions = client.loader.getActions();
|
||||
home = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
system.waitForFullyLoaded();
|
||||
|
||||
selectors = home.Selectors;
|
||||
|
||||
client.apps.launch(home.URL);
|
||||
home.waitForLaunch();
|
||||
|
||||
// install an app
|
||||
client.switchToFrame();
|
||||
appInstall.install(server.manifestURL);
|
||||
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
home.enterEditMode();
|
||||
});
|
||||
|
||||
test('use edit mode to uninstall the app', function() {
|
||||
var icon = home.getIcon(server.manifestURL);
|
||||
var iconId = getIconId(icon);
|
||||
// helps marionette finding the icon: Bug 1046706
|
||||
home.moveIconToIndex(icon, 0);
|
||||
|
||||
var remove = icon.findElement('.remove');
|
||||
|
||||
// remove the icon
|
||||
remove.tap();
|
||||
// confirm the dialog to ensure it was removed.
|
||||
client.switchToFrame();
|
||||
home.confirmDialog('remove');
|
||||
// ensure the icon disappears
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
client.helper.waitForElementToDisappear(icon);
|
||||
|
||||
home.restart();
|
||||
|
||||
var allIconIds = home.getIconIdentifiers();
|
||||
assert.ok(allIconIds.indexOf(iconId) === -1, 'app was removed');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
81
gaia/apps/verticalhome/test/marionette/app_unrecoverable_error_test.js
Executable file
81
gaia/apps/verticalhome/test/marionette/app_unrecoverable_error_test.js
Executable file
|
|
@ -0,0 +1,81 @@
|
|||
/* global __dirname */
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var AppInstall =
|
||||
require('../../../../apps/system/test/marionette/lib/app_install');
|
||||
var createAppServer = require('./server/parent');
|
||||
|
||||
var iconAppState = require('./lib/icon_app_state');
|
||||
var launchIcon = require('./lib/launch_icon');
|
||||
var getIconId = require('./lib/icon_id');
|
||||
|
||||
marionette('Vertical Home - App unrecoverable error', function() {
|
||||
var client = marionette.client({
|
||||
profile: require(__dirname + '/client_options.js'),
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var server;
|
||||
setup(function(done) {
|
||||
var app = __dirname + '/fixtures/template_app';
|
||||
createAppServer(app, client, function(err, _server) {
|
||||
server = _server;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
var subject;
|
||||
var system;
|
||||
var appInstall;
|
||||
setup(function() {
|
||||
subject = client.loader.getAppClass('verticalhome');
|
||||
system = client.loader.getAppClass('system');
|
||||
appInstall = new AppInstall(client);
|
||||
|
||||
system.waitForFullyLoaded();
|
||||
subject.waitForLaunch();
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
function expectAppState(icon, state) {
|
||||
client.waitFor(function() {
|
||||
var currentState = iconAppState(icon);
|
||||
return currentState === state;
|
||||
});
|
||||
}
|
||||
|
||||
test('remove an app that was in an unrecoverable state', function() {
|
||||
client.switchToFrame();
|
||||
|
||||
server.serverError(server.applicationZipUri);
|
||||
appInstall.installPackage(server.packageManifestURL);
|
||||
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
|
||||
// if the server returns a 500 error the app is assumed to be in an
|
||||
// unrecoverable state.
|
||||
var icon = subject.getIcon(server.packageManifestURL);
|
||||
var iconId = getIconId(icon);
|
||||
expectAppState(icon, 'unrecoverable');
|
||||
|
||||
// helps marionette finding the icon: Bug 1046706
|
||||
subject.moveIconToIndex(icon, 0);
|
||||
|
||||
// agree to uninstall the app
|
||||
launchIcon(icon);
|
||||
client.switchToFrame();
|
||||
subject.confirmDialog('unrecoverable');
|
||||
|
||||
// ensure the icon disappears
|
||||
client.switchToFrame(system.getHomescreenIframe());
|
||||
client.helper.waitForElementToDisappear(icon);
|
||||
// verify that the app was uninstalled
|
||||
subject.restart();
|
||||
|
||||
var allIconIds = subject.getIconIdentifiers();
|
||||
assert.ok(allIconIds.indexOf(iconId) === -1, 'app was removed');
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue