This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31359 from Cwiiis/bug1191746-new-homescreen-mario…
…nette-hosted-app-tests Bug 1191746 - Port hosted app tests to new homescreen. r=gmarty
- Loading branch information
Showing
37 changed files
with
1,506 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
apps/homescreen/test/marionette/app_appcache_pending_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
|
||
marionette('Homescreen - Appcache installed download', 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 home, system, appInstall; | ||
setup(function() { | ||
home = client.loader.getAppClass('homescreen'); | ||
system = client.loader.getAppClass('system'); | ||
appInstall = new AppInstall(client); | ||
|
||
system.waitForFullyLoaded(); | ||
home.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(system.getHomescreenIframe()); | ||
|
||
var icon = home.getIcon(server.manifestURL); | ||
|
||
// wait until we see the nice spinner thing | ||
client.waitFor(function() { | ||
return home.iconIsLoading(icon); | ||
}); | ||
|
||
// 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 !home.iconIsLoading(icon); | ||
}); | ||
|
||
// ensure the app launches! | ||
home.launchIcon(icon); | ||
assert.equal(client.title(), 'iwrotethis'); | ||
}); | ||
}); |
63 changes: 63 additions & 0 deletions
63
apps/homescreen/test/marionette/app_hosted_failed_icon_fetch_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* global __dirname */ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var AppInstall = | ||
require('../../../../apps/system/test/marionette/lib/app_install'); | ||
var createAppServer = require('./server/parent'); | ||
|
||
marionette('Homescreen - 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 home, system, appInstall; | ||
setup(function() { | ||
home = client.loader.getAppClass('homescreen'); | ||
system = client.loader.getAppClass('system'); | ||
appInstall = new AppInstall(client); | ||
|
||
system.waitForFullyLoaded(); | ||
home.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(system.getHomescreenIframe()); | ||
|
||
var icon = home.getIcon(server.manifestURL); | ||
|
||
// ensure the default icon is shown | ||
client.waitFor(function() { | ||
var src = home.getIconImageUrl(icon); | ||
return src && src.indexOf('default') !== -1; | ||
}); | ||
|
||
// ensure the icon can be launched! | ||
home.launchIcon(icon); | ||
assert.equal(client.title(), 'iwrotethis'); | ||
}); | ||
}); | ||
|
||
|
Oops, something went wrong.