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

Commit

Permalink
Bug 1087042 - Rocketbar progressbar position in fullscreen-app
Browse files Browse the repository at this point in the history
Conflicts:
	apps/system/test/marionette/lib/system.js
  • Loading branch information
albertopq authored and rvandermeulen committed Oct 29, 2014
1 parent fde08d8 commit a653b4e
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 11 deletions.
12 changes: 10 additions & 2 deletions apps/system/style/wrapper/wrapper.css
Expand Up @@ -18,14 +18,22 @@
z-index: 1000;
}

.chrome gaia-progress.visible {
.fullscreen-app:not(.minimized-tray) gaia-progress {
visibility: hidden;
}

.fullscreen-app .chrome.dragged gaia-progress {
top: calc(var(--statusbar-height) + 4.4rem);
}

.chrome.dragged gaia-progress.visible {
visibility: visible;
}

.chrome > .bar {
pointer-events: auto;
display: none;
}
}

.chrome > .bar.visible {
display: block;
Expand Down
Expand Up @@ -8,6 +8,7 @@ var Search = require(
'../../../../apps/search/test/marionette/lib/search');
var System = require('./lib/system');
var Rocketbar = require('./lib/rocketbar');
var Server = require('../../../../shared/test/integration/server');

marionette('Browser - App /w Fullscreen Navigation Chrome', function() {

Expand All @@ -24,10 +25,10 @@ marionette('Browser - App /w Fullscreen Navigation Chrome', function() {
}
});

var actions, home, rocketbar, search, system;
var actions, home, rocketbar, search, system, frame, server;
var halfScreenHeight;

setup(function() {
setup(function(done) {
actions = new Actions(client);
home = new Home(client);
rocketbar = new Rocketbar(client);
Expand All @@ -40,6 +41,21 @@ marionette('Browser - App /w Fullscreen Navigation Chrome', function() {
halfScreenHeight = client.executeScript(function() {
return window.innerHeight;
}) / 2;

var appOrigin = 'app://fullscreennavapp.gaiamobile.org';
frame = system.waitForLaunch(appOrigin);
client.switchToFrame(frame);
client.helper.waitForElement('body');
client.switchToFrame();
waitForOffscreen(System.Selector.appUrlbar);
Server.create(__dirname + '/fixtures/', function(err, _server) {
server = _server;
done(err);
});
});

teardown(function() {
server.stop();
});

function waitForOffscreen(selector) {
Expand All @@ -61,13 +77,6 @@ marionette('Browser - App /w Fullscreen Navigation Chrome', function() {
}

test('test fullscreen chrome /w navigation', function() {
var appOrigin = 'app://fullscreennavapp.gaiamobile.org';
var frame = system.waitForLaunch(appOrigin);
client.switchToFrame(frame);
client.helper.waitForElement('body');
client.switchToFrame();
waitForOffscreen(System.Selector.appUrlbar);

// Validate page 1
expandRocketbar();
waitForOffscreen(System.Selector.appUrlbar);
Expand All @@ -83,4 +92,38 @@ marionette('Browser - App /w Fullscreen Navigation Chrome', function() {
assert.ok(system.appChromeForward.displayed(), 'Forward button is shown.');
waitForOffscreen(System.Selector.appUrlbar);
});

test('test progressbar', function() {
client.switchToFrame(frame);
var url = server.url('sample.html');
var link = client.helper.waitForElement('#page2-link');
server.cork(url);
link.scriptWith(function(element, url) {
element.href = url;
}, [url]);
link.click();

client.switchToFrame();
expandRocketbar();
var selector = System.Selector.appChromeProgressBar;
var progressBar = client.helper.waitForElement(selector);
var chromeSize = system.appChrome.size();
client.waitFor(function() {
var pbPosition = progressBar.scriptWith(function(element) {
return element.getBoundingClientRect();
});
return pbPosition.y === chromeSize.height;
});

waitForOffscreen(selector);
var progressbar = client.findElement(System.Selector.appChromeProgressBar);
assert.ok(!progressbar.displayed(), 'Progress not shown.');

expandRocketbar();
assert.ok(progressbar.displayed(), 'Progressbar shown.');
server.uncork(url);
client.waitFor(function() {
return !progressbar.displayed();
});
});
});
1 change: 1 addition & 0 deletions apps/system/test/marionette/fullscreennavapp/index.html
Expand Up @@ -6,5 +6,6 @@
<body>
<h1>Fullscreen navigation app.</h1>
<a href="page2.html">Page 2</a>
<a id="page2-link">to sample server</a>
</body>
</html>
18 changes: 18 additions & 0 deletions apps/system/test/marionette/lib/system.js
Expand Up @@ -14,6 +14,7 @@ System.Selector = Object.freeze({
appWindow: '.appWindow',
appTitlebar: '.appWindow.active .titlebar',
appUrlbar: '.appWindow.active .title',
appChrome: '.appWindow.active .chrome',
appChromeBack: '.appWindow.active .back-button',
appChromeForward: '.appWindow.active .forward-button',
appChromeContextLink: '.appWindow.active .menu-button',
Expand All @@ -22,7 +23,9 @@ System.Selector = Object.freeze({
appChromeContextMenuBookmark: '.appWindow.active [data-id=add-to-homescreen]',
appChromeContextMenuShare: '.appWindow.active [data-id=share]',
appChromeReloadButton: '.appWindow.active .controls .reload-button',
appChromeStopButton: '.appWindow.active .controls .stop-button',
appChromeWindowsButton: '.appWindow.active .controls .windows-button',
appChromeProgressBar: '.appWindow.active .chrome gaia-progress',
softwareButtons: '#software-buttons',
browserWindow: '.appWindow.browser',
imeMenu: '.ime-menu',
Expand Down Expand Up @@ -60,6 +63,11 @@ System.prototype = {
return this.client.helper.waitForElement(System.Selector.appUrlbar);
},

get appChrome() {
return this.client.helper.waitForElement(
System.Selector.appChrome);
},

get appChromeBack() {
return this.client.helper.waitForElement(
System.Selector.appChromeBack);
Expand Down Expand Up @@ -100,6 +108,16 @@ System.prototype = {
System.Selector.appChromeReloadButton);
},

get appChromeStopButton() {
return this.client.helper.waitForElement(
System.Selector.appChromeStopButton);
},

get appChromeProgressBar() {
return this.client.helper.waitForElement(
System.Selector.appChromeProgressBar);
},

get imeMenu() {
return this.client.helper.waitForElement(System.Selector.imeMenu);
},
Expand Down

0 comments on commit a653b4e

Please sign in to comment.