This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
/
browser_chrome_title_test.js
105 lines (87 loc) · 3.04 KB
/
browser_chrome_title_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
'use strict';
var assert = require('assert');
var urlUtility = require('url');
var Server = require('../../../../shared/test/integration/server');
var Rocketbar = require('./lib/rocketbar');
marionette('Browser Chrome - Title content', function() {
var client = marionette.client({
profile: {
apps: {
'fakechromenavapp.gaiamobile.org':
__dirname + '/../apps/fakechromenavapp',
}
}
});
var actions, home, rocketbar, search, server, system;
suiteSetup(function(done) {
Server.create(__dirname + '/fixtures/', function(err, _server) {
server = _server;
done();
});
});
suiteTeardown(function() {
server.stop();
});
setup(function() {
actions = client.loader.getActions();
home = client.loader.getAppClass('homescreen');
rocketbar = new Rocketbar(client);
search = client.loader.getAppClass('search');
system = client.loader.getAppClass('system');
system.waitForFullyLoaded();
});
test('app w/o chrome should use name from manifest', function() {
// Open up the calendar and check for the title.
var expectedTitle = 'Calendar';
var appOrigin = 'app://calendar.gaiamobile.org';
client.apps.launch(appOrigin);
assert(!system.pinDialog.displayed(), 'Pin dialog is invisible');
client.waitFor(function(){
return system.appUrlbar.text() === expectedTitle;
});
});
test('app /w chrome navigation should use name from manifest', function() {
// Hard-coded from app fixture.
var expectedTitle = 'Fake Chrome Navigation';
var appOrigin = 'app://fakechromenavapp.gaiamobile.org';
client.apps.launch(appOrigin);
assert(!system.pinDialog.displayed(), 'Pin dialog is invisible');
client.waitFor(function(){
return system.appUrlbar.text() === expectedTitle;
});
});
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();
rocketbar.enterText(url, true);
system.gotoBrowser(url);
client.switchToFrame();
client.waitFor(function(){
return system.appUrlbar.text() === hostname;
});
});
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;
rocketbar.homescreenFocus();
rocketbar.enterText(customAppUrl, true);
system.gotoBrowser(customAppUrl);
client.switchToFrame();
client.waitFor(function(){
return system.appUrlbar.text() === 'Custom App Name';
});
system.appUrlbar.tap();
rocketbar.enterText(sampleUrl, true);
system.gotoBrowser(sampleUrl);
client.switchToFrame();
client.waitFor(function(){
return system.appUrlbar.text() === sampleHostname;
});
});
});