This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
places_search_test.js
98 lines (83 loc) · 2.85 KB
/
places_search_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
'use strict';
/* globals __dirname */
var System = require('../../../system/test/marionette/lib/system');
var Search = require('./lib/search');
var Rocketbar = require('../../../system/test/marionette/lib/rocketbar.js');
var Server = require('../../../../shared/test/integration/server');
var assert = require('assert');
marionette('Places tests', function() {
var client = marionette.client(Rocketbar.clientOptions);
var search, server, rocketbar, system;
suiteSetup(function(done) {
Server.create(__dirname + '/fixtures/', function(err, _server) {
server = _server;
done();
});
system = new System(client);
});
suiteTeardown(function() {
server.stop();
});
setup(function() {
search = new Search(client);
rocketbar = new Rocketbar(client);
system.waitForStartup();
});
// Disabled bug 993652
test.skip('Search for previously visited URL', function() {
var url = server.url('sample.html');
rocketbar.focus();
rocketbar.enterText(url + '\uE006');
rocketbar.waitForBrowserFrame();
client.switchToFrame();
rocketbar.focus();
rocketbar.enterText(url);
search.goToResults();
search.checkResult('firstPlace', 'Sample page');
});
test('Search for a string that doesnt match visited url', function() {
var url = server.url('sample.html');
rocketbar.focus();
rocketbar.enterText(url + '\uE006');
rocketbar.waitForBrowserFrame();
client.switchToFrame();
rocketbar.focus();
rocketbar.enterText('non_matching_string');
search.goToResults();
assert.equal(client.findElements(Search.Selectors.firstPlace).length, 0);
});
test('Ensures urls visited twice only show in results once', function() {
var url = server.url('sample.html');
rocketbar.focus();
rocketbar.enterText(url + '\uE006');
rocketbar.waitForBrowserFrame();
rocketbar.focus();
rocketbar.enterText(url + '\uE006');
rocketbar.waitForBrowserFrame();
client.switchToFrame();
rocketbar.focus();
rocketbar.enterText(url);
search.goToResults();
// Wait to get the correct amount of results
client.waitFor(function() {
return client.findElements(Search.Selectors.firstPlace).length === 1;
}.bind(this));
// Wait for a second and check we dont get extra results
client.helper.wait(1000);
assert.equal(client.findElements(Search.Selectors.firstPlace).length, 1);
});
test('Ensure favicon is loaded', function() {
var url = server.url('favicon.html');
rocketbar.focus();
rocketbar.enterText(url + '\uE006');
rocketbar.waitForBrowserFrame();
client.waitFor(function() {
client.switchToFrame();
rocketbar.focus();
rocketbar.enterText(url);
search.goToResults();
var result = client.helper.waitForElement('#places div .icon');
return !result.getAttribute('class').match('empty');
});
});
});