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 #32086 from Cwiiis/bug1191745-new-homescreen-by-de…
Browse files Browse the repository at this point in the history
…fault

Bug 1191745 - Switch to new homescreen by default. r=gmarty
  • Loading branch information
Cwiiis committed Oct 17, 2015
2 parents 9651a25 + 7ef852e commit 2032dca
Show file tree
Hide file tree
Showing 52 changed files with 167 additions and 153 deletions.
23 changes: 21 additions & 2 deletions apps/homescreen/manifest.webapp
@@ -1,6 +1,6 @@
{
"name": "New Home Screen",
"description": "Vertical paged home screen.",
"name": "Default Home Screen",
"description": "Gaia home screen.",
"launch_path": "/index.html",
"type": "privileged",
"role": "homescreen",
Expand All @@ -24,6 +24,25 @@
"moz-extremely-unstable-and-will-change-webcomponents": {},
"systemXHR": {}
},
"default_locale": "en-US",
"locales": {
"ar": {
"name": "الشاشة الرئيسية",
"description": "Gaia الشاشة الرئيسية"
},
"en-US": {
"name": "Default Home Screen",
"description": "Gaia Home Screen."
},
"fr": {
"name": "Écran d’accueil",
"description": "Écran d’accueil Gaia"
},
"zh-TW": {
"name": "主畫面",
"description": "Gaia 主畫面"
}
},
"datastores-access": {
"bookmarks_store": {
"readonly": true,
Expand Down
34 changes: 34 additions & 0 deletions apps/homescreen/test/marionette/lib/homescreen.js
Expand Up @@ -83,6 +83,18 @@ Homescreen.prototype = {
this.client.apps.switchToApp(Homescreen.URL);
},

/**
* Find and return every id for all the items on the grid... Each element
* can be used with `.getIcon` to find the element for a given id.
*
* @return {Array[String]}
*/
getIconIdentifiers: function() {
return this.visibleIcons.map(function(el) {
return this.getIconId(el);
}, this);
},

/**
* Fetch an icon element on the homescreen by its identifier.
* For apps, the identifier is the manifestURL, or its manifestURL,
Expand Down Expand Up @@ -118,6 +130,17 @@ Homescreen.prototype = {
return null;
},

/**
* Returns a homescreen icon element's identifier.
*
* @param {Marionette.Element} icon A homescreen icon element reference.
*/
getIconId: function(icon) {
return icon.scriptWith(function(el) {
return el.dataset.identifier;
});
},

/**
* Returns a homescreen icon element's text.
*
Expand Down Expand Up @@ -304,6 +327,17 @@ Homescreen.prototype = {
});
},

/**
* Emulates pressing of the hardware home button.
*/
pressHomeButton: function() {
this.client.executeScript(function() {
var home = new CustomEvent('home');
window.dispatchEvent(home);
});
this.client.apps.switchToApp(Homescreen.URL);
},

/**
* Gets a localized application name from a manifest.
* @param {String} app to open
Expand Down
12 changes: 5 additions & 7 deletions apps/search/test/marionette/app_installed_test.js
Expand Up @@ -5,7 +5,7 @@ var AppInstall =
var Rocketbar =
require('../../../system/test/marionette/lib/rocketbar.js');
var createAppServer =
require('../../../verticalhome/test/marionette/server/parent');
require('../../../homescreen/test/marionette/server/parent');

marionette('Search - Installed Apps Test', function() {
var clientOptions = require(__dirname + '/client_options.js');
Expand All @@ -14,7 +14,7 @@ marionette('Search - Installed Apps Test', function() {

setup(function(done) {
appInstall = new AppInstall(client);
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand All @@ -29,7 +29,7 @@ marionette('Search - Installed Apps Test', function() {

test('app result after install/uninstall', function() {
home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();
rocketbar.enterText('Calendar');
search.goToResults();

Expand All @@ -44,8 +44,7 @@ marionette('Search - Installed Apps Test', function() {
appInstall.installPackage(server.packageManifestURL);

// Search again for the same term.
client.switchToFrame(system.getHomescreenIframe());
home.focusRocketBar();
rocketbar.homescreenFocus();
rocketbar.enterText('Calendar');
search.goToResults();

Expand All @@ -61,8 +60,7 @@ marionette('Search - Installed Apps Test', function() {
home.confirmDialog('remove');

// Should now contain only a single app.
client.switchToFrame(system.getHomescreenIframe());
home.focusRocketBar();
rocketbar.homescreenFocus();
rocketbar.enterText('Calendar');
search.goToResults();
client.waitFor(function() {
Expand Down
6 changes: 3 additions & 3 deletions apps/search/test/marionette/app_search_test.js
Expand Up @@ -14,7 +14,7 @@ marionette('Search - App search', function() {
var home, search, rocketbar, system;

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand All @@ -23,7 +23,7 @@ marionette('Search - App search', function() {

test('Search apps from Rocketbar', function() {
home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();
rocketbar.enterText('calendar');
search.goToResults();
var calendarIdentifier = 'app://calendar.gaiamobile.org/manifest.webapp';
Expand All @@ -34,7 +34,7 @@ marionette('Search - App search', function() {

test('Search for app with entry point', function() {
home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();
rocketbar.enterText('Phone');
search.goToResults();
var phoneIdentifier =
Expand Down
4 changes: 2 additions & 2 deletions apps/search/test/marionette/change_providers_test.js
Expand Up @@ -20,7 +20,7 @@ marionette('Search - Switch Providers Test', function() {
});

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand Down Expand Up @@ -51,7 +51,7 @@ marionette('Search - Switch Providers Test', function() {

home.waitForLaunch();

home.focusRocketBar();
rocketbar.homescreenFocus();
search.triggerFirstRun(rocketbar);

rocketbar.enterText('sometext');
Expand Down
4 changes: 2 additions & 2 deletions apps/search/test/marionette/home_button_test.js
Expand Up @@ -10,7 +10,7 @@ marionette('Search - Home Button Press', function() {
var home, search, rocketbar, system;

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand All @@ -19,7 +19,7 @@ marionette('Search - Home Button Press', function() {

test('Home button returns to home screen', function() {
home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();
rocketbar.enterText('calendar');

// Ensure search results are displayed.
Expand Down
7 changes: 3 additions & 4 deletions apps/search/test/marionette/notice_test.js
Expand Up @@ -22,7 +22,7 @@ marionette('Search - Notice Test', function() {
});

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand All @@ -47,7 +47,7 @@ marionette('Search - Notice Test', function() {
test('Search Notice', function() {

home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();

var confirmSelector = search.Selectors.firstRunConfirm;
// Notice should not be displayed if we type < 3 characters
Expand Down Expand Up @@ -77,8 +77,7 @@ marionette('Search - Notice Test', function() {
rocketbar.switchToSearchFrame(server.url('sample.html'), searchText);
client.switchToFrame();
home.pressHomeButton();
client.apps.switchToApp(home.URL);
home.focusRocketBar();
rocketbar.homescreenFocus();
search.goToResults();
assert.ok(!client.findElement(confirmSelector).displayed());
});
Expand Down
19 changes: 10 additions & 9 deletions apps/search/test/marionette/search_rocketbar_test.js
Expand Up @@ -24,7 +24,7 @@ marionette('Search - Rocketbar Test', function() {
});

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand All @@ -50,7 +50,7 @@ marionette('Search - Rocketbar Test', function() {

// Lauch the rocketbar and trigger its first run notice
home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();
search.triggerFirstRun(rocketbar);

// Clear button shouldnt be visible when no text entered
Expand All @@ -66,25 +66,26 @@ marionette('Search - Rocketbar Test', function() {
client.switchToFrame();
rocketbar.cancel.click();
client.apps.switchToApp(home.URL);
var firstIcon = client.helper.waitForElement(home.Selectors.firstIcon);
assert.ok(firstIcon.displayed());
client.waitFor(function() {
return home.visibleIcons.length && home.visibleIcons[0].displayed();
});

// When we previously pressed close, when rocketbar reopens value
// should be empty
home.focusRocketBar();
rocketbar.homescreenFocus();
assert.equal(rocketbar.input.getAttribute('value'), '');

// Search for an app again, this time press close after searching
rocketbar.enterText('Phone');
home.pressHomeButton();

client.apps.switchToApp(home.URL);
firstIcon = client.helper.waitForElement(home.Selectors.firstIcon);
assert.ok(firstIcon.displayed());
client.waitFor(function() {
return home.visibleIcons.length && home.visibleIcons[0].displayed();
});

// If we press home button during a search, next time we focus the rocketbar
// previous result should be displayed
home.focusRocketBar();
rocketbar.homescreenFocus();
search.goToResults();
search.checkResult(phoneIdentifier, 'Phone');

Expand Down
4 changes: 2 additions & 2 deletions apps/search/test/marionette/suggestions_disabled_test.js
Expand Up @@ -20,7 +20,7 @@ marionette('Search - Suggestions disabled', function() {
});

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand Down Expand Up @@ -51,7 +51,7 @@ marionette('Search - Suggestions disabled', function() {

home.waitForLaunch();

home.focusRocketBar();
rocketbar.homescreenFocus();
search.triggerFirstRun(rocketbar);

rocketbar.enterText('sometext');
Expand Down
4 changes: 2 additions & 2 deletions apps/search/test/marionette/suggestions_test.js
Expand Up @@ -20,7 +20,7 @@ marionette('Search - Suggestions Test', function() {
});

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
search = client.loader.getAppClass('search');
rocketbar = new Rocketbar(client);
Expand All @@ -45,7 +45,7 @@ marionette('Search - Suggestions Test', function() {
test('Test suggestions', function() {

home.waitForLaunch();
home.focusRocketBar();
rocketbar.homescreenFocus();

search.triggerFirstRun(rocketbar);
rocketbar.enterText('sometext');
Expand Down
Expand Up @@ -5,7 +5,7 @@ define(function(require) {
'use strict';

const MANIFEST_URL_PREF = 'homescreen.manifestURL';
const DEFAULT_MANIFEST = 'app://verticalhome.gaiamobile.org/manifest.webapp';
const DEFAULT_MANIFEST = 'app://homescreen.gaiamobile.org/manifest.webapp';

var SettingsService = require('modules/settings_service');
var mozApps = require('modules/navigator/mozApps');
Expand Down
Expand Up @@ -17,7 +17,7 @@ suite('Homescreens_details > ', () => {
}
};

const DEFAULT_MANIFEST = 'app://verticalhome.gaiamobile.org/manifest.webapp';
const DEFAULT_MANIFEST = 'app://homescreen.gaiamobile.org/manifest.webapp';

var elements = {
icon: document.createElement('img'),
Expand Down
Expand Up @@ -28,11 +28,12 @@ marionette('App Authentication Dialog',
});

setup(function() {
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
rocketbar = new Rocketbar(client);
search = client.loader.getAppClass('search');
system = client.loader.getAppClass('system');
system.waitForFullyLoaded();
home.waitForLaunch();
});

test('cancel button works', function() {
Expand Down
Expand Up @@ -64,6 +64,7 @@ marionette('AppWindowManager - Pinning sites',
search = client.loader.getAppClass('search');
pinning = new Pinning(client);
system.waitForFullyLoaded();
home.waitForLaunch();
url = server.url('sample.html');
pinAndKill(url);
nApps = system.getAppWindows().length;
Expand Down
Expand Up @@ -23,11 +23,12 @@ marionette('Browser Chrome - Open New Window', function() {

setup(function() {
actions = client.loader.getActions();
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
rocketbar = new Rocketbar(client);
search = client.loader.getAppClass('search');
system = client.loader.getAppClass('system');
system.waitForFullyLoaded();
home.waitForLaunch();
});

test('open new window', function() {
Expand Down
5 changes: 3 additions & 2 deletions apps/system/test/marionette/browser_chrome_title_test.js
Expand Up @@ -32,7 +32,7 @@ marionette('Browser Chrome - Title content', function() {

setup(function() {
actions = client.loader.getActions();
home = client.loader.getAppClass('verticalhome');
home = client.loader.getAppClass('homescreen');
rocketbar = new Rocketbar(client);
search = client.loader.getAppClass('search');
system = client.loader.getAppClass('system');
Expand Down Expand Up @@ -63,6 +63,7 @@ marionette('Browser Chrome - Title content', function() {

test('website without app name should use hostname', function() {
// Use the home-screen search box to open up the system browser
home.waitForLaunch();
var url = server.url('sample.html');
var hostname = urlUtility.parse(url).hostname;
rocketbar.homescreenFocus();
Expand All @@ -76,8 +77,8 @@ marionette('Browser Chrome - Title content', function() {
});

test('Dont persist application-name', function() {

// Use the home-screen search box to open up the system browser
home.waitForLaunch();
var customAppUrl = server.url('app-name.html');
var sampleUrl = server.url('sample.html');
var sampleHostname = urlUtility.parse(sampleUrl).hostname;
Expand Down

0 comments on commit 2032dca

Please sign in to comment.