Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21133 from KevinGrandon/bug_1022098_fix_test_naming
Browse files Browse the repository at this point in the history
Bug 1022098 - Follow-up, rename and fix tests
  • Loading branch information
KevinGrandon committed Jun 28, 2014
2 parents 085a4a8 + 5c498a7 commit 82076d9
Showing 1 changed file with 14 additions and 8 deletions.
Expand Up @@ -10,6 +10,7 @@ var AppInstall =
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(Home2.clientOptions);
Expand Down Expand Up @@ -38,6 +39,13 @@ marionette('Vertical Home - Hosted app failed icon fetch', function() {
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();
Expand All @@ -50,21 +58,18 @@ marionette('Vertical Home - Hosted app failed icon fetch', function() {
client.switchToFrame(system.getHomescreenIframe());

var appIcon = subject.getIcon(server.packageManifestURL);
// wait until the icon is spinning!
client.waitFor(function() {
var state = iconAppState(appIcon);
return state === 'loading';
});
expectAppState(appIcon, 'loading');

// stop the download
appIcon.click();
subject.confirmDialog('stop');
launchIcon(appIcon);
subject.confirmDialog('pause');
expectAppState(appIcon, 'paused');

// Restart the download
server.uncork(server.applicationZipUri);

// resume the download from the ui
appIcon.click();
launchIcon(appIcon);
subject.confirmDialog('resume');

// wait until we are showing our desired icon
Expand All @@ -87,6 +92,7 @@ marionette('Vertical Home - Hosted app failed icon fetch', function() {

// switch back to the homescreen
client.switchToFrame();
client.switchToFrame(system.getHomescreenIframe());

var icon = subject.getIcon(server.manifestURL);

Expand Down

0 comments on commit 82076d9

Please sign in to comment.